java.lang.Object
co.elastic.clients.elasticsearch._types.aggregations.Aggregation
All Implemented Interfaces:
JsonpSerializable, TaggedUnion<Aggregation.Kind,​java.lang.Object>

@JsonpDeserializable
public class Aggregation
extends java.lang.Object
implements TaggedUnion<Aggregation.Kind,​java.lang.Object>, JsonpSerializable
See Also:
API specification
  • Field Details

  • Constructor Details

  • Method Details

    • _kind

      public final Aggregation.Kind _kind()
      Description copied from interface: TaggedUnion
      Get the of the kind of variant held by this object.
      Specified by:
      _kind in interface TaggedUnion<Aggregation.Kind,​java.lang.Object>
      Returns:
      the variant kind
    • _get

      public final java.lang.Object _get()
      Specified by:
      _get in interface TaggedUnion<Aggregation.Kind,​java.lang.Object>
    • of

      public static Aggregation of​(java.util.function.Function<Aggregation.Builder,​ObjectBuilder<Aggregation>> fn)
    • aggregations

      public final java.util.Map<java.lang.String,​Aggregation> aggregations()
      Sub-aggregations for this aggregation. Only applies to bucket aggregations.

      API name: aggregations

    • meta

      public final java.util.Map<java.lang.String,​JsonData> meta()
      API name: meta
    • isAdjacencyMatrix

      public boolean isAdjacencyMatrix()
      Is this variant instance of kind adjacency_matrix?
    • adjacencyMatrix

      public AdjacencyMatrixAggregation adjacencyMatrix()
      Get the adjacency_matrix variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the adjacency_matrix kind.
    • isAutoDateHistogram

      public boolean isAutoDateHistogram()
      Is this variant instance of kind auto_date_histogram?
    • autoDateHistogram

      public AutoDateHistogramAggregation autoDateHistogram()
      Get the auto_date_histogram variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the auto_date_histogram kind.
    • isAvg

      public boolean isAvg()
      Is this variant instance of kind avg?
    • avg

      public AverageAggregation avg()
      Get the avg variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the avg kind.
    • isAvgBucket

      public boolean isAvgBucket()
      Is this variant instance of kind avg_bucket?
    • avgBucket

      public AverageBucketAggregation avgBucket()
      Get the avg_bucket variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the avg_bucket kind.
    • isBoxplot

      public boolean isBoxplot()
      Is this variant instance of kind boxplot?
    • boxplot

      public BoxplotAggregation boxplot()
      Get the boxplot variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the boxplot kind.
    • isBucketScript

      public boolean isBucketScript()
      Is this variant instance of kind bucket_script?
    • bucketScript

      public BucketScriptAggregation bucketScript()
      Get the bucket_script variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the bucket_script kind.
    • isBucketSelector

      public boolean isBucketSelector()
      Is this variant instance of kind bucket_selector?
    • bucketSelector

      public BucketSelectorAggregation bucketSelector()
      Get the bucket_selector variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the bucket_selector kind.
    • isBucketSort

      public boolean isBucketSort()
      Is this variant instance of kind bucket_sort?
    • bucketSort

      public BucketSortAggregation bucketSort()
      Get the bucket_sort variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the bucket_sort kind.
    • isCardinality

      public boolean isCardinality()
      Is this variant instance of kind cardinality?
    • cardinality

      public CardinalityAggregation cardinality()
      Get the cardinality variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the cardinality kind.
    • isChildren

      public boolean isChildren()
      Is this variant instance of kind children?
    • children

      public ChildrenAggregation children()
      Get the children variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the children kind.
    • isComposite

      public boolean isComposite()
      Is this variant instance of kind composite?
    • composite

      public CompositeAggregation composite()
      Get the composite variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the composite kind.
    • isCumulativeCardinality

      public boolean isCumulativeCardinality()
      Is this variant instance of kind cumulative_cardinality?
    • cumulativeCardinality

      public CumulativeCardinalityAggregation cumulativeCardinality()
      Get the cumulative_cardinality variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the cumulative_cardinality kind.
    • isCumulativeSum

      public boolean isCumulativeSum()
      Is this variant instance of kind cumulative_sum?
    • cumulativeSum

      public CumulativeSumAggregation cumulativeSum()
      Get the cumulative_sum variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the cumulative_sum kind.
    • isDateHistogram

      public boolean isDateHistogram()
      Is this variant instance of kind date_histogram?
    • dateHistogram

      public DateHistogramAggregation dateHistogram()
      Get the date_histogram variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the date_histogram kind.
    • isDateRange

      public boolean isDateRange()
      Is this variant instance of kind date_range?
    • dateRange

      public DateRangeAggregation dateRange()
      Get the date_range variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the date_range kind.
    • isDerivative

      public boolean isDerivative()
      Is this variant instance of kind derivative?
    • derivative

      public DerivativeAggregation derivative()
      Get the derivative variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the derivative kind.
    • isDiversifiedSampler

      public boolean isDiversifiedSampler()
      Is this variant instance of kind diversified_sampler?
    • diversifiedSampler

      public DiversifiedSamplerAggregation diversifiedSampler()
      Get the diversified_sampler variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the diversified_sampler kind.
    • isExtendedStats

      public boolean isExtendedStats()
      Is this variant instance of kind extended_stats?
    • extendedStats

      public ExtendedStatsAggregation extendedStats()
      Get the extended_stats variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the extended_stats kind.
    • isExtendedStatsBucket

      public boolean isExtendedStatsBucket()
      Is this variant instance of kind extended_stats_bucket?
    • extendedStatsBucket

      public ExtendedStatsBucketAggregation extendedStatsBucket()
      Get the extended_stats_bucket variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the extended_stats_bucket kind.
    • isFilter

      public boolean isFilter()
      Is this variant instance of kind filter?
    • filter

      public Query filter()
      Get the filter variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the filter kind.
    • isFilters

      public boolean isFilters()
      Is this variant instance of kind filters?
    • filters

      public FiltersAggregation filters()
      Get the filters variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the filters kind.
    • isGeoBounds

      public boolean isGeoBounds()
      Is this variant instance of kind geo_bounds?
    • geoBounds

      public GeoBoundsAggregation geoBounds()
      Get the geo_bounds variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geo_bounds kind.
    • isGeoCentroid

      public boolean isGeoCentroid()
      Is this variant instance of kind geo_centroid?
    • geoCentroid

      public GeoCentroidAggregation geoCentroid()
      Get the geo_centroid variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geo_centroid kind.
    • isGeoDistance

      public boolean isGeoDistance()
      Is this variant instance of kind geo_distance?
    • geoDistance

      public GeoDistanceAggregation geoDistance()
      Get the geo_distance variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geo_distance kind.
    • isGeohashGrid

      public boolean isGeohashGrid()
      Is this variant instance of kind geohash_grid?
    • geohashGrid

      public GeoHashGridAggregation geohashGrid()
      Get the geohash_grid variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geohash_grid kind.
    • isGeoLine

      public boolean isGeoLine()
      Is this variant instance of kind geo_line?
    • geoLine

      public GeoLineAggregation geoLine()
      Get the geo_line variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geo_line kind.
    • isGeotileGrid

      public boolean isGeotileGrid()
      Is this variant instance of kind geotile_grid?
    • geotileGrid

      public GeoTileGridAggregation geotileGrid()
      Get the geotile_grid variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geotile_grid kind.
    • isGlobal

      public boolean isGlobal()
      Is this variant instance of kind global?
    • global

      public GlobalAggregation global()
      Get the global variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the global kind.
    • isHistogram

      public boolean isHistogram()
      Is this variant instance of kind histogram?
    • histogram

      public HistogramAggregation histogram()
      Get the histogram variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the histogram kind.
    • isIpRange

      public boolean isIpRange()
      Is this variant instance of kind ip_range?
    • ipRange

      public IpRangeAggregation ipRange()
      Get the ip_range variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the ip_range kind.
    • isInference

      public boolean isInference()
      Is this variant instance of kind inference?
    • inference

      public InferenceAggregation inference()
      Get the inference variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the inference kind.
    • isMatrixStats

      public boolean isMatrixStats()
      Is this variant instance of kind matrix_stats?
    • matrixStats

      public MatrixStatsAggregation matrixStats()
      Get the matrix_stats variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the matrix_stats kind.
    • isMax

      public boolean isMax()
      Is this variant instance of kind max?
    • max

      public MaxAggregation max()
      Get the max variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the max kind.
    • isMaxBucket

      public boolean isMaxBucket()
      Is this variant instance of kind max_bucket?
    • maxBucket

      public MaxBucketAggregation maxBucket()
      Get the max_bucket variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the max_bucket kind.
    • isMedianAbsoluteDeviation

      public boolean isMedianAbsoluteDeviation()
      Is this variant instance of kind median_absolute_deviation?
    • medianAbsoluteDeviation

      public MedianAbsoluteDeviationAggregation medianAbsoluteDeviation()
      Get the median_absolute_deviation variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the median_absolute_deviation kind.
    • isMin

      public boolean isMin()
      Is this variant instance of kind min?
    • min

      public MinAggregation min()
      Get the min variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the min kind.
    • isMinBucket

      public boolean isMinBucket()
      Is this variant instance of kind min_bucket?
    • minBucket

      public MinBucketAggregation minBucket()
      Get the min_bucket variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the min_bucket kind.
    • isMissing

      public boolean isMissing()
      Is this variant instance of kind missing?
    • missing

      public MissingAggregation missing()
      Get the missing variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the missing kind.
    • isMovingAvg

      public boolean isMovingAvg()
      Is this variant instance of kind moving_avg?
    • movingAvg

      public MovingAverageAggregation movingAvg()
      Get the moving_avg variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the moving_avg kind.
    • isMovingPercentiles

      public boolean isMovingPercentiles()
      Is this variant instance of kind moving_percentiles?
    • movingPercentiles

      public MovingPercentilesAggregation movingPercentiles()
      Get the moving_percentiles variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the moving_percentiles kind.
    • isMovingFn

      public boolean isMovingFn()
      Is this variant instance of kind moving_fn?
    • movingFn

      public MovingFunctionAggregation movingFn()
      Get the moving_fn variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the moving_fn kind.
    • isMultiTerms

      public boolean isMultiTerms()
      Is this variant instance of kind multi_terms?
    • multiTerms

      public MultiTermsAggregation multiTerms()
      Get the multi_terms variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the multi_terms kind.
    • isNested

      public boolean isNested()
      Is this variant instance of kind nested?
    • nested

      public NestedAggregation nested()
      Get the nested variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the nested kind.
    • isNormalize

      public boolean isNormalize()
      Is this variant instance of kind normalize?
    • normalize

      public NormalizeAggregation normalize()
      Get the normalize variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the normalize kind.
    • isParent

      public boolean isParent()
      Is this variant instance of kind parent?
    • parent

      public ParentAggregation parent()
      Get the parent variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the parent kind.
    • isPercentileRanks

      public boolean isPercentileRanks()
      Is this variant instance of kind percentile_ranks?
    • percentileRanks

      public PercentileRanksAggregation percentileRanks()
      Get the percentile_ranks variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the percentile_ranks kind.
    • isPercentiles

      public boolean isPercentiles()
      Is this variant instance of kind percentiles?
    • percentiles

      public PercentilesAggregation percentiles()
      Get the percentiles variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the percentiles kind.
    • isPercentilesBucket

      public boolean isPercentilesBucket()
      Is this variant instance of kind percentiles_bucket?
    • percentilesBucket

      public PercentilesBucketAggregation percentilesBucket()
      Get the percentiles_bucket variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the percentiles_bucket kind.
    • isRange

      public boolean isRange()
      Is this variant instance of kind range?
    • range

      public RangeAggregation range()
      Get the range variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the range kind.
    • isRareTerms

      public boolean isRareTerms()
      Is this variant instance of kind rare_terms?
    • rareTerms

      public RareTermsAggregation rareTerms()
      Get the rare_terms variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the rare_terms kind.
    • isRate

      public boolean isRate()
      Is this variant instance of kind rate?
    • rate

      public RateAggregation rate()
      Get the rate variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the rate kind.
    • isReverseNested

      public boolean isReverseNested()
      Is this variant instance of kind reverse_nested?
    • reverseNested

      public ReverseNestedAggregation reverseNested()
      Get the reverse_nested variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the reverse_nested kind.
    • isSampler

      public boolean isSampler()
      Is this variant instance of kind sampler?
    • sampler

      public SamplerAggregation sampler()
      Get the sampler variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the sampler kind.
    • isScriptedMetric

      public boolean isScriptedMetric()
      Is this variant instance of kind scripted_metric?
    • scriptedMetric

      public ScriptedMetricAggregation scriptedMetric()
      Get the scripted_metric variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the scripted_metric kind.
    • isSerialDiff

      public boolean isSerialDiff()
      Is this variant instance of kind serial_diff?
    • serialDiff

      public SerialDifferencingAggregation serialDiff()
      Get the serial_diff variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the serial_diff kind.
    • isSignificantTerms

      public boolean isSignificantTerms()
      Is this variant instance of kind significant_terms?
    • significantTerms

      public SignificantTermsAggregation significantTerms()
      Get the significant_terms variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the significant_terms kind.
    • isSignificantText

      public boolean isSignificantText()
      Is this variant instance of kind significant_text?
    • significantText

      public SignificantTextAggregation significantText()
      Get the significant_text variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the significant_text kind.
    • isStats

      public boolean isStats()
      Is this variant instance of kind stats?
    • stats

      public StatsAggregation stats()
      Get the stats variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the stats kind.
    • isStatsBucket

      public boolean isStatsBucket()
      Is this variant instance of kind stats_bucket?
    • statsBucket

      public StatsBucketAggregation statsBucket()
      Get the stats_bucket variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the stats_bucket kind.
    • isStringStats

      public boolean isStringStats()
      Is this variant instance of kind string_stats?
    • stringStats

      public StringStatsAggregation stringStats()
      Get the string_stats variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the string_stats kind.
    • isSum

      public boolean isSum()
      Is this variant instance of kind sum?
    • sum

      public SumAggregation sum()
      Get the sum variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the sum kind.
    • isSumBucket

      public boolean isSumBucket()
      Is this variant instance of kind sum_bucket?
    • sumBucket

      public SumBucketAggregation sumBucket()
      Get the sum_bucket variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the sum_bucket kind.
    • isTerms

      public boolean isTerms()
      Is this variant instance of kind terms?
    • terms

      public TermsAggregation terms()
      Get the terms variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the terms kind.
    • isTopHits

      public boolean isTopHits()
      Is this variant instance of kind top_hits?
    • topHits

      public TopHitsAggregation topHits()
      Get the top_hits variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the top_hits kind.
    • isTTest

      public boolean isTTest()
      Is this variant instance of kind t_test?
    • tTest

      public TTestAggregation tTest()
      Get the t_test variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the t_test kind.
    • isTopMetrics

      public boolean isTopMetrics()
      Is this variant instance of kind top_metrics?
    • topMetrics

      public TopMetricsAggregation topMetrics()
      Get the top_metrics variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the top_metrics kind.
    • isValueCount

      public boolean isValueCount()
      Is this variant instance of kind value_count?
    • valueCount

      public ValueCountAggregation valueCount()
      Get the value_count variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the value_count kind.
    • isWeightedAvg

      public boolean isWeightedAvg()
      Is this variant instance of kind weighted_avg?
    • weightedAvg

      public WeightedAverageAggregation weightedAvg()
      Get the weighted_avg variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the weighted_avg kind.
    • isVariableWidthHistogram

      public boolean isVariableWidthHistogram()
      Is this variant instance of kind variable_width_histogram?
    • variableWidthHistogram

      public VariableWidthHistogramAggregation variableWidthHistogram()
      Get the variable_width_histogram variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the variable_width_histogram kind.
    • serialize

      public void serialize​(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
      Specified by:
      serialize in interface JsonpSerializable
    • setupAggregationDeserializer

      protected static void setupAggregationDeserializer​(ObjectDeserializer<Aggregation.Builder> op)