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

Sort.toJSON() wrong format!? #118

Closed
Hypopheralcus opened this issue Jun 22, 2020 · 3 comments
Closed

Sort.toJSON() wrong format!? #118

Hypopheralcus opened this issue Jun 22, 2020 · 3 comments

Comments

@Hypopheralcus
Copy link

let sortField = new Sort('MyFieldToSort', 'desc');

sortField.toJSON()

Result:
{ MyFieldToSort: 'desc' }

Expected result:
{ "MyFieldToSort": { "order": "desc" } }

@sudo-suhas
Copy link
Owner

@Hypopheralcus
Copy link
Author

Okay thanks. So this is a Bug in the Elasticsearch.Net/NEST Client. Because the generated Syntax forces the RequestResponseSerializer.Deserialize() to fail with the message: "Character: { expected." If I change the JSON from ESB the Deserialize works.

@russcam
Copy link

russcam commented Jun 30, 2020

NEST now supports deserializing the short forms of sort in 7.8.1 (elastic/elasticsearch-net#4806).

Historically, NEST has generally only supported serializing and deserializing the long form of sort/queries/etc., but in more recent versions, support for deserializing short forms has been added where it is missing (serialization will still use the long form). So, if you come across a case where NEST does not deserialize the short form of something, please do open an issue, thanks!

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

3 participants