# ES Dashboard cURL Examples (v1)

Use env vars:
- `ES_URL`
- `ES_API_KEY`
- `ES_INDEX=customer_subscription_v1`

## KPI style count (active customers)
```bash
curl -sS -H "Authorization: ApiKey $ES_API_KEY" "$ES_URL/$ES_INDEX/_search" \
  -H 'Content-Type: application/json' -d '{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {"term": {"app_id": 1004}},
        {"term": {"customer_status": 1}},
        {"range": {"created_at": {"gte": "2026-02-05 00:00:00", "lte": "2026-05-05 23:59:59"}}}
      ]
    }
  },
  "aggs": {"users": {"cardinality": {"field": "sms_cust_id"}}}
}'
```
