search - No results when in the mapping, the field _all has specified an index_analyzer -
with elasticsearch have created index using custom mapping , custom set of analszers, i'm not able query search on _all field.
i'm using these analyzers:
{ "analysis": { "analyzer": { "case_insensitive": { "type": "custom", "tokenizer": "keyword", "filter": [ "lowercase", "asciifolding" ], "char_filter": "punctuation" } }, "char_filter": { "punctuation": { "type": "mapping", "mappings": [ ".=>\\u0020", "-=>\\u0020", "_=>\\u0020" ] } } } } and mapping:
{ "article": { "_all": { "enabled": true, "store": "yes", "index_analyzer": "case_insensitive", "search_analyzer": "case_insensitive" }, "properties": { "title": { "type": "string", "index": "analyzed" }, "subtitle": { "type": "string", "analyzer": "case_insensitive" }, "comment": { "type": "string", "index": "not_analyzed" }, "review": { "type":"string", "index": "not_analyzed", "include_in_all":false } } } }
then add document this:
{ "title": "this story of wonderful man.", "subtitle":"a man goes on vacation in worst place possible.", "comment": "i movie much, did not undertand it.", "review":"very well" } and expect following 3 out of 4 fields shall included in _all, in particular title, subtitle , comment.
the analyzer working following (tested using analyzer test in elasticsearch):
"i movie much, did not undertand it." -> "i movie much, did not undertand "
"this story of wonderful man." -> "this story of wonderful man "
i expect @ least searching on _all using query: "this story of wonderful man." should able find document.
what doing wrong?
how elasticsearch populating _all field?
if field 'title' shall added _all field, data used , how? using output of analyzer selected 'title' field input analyzer of _all or using raw data?
how flow of data in _all field? example
input -> analyzer -> title -> index_analyser -> _all
or
input -> analyzer -> title -> index_analyser -> _all
thank in advance...
your mapping looks ok me. thing try set 1 of fields explicitly include_in_all=true , rerun query.
according docs, may overriding default value of include_in_all 1 of fields, may have changed other fields of objects. see here _all
relevant text documentation below:
inclusion in _all field can controlled on field-by-field basis using include_in_all setting, defaults true. setting include_in_all on object (or on root object) changes default fields within object.
update:
i think know why not working. here did. first, removed custom analysers _all_ field (so using standard analyser). able query , results expected. results returned terms in of document attributes review. @ least confirms general behaviour of _all correct. next test analysers, did query on subtitle field exact text(as using keyword analyser). worked. realised _all aggregated field , then analysed.
so query should include text fields work. again, how know in order aggregated :)
this link _all custom analyser has information. relevant bits extracted below (from shay).
you don't want set analyzer _all keyword, _all aggregation of other fields int doc, treat whole aggregation of text single token.
Comments
Post a Comment