diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/AbstractAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/AbstractAggregationBuilder.java index ef82c48b4e7..bbd9e3a20f7 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/AbstractAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/AbstractAggregationBuilder.java @@ -24,6 +24,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.internal.SearchContext; import java.io.IOException; +import java.util.Collections; import java.util.Map; import java.util.Objects; @@ -115,6 +116,11 @@ public abstract class AbstractAggregationBuilder getMetaData() { + return Collections.unmodifiableMap(metaData); + } + @Override public final String getWriteableName() { // We always use the type of the aggregation as the writeable name diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/AggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/AggregationBuilder.java index 16f8ef2444f..694a78f9d1c 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/AggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/AggregationBuilder.java @@ -64,6 +64,9 @@ public abstract class AggregationBuilder @Override public abstract AggregationBuilder setMetaData(Map metaData); + /** Return any associated metadata with this {@link AggregationBuilder}. */ + public abstract Map getMetaData(); + /** Add a sub aggregation to this builder. */ public abstract AggregationBuilder subAggregation(AggregationBuilder aggregation); diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregationBuilder.java index cb239781e3e..d534b572f96 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregationBuilder.java @@ -148,6 +148,13 @@ public class TermsAggregationBuilder extends ValuesSourceAggregationBuilder pipelineAggregators, + public InternalSum(String name, double sum, DocValueFormat formatter, List pipelineAggregators, Map metaData) { super(name, pipelineAggregators, metaData); this.sum = sum;