Skip to content

Nest 1.0.2 Aggregations - issue supporting different aggrgation types #931

@djnelson9715

Description

@djnelson9715

So this has been a bit of a head scratcher

.Aggregations( a=> a
  .Terms("searchTerms", at => at
    .Field("searchTerm.raw")
    .Size(100)
    .Aggregations( rs => rs
      .Stats("pageRankStats", prs =>  prs.Field("pageRank"))
      .Percentiles("pageRankMedian",  prm  => prm.Field("pageRank").Percentages(new double[]{50.0}))))

I should expect to see two aggregations for each search term, the "pageRankStats", "pageRankMedian".

Using the following code to access the results

foreach(KeyItem x in ((Bucket)result.Aggs.Aggregations["searchTerms"]).Items)
{
  var stats = x.Stats("pageRankStats");
  var median = x.Percentiles("pageRankMedian");
}

what I am finding is stats is null and median is populated as expected. If however, I can the second aggregation to be a stats aggregation then I am able to access both aggregation results.

Is this not supported?

Thanks in advance

Doug

Metadata

Metadata

Assignees

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