@elastic/aggregate-by-field
Aggregate documents by a specific field
RUN SKILL aggregate_by_field()With parameters:
RUN SKILL aggregate_by_field WITH index_pattern = 'value', field = 'value', limit = 0| Name | Type | Default | Description |
|---|---|---|---|
| index_pattern | STRING | — | Index pattern to aggregate |
| field | STRING | — | Field name to group by |
| limit | INT | — | Maximum number of buckets |
-- Using curl
curl -u elastic-admin:elastic-password http://localhost:9200/_escript \
-H "Content-Type: application/json" \
-d '{"query": "RUN SKILL aggregate_by_field()"}'
-- Response
{
"result": [...],
"_meta": {
"execution_id": "abc123",
"duration_ms": 45
}
}