How to get an ordered numeric field data


I am writing a custom scoring plugin to use numeric array field data as vector, such as
POST /scoring_test/test/1 {
"vector": [4,3,2,1]

When I load numeric field data, IndexNumericFieldData class returns its sorted order. When I am glancing through source codes, default behavior of numeric field data is sorted but I don't want this. I don't think that there's a exposed configuration to control this behavior but is there any hacky way to do in the custom scoring plugin implementation?

Another workaround is, storing that vector information as binary or text then do some parsing to convert to the vector format, which looks ugly.

Do you have any idea? Thank you

There is no way to maintain ordering. So your best option would probably be to encode everything in a binary field indeed.

1 Like

Thank you so much for confirming!

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