I'm upgrading from Elasticsearch 1.5 to 2.2, and am trying to fix the code to work with it.
I am using filters, and am changing them all to queries; however, I'm using inFilter(), and there is no longer an inQuery() method. What has this been replaced with?
Also, is there any documentation with more details about the changes from filters to queries besides what's on the "breaking changes/java" page?
Thanks for your reply - hopefully someone will comment on what to use instead.
Do you happen to know, by the way, if there is any documentation describing why filters were removed and replaced with queries? I had thought the underlying mechanisms of queries and filters were different, and having them as separate entities made things more efficient. What changed such that this merging was necessary, and how does that change in the implementations of what USED to be filters?
In my opinion, it is more user-friendly this way: you just express what you are searching for, and then elasticsearch figures out by itself where scores are needed.
In terms of implementations, it simplified as well: many queries/filters were duplicated: TermQuery/TermFilter, BooleanQuery/BooleanFilter, etc. now we only have the query version anymore. Also there used to be 3 ways to perform conjunctions: two queries together with a BooleanQuery, two filters together with a BooleanFilter, and a query and a filter with FilteredQuery. Now everything is handled by BooleanQuery.
Also it is important to realize that queries become filters implicitely sometimes, for instance if you are not sorting based on the score. So this case is now also optimized, even if you used the dsl for queries.
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.