Class AggregationErrors

java.lang.Object
org.elasticsearch.search.aggregations.AggregationErrors

public class AggregationErrors extends Object
Collection of helper methods for what to throw in common aggregation error scenarios.
  • Method Details

    • invalidPathElement

      public static IllegalArgumentException invalidPathElement(String element, String path)
      This error indicates that the aggregations path the user specified cannot be parsed. It is a 400 class error and should not be retried.
    • unsupportedValuesSourceType

      public static IllegalArgumentException unsupportedValuesSourceType(ValuesSource valuesSource, String name)
      This error indicates that an aggregation is being used on a value type that it is not capable of processing, such as taking the sum of a keyword. It is a 400 class error and should not be retried. This is a legacy version of this error; in general, we should aim to use the ValuesSourceType version below
      Parameters:
      valuesSource - The values source we resolved from the query
      name - The name of the aggregation
      Returns:
      an appropriate exception type
    • rateWithoutDateHistogram

      public static RuntimeException rateWithoutDateHistogram(String name)
      This error indicates that a rate aggregation is being invoked without a single Date Histogram parent, as is required. This is a 400 class error and should not be retried.
      Parameters:
      name - the name of the rate aggregation
      Returns:
      an appropriate exception
    • reduceTypeMismatch

      public static RuntimeException reduceTypeMismatch(String aggregationName, Optional<Integer> position)
      This error indicates that the backing indices for a field have different, incompatible, types (e.g. IP and Keyword). This causes a failure at reduce time, and is not retryable (and thus should be a 400 class error)
      Parameters:
      aggregationName - - The name of the aggregation
      position - - optional, for multisource aggregations. Indicates the position of the field causing the problem.
      Returns:
      - an appropriate exception
    • valuesSourceDoesNotSupportScritps

      public static RuntimeException valuesSourceDoesNotSupportScritps(String typeName)
    • unsupportedScriptValue

      public static RuntimeException unsupportedScriptValue(String actual)
    • unsupportedMultivalue

      public static RuntimeException unsupportedMultivalue()
      Indicates that a multivalued field was found where we only support a single valued field
      Returns:
      an appropriate exception
    • unsupportedMultivalueValuesSource

      public static RuntimeException unsupportedMultivalueValuesSource(String source)
      Indicates the given values source is not suitable for use in a multivalued aggregation. This is not retryable.
      Parameters:
      source - a string describing the Values Source
      Returns:
      an appropriate exception
    • unsupportedRounding

      public static RuntimeException unsupportedRounding(String typeName)
      Indicates an attempt to use date rounding on a non-date values source
      Parameters:
      typeName - - name of the type we're attempting to round
      Returns:
      an appropriate exception
    • incompatibleAggregationType

      public static RuntimeException incompatibleAggregationType(String aggPath, String expected, String got, String currentAgg)
      Indicates that an aggregation path (e.g. from a pipeline agg) references an aggregation of the wrong type, for example attempting to take a cumulative cardinality of something other than a cardinality aggregation.
      Parameters:
      aggPath - the path element found to be invalid
      expected -
      got - What we actually got; this may be null.
      currentAgg - The name of the aggregation in question
      Returns:
      an appropriate exception
    • iterationOrderChangedWithoutMutating

      public static RuntimeException iterationOrderChangedWithoutMutating(String bucketOrds, long got, long expected)
      This is a 500 class error indicating a programming error. Hopefully we never see this outside of tests.
      Parameters:
      bucketOrds - - the ords we are processing
      got - - the ordinal we got
      expected - - the ordinal we expected
      Returns:
      an appropriate exception