elasticsearch-search-relevance
Improve Elasticsearch search relevance for content and catalog indices: pin or promote results with query rules (correct rule type, criteria, and rule-query…
Skill by elasticOfficial
Chalk Labs
Need help deploying elasticsearch-search-relevance?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/elastic-elasticsearch-search-relevance
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents, data, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/elasticsearch-search-relevance
What's inside
- Skill name
elasticsearch-search-relevance- Description
- Improve Elasticsearch search relevance for content and catalog indices: pin or promote results with query rules (correct rule type, criteria, and rule-query wiring) and tune organic ranking with multi_match, field boosts, and analysis grounded in the index mapping. Use when search results rank poorly, a specific document must appear first for a query, or the user asks to tune full-text matching — not for ES|QL analytics, index ingest, or cluster health.
- License
- Apache-2.0
- Compatibility
- Elasticsearch 8.10 or later (query rules), self-managed, Elastic Cloud Hosted, or Elastic Cloud Serverless. Requires the `elastic` CLI ≥ 0.2 with `stack es` support.
- Metadata
- author: elastic · version: 0.1.0 · universal: true
- Instructions
- 210 lines in SKILL.md · view on GitHub
Files (3)
- SKILL.md
- multi-match-tuning.md · references/
- query-rules-reference.md · references/
SKILL.md (first lines)
# Elasticsearch Search Relevance
Improve full-text search results on content and catalog indices. Diagnose the mapping and current query, choose the
right relevance lever (query rules for deterministic pinning vs multi_match and field boosts for organic ranking), apply
the change, and verify top hits before reporting success.
<!-- begin-partial: preamble -->
## Environment Configuration
This skill executes Elasticsearch operations through the `elastic` CLI. If the
[`elastic` CLI](https://github.com/elastic/cli#configuration) is not installed, tell the user what it is needed for. Do
not guess credentials, call the HTTP API directly, or attempt other workarounds.
This skill references operations in HTTP-shorthand form (e.g., `GET /`, `GET /_cat/indices`, `GET /{index}/_mapping`,
`GET /{index}/_settings/index.mode`, `POST /_query`). The [Operations](#operations) table at the end of this document
maps each shorthand to the equivalent `elastic` CLI command — always use the CLI rather than calling the HTTP API
directly.
<!-- end-partial: preamble -->
## Scope
This skill covers **Query DSL** relevance on indices with `text` (and optional `keyword`) fields — product catalogs,
documentation, knowledge bases. It uses `POST /{index}/_search` for evaluation and query-rules APIs for pinned or
excluded documents.
Out of scope:
- ES|QL search (`POST /_query`) — use the `elasticsearch-esql` skill.
- Semantic / vector / hybrid retrieval — different field types and retrievers.
- Sorting by price, date, or popularity **instead of** fixing text relevance unless the user explicitly wants
non-relevance ordering.
## Relevance levers
| User intent | Lever | APIs |
| ------------------------------------------ | ----------------------------------------------------------- | ------------------------------------------------------------ |
| Always show document X first for query Q | Query rules — `pinned` rule + `rule` query in search | `PUT /_query_rules/{ruleset_id}`, `POST /{index}/_search` |
| Hide specific documents for query Q | Query rules — `exclude` rule + `rule` query | Same |
| Better ranking for open-ended text queries | `multi_match` across mapped `text` fields with field boosts | `POST /{index}/_search` |
| Tokens not matching user language | Operator, `minimum_should_match`, or synonym analyzers | `POST /{index}/_search`, optionally `POST /{index}/_analyze` |
**Decision rule:** If the user names a document that must rank first for a specific query, use query rules. If results
are generally weak for a phrase, tune the organic query from the mapping. Do not simulate pinning with extreme boosts,
`function_score`, or sort clauses.
## Process
1. **Inspect the mapping and current query.** Call `GET /` to confirm connectivity. When the index is unknown, narrow
candidates with `GET /_cat/indices`, then call `GET /{index}/_mapping`.
From the mapping, list every `text` field (e.g., `title`, `description`) and every `keyword` field used for filters
(`brand`, `category`). Note which fields are short (precision) vs long (recall). Read the user's current search body
if provided — identify which fields it queries and whether it already uses `rule`, `multi_match`, or single-field
`match`.
**Decision:** Is the problem **deterministic promotion** (one doc must win for one query) or **organic ranking**
(several docs should score better)? **Data needed:** index name, mapping properties, current query JSON, example
query strings, and target document ID(s) when pinning.
2. **Choose the relevance lever.** Apply the decision from step 1:
- **Pinning / promotion** → Create a query-rules ruleset with a rule of type `pinned` (never `exclude` for
promotion). Set `criteria` so the rule fires only for the intended query text — e.g., `contains` or `exact` on a
metadata key such as `query_string` with value `"sale"`. Set `actions` to pin the correct document via `ids` (e.g.,
`["SKU123"]`) or `docs` (e.g., `[{"_index":"catalog","_id":"SKU123"}]`). Use `docs` when `_id` may not be unique
across indices. Read [Query Rules Reference](references/query-rules-reference.md) for full structure.
- **Organic ranking** → Replace single-field `match` on a long field with `multi_match` across the mapped `text`
fields. Boost short fields (typically `title^2` with `description` unboosted). Consider `operator`,
`minimum_should_match`, or synonym-aware analyzers when multi-word recall is still poor — but do **not** sort by
price, date, or keyword fields to fake better text relevance, and do **not** query `.keyword` sub-fields with
`term` for analyzed user phrases. Read [Multi-Match Tuning](references/multi-match-tuning.md).
**Decision:** Pick exactly one primary lever per request. **Data needed:** chosen fields and boosts, ruleset ID and
rule ID names, criteria metadata keys, and pinned document identifiers.
3. **Apply the change.** Execute the APIs for the chosen lever:
**Query rules path**
- Create or replace the ruleset with `PUT /_query_rules/{ruleset_id}` (or add one rule with
`PUT /_query_rules/{ruleset_id}/_rule/{rule_id}`).
- Confirm structure with `GET /_query_rules/{ruleset_id}`.
- Validate criteria with `POST /_query_rules/{ruleset_id}/_test` using the same `match_criteria` you will pass at
search time.
- **Wire the search:** `POST /{index}/_search` must use a `rule` query whose `ruleset_id` references the ruleset and
whose `match_criteria` supplies values for every criteria `metadata` key (e.g., `"query_string": "sale"`). Place
the normal relevance clause inside `organic`. **Creating the ruleset alone does not pin anything** — the pin
applies only when search includes the `rule` query.
**Organic tuning path**
- Build a candidate `multi_match` (or equivalent bool/should) query from the mapping.
- Optionally inspect analysis with `POST /{index}/_analyze` on sample query text when tokenization explains misses.
**Decision:** Stop after one coherent change set; avoid stacking unrelated edits before testing.
4. **Test and compare top hits.** Before and after each candidate, call `POST /{index}/_search` with the same `size` (≥
10), the user's query string, and `"track_scores": true`. For pinning, the search body **must** include the `rule`
query from step 3.
Compare for each run:
- Top `_id` values and order
- `_score` where relevant
- Key `_source` fields (`title`, `description`, product id)
For pinning, confirm the target document (e.g., `SKU123`) is **first** when `match_criteria` matches the query and
that organic matches still appear below. For organic tuning, confirm titles and intent-aligned documents rise without
relying on sort or keyword exact-match hacks.
**Decision:** Ship the candidate that wins on evidence; if none improve results, report what was tried and propose
the next lever (e.g., synonyms or additional fields). **Data needed:** side-by-side top-hit lists from baseline and
candidate queries.
## Examples
### Pin SKU123 for query "sale" on `catalog`
**Wrong:** Boost `SKU123`, sort by `_id`, or create a ruleset without a `rule` search query.From elastic/agent-skills, Apache-2.0.
More from elastic/agent-skills
- 0.762score
elasticsearch-anomaly-detection
elasticOfficial
Create and manage Elastic ML anomaly detection jobs via the API.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-anomaly-detection-explainer
elasticOfficial
Explain Elasticsearch ML anomaly detection scores, model behavior, and result interpretation.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-esql
elasticOfficial
Execute ES|QL (Elasticsearch Query Language) queries, use when the user wants to query Elasticsearch data, analyze logs, aggregate metrics, explore data, or…
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-index-design
elasticOfficial
Design and review Elasticsearch index mappings for stated access patterns: correct field types, text+keyword multi-fields, doc_values tuning…
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-ingest
elasticOfficial
Load CSV and JSON files into Elasticsearch indices using the bulk API and explicit mappings when field types matter.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-onboarding
elasticOfficial
Help developers new to Elasticsearch get from zero to a working search experience.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-query-optimization
elasticOfficial
Diagnose slow Elasticsearch Query DSL searches and propose measured fixes.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-reindex
elasticOfficial
Guide Elasticsearch reindex for performance: local and remote, slicing, throttling, task API.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
kibana-agent-builder
elasticOfficial
Create and manage Kibana Agent Builder agents and custom tools.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
kibana-alerting-rules
elasticOfficial
Create and manage Kibana alerting rules.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
kibana-anomaly-detection
elasticOfficial
Elastic ML anomaly detection — investigation/RCA, score explanation, job lifecycle troubleshooting, and job operations.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
kibana-dashboards
elasticOfficial
Create and manage Kibana Dashboards and Lens visualizations.
SkillBFreshness: B★ 600Claude Code +9
Signals
- Stars
- 600
- Forks
- 55
- Open issues
- 4
- Last commit (this folder)
- Sep 4, 2026 (1 month ago)
- Last release
- Sep 4, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 0.1.0
- License
- Apache-2.0
- Repository
- github.com/elastic/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from elastic
- 0.762score
elasticsearch-anomaly-detection
elasticOfficial
Create and manage Elastic ML anomaly detection jobs via the API.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-anomaly-detection-explainer
elasticOfficial
Explain Elasticsearch ML anomaly detection scores, model behavior, and result interpretation.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-esql
elasticOfficial
Execute ES|QL (Elasticsearch Query Language) queries, use when the user wants to query Elasticsearch data, analyze logs, aggregate metrics, explore data, or…
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-index-design
elasticOfficial
Design and review Elasticsearch index mappings for stated access patterns: correct field types, text+keyword multi-fields, doc_values tuning…
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-ingest
elasticOfficial
Load CSV and JSON files into Elasticsearch indices using the bulk API and explicit mappings when field types matter.
SkillBFreshness: B★ 600Claude Code +9 - 0.762score
elasticsearch-onboarding
elasticOfficial
Help developers new to Elasticsearch get from zero to a working search experience.
SkillBFreshness: B★ 600Claude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get elasticsearch-search-relevance running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
elasticsearch-search-relevance skill. Agent Mart. https://agentmart.dev/skills/elastic-elasticsearch-search-relevance (last updated 2026-10-24)