I am trying to write query for search as you type with fuzziness added.(elastic search 7.12)
{
"query": {
"multi_match": {
"query": "airl recl",
"fields": [
"tags",
"display_text",
"display_subtext"
],
"type" : "most_fields",
"operator": "and",
"fuzziness": "AUTO:4,6",
"prefix_length" :2
}
}
}
I have inserted docs with "airtel recharge" values. I am also using edge n gram(1:50) for above given 3 fields along with space analyzer.
- If i search with airl -> it works fine, getting result with airtel keyword.
- If i search with recl -> it works fine, getting result with recharge keyword.
- But when i search with "airl recl" in query, not getting any result.
space analyzer :
"words_with_spaces_analyzer" : {
"filter" : [
"lowercase",
"asciifolding"
],
"type" : "custom",
"tokenizer" : "words_with_space"
}
},
"tokenizer" : {
"words_with_space" : {
"pattern" : "([a-zA-Z0-9.-]+[\\s]*)",
"type" : "pattern",
"group" : "0"
}
}
},
Mapping
"display_text": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
},
"analyzer": "edge_nGram_analyzer",
"search_analyzer": "words_with_spaces_analyzer"
}
Can someone please help me in understanding why above given query behaves this way for multi token input whereas both the token giving output if run them separately ?