---
title: "Get Compound Index Patterns"
method: GET
path: "/v1/analytics/namespaces/indexes/compound-patterns"
tags: ["Analytics", "Analytics - Namespaces"]
---

# Get Compound Index Patterns

`GET /v1/analytics/namespaces/indexes/compound-patterns`

Identify compound index opportunities.

Finds metadata fields commonly used together in filters, suggesting
opportunities for compound (multi-field) indexes.

**Use Cases:**
- Optimize multi-field queries
- Create compound indexes
- Understand query complexity
- Improve complex filter performance

**Response Includes:**
- Field combinations used together
- Frequency of combination usage
- Average and P95 latency
- Sorted by combination frequency

**Compound Index Example:**
If `brand + status` appears frequently, create:
```javascript
db.documents.createIndex({"metadata.brand": 1, "metadata.status": 1})
```

**Example:**
```bash
curl -X GET "https://api.mixpeek.com/v1/analytics/namespaces/indexes/compound-patterns" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Namespace: your-namespace"
```

## Query parameters

- `days` integer — Days of history to analyze
- `limit` integer — Maximum patterns to return

## Response `200`

Successful Response

- CompoundIndexResponse — Response for compound index patterns endpoint.
  - `namespace_id` string, required — Namespace ID analyzed
  - `time_range_days` integer, required — Number of days analyzed
  - `patterns` CompoundIndexPattern[], required — Compound field patterns
    - `field_combination` string[], required — Fields used together
    - `combination_count` integer, required — Number of times this combination was used
    - `avg_latency_ms` number, required — Average latency for this combination
    - `p95_latency_ms` number, required — 95th percentile latency
  - `total_patterns` integer, required — Total patterns found

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `422` — Validation Error
- `500` — Internal Server Error

---

[API](https://skmtc.net/mixpeek/apis/mixpeek-api.md) · [All operations](https://skmtc.net/mixpeek/apis/mixpeek-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mixpeek/mixpeek-api/versions/220a3b263fda/schema)
