Skip to main content
skill CX Codex

elasticsearch-expert — Claude Code skill: what it does, how to install

elasticsearch-expert is a Claude Code skill that helps design Elasticsearch mappings, build search queries and aggregations, and optimize ELK stacks.

Apache-2.0 205 installs ★ 45 updated 2026-10-12

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add personamanagmentlayer/pcl --skill elasticsearch-expert -a claude-code
Open on GitHub

What elasticsearch-expert does

This skill equips your agent with reference patterns for the Elasticsearch Python client. It covers index creation with explicit property analyzers, document ingestion via helpers.bulk, and boolean or multi-match queries with field boosting.

It also provides templates for aggregations, including metric averages, term breakdowns, and date histograms. The guide flags operational anti-patterns directly: deep pagination using from/size, un-prefixed wildcard queries, and over-sharding clusters.

The skill requires Bash execution rights for python, python3, pip, and pytest alongside basic file read and edit permissions.

What it helps with

  • define Elasticsearch index mappings with field types and analyzers
  • construct boolean and multi-match queries with field boosting
  • build metric aggregations and date histograms in Python
  • replace deep from/size pagination with search_after

Example prompts for the agent

  • Create an Elasticsearch mapping for an article catalog with text and date fields
  • Write a Python script to index documents in bulk using elasticsearch.helpers
  • Draft a bool search query combining text matching with a status filter

How to install elasticsearch-expert

1Skills CLI (Vercel)

npx skills add personamanagmentlayer/pcl --skill elasticsearch-expert -a claude-code

2Manually: put the files in place

~/.claude/skills/elasticsearch-expert/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/elasticsearch-expert/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about elasticsearch-expert

How to install elasticsearch-expert in Claude Code?

Run npx skills add personamanagmentlayer/pcl --skill elasticsearch-expert -a claude-code in your terminal.

What does elasticsearch-expert do?

It provides Elasticsearch and ELK stack practices covering index mappings, search optimization, aggregations, and cluster health rules.

Which tools does this skill need?

It relies on file read/write permissions and Bash execution rights restricted to python, python3, pip, and pytest.

Source text

SKILL.md · Apache-2.0
---
name: elasticsearch-expert
version: 2.0.0
description: >-
  Expert-level Elasticsearch, search, ELK stack, and full-text search. Use when the user
  mentions search, ELK, Logstash, Kibana, or full text search.
category: data
tags: [elasticsearch, search, elk, logstash, kibana, full-text-search]
allowed-tools:
  - Read
  - Write
  - Edit
  - Bash(python:*, python3:*, pip:*, pytest:*)
---

# Elasticsearch Expert

Expert guidance for Elasticsearch, search optimization, ELK stack, and distributed search systems.

## Core Concepts

- Full-text search and inverted indexes
- Document-oriented storage
- RESTful API
- Distributed architecture with sharding
- ELK stack (Elasticsearch, Logstash, Kibana)
- Aggregations and analytics

## Index Management

```python
from elasticsearch import Elasticsearch

es = Elasticsearch(['http://localhost:9200'])

# Create index with mapping
mapping = {
    "mappings": {
        "properties": {
            "title": {"type": "text", "analyzer": "english"},
            "content": {"type": "text"},
            "author": {"type": "keyword"},
            "created_at": {"type": "date"},
            "views": {"type": "integer"}
        }
    }
}

es.indices.create(index='articles', body=mapping)

# Index document
doc = {
    "title": "Elasticsearch Guide",
    "content": "Complete guide to Elasticsearch",
    "author": "John Doe",
    "created_at": "2024-01-01",
    "views": 100
}

es.index(index='articles', id=1, body=doc)

# Bulk indexing
from elasticsearch.helpers import bulk

actions = [
    {"_index": "articles", "_id": i, "_source": doc}
    for i, doc in enumerate(documents)
]

bulk(es, actions)
```

## Search Queries

```python
# Full-text search
query = {
    "query": {
        "match": {
            "content": "elasticsearch guide"
        }
    }
}

results = es.search(index='articles', body=query)

# Boolean query
bool_query = {
    "query": {
        "bool": {
            "must": [
                {"match": {"content": "elasticsearch"}}
            ],
            "filter": [
                {"range": {"views": {"gte": 100}}}
            ],
            "should": [
                {"term": {"author": "john-doe"}}
            ],
            "must_not": [
                {"term": {"status": "draft"}}
            ]
        }
    }
}

# Multi-match query
multi_match = {
    "query": {
        "multi_match": {
            "query": "elasticsearch guide",
            "fields": ["title^2", "content"],  # Boost title
            "type": "best_fields"
        }
    }
}

# Fuzzy search
fuzzy = {
    "query": {
        "fuzzy": {
            "title": {
                "value": "elasticseerch",
                "fuzziness": "AUTO"
            }
        }
    }
}
```

## Aggregations

```python
# Aggregation query
agg_query = {
    "aggs": {
        "authors": {
            "terms": {
                "field": "author",
                "size": 10
            }
        },
        "avg_views": {
            "avg": {
                "field": "views"
            }
        },
        "views_histogram": {
            "histogram": {
                "field": "views",
                "interval": 100
            }
        },
        "date_histogram": {
            "date_histogram": {
                "field": "created_at",
                "calendar_interval": "month"
            }
        }
    }
}

result = es.search(index='articles', body=agg_query)
```

## Best Practices

- Design mappings carefully
- Use appropriate analyzers
- Implement proper sharding strategy
- Monitor cluster health
- Use bulk operations
- Implement pagination with search_after
- Cache frequently used queries

## Anti-Patterns

❌ Deep pagination with from/size
❌ Wildcard queries without prefix
❌ No replica shards
❌ Over-sharding
❌ Not using filters for exact matches
❌ Ignoring cluster yellow/red status

## Resources

- Elasticsearch Guide: https://www.elastic.co/guide/
- ELK Stack: https://www.elastic.co/elk-stack

© personamanagmentlayer · Apache-2.0 · personamanagmentlayer/pcl

Similar skills

All skills for Data and databases →

From the same set104

The whole set →
spring-boot-expert spring-boot-expert guides coding agents through Spring Boot development, REST API design, and microservice setup in Java projects. CX Codex +1 212installs devops-expert devops-expert puts working CI/CD, infrastructure-as-code and release-strategy patterns in front of the agent whenever a task touches pipelines, automation or DevOps culture. CX Codex +1 210installs testing-expert testing-expert — a skill that gives the agent rules for writing tests: AAA structure, isolated cases, doubles and edge cases. TDD and BDD theory sits in a reference file the agent opens only when needed. CX Codex +1 206installs sre-expert sre-expert guides site reliability engineering practices, incident workflows, and error budget calculations. CX Codex +1 205installs prometheus-expert prometheus-expert — a skill that gives your coding agent solid Prometheus knowledge: metric collection, PromQL, recording and alerting rules. Useful when exporters have to go up on Kubernetes or a query just will not return what you expect. CX Codex +1 204installs kotlin-expert The kotlin-expert skill guides Kotlin work across Android, coroutines, JVM, and Kotlin Multiplatform. Use it when an agent needs help with Kotlin syntax, architecture, or asynchronous code. CX Codex +1 203installs react-expert react-expert configures coding agents for React 18+ and Next.js, enforcing clean TypeScript interfaces, proper hook usage, and tests with React Testing Library. CX Codex +1 200installs performance-expert performance-expert guides code profiling, database query tuning, and caching strategies to resolve latency and throughput issues. CX Codex +1 198installs

Project sponsors

Companies that keep this analytics open