elasticsearch - Query with values that have special characters -
elasticsearch - Query with values that have special characters -
i have document next structure:
{ "_index": "logstash-2014.10.08", "_type": "iis", "_id": "hrm7lwfbspgo9pus0z1ynw", "_score": 1, "_source": { "@version": "1", "@timestamp": "2014-10-08t12:37:26.000z", "type": "iis", "messageid": "o5puhwouentt0xqxxfnw6l+o6emijtfo7e//t+s/99en4zzonlhqjeklw02zzvrflyvaawa==" } }
here mapping:
"messageid" : { "type" : "string", "norms" : { "enabled" : false }, "fields" : { "raw" : { "type" : "string", "index" : "not_analyzed", "ignore_above" : 256 } } }
i'm trying perform query , homecoming documents have exact value of messageid passed on query. i've tried perform queries using match , filter.
if utilize term, returns 0 documents:
{ "query": { "term" : { "messageid" : "o5puhwouentt0xqxxfnw6l+o6emijtfo7e//t+s/99en4zzonlhqjeklw02zzvrflyvaawa==" } } }
when utilize match, can document if little changes on messageid, still returns document , messageid on query different document.
{ "query": { "match" : { "messageid" : "o5puhwouxxfnw6l+o6emijtfo7e//t+s/99en4zzonlhqjeklw02zzvrflyvaawa==" } } }
anyone knows how can query , retrieve documents have exact value messageid?
thank in advance.
i don't believe special character problem, instead think index analyzed vs non-analyzed problem. if utilize regular, analyzed field need search in lower-case term match. not-analyzed not case.
i ran next test using sample , able result wanted.
put index1 set index1/type1/_mapping { "type1": { "properties": { "raw" : { "type" : "string", "index" : "not_analyzed", "ignore_above" : 256 } } } } post index1/type1 { "raw": "o5puhwouentt0xqxxfnw6l+o6emijtfo7e//t+s/99en4zzonlhqjeklw02zzvrflyvaawa==" } index1/type1/_search { "query": { "term": { "raw": { "value": "o5puhwouentt0xqxxfnw6l+o6emijtfo7e//t+s/99en4zzonlhqjeklw02zzvrflyvaawa==" } } } }
my guess info in field working on analyzed. can check getting using _mapping api. in illustration be:
get index1/type1/_mapping
elasticsearch
Comments
Post a Comment