Class TopMetricsAggregationBuilder
java.lang.Object
org.elasticsearch.search.aggregations.AggregationBuilder
org.elasticsearch.search.aggregations.AbstractAggregationBuilder<TopMetricsAggregationBuilder>
org.elasticsearch.client.analytics.TopMetricsAggregationBuilder
- All Implemented Interfaces:
NamedWriteable
,Writeable
,ToXContent
,ToXContentFragment
,BaseAggregationBuilder
public class TopMetricsAggregationBuilder extends AbstractAggregationBuilder<TopMetricsAggregationBuilder>
Builds the Top Metrics aggregation request.
NOTE: This extends AbstractAggregationBuilder for compatibility
with SearchSourceBuilder.aggregation(AggregationBuilder)
but it
doesn't support any "server" side things like
Writeable.writeTo(StreamOutput),
AggregationBuilder.rewrite(QueryRewriteContext), or
AbstractAggregationBuilder.build(QueryShardContext, AggregatorFactory).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.AggregationBuilder
AggregationBuilder.BucketCardinality, AggregationBuilder.CommonFields
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V extends java.lang.Object>, Writeable.Writer<V extends java.lang.Object>
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NAME
Fields inherited from class org.elasticsearch.search.aggregations.AbstractAggregationBuilder
metadata
Fields inherited from class org.elasticsearch.search.aggregations.AggregationBuilder
factoriesBuilder, name
-
Constructor Summary
Constructors Constructor Description TopMetricsAggregationBuilder(java.lang.String name, SortBuilder<?> sort, int size, java.lang.String... metrics)
Build the request. -
Method Summary
Modifier and Type Method Description AggregationBuilder.BucketCardinality
bucketCardinality()
protected AggregatorFactory
doBuild(QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subfactoriesBuilder)
protected void
doWriteTo(StreamOutput out)
java.lang.String
getType()
protected XContentBuilder
internalXContent(XContentBuilder builder, ToXContent.Params params)
protected AggregationBuilder
shallowCopy(AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metadata)
Methods inherited from class org.elasticsearch.search.aggregations.AbstractAggregationBuilder
build, equals, getMetadata, getWriteableName, hashCode, setMetadata, subAggregation, subAggregation, subAggregations, toXContent, writeTo
Methods inherited from class org.elasticsearch.search.aggregations.AggregationBuilder
buildPipelineTree, doRewrite, getName, getPipelineAggregations, getSubAggregations, rewrite, toString
-
Field Details
-
NAME
public static final java.lang.String NAME- See Also:
- Constant Field Values
-
-
Constructor Details
-
TopMetricsAggregationBuilder
public TopMetricsAggregationBuilder(java.lang.String name, SortBuilder<?> sort, int size, java.lang.String... metrics)Build the request.- Parameters:
name
- the name of the metricsort
- the sort key used to select the top metricssize
- number of results to return per bucketmetrics
- the names of the fields to select
-
-
Method Details
-
getType
public java.lang.String getType() -
internalXContent
protected XContentBuilder internalXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
internalXContent
in classAbstractAggregationBuilder<TopMetricsAggregationBuilder>
- Throws:
java.io.IOException
-
doWriteTo
- Specified by:
doWriteTo
in classAbstractAggregationBuilder<TopMetricsAggregationBuilder>
- Throws:
java.io.IOException
-
bucketCardinality
- Specified by:
bucketCardinality
in classAggregationBuilder
-
doBuild
protected AggregatorFactory doBuild(QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subfactoriesBuilder) throws java.io.IOException- Specified by:
doBuild
in classAbstractAggregationBuilder<TopMetricsAggregationBuilder>
- Throws:
java.io.IOException
-
shallowCopy
protected AggregationBuilder shallowCopy(AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metadata)- Specified by:
shallowCopy
in classAggregationBuilder
-