How to add more than one term query in Java API?


(Daniel Guo) #1

Term query in Java API looks like:

SearchResponse searchResponse = client.prepareSearch("rank", "feedback").
setQuery(QueryBuilders.termQuery("RANK_LIST_ID", "1")).execute().actionGet
();

If I need more than one term query, how do I add them to the QueryBuilders?
Thanks.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/46c35fad-d6f5-4700-9202-baa0337c03fa%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

With a BoolQuery?

BTW, in your example, I would probably use a TermFilter instead a TermQuery.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 nov. 2013 à 07:40, Daniel Guo daniel5hbs@gmail.com a écrit :

Term query in Java API looks like:

SearchResponse searchResponse = client.prepareSearch("rank", "feedback").setQuery(QueryBuilders.termQuery("RANK_LIST_ID", "1")).execute().actionGet();

If I need more than one term query, how do I add them to the QueryBuilders? Thanks.

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/46c35fad-d6f5-4700-9202-baa0337c03fa%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/45B259F6-C2F0-4AF8-B16F-D73D0388EEE7%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.


(Daniel Guo) #3

I'm trying on it, thanks.

On Thursday, November 28, 2013 2:48:07 PM UTC+8, David Pilato wrote:

With a BoolQuery?

BTW, in your example, I would probably use a TermFilter instead a
TermQuery.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 nov. 2013 à 07:40, Daniel Guo <danie...@gmail.com <javascript:>> a
écrit :

Term query in Java API looks like:

SearchResponse searchResponse = client.prepareSearch("rank", "feedback").
setQuery(QueryBuilders.termQuery("RANK_LIST_ID", "1")).execute().actionGet
();

If I need more than one term query, how do I add them to the
QueryBuilders? Thanks.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/46c35fad-d6f5-4700-9202-baa0337c03fa%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fcd92e28-620a-472c-9789-3c47a4b18b54%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4