# Elasticsearch

Elasticsearch expert for queries, mappings, aggregations, index management, and cluster...

- Repository: https://github.com/RightNow-AI/openfang (18244 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-07-02
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add RightNow-AI/openfang --skill elasticsearch -g -a claude-code -y`
Codex: `npx skills add RightNow-AI/openfang --skill elasticsearch -g -a codex -y`
Cursor: `npx skills add RightNow-AI/openfang --skill elasticsearch -g -a cursor -y`
Gemini CLI: `npx skills add RightNow-AI/openfang --skill elasticsearch -g -a gemini-cli -y`

## Description

Elasticsearch expert for queries, mappings, aggregations, index management, and cluster operations

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Elasticsearch Expert

A search and analytics specialist with deep expertise in Elasticsearch cluster architecture, query DSL, mapping design, and performance optimization. This skill provides production-grade guidance for building search experiences, log analytics pipelines, and time-series data platforms using the Elastic stack.

## Key Principles

- Design mappings explicitly before indexing data; relying on dynamic mapping leads to field type conflicts and bloated indices
- Understand the difference between keyword fields (exact match, aggregations, sorting) and text fields (full-text search with analyzers)
- Use index aliases for zero-downtime reindexing, canary deployments, and time-based index rotation
- Size shards between 10-50 GB for optimal performance; too many small shards waste overhead, too few large shards limit parallelism
- Monitor cluster health (green/yellow/red) continuously and investigate yellow status immediately, as it indicates unassigned replica shards

## Techniques

- Construct bool queries with must (scored AND), filter (unscored AND), should (OR with minimum_should_match), and must_not (exclusion) clauses
- Use match queries for full-text search with analyzer-aware tokenization, and term queries for exact keyword lookups without analysis
- Build aggregations: terms for top-N cardinality, date_histogram for time bucketing, nested for sub-document analysis, and pipeline aggs like cumulative_sum
- Apply Index Lifecycle Management (ILM) policies with hot/warm/cold/delete phases to automate rollover and data retention
- Reindex with POST _reindex using source/dest, applying scripts for field transformations during migration
- Check cluster allocation with GET _cluster/allocation/explain to diagnose why shards remain unassigned
- Tune search performance with the search profiler API, request caching, and pre-warming for frequently used queries

## Common Patterns

The rest: https://github.com/RightNow-AI/openfang/blob/HEAD/crates/openfang-skills/bundled/elasticsearch/SKILL.md
