Module org.elasticsearch.server
Class AggregationErrors
java.lang.Object
org.elasticsearch.search.aggregations.AggregationErrors
Collection of helper methods for what to throw in common aggregation error scenarios.
-
Method Summary
Modifier and TypeMethodDescriptionstatic RuntimeException
incompatibleAggregationType
(String aggPath, String expected, String got, String currentAgg) Indicates that an aggregation path (e.g.static IllegalArgumentException
invalidPathElement
(String element, String path) This error indicates that the aggregations path the user specified cannot be parsed.static RuntimeException
iterationOrderChangedWithoutMutating
(String bucketOrds, long got, long expected) This is a 500 class error indicating a programming error.static RuntimeException
This error indicates that a rate aggregation is being invoked without a single Date Histogram parent, as is required.static RuntimeException
reduceTypeMismatch
(String aggregationName, Optional<Integer> position) This error indicates that the backing indices for a field have different, incompatible, types (e.g.static RuntimeException
Indicates that a multivalued field was found where we only support a single valued fieldstatic RuntimeException
Indicates the given values source is not suitable for use in a multivalued aggregation.static RuntimeException
unsupportedRounding
(String typeName) Indicates an attempt to use date rounding on a non-date values sourcestatic RuntimeException
unsupportedScriptValue
(String actual) 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.static RuntimeException
valuesSourceDoesNotSupportScritps
(String typeName)
-
Method Details
-
invalidPathElement
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 theValuesSourceType
version below- Parameters:
valuesSource
- The values source we resolved from the queryname
- The name of the aggregation- Returns:
- an appropriate exception type
-
rateWithoutDateHistogram
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 aggregationposition
- - optional, for multisource aggregations. Indicates the position of the field causing the problem.- Returns:
- - an appropriate exception
-
valuesSourceDoesNotSupportScritps
-
unsupportedScriptValue
-
unsupportedMultivalue
Indicates that a multivalued field was found where we only support a single valued field- Returns:
- an appropriate exception
-
unsupportedMultivalueValuesSource
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
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 invalidexpected
-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 processinggot
- - the ordinal we gotexpected
- - the ordinal we expected- Returns:
- an appropriate exception
-