must included all words and sorted by word order to results of Elastic Search
How to do that?
i mean i have python query:
result = es.search(index="main_database", body={"query": {"match": {'Full_texts':es_query}}}, size=50)
problem is: at least one word is in 'Full_texts' then it gives to me results.
For me i want all words must included and keep word orders.
for example: the top of search result is fulfilled with all above like my requirements AND mid and bottom results is same as default Elastic search results.
CodePudding user response:
You need to use intervals query or span near
With respectively with ordered
or in_order
parameter
CodePudding user response:
Try using the operator and
for your Elasticsearch match query.
The search query will be
{
"query": {
"match": {
"Full_texts": {
"query": "<your_query_input_goes_here>",
"operator": "and"
}
}
}
}
However, the word order is not guaranteed, if you strictly need the words to follow order, please also refer to the answer of @ExploZe