-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Nodes.StatsAsync(x => x.Human()) Fails with Utf8Json.JsonParsingException #5953
Comments
@J-Griffin Thanks for raising this issue. It's interesting on a few levels. The first thing I'd like to understand is your scenario which requires requesting a human-readable response. Since this is essentially a machine situation, I wouldn't expect responses in the human-readable form to deserialise into our types, which is the case here. When using the High-Level NEST client, the types are modelled on the machine-readable JSON responses. The The fact you're receiving that exception is not unexpected, but I agree, we may be able to consider if that should be caught internally with the failure being identified on the response object. I believe right now this is likely by design since, for the standard case, we never expect the JSON deserialisation to fail and when it does, this is a more explicit identification and failure. |
@stevejgordon on the one hand, I agree it's a bit odd, but on the other, Human() is explicitly in the NEST syntax AND properties like Our specific case is for some basic dashboarding where we want to highlight basic human readable values we find valuable. The least effort way of doing that is/was to call stats endpoints with "human" to use the already formatted strings instead of parsing bytes, time values, etc. |
@J-Griffin My apologies for letting the ball drop on this issue. I took a fresh look and agree, that currently this is supported for other properties and this particular property is mistyped. I have fixed this in #6107 and will get that into the next release. Sorry, it took so long to resolve this one. |
NEST/Elasticsearch.Net version: 7.13.2
Elasticsearch version: 7.13.4
.NET runtime version: 4.7
Operating system version: Windows 10 (Dev machine)
Description of the problem including expected versus actual behavior:
Calls to node stats with the "human" param fail with a deserialization exception.
Steps to reproduce:
{"expected:'Number Token', actual:'\"34.7ms\"', at offset:13214"}
Expected behavior
The NodesStatsResponse should be returned (successful request or not). Excluding "human" resolves the issue. The json parsing fails because Nest.AdaptiveSelectionStats.AverageResponseTime is a long, but should be a string.
This works:
Preventing the "adaptive_selection" section from returning also works:
The text was updated successfully, but these errors were encountered: