I'm using elasticsearch
version 7.6.2
I want to search for a sentence and get results of the same words order (like match_phrase
) with sentence fuzziness
for example:
suppose for simplicity i have 1 document in the index:
PUT demo_idx/_doc/1
{
"content": "michael jordan and scottie pippen"
}
I want to search the following sentences (with fuzziness
equals 2):
- "michael jordan and scottie pippen" -> get 1 result (reason: same sentence)
- "scottie pippen and michael jordan" -> 0 results (reason: words not in the correct order)
- "ichael jordan and scottie pippen" -> get 1 result (reason: 'm' of michael is missing, 1 fuzziness)
- "ichae jordan and scottie pippen" -> get 1 result (reason: 'm' + 'l' of michael are missing, 2 fuzziness)
- "ichael jordan and cottie pippen" -> get 1 results (reason: 'm' of michael and 's' of scottie are missing, 2 fuzziness)
- "ichael jordan and cottie pippe" -> 0 results (reason: 'm' of michael and 's' of scottie and 'n' of pippen are missing, 3 fuzziness)
- "ichael jordan and ottie pippen" -> 0 results (reason: 'm' of michael and 's' + 'c' of scottie are missing, 3 fuzziness)
How can I right the search query in order to get the results I want ?