-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Wrong serialization of TermsQuery, MinimumShouldMatch and TrackTotalHits #8387
Comments
Hi @andersosthus, you are trying to serialize "internal" request/response types using the It should work, if you use the Hint: If you update to the latest version, you can use one of the new serialization overloads: var jsonPayload = client.RequestResponseSerializer.SerializeToString(request); This way you don't have to manually create a Please let me know, if that answers your question. |
Yes, I agree. This is currently incorrectly named in our specification. The specification is used to generate multiple clients and other tools, which means we have to be careful with breaking changes like this one. We will discuss this point internally.
This is already on the list of upcoming usability improvements. For this to work, we have to generate transient implicit conversion operators. |
Thanks @flobernd. Too many serializers :) I guess I need to dig a bit deeper to find what's breaking our request. A bunch of assumptions led me to believe it was in the serializer (based on my example above), but that was clearly wrong :) |
@andersosthus Let me know if I can do something else to help you debugging your issue. |
Elastic.Clients.Elasticsearch version: 8.15.9
Elasticsearch version: N/A
.NET runtime version: 8.0
Operating system version: Win 11
Description of the problem including expected versus actual behavior:
Term
inTermsQuery
does not serialize properly.MinimumShouldMatch
inBoolQuery
does not serialize properly.TrackTotalHits
inSearchRequest
does not serialize properly.Steps to reproduce:
Expected behavior
Expected the following output:
but this is the actual produces JSON:
Other notes:
Using
new TrackHits(1)
forTrackTotalHits
gives the same output.We've worked around it for now with custom serializers, just reporting it here to make sure you're aware of it.
Sidenote, for
TermsQuery
, shouldn'tTerm
be renamed toTerms
to align semantically since the use case is for one or many terms? Also, thinking about DX,TermsQuery.Term(s)
should allow us to just pass in a collection in stead of aTermsQueryField
which feels a lot more clunky.The text was updated successfully, but these errors were encountered: