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?
I think the primary difference between query and filter is that filter is
cacheable (http://www.elasticsearch.org/guide/reference/query-dsl/). Also,
another major difference, is that filter is not applied on facets, while
query is.
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?
I think the primary difference between query and filter is that filter is cacheable (http://www.elasticsearch.org/guide/reference/query-dsl/). Also, another major difference, is that filter is not applied on facets, while query is.
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?
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
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.