# Elasticsearch Docs (customer_subscription_v1)

Canonical docs aligned with current service implementation under `app/Services/Elasticsearch`:

1. `ES_SERVICES_REFERENCE_customer_subscription_v1.md`
2. Module query docs:
- `DASHBOARD_PAGE_ES_QUERIES.md`
- `BILLING_ES_QUERIES.md`
- `BUSINESS_ANALYTICS_ES_QUERIES.md`
- `BUSINESS_UNITS_ES_QUERIES.md`
- `CAMPAIGN_SEGMENT_ES_QUERIES.md`
- `GLOBAL_SEARCH_ES_QUERIES.md`
- `BACKOFFICE_COUPON_ANALYTICS_ES_QUERIES.md`
- `PRODUCT_ADMIN_ES_QUERIES.md`
- `REPORTS_ES_QUERIES.md`
- `SUBSCRIBER360_ES_QUERIES.md`

Supporting field/cURL docs (updated for v1 nested mapping):
- `ES_*_FIELD_SUBSET.md`
- `ES_*_CURL_EXAMPLES.md`

Postman:
- `ES_SERVICES_API_customer_subscription_v1.postman_collection.json`
  - Includes dashboard timeline, payment trends, and payment gateway distribution requests aligned with current endpoints.
  - Dashboard request docs are aligned with:
    - timeline ES stock logic (no automatic SQL fallback on low active series)
    - adaptive payment trends interval (`day/week/month` by range)
    - agg-only query execution with `track_total_hits=false`

Fallback model:
- ES/SQL fallback is backend service-driven through `DashboardElasticsearchService` and consuming service classes.
- No blade-level fallback behavior should be treated as source-of-truth.

Profiling logs:
- Dashboard ES query profiling is emitted by `DashboardElasticsearchService`:
  - `dashboard.es_query`
  - `dashboard.es_query_slow`
  - `dashboard.es_query_failed`
- Slow threshold env: `DASHBOARD_ES_SLOW_MS` (default `1200` ms).

Legacy:
- `*_customer_subscription_v2.postman_collection.json` files are retained only for historical reference.
