Is there a difference between a score of 0 and a score of 1 in a filtered query. I am trying to decide which query to use. I would like to submit the queries under the filter context as it should be more performant (use of cache) and I don't need scoring. I am using ES 6.2. Which of the 2 options would perform better?
If there are no other parts of the query, it doesn't matter at all. Scores are just relative, and if all docs have the same value (zero or one) it's the same.
If your query has other scoring components, it depends if you want the filtered values to impact the score at all. If you don't want them to impact the score, just filter values, the filter clause of a bool is what you want since it gives zero score to those docs.
If you want the act of filtering docs to influence the score, constant_score is what you want since it can impart an arbitrary boost. The default is 1, but you can change that with the boost param
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.