I have a set of documents like [Egg Duck Whole Fresh, Egg Goose Whole Fresh, Egg Quail Whole Fresh, Egg Whole Fresh]
and if I search egg fresh whole, its returning , [Egg Duck Whole Fresh, Egg Whole Fresh, Egg Goose Whole Fresh Egg Quail Whole Fresh]
Actually it should return Egg Whole Fresh first but its giving relevance to Egg Duck Whole Fresh.
My query is
GET /_search
{
"query": {
"match": {
"name": {
"query": "egg whole fresh",
"fuzziness": 1,
"fuzzy_transpositions": false,
"operator": "and"
}
}
}
}
Any idea why happening this?
Thanks
This happens because elasticsearch search for the terms separated in any order, if you want the order to be considered you should change your query to the span query Span Near Query
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.