Filter vs Query in ES

I am a bit confused betweenFilter(FilterBuilders) and Query(QueryBuilders).
Whatever possible with FilterBuilder is also achievable using QueryBuilders.
Is there any case which can only be possible with Filter?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

I think the primary difference between query and filter is that filter is
cacheable (Elasticsearch Platform — Find real-time answers at scale | Elastic). Also,
another major difference, is that filter is not applied on facets, while
query is.

On Fri, May 17, 2013 at 2:12 PM, Chetana ambha.career@gmail.com wrote:

I am a bit confused betweenFilter(FilterBuilders) and
Query(QueryBuilders). Whatever possible with FilterBuilder is also
achievable using QueryBuilders.
Is there any case which can only be possible with Filter?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Aash

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Also note that filters only "filter" docs and are not taken into account when computing score.

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

Le 17 mai 2013 à 10:53, aash dhariya aash.discover@gmail.com a écrit :

I think the primary difference between query and filter is that filter is cacheable (Elasticsearch Platform — Find real-time answers at scale | Elastic). Also, another major difference, is that filter is not applied on facets, while query is.

On Fri, May 17, 2013 at 2:12 PM, Chetana ambha.career@gmail.com wrote:

I am a bit confused betweenFilter(FilterBuilders) and Query(QueryBuilders). Whatever possible with FilterBuilder is also achievable using QueryBuilders.
Is there any case which can only be possible with Filter?

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.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Aash

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.
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.
For more options, visit https://groups.google.com/groups/opt_out.

On 17 May 2013 10:53, aash dhariya aash.discover@gmail.com wrote:

Also, another major difference, is that filter is not applied on facets,
while query is.

To be clear: filters within the query ARE taken into account by facets, but
filters specified at the top level of the search request are only applied
after facets, eg:

query: {
    filtered: {
        query: { SOME QUERY },
        filter:   { SOME FILTER; TAKEN INTO ACCOUNT BY FACETS }
    }
},
filter: { SOME FILTER; ONLY APPLIED AFTER FACETS }

In general, the top-level filter parameter should only be used for this
purpose. Using it as a general filter will usually result in slower
performance

--
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.
For more options, visit https://groups.google.com/groups/opt_out.