Hi everyone.
I struggling with a problem is that fuzziness not work with multi_match bool_prefix query , but I found on document that fuzziness option was supported:
Here is my query:
{
"_source": {},
"query": {
"multi_match": {
"query": "dross",
"type": "bool_prefix",
"fields": [
"title",
"title._2gram",
"title._3gram"
],
"fuzziness": "AUTO"
}
}
}
I'm using Elasticsearch 7.4, and trying to use Search-as-you-type feature in Elasticsearch 7.4: https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-as-you-type.html
Here is my example to reproduce issue:
- Create a index with a field has search-as-you-type field type, and indexing a document:
PUT my_index
{
"mappings": {
"properties": {
"my_field": {
"type": "search_as_you_type"
}
}
}
}
PUT my_index/_doc/1?refresh
{
"my_field": "dress"
}
- After that I query with multi_match bool_prefix, with query term is "dross" (I assume that user when searing made mistake):
GET my_index/_search
{
"query": {
"multi_match": {
"query": "dross",
"type": "bool_prefix",
"fields": [
"my_field",
"my_field._2gram",
"my_field._3gram"
],
"fuzziness": "AUTO"
}
}
}
The result is empty. But my expectation is that it should show the result is "dress" like this:
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "my_index",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"my_field" : "dress"
}
}
]
}
}
Anyone can help? Thanks in advance.