# ES Global Search cURL Examples (v1)

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

## Search by order/transaction text in nested orders
```bash
curl -sS -H "Authorization: ApiKey $ES_API_KEY" "$ES_URL/$ES_INDEX/_search" \
  -H 'Content-Type: application/json' -d '{
  "size": 20,
  "query": {
    "bool": {
      "must": [
        {"term": {"app_id": 1004}},
        {"nested": {"path": "orders", "query": {"bool": {"must": [
          {"wildcard": {"orders.order_id": "*1004*"}}
        ]}}}}
      ]
    }
  },
  "_source": ["sms_cust_id", "email_id", "orders"]
}'
```
