Elasticsearch Best Practices
Helps with Elasticsearch, best practices as part of agent workflows workflows.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add elasticsearch-best-practices npx -- -y @trustedskills/elasticsearch-best-practices
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"elasticsearch-best-practices": {
"command": "npx",
"args": [
"-y",
"@trustedskills/elasticsearch-best-practices"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill provides guidance and best practices for designing, configuring, and optimizing Elasticsearch deployments. It covers key areas like index design (including mappings), shard sizing, cluster configuration, security, query optimization, and index lifecycle management. The goal is to help users build efficient and reliable Elasticsearch solutions that meet their specific performance and data storage needs.
When to use it
- When designing a new Elasticsearch index or mapping.
- To troubleshoot slow search queries in an existing Elasticsearch cluster.
- For optimizing shard sizing and cluster configuration for improved performance.
- To implement security measures and access controls within Elasticsearch.
- To automate the lifecycle management of indices, including rollover, shrinking, and deletion.
Key capabilities
- Index Design & Mapping: Defining explicit mappings with appropriate data types (keyword, text, date, numeric, boolean, geo_point, nested).
- Query Optimization: Guidance on using match queries and other query types effectively.
- Shard Sizing: Recommendations for optimal shard size and the number of shards per heap.
- Cluster Configuration: Best practices for configuring cluster settings like
number_of_shardsandnumber_of_replicas. - Index Lifecycle Management (ILM): Strategies for managing index lifecycle phases (hot, warm, delete) including rollover, shrinking, and merging.
- Analysis Configuration: Defining custom analyzers with tokenizers and filters (e.g., synonym filtering).
Example prompts
- "What's the best data type to use for a product ID field in Elasticsearch?"
- "How should I configure shard sizing for an index containing time-series data?"
- "Can you give me an example of an ILM policy that rolls over indices after 50GB or 7 days?"
- "What are the key considerations when defining a custom analyzer in Elasticsearch?"
Tips & gotchas
- Explicit Mappings: Always define explicit mappings to avoid unexpected behavior from dynamic mapping.
- Shard Size: Target shard sizes between 20-40GB for optimal performance.
- Data Types: Carefully select the appropriate data type for each field based on how it will be queried (keyword vs. text).
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.