elasticsearch - No result when using search analyzer -
i'm trying search string using query_string
in elasticsearch accented characters.
when use query_string
without analyzer query result on exact match (i'm searching string "Ředitel kvality" when dot "reditel kvality" no results)
when use same analyzer it's used in mappings no results both string or without ascended characters.
analyzers & filters:
"analysis": { "filter": { "cs_cz": { "recursion_level": "0", "locale": "cs_cz", "type": "hunspell", "dedup": "true" }, "czech_stemmer": { "type": "stemmer", "language": "czech" }, "czech_stop": { "type": "stop", "stopwords": "_czech_" } }, "analyzer": { "cz": { "filter": [ "standard", "lowercase", "czech_stop", "icu_folding", "cs_cz", "lowercase" ], "type": "custom", "tokenizer": "standard" }, "folding": { "filter": [ "standard", "lowercase", "asciifolding" ], "type": "custom", "tokenizer": "standard" }
mappings:
"index1": { "mappings": { "type1": { "properties": { "revisions": { "type": "nested", "properties": { "title": { "type": "text", "boost": 10.0, "fields": { "folded": { "type": "text", "boost": 6.0, "analyzer": "folding" } }, "analyzer": "cz"
here term vectors looks fine:
"term_vectors": { "revisions.title": { "field_statistics": { "sum_doc_freq": 764, "doc_count": 201, "sum_ttf": 770 }, "terms": { "kvalita": { "term_freq": 1, "tokens": [ { "position": 1, "start_offset": 8, "end_offset": 15 } ] }, "reditel": { "term_freq": 1, "tokens": [ { "position": 0, "start_offset": 0, "end_offset": 7 } ] } } } }
and when run analyze on query index1/_analyze?field=type1.revisions.title&text=Ředitel%20kvality
same tokens.
{ "tokens": [ { "token": "reditel", "start_offset": 0, "end_offset": 7, "type": "<alphanum>", "position": 0 }, { "token": "kvalita", "start_offset": 8, "end_offset": 15, "type": "<alphanum>", "position": 1 } ] }
i can't find out wrong , why es not match "reditel kvality" "Ředitel kvality".
this query i'm using:
{ "query":{ "bool":{ "must":[ { "query_string":{ "query":"\u0158editel kvality*", "rewrite":"scoring_boolean", "analyzer":"cz", "default_operator":"and" } } ] } }, "size":10, "from":0 }
my es version 5.2.2
found out what's wrong. _all
field must defined in mappings analyzer. docs feeling automatic, , field magically created analyzed fields.
so in fields have
_all": { "enabled": true, "analyzer": "cz" },
and it's working.
thank's lot xylakant on irc guiding me.
Comments
Post a Comment