I have an index field 'properties.language' with a value of 'en sv'. This field has a multi-valued display consisting of two fields, one of which is analyzed (name "language"), and the other non-analysis (name "_exact").
How can I create one search query without querying both "properties.language" and "properties.language._exact"?
Edit:
Here is my configuration:
Indexed Data:
{ "_index": "51ded0be98035", "_type": "user", "_id": "WUzwcwhTRbKur7J5ZY_hgA", "_version": 1, "_score": 1, "_source": { "properties": { "language":"en sv" } } }
Mapping for user type:
{ "user": { "properties": { "properties": { "properties": { "language": { "type": "multi_field", "fields": { "language": { "type": "string", "analyzer": "standard", "index": "analyzed" }, "_exact": { "type": "string", "index": "not_analyzed" } } } } } } } }
Search query:
{ "query": { "filtered": { "query": { "match_all": {} }, "filter": { "bool": { "must": [{ "or": [{ "term": { "properties.language": "en sv" } }, { "term": { "properties.language._exact": "en sv" } }] }] } } } } }
elasticsearch
Robin orheden
source share