Skip to content

Sigma should be a double? on ExtendedStatsBucketAggregation #1982

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

Closed
russcam opened this issue Apr 4, 2016 · 3 comments
Closed

Sigma should be a double? on ExtendedStatsBucketAggregation #1982

russcam opened this issue Apr 4, 2016 · 3 comments

Comments

@russcam
Copy link
Contributor

russcam commented Apr 4, 2016

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).

@jonyadamit
Copy link
Contributor

@russcam How would this be a breaking change, when ExtendedStatsBucketAggregation hasn't been released yet?

@russcam
Copy link
Contributor Author

russcam commented Apr 4, 2016

@jonyadamit My bad, I thought it'd gone into 2.1.0 but I was looking at ExtendedStatsAggregation - will close this issue and change it to double? 👍

@gmarz
Copy link
Contributor

gmarz commented Apr 4, 2016

👍 I had actually made this change in master (7273f55) but never cherry picked it to 2.x.

@russcam russcam added v2.1.1 and removed v2.2.0 labels Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants