How to implement fuzzy search for phrase/phrase_prefix in elasticsearch6.8?

hi
i want to know how to implement fuzzy search for match/match_phrase/match_phrase_prefix in elasticsearch6.8? previously i implement it using below clause in es5.4
"match" : {
"_all" : {
"query" : "test",
"operator" : "and",
"boost" : 1,
"fuzziness" : 0.75,
"prefix_length" : 0,
"max_expansions" : 100
}
}
but in es6.8, i use below clause to implement it
{
"multi_match" : {
"query" : "test",
"type" : "phrase",
"boost" : 1,
"fuzziness" : 0.75,
"prefix_length" : 0,
"max_expansions" : 100
}
}
but search meet with below exception:
{"error":{"root_cause":[{"type":"parsing_exception","reason":"Fuzziness not allowed for type [phrase]"

any solution can solve the problem for it? or other method? thanksPreformatted text

why are you using type: phrase in the 6.8 example, but not in the 5.4 example? Those end up being two different queries. Also one is a match query and one if a multi_match query and the operator is different as well. Those will end up as very different queries being executed, so I am wondering if you are trying to create a new query or resemble the behaviour of the old query.

Also the _all field has been disabled by default in 6.x.

because _all field is disabled, so i can't use match combining with _all, but i want to search all documents that crawling mongodb collection's fields with value to elasticsearch's index, i try multi_match to combine phrase search without fuzziness, it's ok and search effect is same as using match combine _all for es5.4, but es6.8 don't support phrase with fuzziness

Why don't you either enable the all field again or use the workaround described in the deprecation warning at https://www.elastic.co/guide/en/elasticsearch/reference/6.8/mapping-all-field.html ?

i have adopt the multi_match solution, whether _all field also can be enabled in elasticsearch7 and above version? because later i also need to upgrade to es7, except for this all field workaround, do i have other option for it?

please take the time to read my last message and the included link, where I explicitely mentioned a workaround that is laid out in the documentation, as this exact feature is removed in 7.0 but can be rebuild in a different manner.

ok, thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.