Skip to content

A call to client.Cluster.StatsAsync fails with JSON serialization error #8015

Closed
@yansklyarenko

Description

@yansklyarenko

Elastic.Clients.Elasticsearch version: 8.11.0

Elasticsearch version: 8.11.0

.NET runtime version: net7.0, net6.0

Operating system version: Windows 10

Description of the problem including expected versus actual behavior:
Run a plain request to get cluster stats:

var stats = await client.Cluster.StatsAsync(new ClusterStatsRequest()).ConfigureAwait(false);

It fails with the following error:

The JSON value could not be converted to System.Int32. Path: $.indices.query_cache.total_count

Notes
This is only happening when the total_count property of the query_cache object of the target cluster exceeds the int.MaxValue. In my case, if I run the same query in the ES console, I get 2153022551 for the .indices.query_cache.total_count, which is obviously bigger than int.MaxValue (2147483647).
The type of the TotalCount property is int, but should probably be long.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions