Uses a newer way to build `ObjectParser` for in `boxplot` that allows us to drop a mostly ceremonial method.
This commit is contained in:
parent
7cd997df84
commit
8796cdce4b
|
@ -16,7 +16,6 @@ import org.elasticsearch.plugins.ActionPlugin;
|
|||
import org.elasticsearch.plugins.MapperPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.SearchPlugin;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.xpack.analytics.action.TransportAnalyticsStatsAction;
|
||||
import org.elasticsearch.xpack.analytics.boxplot.BoxplotAggregationBuilder;
|
||||
import org.elasticsearch.xpack.analytics.boxplot.InternalBoxplot;
|
||||
|
@ -74,7 +73,7 @@ public class AnalyticsPlugin extends Plugin implements SearchPlugin, ActionPlugi
|
|||
new AggregationSpec(
|
||||
BoxplotAggregationBuilder.NAME,
|
||||
BoxplotAggregationBuilder::new,
|
||||
(ContextParser<String, AggregationBuilder>) (p, c) -> BoxplotAggregationBuilder.parse(c, p))
|
||||
BoxplotAggregationBuilder.PARSER)
|
||||
.addResultReader(InternalBoxplot::new),
|
||||
new AggregationSpec(
|
||||
TopMetricsAggregationBuilder.NAME,
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.ObjectParser;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.query.QueryShardContext;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
|
@ -33,18 +32,13 @@ public class BoxplotAggregationBuilder extends ValuesSourceAggregationBuilder.Le
|
|||
BoxplotAggregationBuilder> {
|
||||
public static final String NAME = "boxplot";
|
||||
|
||||
private static final ObjectParser<BoxplotAggregationBuilder, Void> PARSER;
|
||||
|
||||
public static final ObjectParser<BoxplotAggregationBuilder, String> PARSER =
|
||||
ObjectParser.fromBuilder(NAME, BoxplotAggregationBuilder::new);
|
||||
static {
|
||||
PARSER = new ObjectParser<>(BoxplotAggregationBuilder.NAME);
|
||||
ValuesSourceParserHelper.declareAnyFields(PARSER, true, true);
|
||||
PARSER.declareDouble(BoxplotAggregationBuilder::compression, COMPRESSION_FIELD);
|
||||
}
|
||||
|
||||
public static AggregationBuilder parse(String aggregationName, XContentParser parser) throws IOException {
|
||||
return PARSER.parse(parser, new BoxplotAggregationBuilder(aggregationName), null);
|
||||
}
|
||||
|
||||
private double compression = 100.0;
|
||||
|
||||
public BoxplotAggregationBuilder(String name) {
|
||||
|
|
Loading…
Reference in New Issue