Skip to content

Sigma should be a double? on ExtendedStatsBucketAggregation #1982

Closed
@russcam

Description

@russcam

NEST/Elasticsearch.Net version: 2.1.0

Elasticsearch version: 2.3.0

Description of the problem including expected versus actual behavior:

Sigma is specified as an int? on ExtendedStatsBucketAggregation but it should be a double? (based on the docs of Extended Stats Aggregation).

Sending a number without decimal places throws a parse exception on Elasticsearch 2.3.0:

Request:

{
  "size": 0,
  "aggs": {
    "projects_started_per_month": {
      "date_histogram": {
        "field": "startedOn",
        "interval": "month"
      },
      "aggs": {
        "commits": {
          "sum": {
            "field": "numberOfCommits"
          }
        }
      }
    },
    "extended_stats_commits_per_month": {
      "extended_stats_bucket": {
        "buckets_path": "projects_started_per_month>commits",
        "sigma": 2
      }
    }
  }
}

Response:

  "error" : {
    "root_cause" : [ {
      "type" : "parse_exception",
      "reason" : "Parameter [sigma] must be a Double, type `Integer` provided instead"
    } ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [ {
      "shard" : 0,
      "index" : "project",
      "node" : "afZfSF7hQoqmZQip5n3-LQ",
      "reason" : {
        "type" : "parse_exception",
        "reason" : "Parameter [sigma] must be a Double, type `Integer` provided instead"
      }
    } ]
  },
  "status" : 500
}

Steps to reproduce:

  1. Run the ExtendedStatsBucketAggregationUsageTests.
  2. Changing Sigma to double? fixes the problem. This would be a binary break for NEST 2.x however 😞

See also elastic/elasticsearch#17499 - I filed an issue as I think Elasticsearch should also accept an integer value for sigma (and deserialize to double on the server side).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions