I am using ES 1.5.2, Java API. I am working on implemented filterd/faceted/refine search in our product. Left side filters include countries, state, city etc. I want these values to depend only on keywords or query string and have no impact of filter applied. I will explain this using a usecase:
The actual explanation is not that post filters are not fast but that filtered queries are very fast: when you run a filtered query, elasticsearch will leverage the inverted index in order to quickly compute the intersection of your query and your filter. When you have a post filter, elasticsearch will only use the query (which might match many more docs than the intersection) and then check for every document matching the query if it also matches the filter. This is why if you don't have aggregations, then a regular filtered query will be much faster than a query with a post filter.
However in your case, you need to collect all documents that match the query anyway for aggregations, so you don't really have any other option.
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.