Answer the question
In order to leave comments, you need to log in
How to properly organize data in an index in Elasticsearch?
Hello.
There is a certain entity with a characteristic that can have an arbitrary number of text values. For example:
"entity1": { "param": ["1", "2", "3"] }
"entity2": { "param": ["1", "2"] }
Answer the question
In order to leave comments, you need to log in
If these are just arrays of data, then it is enough to use the standard mapping for the field and the usual queries query term / terms.
Minimal mapping (ES 5.0+)
...
"param": {"type": "keyword"}
...
GET your_index/your_type/_search
{"query": {"term": {"param": {"value": "2"}}}}
GET your_index/your_type/_search
{"query": {"terms": {"param": ["2", "1"]}}}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question