I have an integer array field, for example, my_integer_array.
I stored [3, 4, 1, 2] on the field via client and I can see that [3, 4, 1, 2] is successfully set on the document's my_integer_array field via Kibana.
But whenever I try to access the field in Painless Elasticsearch scripting language, e.g. doc['my_integer_array'], it returns [1, 2, 3, 4], not [3, 4, 1, 2]. Accessing it's element via doc['my_integer_array'][0] returns 1, not 3.
It seems like Painless provides sorted version of the field's data rather than the original array itself. Am I missing something? Can I disable this behavior and preserve the order?
P.S. I'm using elasticsearch-dsl-py Elasticsearch Python DSL library as an Elasticsearch client.