1

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.

3
  • Were you able to solve this? Commented May 8, 2017 at 13:34
  • @ZaidAmir No. I failed to solve this issue. Commented May 19, 2017 at 8:52
  • 1
    I think this so answer can give you some insights => stackoverflow.com/a/43836510/2119685 Commented Jun 2, 2017 at 9:57

1 Answer 1

2

You can access the array setting _source:true and then using params._source['my_integer_array'] this way the array will be unsorted in its original state.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.