And in SearchRequestBuilder I want to give the result of qb1 AND qb2
to FilterBuilder fb.Here I am able to provide single query either qb1
or qb2;
SearchRequestBuilder request =
client.prepareSearch(index).setFilter(fb).setTypes(mapping).setQuery(qb1);
But i want this filter to be applied to results of both qb1 and qb2.
Please Help me with this.
Create a bool filter and add qb1 and qb2 as either must or should clauses
(not sure which behavior you want between the two). Then, use a
filteredQuery, provide the bool query you have to it, and the filter you
create as the filter.
And in SearchRequestBuilder I want to give the result of qb1 AND qb2
to FilterBuilder fb.Here I am able to provide single query either qb1
or qb2;
SearchRequestBuilder request =
client.prepareSearch(index).setFilter(fb).setTypes(mapping).setQuery(qb1);
But i want this filter to be applied to results of both qb1 and qb2.
Please Help me with this.
Thank you shay,filteredQuery helped me achieving expected results.
On Tue, Oct 25, 2011 at 4:08 AM, Shay Banon kimchy@gmail.com wrote:
Create a bool filter and add qb1 and qb2 as either must or should clauses
(not sure which behavior you want between the two). Then, use a
filteredQuery, provide the bool query you have to it, and the filter you
create as the filter.
And in SearchRequestBuilder I want to give the result of qb1 AND qb2
to FilterBuilder fb.Here I am able to provide single query either qb1
or qb2;
SearchRequestBuilder request =
client.prepareSearch(index).setFilter(fb).setTypes(mapping).setQuery(qb1);
But i want this filter to be applied to results of both qb1 and qb2.
Please Help me with this.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.