fuzzy search - ElasticSearch multi_match query over multiple fields with Fuzziness -
how can add fuziness multi_match query? if search 'basball' still find 'baseball' articles. query looks this:
post /newspaper/articles/_search { "query": { "function_score": { "query": { "multi_match": { "query": "baseball", "type": "phrase", "fields": [ "subject^3", "section^2.5", "article^2", "tags^1.5", "notes^1" ] } } } } }
one option looking @ this, don't know if best option. important keep sorting based on scoring.
"query" : { "query_string" : { "query" : "subject:basball^3 section:basball^2.5 article:basball^2", "fuzzy_prefix_length" : 1 } }
suggestions?
to add fuzziness multiquery need add fuzziness property described here:
{ "query": { "function_score": { "query": { "multi_match": { "query": "baseball", "type": "phrase", "fields": [ "subject^3", "section^2.5", "article^2", "tags^1.5", "notes^1" ], "fuzziness" : "auto", "prefix_length" : 2 } } } } }
please notice prefix_length explained in doc as:
the number of initial characters not “fuzzified”. helps reduce number of terms must examined. defaults 0.
to check possible values of fuzziness please visit es docs.
Comments
Post a Comment