Class CardinalityAggregationBuilder
java.lang.Object
org.opensearch.search.aggregations.AggregationBuilder
org.opensearch.search.aggregations.AbstractAggregationBuilder<CardinalityAggregationBuilder>
org.opensearch.search.aggregations.support.ValuesSourceAggregationBuilder<CardinalityAggregationBuilder>
org.opensearch.search.aggregations.support.ValuesSourceAggregationBuilder.LeafOnly<ValuesSource,CardinalityAggregationBuilder>
org.opensearch.search.aggregations.metrics.CardinalityAggregationBuilder
- All Implemented Interfaces:
org.opensearch.core.common.io.stream.NamedWriteable
,org.opensearch.core.common.io.stream.Writeable
,org.opensearch.core.xcontent.ToXContent
,org.opensearch.core.xcontent.ToXContentFragment
,Rewriteable<AggregationBuilder>
,BaseAggregationBuilder
public final class CardinalityAggregationBuilder
extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource,CardinalityAggregationBuilder>
Aggregation Builder for cardinality agg
- Opensearch.internal:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensearch.search.aggregations.support.ValuesSourceAggregationBuilder
ValuesSourceAggregationBuilder.LeafOnly<VS extends ValuesSource,
AB extends ValuesSourceAggregationBuilder<AB>> Nested classes/interfaces inherited from class org.opensearch.search.aggregations.AggregationBuilder
AggregationBuilder.BucketCardinality, AggregationBuilder.CommonFields
Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final org.opensearch.core.xcontent.ObjectParser
<CardinalityAggregationBuilder, String> static final org.opensearch.core.ParseField
Fields inherited from class org.opensearch.search.aggregations.support.ValuesSourceAggregationBuilder
config
Fields inherited from class org.opensearch.search.aggregations.AbstractAggregationBuilder
metadata
Fields inherited from class org.opensearch.search.aggregations.AggregationBuilder
factoriesBuilder, name
Fields inherited from interface org.opensearch.index.query.Rewriteable
MAX_REWRITE_ROUNDS
Fields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionCardinalityAggregationBuilder
(org.opensearch.core.common.io.stream.StreamInput in) Read from a stream.CardinalityAggregationBuilder
(CardinalityAggregationBuilder clone, AggregatorFactories.Builder factoriesBuilder, Map<String, Object> metadata) -
Method Summary
Modifier and TypeMethodDescriptionprotected ValuesSourceType
Aggregations should use this method to define aValuesSourceType
of last resort.org.opensearch.core.xcontent.XContentBuilder
doXContentBody
(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) boolean
protected ValuesSourceRegistry.RegistryKey
<?> getType()
The name of the type of aggregation built by this builder.int
hashCode()
protected org.opensearch.search.aggregations.metrics.CardinalityAggregatorFactory
innerBuild
(QueryShardContext queryShardContext, ValuesSourceConfig config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) protected void
innerWriteTo
(org.opensearch.core.common.io.stream.StreamOutput out) Write subclass's state to the stream.Get the precision threshold.precisionThreshold
(long precisionThreshold) Set a precision threshold.static void
protected boolean
serializeTargetValueType
(org.opensearch.Version version) DO NOT OVERRIDE THIS!protected AggregationBuilder
shallowCopy
(AggregatorFactories.Builder factoriesBuilder, Map<String, Object> metadata) Create a shallow copy of this builder and replacingAggregationBuilder.factoriesBuilder
andmetadata
.Methods inherited from class org.opensearch.search.aggregations.support.ValuesSourceAggregationBuilder.LeafOnly
bucketCardinality, subAggregations
Methods inherited from class org.opensearch.search.aggregations.support.ValuesSourceAggregationBuilder
declareFields, declareFields, doBuild, doWriteTo, field, field, format, format, internalXContent, missing, missing, resolveConfig, script, script, timeZone, timeZone, userValueTypeHint, userValueTypeHint
Methods inherited from class org.opensearch.search.aggregations.AbstractAggregationBuilder
build, getMetadata, getWriteableName, setMetadata, subAggregation, subAggregation, toXContent, writeTo
Methods inherited from class org.opensearch.search.aggregations.AggregationBuilder
buildPipelineTree, doRewrite, getName, getPipelineAggregations, getSubAggregations, rewrite, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensearch.core.xcontent.ToXContentFragment
isFragment
-
Field Details
-
NAME
- See Also:
-
REGISTRY_KEY
-
PRECISION_THRESHOLD_FIELD
public static final org.opensearch.core.ParseField PRECISION_THRESHOLD_FIELD -
PARSER
public static final org.opensearch.core.xcontent.ObjectParser<CardinalityAggregationBuilder,String> PARSER
-
-
Constructor Details
-
CardinalityAggregationBuilder
-
CardinalityAggregationBuilder
public CardinalityAggregationBuilder(CardinalityAggregationBuilder clone, AggregatorFactories.Builder factoriesBuilder, Map<String, Object> metadata) -
CardinalityAggregationBuilder
public CardinalityAggregationBuilder(org.opensearch.core.common.io.stream.StreamInput in) throws IOException Read from a stream.- Throws:
IOException
-
-
Method Details
-
registerAggregators
-
defaultValueSourceType
Description copied from class:ValuesSourceAggregationBuilder
Aggregations should use this method to define aValuesSourceType
of last resort. This will only be used when the resolver can't find a field and the user hasn't provided a value type hint.- Specified by:
defaultValueSourceType
in classValuesSourceAggregationBuilder<CardinalityAggregationBuilder>
- Returns:
- The CoreValuesSourceType we expect this script to yield.
-
shallowCopy
protected AggregationBuilder shallowCopy(AggregatorFactories.Builder factoriesBuilder, Map<String, Object> metadata) Description copied from class:AggregationBuilder
Create a shallow copy of this builder and replacingAggregationBuilder.factoriesBuilder
andmetadata
. Used byAggregationBuilder.rewrite(QueryRewriteContext)
.- Specified by:
shallowCopy
in classAggregationBuilder
-
innerWriteTo
protected void innerWriteTo(org.opensearch.core.common.io.stream.StreamOutput out) throws IOException Description copied from class:ValuesSourceAggregationBuilder
Write subclass's state to the stream.- Specified by:
innerWriteTo
in classValuesSourceAggregationBuilder<CardinalityAggregationBuilder>
- Throws:
IOException
-
serializeTargetValueType
protected boolean serializeTargetValueType(org.opensearch.Version version) Description copied from class:ValuesSourceAggregationBuilder
DO NOT OVERRIDE THIS!This method only exists for legacy support. No new aggregations need this, nor should they override it.
- Overrides:
serializeTargetValueType
in classValuesSourceAggregationBuilder<CardinalityAggregationBuilder>
- Parameters:
version
- For backwards compatibility, subclasses can change behavior based on the version
-
precisionThreshold
Set a precision threshold. Higher values improve accuracy but also increase memory usage. -
precisionThreshold
Get the precision threshold. Higher values improve accuracy but also increase memory usage. Will returnnull
if the precisionThreshold has not been set yet. -
innerBuild
protected org.opensearch.search.aggregations.metrics.CardinalityAggregatorFactory innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws IOException - Specified by:
innerBuild
in classValuesSourceAggregationBuilder<CardinalityAggregationBuilder>
- Throws:
IOException
-
doXContentBody
public org.opensearch.core.xcontent.XContentBuilder doXContentBody(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException - Specified by:
doXContentBody
in classValuesSourceAggregationBuilder<CardinalityAggregationBuilder>
- Throws:
IOException
-
hashCode
public int hashCode()- Overrides:
hashCode
in classValuesSourceAggregationBuilder<CardinalityAggregationBuilder>
-
equals
- Overrides:
equals
in classValuesSourceAggregationBuilder<CardinalityAggregationBuilder>
-
getType
Description copied from interface:BaseAggregationBuilder
The name of the type of aggregation built by this builder. -
getRegistryKey
- Specified by:
getRegistryKey
in classValuesSourceAggregationBuilder<CardinalityAggregationBuilder>
-