Skip to content

MatrixStats when all values are 1-> UnexpectedElasticsearchClientException #8429

Closed
@msw16

Description

@msw16

Similar issue from #5007

NEST/Elasticsearch.Net version:
7.17
Elasticsearch version:
8.10 / 8.15
.NET runtime version:
8
Operating system version:
Windows 11
Description of the problem including expected versus actual behavior:
A clear and concise description of what the bug is.

"message": "An error has occurred.",
 "exceptionMessage": "expected:'Number Token', actual:'\"NaN\"', at offset:179002",
 "exceptionType": "Elasticsearch.Net.UnexpectedElasticsearchClientException",

Steps to reproduce:

  1. One field, which is mapped as double, more than 1 data but values are all 1
  2. While querying aggregation with MatrixStats, skewness and kurtosis is "NaN", which is right calculation but got the exception while creating a response
  3. Seems Extended Stats are patched but not MatrixStats
var searchResponse = await _Nest.SearchAsync<Document>(s => s
    .Index(indexName)
    .Size(0)
    .Query(_ => queryContainer)
    .Aggregations(a => a
        .MatrixStats("matrix_stats", m => m
            .Field(new[] { field })
        )
        .ExtendedStats("extended_stats", e => e
            .Field(field)
        )
        .Percentiles("percentiles", p => p
            .Field(field)
            .Percents(5.0, 25.0, 50.0, 75.0, 95.0)
        )
        .Missing("missing", m => m
            .Field(field)
        )
    )
    .TrackTotalHits()
);

Expected behavior
A clear and concise description of what you expected to happen.
SearchApi shouldn't be failed while returns query

Provide ConnectionSettings (if relevant):

Provide DebugInformation (if relevant):

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