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

SearchDescriptor doesn't allow creating a list of sorts #804

Closed
johndaniels opened this issue Jul 17, 2014 · 1 comment
Closed

SearchDescriptor doesn't allow creating a list of sorts #804

johndaniels opened this issue Jul 17, 2014 · 1 comment

Comments

@johndaniels
Copy link

Adding sorts to the SearchDescriptor using .Sort() adds more key/value pairs to a dictionary, whereas the API specification at https://github.com/elasticsearch/elasticsearch/blob/master/rest-api-spec/api/search.json#L96 and the Elasticsearch documentation at http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html indicates that sort is supposed to be a list of sorts.

Ideally, SearchDescriptor should add items to a list and serialize as such, which would preserve the order of any sorts applied in the descriptor. As far as I can tell the current scheme only works because .NET serializes dictionary entries in the order they were added, and ElasticSearch honors that order as well, but that doesn't seem like a good thing to rely on.

@gmarz gmarz mentioned this issue Jul 18, 2014
@gmarz
Copy link
Contributor

gmarz commented Jul 18, 2014

Hey @johndaniels, you are absolutely right- this was a great find. I've opened the above PR #807 which addresses this. Sort() now adds to a list of key/value pairs and serializes to a json array. Thanks for reporting!

@gmarz gmarz closed this as completed Jul 21, 2014
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