home / skills / partme-ai / full-stack-skills / elasticsearch

elasticsearch skill

/skills/elasticsearch

This skill guides Elasticsearch indexing, searching, mappings, and clustering to help you implement, optimize, and manage powerful search functionality.

npx playbooks add skill partme-ai/full-stack-skills --skill elasticsearch

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
696 B
---
name: elasticsearch
description: Provides comprehensive guidance for Elasticsearch including indexing, searching, aggregations, mappings, and cluster management. Use when the user asks about Elasticsearch, needs to implement search functionality, work with Elasticsearch queries, or manage Elasticsearch clusters.
license: Complete terms in LICENSE.txt
---

## When to use this skill

Use this skill whenever the user wants to:
- [待完善:根据具体工具添加使用场景]

## How to use this skill

[待完善:根据具体工具添加使用指南]

## Best Practices

[待完善:根据具体工具添加最佳实践]

## Keywords

[待完善:根据具体工具添加关键词]

Overview

This skill provides comprehensive, practical guidance for working with Elasticsearch across indexing, searching, aggregations, mappings, and cluster management. It targets developers and operators who need to implement search features, optimize queries, or maintain healthy Elasticsearch clusters. Content focuses on actionable patterns, examples in Python, and operational best practices.

How this skill works

The skill inspects user intent to determine whether they need help designing mappings, writing queries, tuning performance, or managing cluster health. It explains core concepts (indices, shards, replicas, analyzers), shows query DSL and aggregation examples, and offers Python code snippets for indexing and searching. It also guides on monitoring, scaling, and recovery procedures for production clusters.

When to use it

  • Building full-text search functionality or relevance tuning for an application
  • Designing index mappings and analyzers for structured and unstructured data
  • Composing Elasticsearch Query DSL or aggregation queries for analytics
  • Optimizing performance: shards, replicas, refresh, and bulk indexing
  • Managing clusters: scaling, snapshots, node failures, and upgrades

Best practices

  • Design mappings intentionally: set explicit types, disable dynamic fields where not needed
  • Use bulk API for high-throughput indexing and tune refresh_interval during imports
  • Prefer filters for boolean matching and queries for relevance scoring
  • Monitor cluster health, JVM memory, and disk usage; set appropriate shard sizing
  • Use snapshots for backups and test recovery procedures in a staging environment

Example use cases

  • Implementing product search with multi-field matching, synonyms, and fuzziness
  • Creating time-series aggregations for dashboards with date_histogram and metrics
  • Migrating indices: reindex with mapping changes and zero-downtime alias swap
  • Setting up alerting for disk-watermark or unassigned shards and automated remediation
  • Batch-loading millions of documents using Python bulk helpers with retry logic

FAQ

Should I use dynamic mapping or explicit mapping?

Prefer explicit mappings for production data to avoid unexpected field types and index mapping explosion. Use dynamic mapping selectively for exploratory or ingest scenarios.

How do I choose shard count and size?

Aim for shard sizes between 20GB and 50GB for typical workloads, keep shard counts modest per node, and plan for growth. Reindex if you need to change shard count.