跳到正文
cccskills
免费在 GitHub 公开

elasticsearch-pro

Elasticsearch search and analytics — mappings, queries, and cluster health — use when building search or log analytics.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md4.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Overview

Elasticsearch is a distributed search and analytics engine built on Lucene. Good results come from three things: mappings designed before indexing, queries that use the right clause for the job, and a cluster sized for the workload. This skill covers all three plus operational hygiene.

When to use

  • Designing index mappings and analyzers for full-text search
  • Writing bool, match, term, aggregation, and nested queries
  • Debugging relevance ("why doesn't this document match?")
  • Sizing shards, managing index lifecycle (ILM), and handling cluster health
  • Ingesting logs/metrics and building Kibana-style dashboards

Core concepts

Mappings decide everything. text fields are analyzed (tokenized, lowercased, stemmed) for full-text search; keyword fields are exact-match for filtering, sorting, and aggregations. Multi-fields ("fields": {"keyword": {...}}) give you both. Dynamic mapping guesses types — often wrong (a date-like string becomes text) — so define explicit mappings for production indices.

Analyzers shape relevance. The standard analyzer lowercases and tokenizes; language analyzers stem ("running" → "run"). Custom analyzers (edge n-grams for autocomplete, keyword + lowercase for exact-ish match) solve specific UX needs. Use the _analyze API to see exactly how text is tokenized before debugging relevance.

Query DSL: filter vs must. filter clauses are cached and don't affect scoring — use them for yes/no constraints (status, tenant, date range). must / should affect scoring for relevance-ranked parts. Mixing them correctly is the difference between fast faceted search and slow scoring over everything.

Shards are the scaling unit — and the overhead unit. Too few shards limits throughput; too many (hundreds of tiny shards) wastes heap and slows the cluster. Aim for shards in the tens of GB, use ILM rollover to keep them sized right, and avoid the default "one shard per tiny index" sprawl.

Aggregations are analytics. terms, date_histogram, range, and nested aggs power faceted navigation and dashboards. They're computed across shards and merged — terms on high-cardinality fields is approximate by design (shard_size tunes accuracy).

Practical workflow

  1. Define the search UX first: what fields are searched, filtered, sorted, faceted? This drives the mapping (text vs keyword, which analyzers).
  2. Create the index with explicit mappings and settings (shards, replicas, refresh interval); use index templates/aliases so mappings evolve without downtime (reindex into a new index, flip the alias).
  3. Test relevance deliberately: build a small judgment set of queries → expected top results; iterate analyzers and boosts (^2) against it.
  4. Write queries filter-first: bool with filter for constraints, must only for scored text; add track_total_hits consciously for deep pagination (or use search_after instead of large from).
  5. Manage lifecycle: ILM policies (hot → warm → cold → delete) or data streams for time-series; monitor shard counts, heap usage, and GC.
  6. Operate: keep replicas ≥ 1 in production, snapshot to durable storage on a schedule, watch cluster health (green/yellow/red) and unassigned shards.

Common pitfalls

  • Relying on dynamic mapping in production — one bad document sets the field type forever (until reindex). Explicit mappings or strict dynamic templates.
  • Scoring everything: putting filters in must instead of filter — slower and noisier relevance. Filters don't score; use them.
  • Deep pagination with from: 100000 — each shard sorts and discards; use search_after with a tiebreaker sort for infinite scroll.
  • Oversharding: thousands of 50MB shards crush the master and heap. Fewer, bigger shards; ILM rollover by size.
  • refresh_interval left at 1s for bulk loads — heavy indexing with near-real-time refresh is slow; raise the interval (or -1) during bulk loads, restore after.
  • No snapshots — a red cluster without snapshots is data loss waiting to happen. Snapshot early, snapshot often, test restores.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Master 1Password: vaults, Watchtower, passkeys, SSH agent, CLI, and family/team administration. Use when getting full value from 1Password personally or administering it for others.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills282026年10月10日 更新

Create 3D visuals with modeling, texturing, lighting, rendering, and optimization for web and product.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills282026年10月10日 更新

Create 3D web experiences: scene setup, models, materials, lighting, animation, scroll-driven scenes, and performance budgets. Use when adding 3D to websites beyond basic demos.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills282026年10月10日 更新

Writing abstracts that get papers read — structured content, the 5-sentence core, and journal-specific constraints.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills282026年10月10日 更新

Learn effectively from courses and academies: choosing programs, studying actively, and converting courses into skills. Use when investing time/money in structured learning.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills282026年10月10日 更新

Audit designs for accessibility with WCAG checklists covering color, type, focus, motion, and content.

中文简介正在准备中。当前显示原文说明。

aicodedecode/awesome-muse-skills282026年10月10日 更新

查看 aicodedecode 的全部技能

报告此技能的问题