Using doc in script but return in order

Hello all,

I am using ES 5.6.3.
I save some float array in a field named feature, and I want to use them in script.

My mapping:

"feature" : {
    "type" : "float",
    "index" : false
},

But when I use script like doc['feature'] to get the data, the order change.
For example, my raw data is

[0.3, 0.2, 0.1]

Now I get

[0.1, 0.2, 0.3]

I don't want to change the order in the field. I know that I can use _source to get the raw data, but it is too slow.

Please give me some help. Thanks in advance!

docvalues are sorted to allowed improved compression. If you want the original order, you either need to use _source, or encode the values into a separate field that you can decode in scripting.

Thanks for your response.

However, it is too slow to get the raw data using _source or saving the in several fields.

Is there any way to prevent es from sorting the docvalues? I heard about that setting store to true may help, do you have any idea?

Thanks again, may you have a nice day:)

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