# Documentdb Indexing

> Index-type selection and shape guidance for Azure DocumentDB — when to use single-field, compound (ESR), multikey, wildcard, hashed, 2dsphere, TTL, and vector indexes; query-pattern → index-shape cookbook; per-collection index budget; DocumentDB-specific preference for `textSearch` over community `$text`. Use when designing or reviewing indexes, choosing an index type for a query pattern, or deci…

- **Type:** Skill
- **Install:** `agentstack add skill-azure-documentdb-agent-kit-indexing`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Azure](https://agentstack.voostack.com/s/azure)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Azure](https://github.com/Azure)
- **Source:** https://github.com/Azure/documentdb-agent-kit/tree/main/skills/indexing

## Install

```sh
agentstack add skill-azure-documentdb-agent-kit-indexing
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Indexing Strategies — Azure DocumentDB

Companion skill to `documentdb-query-optimizer`. That skill answers *"why is this query slow?"*; this one answers *"which index should I create, and what shape should it take?"*.

Azure DocumentDB supports the standard MongoDB index types. Only `_id` is created automatically — every other index must be created explicitly. Default limit: **64 single-field indexes per collection** (extendable to 300 on request).

### Index engine types

> **`_id` vs regular indexes:** The `_id` index is a **B-tree**, created automatically, and cannot be dropped. For sharded collections the `_id` key is composite — it includes a hash of the shard key. All other indexes created via `createIndex` are **RUM** indexes; the exception is geospatial indexes (`2dsphere`, `2d`), which are **GiST** indexes.

## Rules

- [index-single-field](index-single-field.md) — When a single-field index is enough; direction, options (`unique`, `sparse`, `partial`, collation).
- [index-compound-esr](index-compound-esr.md) — Compound index design via ESR (Equality → Sort → Range); prefer one compound over many singles.
- [index-multikey-arrays](index-multikey-arrays.md) — Indexing array fields; the one-array-per-compound (parallel-array) restriction; multikey can't cover queries.
- [index-text-prefer-textsearch](index-text-prefer-textsearch.md) — On Azure DocumentDB, prefer the `textSearch` index + `$search` over community `$text` indexes.
- [index-wildcard-dynamic-schemas](index-wildcard-dynamic-schemas.md) — Wildcard indexes for truly dynamic schemas; cost vs benefit; scope the prefix.
- [index-hashed-shard-keys](index-hashed-shard-keys.md) — Hashed indexes for even distribution; when sharding becomes necessary; shard-key alignment; range-query caveats.
- [index-2dsphere-geospatial](index-2dsphere-geospatial.md) — GeoJSON types, `[longitude, latitude]` order, `$near` / `$geoWithin` / `$geoIntersects`.
- [index-ttl-expiry](index-ttl-expiry.md) — TTL indexes: `expireAfterSeconds` semantics, date-field requirement, monitoring.
- [index-count-budget](index-count-budget.md) — Keep 5–15 indexes per collection; review `$indexStats`; drop unused.
- [index-lifecycle-drop-hide](index-lifecycle-drop-hide.md) — Safe lifecycle: inventory → detect redundancy → `hideIndex` → `dropIndex`. The `_id` index cannot be dropped.
- [index-pattern-cookbook](index-pattern-cookbook.md) — Query-pattern → index-shape cookbook
  (equality+sort, multi-equality, selectivity ordering, $eq + $in mix, range+sort,
  equality+range, hybrid, partial index for large arrays).

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Azure](https://github.com/Azure)
- **Source:** [Azure/documentdb-agent-kit](https://github.com/Azure/documentdb-agent-kit)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-azure-documentdb-agent-kit-indexing
- Seller: https://agentstack.voostack.com/s/azure
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
