elasticsearch-index-design
Design and review Elasticsearch index mappings for stated access patterns: correct field types, text+keyword multi-fields, doc_values tuning…
Skill by elasticOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/elastic-elasticsearch-index-design
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/elasticsearch-index-design
What's inside
- Skill name
elasticsearch-index-design- Description
- Design and review Elasticsearch index mappings for stated access patterns: correct field types, text+keyword multi-fields, doc_values tuning, mapping-explosion avoidance, and explicit shard settings. Use when creating a new index, reviewing a mapping for storage or query performance, fixing wrong field types, or when the user asks which type to use for search, filter, sort, or aggregation on a field.
- License
- Apache-2.0
- Compatibility
- Elasticsearch 8.x or 9.x, self-managed, Elastic Cloud Hosted, or Elastic Cloud Serverless; explicit shard and replica settings apply to self-managed and Elastic Cloud Hosted only (managed internally on Serverless). Requires the `elastic` CLI ≥ 0.2 with `stack es` support.
- Metadata
- author: elastic · version: 0.1.0 · universal: true
- Instructions
- 206 lines in SKILL.md · view on GitHub
Files (4)
- SKILL.md
- field-type-decisions.md · references/
- mapping-explosion.md · references/
- multi-field-patterns.md · references/
SKILL.md (first lines)
# Elasticsearch Index Design
Design explicit index mappings from access patterns, review existing mappings for type and storage mistakes, and apply
corrections through a new index plus reindex when field types must change.
<!-- begin-partial: preamble -->
## Environment Configuration
This skill executes Elasticsearch operations through the `elastic` CLI. If the
[`elastic` CLI](https://github.com/elastic/cli#configuration) is not installed, tell the user what it is needed for. Do
not guess credentials, call the HTTP API directly, or attempt other workarounds.
This skill references operations in HTTP-shorthand form (e.g., `GET /`, `GET /_cat/indices`, `GET /{index}/_mapping`,
`GET /{index}/_settings/index.mode`, `POST /_query`). The [Operations](#operations) table at the end of this document
maps each shorthand to the equivalent `elastic` CLI command — always use the CLI rather than calling the HTTP API
directly.
<!-- end-partial: preamble -->
## Process
1. **Gather access patterns per field.** Before choosing types, list how each field is used. For every field capture:
- **Search** — full-text match, phrase, relevance scoring?
- **Filter** — exact term, terms set, prefix?
- **Aggregate** — terms, cardinality, histogram, stats?
- **Sort** — ascending/d descending in result sets?
- **Retrieve only** — returned in `_source` but never queried?
The decision: classify each field into one primary access pattern (search, exact, numeric metric, date, boolean,
structured object, or retrieve-only). Missing access-pattern data is a blocker — ask the user rather than guessing.
Call `GET /` to confirm connectivity; when reviewing an existing index, call `GET /{index}/_mapping` to ground the
discussion in the current mapping.
2. **Choose field types from access patterns.** Map each field to the minimal type set that satisfies its pattern. Read
[Field Type Decisions](references/field-type-decisions.md) and
[Multi-Field Patterns](references/multi-field-patterns.md) before proposing mappings.
Key judgments:
| Pattern | Mapping |
| ----------------------------------------------- | ------------------------------------------------------------ |
| Full-text search only | `text` (no keyword sub-field) |
| Filter / agg / sort only | `keyword` (not `text`) |
| Full-text search **and** sort or aggregation | `text` with `fields.keyword` multi-field |
| Decimal price or metric | `double`, `float`, or `scaled_float` — not `text` or integer |
| Timestamp | `date` |
| True/false flag | `boolean` |
| Free-form key/value map with many distinct keys | `flattened` — not dynamic `object` |
**Multi-field rule:** When a field must be searchable **and** sortable/aggregatable (e.g. product `name`), map it as
`text` with a `keyword` sub-field — search on `name`, sort and aggregate on `name.keyword`. Mapping as only `text` or
only `keyword` is wrong for that combined pattern.
**Explicit mapping rule:** For new indices, always define mappings explicitly with `PUT /{index}`. Do not rely on
dynamic mapping for production indices — the first document can lock in wrong types (strings as `text`, ambiguous
numbers as `keyword`).
**Index settings:** Set deliberate `number_of_shards` and `number_of_replicas` in the same `PUT /{index}` request
when the deployment allows it (Self-Managed / Elastic Cloud Hosted). On Serverless, omit shard and replica counts
(Elastic manages them); still supply explicit mappings. State chosen values or document that defaults apply.
Example — `products` index optimized for search plus sort/agg on name:
```json
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"name": {
"type": "text",
"fields": {
"keyword": { "type": "keyword", "ignore_above": 256 }
}
},
"price": { "type": "double" },
"created": { "type": "date" },
"in_stock": { "type": "boolean" }
}
}
}
```
Create with `PUT /products` passing the `settings` and `mappings` blocks. Verify with `GET /products/_mapping`.
3. **Guard against mapping explosion and storage bloat.** On high-volume indices, type mistakes multiply cost. Read
[Mapping Explosion and Storage Bloat](references/mapping-explosion.md) and apply these review checks:
- **Analyzed-but-not-searched fields** — Fields used only for filter and aggregation (`url`, HTTP `status_code`,
`tags`, IDs) must be `keyword`, not `text`. `text` wastes space; aggregations on `text` require fielddata or a
`.keyword` sub-field that should not exist if the field is not searched.
- **`message.keyword` without `ignore_above`** — A keyword sub-field on a large full-text body indexes the entire raw
string as one term. Flag this anti-pattern; remove the sub-field when only full-text search is needed, or add
`ignore_above` when a bounded exact-match sub-field is truly required.
- **Dynamic free-form objects** — `object` with `"dynamic": true` on user-supplied key/value data with thousands of
distinct keys causes **mapping explosion**. Recommend `flattened` (or strict dynamic / allowlist strategy).
- **`doc_values: false`** — On fields retrieved in hits but never sorted, aggregated, or filtered (e.g. display-only
`session_id`), set `"doc_values": false` on `keyword` to save disk at scale.
- **`scaled_float`** — For metrics with bounded precision (e.g. `response_time_ms`), prefer `scaled_float` with an
appropriate `scaling_factor` over plain `float`/`double` when storage dominates.
Prefer `"dynamic": "strict"` on the root mapping unless unknown fields are an explicit requirement.
4. **Apply design: create new index and reindex when types change.** Elasticsearch **cannot** change an existing field's
type in place. When review finds wrong types (text→keyword, object→flattened, float→scaled_float, doc_values changes
on existing fields), state clearly that fixes require a **new index** and **reindex** — not a mapping update on the
live index.
Workflow for correcting an existing high-volume index such as `events`:
1. **Design the corrected mapping** on a new index name (e.g. `events-v2`) incorporating all fixes from steps 2–3.
2. **Create the destination** with `PUT /events-v2` and the full corrected `mappings` (and `settings` where
applicable).
3. **Copy documents** with `POST /_reindex` — for large indices use `wait_for_completion=false` and track the task.
Source: `{ "index": "events" }`, destination: `{ "index": "events-v2" }`.
4. **Verify** with `GET /events-v2/_count` (compare to source count) and `GET /events-v2/_mapping` (confirm types).
5. **Cut over** reads and writes (index alias swap or application config) after validation.From elastic/agent-skills, Apache-2.0.
More from elastic/agent-skills
- 0.762score
elasticsearch-anomaly-detection
elasticOfficial
Create and manage Elastic ML anomaly detection jobs via the API.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-anomaly-detection-explainer
elasticOfficial
Explain Elasticsearch ML anomaly detection scores, model behavior, and result interpretation.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-esql
elasticOfficial
Execute ES|QL (Elasticsearch Query Language) queries, use when the user wants to query Elasticsearch data, analyze logs, aggregate metrics, explore data, or…
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-ingest
elasticOfficial
Load CSV and JSON files into Elasticsearch indices using the bulk API and explicit mappings when field types matter.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-onboarding
elasticOfficial
Help developers new to Elasticsearch get from zero to a working search experience.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-query-optimization
elasticOfficial
Diagnose slow Elasticsearch Query DSL searches and propose measured fixes.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-reindex
elasticOfficial
Guide Elasticsearch reindex for performance: local and remote, slicing, throttling, task API.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-search-relevance
elasticOfficial
Improve Elasticsearch search relevance for content and catalog indices: pin or promote results with query rules (correct rule type, criteria, and rule-query…
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
kibana-agent-builder
elasticOfficial
Create and manage Kibana Agent Builder agents and custom tools.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
kibana-alerting-rules
elasticOfficial
Create and manage Kibana alerting rules.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
kibana-anomaly-detection
elasticOfficial
Elastic ML anomaly detection — investigation/RCA, score explanation, job lifecycle troubleshooting, and job operations.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
kibana-dashboards
elasticOfficial
Create and manage Kibana Dashboards and Lens visualizations.
SkillBFreshness: B★ 600Claude Code +9
Signals
- Stars
- 600
- Forks
- 55
- Open issues
- 4
- Last commit (this folder)
- Sep 4, 2026 (1 month ago)
- Last release
- Sep 4, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 0.1.0
- License
- Apache-2.0
- Repository
- github.com/elastic/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from elastic
- 0.762score
elasticsearch-anomaly-detection
elasticOfficial
Create and manage Elastic ML anomaly detection jobs via the API.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-anomaly-detection-explainer
elasticOfficial
Explain Elasticsearch ML anomaly detection scores, model behavior, and result interpretation.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-esql
elasticOfficial
Execute ES|QL (Elasticsearch Query Language) queries, use when the user wants to query Elasticsearch data, analyze logs, aggregate metrics, explore data, or…
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-ingest
elasticOfficial
Load CSV and JSON files into Elasticsearch indices using the bulk API and explicit mappings when field types matter.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-onboarding
elasticOfficial
Help developers new to Elasticsearch get from zero to a working search experience.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-query-optimization
elasticOfficial
Diagnose slow Elasticsearch Query DSL searches and propose measured fixes.
SkillBFreshness: B★ 600Claude Code +9
Cite this page
elasticsearch-index-design skill. Agent Mart. https://agentmart.dev/skills/elastic-elasticsearch-index-design (last updated 2026-10-24)