Is there anyone can help me how to boost sould query
my example is the following "should": [ { "multi_match": { "query": "apple", "fuzziness": "AUTO", "fields": ["name", "name.stemmed"] }}, { "multi_match": { "query": "juice", "fuzziness": "AUTO", "fields": ["name", "name.stemmed"] }} ]
I want the documents with the name contain both juice and apple appear first then the documents contains apple only or juice only
please is there anyone can help me how to boost in this case
What you describe is already the default behavior of bool should clauses.
The way this works is that Elasticsearch will calculate a score for the "apple" query, and a score for the "juice" query, and it will sum those two scores to get to a document's overall score. As a result, a document matching both "apple" and "juice" will get a higher score and will typically be ranked at the top.
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.