IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Matrix Stats Aggregation Usage
editMatrix Stats Aggregation Usage
editFluent DSL example
edita => a .MatrixStats("matrixstats", ms => ms .Meta(m => m .Add("foo", "bar") ) .Fields(fs => fs .Field(p => p.NumberOfCommits) .Field(p => p.NumberOfContributors) ) .Missing(m => m .Add(Field<Project>(p => p.NumberOfCommits), 0) .Add(Field<Project>(p => p.NumberOfContributors), 1) ) .Mode(MatrixStatsMode.Median) )
Object Initializer syntax example
editnew MatrixStatsAggregation("matrixstats", Field<Project>(p => p.NumberOfCommits)) { Meta = new Dictionary<string, object> { { "foo", "bar" } }, Missing = new Dictionary<Field, double> { { "numberOfCommits", 0.0 }, { "numberOfContributors", 1.0 }, }, Mode = MatrixStatsMode.Median, Fields = Field<Project>(p => p.NumberOfCommits).And("numberOfContributors") }
Example json output.
{ "matrixstats": { "meta": { "foo": "bar" }, "matrix_stats": { "fields": [ "numberOfCommits", "numberOfContributors" ], "missing": { "numberOfCommits": 0.0, "numberOfContributors": 1.0 }, "mode": "median" } } }
Handling Responses
editresponse.ShouldBeValid(); var matrix = response.Aggregations.MatrixStats("matrixstats"); matrix.Should().NotBeNull(); matrix.Fields.Should().NotBeNull().And.HaveCount(2); matrix.DocCount.Should().BeGreaterThan(0); AssertField(matrix, "numberOfCommits"); AssertField(matrix, "numberOfContributors");