Skip to main content

Error message

Example: defaults: approx_count_distinct and count_distinct cannot both be enabled

When this error occurs

approx_count_distinct uses HyperLogLog for fast approximate cardinality. count_distinct computes the exact value. Enabling both on the same scope is redundant and indicates a configuration mistake, so the server rejects it. This validation applies at every level: defaults, namespace scope, field overrides, and nested nodes.

Example: request that triggers this error

How to fix

Choose one of the two:
  • approx_count_distinct — faster, suitable for large datasets where an estimate is acceptable
  • count_distinct — exact, more expensive to compute