# Checked Exception "reference to termsQuery is ambiguous \[ERROR\]"

**URL:** <https://discuss.elastic.co/t/checked-exception-reference-to-termsquery-is-ambiguous-error/309969>\
**Category:** Elasticsearch\
**Created:** [July 19, 2022, 3:17am UTC](https://discuss.elastic.co/t/checked-exception-reference-to-termsquery-is-ambiguous-error/309969 "2022-07-19T03:17:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![willowHB](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willowhb/32/108487_2.png) [@willowHB](https://discuss.elastic.co/u/willowHB)\
**Post date:** [July 19, 2022, 3:17am UTC](https://discuss.elastic.co/t/checked-exception-reference-to-termsquery-is-ambiguous-error/309969/1 "2022-07-19T03:17:03Z")

</div>

version：elasticsearch-7.15.2.jar  
1、I think this is an api method error.When you use “QueryBuilders.termsQuery("status", 3,4)” query, an error “reference to termsQuery is ambiguous  
[ERROR] both method termsQuery(java.lang.String,double...) in org.elasticsearch.index.query.QueryBuilders and method termsQuery(java.lang.String,java.lang.Object...) in org.elasticsearch.index.query.QueryBuilders ” is reported during compilation；  
2、In order to avoid the above problems, we need to change another method “QueryBuilders.termsQuery(“status”, Arrays.asList(3, 4)”；Compilation and query passed completely.  
3、This error has nothing to do with elasticsearh itself,so I didn't provide DSL  
4、如有不妥，请多多指教！（If there is something wrong, please give me more advice!）

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 16, 2022, 3:17am UTC](https://discuss.elastic.co/t/checked-exception-reference-to-termsquery-is-ambiguous-error/309969/2 "2022-08-16T03:17:29Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
