i going through documentation , understood multi_field used apply different analyzers on 1 field.
{ "tweet" : { "properties" : { "name" : { "type" : "multi_field", "fields" : { "name" : {"type" : "string", "index" : "analyzed"}, "untouched" : {"type" : "string", "index" : "not_analyzed"} } } } } }
i have indexed data follows
/tweet/1 { "name" : "anil" } and searching same follows.
/<indexname>/_search i getting data follows.
hits : [ { "_index" : ... .... "_source" : { "name" : "anil" } } ] so far good.
now looking match.
get <indexname>/_search { "query": { "match": { "name": "anil" } } } the above 1 works fine since have analyzer applied on it.
my question is, if want apply filter exact string, getting 0 hits.
get <indexname>/_search { "query": { "filtered": { "query": { "match_all": {} }, "filter": { "term": { "name" : "anil" } } } } } please suggest do.
have tried this?
get <indexname>/_search { "query": { "filtered": { "query": { "match_all": {} }, "filter": { "term": { "name.untouched" : "anil" } } } } } also, don't have use multi_fields anymore, can use fields, explained here, don't think that's cause of problem.
Comments
Post a Comment