Can the sorting order of doc_values arrays be controlled?

As written in the documentation

Doc values are the on-disk data structure, built at document index time, which makes this data access pattern possible. They store the same values as the _source but in a column-oriented fashion that is way more efficient for sorting and aggregations.

I am interested to know in which orderthey are actually stored for each document.

Lets say i have a keyword color and i save a document with the colors [red, green, yellow]

Now i am accessing the keyword color in a script doc["color"]

How do i get the list ? Like i added it [red, green, yellow] ? Do i get it in sorted order ? [green, red, yellow] or is the order non deterministic ?

It's non deterministic because json itself is (not that doc values are stored in json, but it's consistent with the overall approach of Elasticsearch).

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.