I have some posts data and I use elasticsearch to search in title of these
posts. Then I use filters to filter results based on category ids and some
other parameters. What I'm trying to do is to get all categories of posts
that matches the query criteria and ignore the filter.
Here is my what I have done so far. This is the query part:
The problem is that when I apply geo_distance or some other filters, this
affects what is returned by the facet. I want the facet to be affected by
the query only, so if the $search variable returns 100 results and then geo
distance reduces that to 10, facet should return all categories from that
100 results, not 10. Is that possible using elasticsearch?
I'm not fluent enough in PHP to understand what the code is doing but it
looks like what you are interested in are top-level filters. On the
contrary to filtered queries, these filters don't apply to facets. See
I have some posts data and I use elasticsearch to search in title of these
posts. Then I use filters to filter results based on category ids and some
other parameters. What I'm trying to do is to get all categories of posts
that matches the query criteria and ignore the filter.
Here is my what I have done so far. This is the query part:
The problem is that when I apply geo_distance or some other filters, this
affects what is returned by the facet. I want the facet to be affected by
the query only, so if the $search variable returns 100 results and then
geo distance reduces that to 10, facet should return all categories from
that 100 results, not 10. Is that possible using elasticsearch?
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.