Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions _aggregations/metric/cardinality.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,26 @@ GET opensearch_dashboards_sample_data_ecommerce/_search
}
}
}
```

You can choose the mechanism by which the aggregation is executed with the `execution_hint` setting. This setting accepts two values:

1. `direct`: Use field values directly.
2. `ordinals`: Use ordinals of the field.

If not specified, mechanism that is appropriate for the field is selected. Note that specifying `ordinals` on a non-ordinal field will have no effect. Similarly, `direct` will have no effect on ordinal fields.

```json
GET opensearch_dashboards_sample_data_ecommerce/_search
{
"size": 0,
"aggs": {
"unique_products": {
"cardinality": {
"field": "products.product_id",
"execution_hint": "ordinals"
}
}
}
}
```