Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why ScriptDocValues.Doubles is sorted ? #29110

Closed
HorsonLiu opened this issue Mar 16, 2018 · 2 comments
Closed

Why ScriptDocValues.Doubles is sorted ? #29110

HorsonLiu opened this issue Mar 16, 2018 · 2 comments

Comments

@HorsonLiu
Copy link

mappping:
{ "settings" : { "index" : { "number_of_shards" : 1, "number_of_replicas" : 0 } }, "mappings": { "obj_type": { "properties": { "feature_value": { "type": "double" }, } } } }

doc:
{"feature_value":[0.5, 0.1, 0.3]}

In self-defined SearchScript, I use ((ScriptDocValues<List>) getDoc().get(field)).get(0) returns 0.1 , but not 0.5. Why ? How can I retrieve the original double array, e.g. [0.5, 0.1, 0.3], not [0.1, 0.3, 0.5] ?
Thanks !

@romseygeek
Copy link
Contributor

We prefer to use github for bug reports or feature requests, for more general questions or support please use our discussion forums at http://discuss.elastic.co.

Multivalued docvalues are stored as sorted at the lucene level, so lose their original ordering when indexed. If you need to preserve the ordering, you could try encoding the values in a binary field and retrieving them from BinaryDocValues at search time, or storing them as separate fields.

@HorsonLiu
Copy link
Author

HorsonLiu commented Mar 19, 2018

Thank you !
With cmd curl -XGET http://<ip>:<port>/<index>/<type>/<ID> I got the 'feature_value' in original order. So I don't think docvalues stored as sorted at the lucene level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants