Percentile Ranks Aggregation Usageedit

Fluent DSL exampleedit

s => s
.Aggregations(a => a
    .PercentileRanks("commits_outlier", pr => pr
        .Field(p => p.NumberOfCommits)
        .Values(15, 30)
        .Method(m => m
            .TDigest(td => td
                .Compression(200)
            )
        )
        .Script(ss => ss.Inline("doc['numberOfCommits'].value * 1.2").Lang("groovy"))
        .Missing(0)
    )
)

Object Initializer syntax exampleedit

new SearchRequest<Project>
{
    Aggregations = new PercentileRanksAggregation("commits_outlier", Field<Project>(p => p.NumberOfCommits))
    {
        Values = new List<double> { 15, 30 },
        Method = new TDigestMethod
        {
            Compression = 200
        },
        Script = new InlineScript("doc['numberOfCommits'].value * 1.2") { Lang = "groovy" },
        Missing = 0
    }
}

Example json output. 

{
  "aggs": {
    "commits_outlier": {
      "percentile_ranks": {
        "field": "numberOfCommits",
        "values": [
          15.0,
          30.0
        ],
        "tdigest": {
          "compression": 200.0
        },
        "script": {
          "inline": "doc['numberOfCommits'].value * 1.2",
          "lang": "groovy"
        },
        "missing": 0.0
      }
    }
  }
}

Handling Responsesedit

response.ShouldBeValid();
var commitsOutlier = response.Aggs.PercentileRanks("commits_outlier");
commitsOutlier.Should().NotBeNull();
commitsOutlier.Items.Should().NotBeNullOrEmpty();
foreach (var item in commitsOutlier.Items)
    item.Should().NotBeNull();