Does Elasticsearch keep an order of multi-value fields?
I.e. if I've put following values into fields:
{
"values": ["one", "two", "three"],
"values_original": ["1", "2", "3"]
}
(Given that fields are not analyzed)
Can I be sure that the contents of lists will always be returned in the same order I put it there?
In the example above, I want to make sure that "one" on first position in "values" will always correspond to "1" in "values_original" etc.
I could keep it also as nested objects, i.e.
{
"values": [
{"original": "1", "new": "one"},
{"original":"2", "new":"two"},
{"original":"3","new":"three"}
]
}
but I want to avoid the overhead.
If it is guaranteed that order of values in multi-value field is preserved, then my approach of keeping two parallel multi-valued fields will work.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…