Class TopMetricsAggregationBuilder

java.lang.Object
org.elasticsearch.search.aggregations.AggregationBuilder
org.elasticsearch.search.aggregations.AbstractAggregationBuilder<TopMetricsAggregationBuilder>
org.elasticsearch.client.analytics.TopMetricsAggregationBuilder
All Implemented Interfaces:
org.elasticsearch.common.io.stream.NamedWriteable, org.elasticsearch.common.io.stream.Writeable, org.elasticsearch.index.query.Rewriteable<org.elasticsearch.search.aggregations.AggregationBuilder>, org.elasticsearch.search.aggregations.BaseAggregationBuilder, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentFragment

public class TopMetricsAggregationBuilder extends org.elasticsearch.search.aggregations.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(AggregationContext, AggregatorFactory).

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.AggregationBuilder

    org.elasticsearch.search.aggregations.AggregationBuilder.BucketCardinality, org.elasticsearch.search.aggregations.AggregationBuilder.CommonFields

    Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent

    org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    org.elasticsearch.common.io.stream.Writeable.Reader<V extends Object>, org.elasticsearch.common.io.stream.Writeable.Writer<V extends Object>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from class org.elasticsearch.search.aggregations.AbstractAggregationBuilder

    metadata

    Fields inherited from class org.elasticsearch.search.aggregations.AggregationBuilder

    DEFAULT_PREALLOCATION, factoriesBuilder, name

    Fields inherited from interface org.elasticsearch.index.query.Rewriteable

    MAX_REWRITE_ROUNDS

    Fields inherited from interface org.elasticsearch.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    TopMetricsAggregationBuilder(String name, org.elasticsearch.search.sort.SortBuilder<?> sort, int size, String... metrics)
    Build the request.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.elasticsearch.search.aggregations.AggregationBuilder.BucketCardinality
     
    protected org.elasticsearch.search.aggregations.AggregatorFactory
    doBuild(org.elasticsearch.search.aggregations.support.AggregationContext context, org.elasticsearch.search.aggregations.AggregatorFactory parent, org.elasticsearch.search.aggregations.AggregatorFactories.Builder subfactoriesBuilder)
     
    protected void
    doWriteTo(org.elasticsearch.common.io.stream.StreamOutput out)
     
     
    protected org.elasticsearch.xcontent.XContentBuilder
    internalXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params)
     
    protected org.elasticsearch.search.aggregations.AggregationBuilder
    shallowCopy(org.elasticsearch.search.aggregations.AggregatorFactories.Builder factoriesBuilder, Map<String,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, bytesToPreallocate, doRewrite, getName, getOutputFieldNames, getPipelineAggregations, getSubAggregations, rewrite, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment

    isFragment
  • Field Details

  • Constructor Details

    • TopMetricsAggregationBuilder

      public TopMetricsAggregationBuilder(String name, org.elasticsearch.search.sort.SortBuilder<?> sort, int size, String... metrics)
      Build the request.
      Parameters:
      name - the name of the metric
      sort - the sort key used to select the top metrics
      size - number of results to return per bucket
      metrics - the names of the fields to select
  • Method Details

    • getType

      public String getType()
    • internalXContent

      protected org.elasticsearch.xcontent.XContentBuilder internalXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      internalXContent in class org.elasticsearch.search.aggregations.AbstractAggregationBuilder<TopMetricsAggregationBuilder>
      Throws:
      IOException
    • doWriteTo

      protected void doWriteTo(org.elasticsearch.common.io.stream.StreamOutput out) throws IOException
      Specified by:
      doWriteTo in class org.elasticsearch.search.aggregations.AbstractAggregationBuilder<TopMetricsAggregationBuilder>
      Throws:
      IOException
    • bucketCardinality

      public org.elasticsearch.search.aggregations.AggregationBuilder.BucketCardinality bucketCardinality()
      Specified by:
      bucketCardinality in class org.elasticsearch.search.aggregations.AggregationBuilder
    • doBuild

      protected org.elasticsearch.search.aggregations.AggregatorFactory doBuild(org.elasticsearch.search.aggregations.support.AggregationContext context, org.elasticsearch.search.aggregations.AggregatorFactory parent, org.elasticsearch.search.aggregations.AggregatorFactories.Builder subfactoriesBuilder) throws IOException
      Specified by:
      doBuild in class org.elasticsearch.search.aggregations.AbstractAggregationBuilder<TopMetricsAggregationBuilder>
      Throws:
      IOException
    • shallowCopy

      protected org.elasticsearch.search.aggregations.AggregationBuilder shallowCopy(org.elasticsearch.search.aggregations.AggregatorFactories.Builder factoriesBuilder, Map<String,Object> metadata)
      Specified by:
      shallowCopy in class org.elasticsearch.search.aggregations.AggregationBuilder