-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Make path syntax for lower and upper standard deviation bounds in the extended_stats aggregation more obvious #20818
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,13 @@ | |
|
||
package org.elasticsearch.search.aggregations.metrics; | ||
|
||
import org.elasticsearch.search.DocValueFormat; | ||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStats; | ||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStatsAggregationBuilder; | ||
import org.elasticsearch.search.aggregations.metrics.stats.extended.InternalExtendedStats; | ||
import org.junit.Test; | ||
|
||
import java.util.Collections; | ||
|
||
public class ExtendedStatsTests extends AbstractNumericMetricTestCase<ExtendedStatsAggregationBuilder> { | ||
|
||
|
@@ -32,4 +38,15 @@ protected ExtendedStatsAggregationBuilder doCreateTestAggregatorFactory() { | |
return factory; | ||
} | ||
|
||
@Test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our build does not allow the use of the |
||
public void getStdDeviationBoundsByPath() throws Exception { | ||
double min = 1.0; | ||
double max = 4.0; | ||
|
||
ExtendedStats stats = new InternalExtendedStats("test", 2, min + max, min, max, Math.pow(min, 2) + Math.pow(max, 2), | ||
1.0, DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); | ||
|
||
assertEquals(stats.getStdDeviationBound(ExtendedStats.Bounds.LOWER), stats.getProperty("std_deviation_bounds.lower")); | ||
assertEquals(stats.getStdDeviationBound(ExtendedStats.Bounds.UPPER), stats.getProperty("std_deviation_bounds.upper")); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The disadvantage of doing the change here is that we will have two ways of getting the upper and lower bounds. In buckets path syntax for pipeline aggregations we will have
std_deviation_bounds.upper
andstd_deviation_bounds.lower
and for the AggregationPath syntax used by the terms aggregation order parameter we will still usestd_upper
andstd_lower
. I now wonder if we should instead change the name in thevalue(String name)
method so that it isstandard_deviation_bounds.upper
andstandard_deviation_bounds.lower
? Then it would be consistent all the places it is used. We could make the change in 6.0 and have a change in 5.x which accepts both versions but logs to the deprecation logger if thestd_upper
orstd_lower
version is used.@clintongormley @jpountz what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable