Hello Ali ,

You need to use bool query
<http://www.elastic.co/guide/en/elasticsearch/reference/1.4/query-dsl-bool-query.html>
for that.
Filtered query is not the best match for that.

You can see some code samples here
<http://www.elastic.co/guide/en/elasticsearch/client/java-api/current/query-dsl-queries.html#bool>
.

Thanks
           Vineeth Mohan,
           Elasticsearch consultant,
           qbox.io ( Elasticsearch service provider <http://qbox.io/>)

On Sun, Apr 5, 2015 at 5:10 PM, Ali Akhtar <ali.rac...@gmail.com> wrote:

> Hi there,
>
> I'm able to filter on one field at a time, using:
>
>                 client.prepareSearch(index)
>                 .setTypes(type)
>                 .setQuery( new FilteredQueryBuilder(null, FilterBuilders
>                                                         .termFilter(field,
> value)));
>
>
> However, I need to be able to filter on multiple fields.
>
> For example, I may have an index for books, and I need to find the books
> written by Author X, in Category Y, and in the year Z.
>
> In this case, I'd need to filter on multiple fields (author, category,
> year).
>
> Is it possible to combine these filters in one query?
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/0df8ad1c-f29c-48b2-a30c-da3abbdc9126%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/0df8ad1c-f29c-48b2-a30c-da3abbdc9126%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m2TZThDHw2%2BkgC7cHi-YJvQrRN8FpeVSPQaU%3Dg2Li8Yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to