Generated banner for Elasticsearch Onboarding
Generated logo for Elasticsearch Onboarding

Elasticsearch Onboarding

ElasticOfficialCreated by elastic

  • Skill
  • Workflow
  • Software development
  • Apache-2.0
  • Low risk

From the author

Help developers new to Elasticsearch get from zero to a working search experience. Guide them through understanding their intent, mapping their data, and building a search experience with best practices baked in. Use this when the user shows intent to build search-related functionality, asks about Elasticsearch-related concepts for their use case, or expresses the need for help getting started with Elasticsearch.
— the description by elastic

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill acts as an Elasticsearch solutions architect, guiding developers from initial intent to a production-ready search implementation. It follows a structured playbook to understand user requirements, inspect existing cluster data, and provide best-practice recommendations for mapping and search architecture. The skill emphasizes an educational approach, requiring explicit confirmation before performing any write operations on the cluster.

What it does

  • Guides developers through the end-to-end process of building a search experience.
  • Automatically inspects cluster state, including versions, indices, and mappings.
  • Provides best-practice advice on data modeling and search relevance.
  • Generates tested, production-ready code snippets for Elasticsearch operations.
  • Requires explicit developer approval before executing any cluster-mutating write operations.
  • Translates high-level search goals into specific API calls using the elastic CLI.

When to use it

  • When a developer is new to Elasticsearch and needs help getting started.
  • When a user expresses intent to build search features like e-commerce catalogs or RAG pipelines.
  • When a developer needs guidance on mapping data or optimizing search relevance.
  • When a user asks about specific Elasticsearch concepts like kNN, ELSER, or ES|QL.

Advantages

  • Ensures best practices are applied from the start, reducing the need for future reindexing.
  • Maintains an educational focus by explaining decisions and requiring confirmation for changes.
  • Reduces friction by automatically gathering cluster context before making recommendations.
  • Provides a safe environment for experimentation with clear separation between reads and writes.

Usage examples

“I want to build a search experience for my e-commerce site.”
The agent will initiate the onboarding playbook, ask about the product catalog structure, and begin inspecting the current cluster to propose a mapping strategy.
“How do I build a RAG pipeline with Elasticsearch?”
The agent will guide the user through setting up embeddings, mapping vector fields, and configuring the search pipeline for semantic retrieval.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/elastic/elasticsearch-onboarding/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip elasticsearch-onboarding.zip -d .agents/skills

Documentation by elastic

Elastic Developer Guide

You are an Elasticsearch solutions architect working alongside the developer. Your job is to guide developers from "I want search" to a working search experience — understanding their intent, recommending the right approach, and generating tested, production-ready code. Use the conversation playbook in references/elasticsearch-onboarding-playbook.md to structure the conversation. Always ask one question at a time, listen for signals, and adapt your recommendations to their specific use case and data shape.

<!-- begin-partial: preamble -->

Environment Configuration

This skill executes Elasticsearch operations through the elastic CLI. If the elastic CLI 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 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 -->

Cluster Access

Cluster interaction splits into reads and writes. Load references/cluster-access/cluster-access.md for the full protocol.

Reads happen automatically. Ground every recommendation in the developer's actual cluster rather than asking them to describe it. Detect the version with GET /, list indices with GET /_cat/indices, read field types with GET /{index}/_mapping, check volume with GET /{index}/_count, and validate relevance by running real queries with POST /{index}/_search or POST /_query.

Writes require confirmation. Before PUT /{index}, POST /_aliases, POST /_bulk, PUT /_ingest/pipeline/{name}, or PUT /_synonyms/{id}, show the developer the exact call you intend to make and wait for approval. Never mutate the cluster silently — this is an educational experience, and the developer needs to see what is being created.

Don't volunteer connection state; do answer connection questions. Two different situations, and the distinction matters:

  • Unprompted — never open on your own connection or credential status. A cluster you cannot reach is not the developer's first problem; understanding what they want to build is. Lead with the use-case question, and mention a failed read only at the moment it actually blocks you, in one sentence attached to the question you were already asking. Onboarding works fine before any cluster exists.

  • When the developer explicitly asks how to connect their IDE, editor, or chat client — that request is the task. Answer it fully and concretely from the appendix in references/cluster-access/cluster-access.md, then ask the use-case question at the end. Deflecting a direct setup question into discovery is a failure, not restraint.

Examples

Example user intents that should trigger this skill:

  • "I want to build a search experience for my e-commerce site"

  • "How do I get started with Elasticsearch?"

  • "What are the best practices for building a search experience?"

  • "Can you help me understand how to model my data for search?"

  • "How do I build a vector database?"

  • "I want to build a RAG pipeline with Elasticsearch"

  • "How do I use EIS for embeddings?"

  • "How do I connect an LLM to Elasticsearch?"

  • "How do I do kNN search in Elasticsearch?"

  • "How do I use ELSER for semantic search?"

  • "How do I set up the Elasticsearch MCP?"

  • "How do I combine keyword and vector results with RRF?"

  • "I want NLP-powered search"

  • "What's the difference between BM25 and vector search?"

  • "Can I use ES|QL to query my data?"

Guidelines

  • Ask one question at a time, then wait.

  • Don't lead with tooling, connection, or credential setup unprompted — lead with what the developer is building. But if they directly ask how to connect, answer that question fully before moving on.

  • Only generate code once the user confirms the approach and the mapping.

  • Use the Synonyms API for synonym management, not a custom-built solution.

  • Always use a versioned index name + alias (e.g. products_v1 + products_current) and explain why.

  • Explain decisions briefly, assume the user does not understand Elasticsearch yet.

  • Always go through the mapping walkthrough — it's the most expensive thing to change later.

  • Ask what programming language the user wants to use, don't assume.

  • Avoid generating code with deprecated APIs. If you must use a deprecated API for some reason, explain why and warn about future compatibility issues.

Operations

HTTP API (shorthand)elastic CLI command
GET /elastic es info
GET /_cat/indiceselastic es cat indices --index '<pattern>'
GET /{index}/_mappingelastic es indices get-mapping --index '<index>'
GET /{index}/_countelastic es count --index '<index>'
POST /{index}/_searchelastic es search --index '<index>' --input-file '<search-body.json>'
POST /_queryelastic es esql query --format tsv --query "<esql>"
PUT /{index}elastic es indices create --index '<index>' --mappings '<json>' --aliases '<json>'
POST /_aliaseselastic es indices update-aliases --actions '<json>'
POST /_bulkelastic es bulk --index '<index>' --input-file '<ndjson-path>'
PUT /_ingest/pipeline/{name}elastic es ingest put-pipeline --id '<name>' --input-file '<json-path>'
PUT /_synonyms/{id}elastic es synonyms put-synonym --id '<id>' --synonyms-set '<json>'

Files

references/vector-hybrid-search/vector-hybrid-search.md


name: vector-hybrid-search description: Complete guide for building vector search, hybrid search, and using Elasticsearch as a vector store for AI pipelines. Covers the full decision tree from deployment type through production optimization and RAG extension. Use when a developer wants semantic search, hybrid BM25+vector search, kNN, embeddings, RAG, or Elasticsearch as a vector store for LangChain/LlamaIndex.

Vector & Hybrid Search Guide

Consumer Fork

Before any other decision, establish who consumes the search results. If the conversation hasn't answered it yet, open with: "What are you building — a search experience for users, or a retrieval backend for an AI pipeline like RAG or LangChain?"

  • AI pipeline (code consumes results) → LangChain, LlamaIndex, custom RAG, agent memory, recommendations

  • Human-facing search (people type queries) → search bar, results page, filters, autocomplete

This determines Decision I (App Integration) and whether to offer a frontend at the end.


Phase 1 — Planning & Decision-Making

Step 1.1: Define Use Case

Ask what they're building. Listen for:

SignalUse Case
"semantic search", "meaning-based", "natural language"Semantic search
"BM25 + vector", "hybrid", "keyword and semantic"Hybrid search
"RAG", "chatbot", "Q&A over documents"RAG — use rag-chatbot skill
"LangChain", "LlamaIndex", "vector store", "vector database", "agent memory"AI pipeline / vector store
"recommendations", "similar items"Vector similarity
"image search", "multimodal"Dense vector with image embeddings

Scale check: If the developer indicates >1M documents, >10GB, or cost sensitivity, flag quantization early:

"With that volume, choose quantization now — it affects the mapping and requires reindexing to add later. int8_hnsw is the safe default (~4x memory reduction, minimal recall impact)."

Decision A: Deployment Type
OptionResolves
A1: Elastic Cloud ServerlessJ1 (automatic scaling), K1 (AutoOps)
A2: Elastic Cloud Hosted (ECH)J2 (policy-based scaling), K1 or K2
A3: Self-ManagedJ3 (manual scaling), K2 or K3
Decision B: Embedding Strategy

Routing questions — ask first to narrow the options:

  1. "Are you already generating embeddings?" → Yes → briefly offer semantic_text as alternative. If they prefer control → C2/C3 + D2, skip B.

  2. "What version?" → Below 8.15 → semantic_text unavailable, skip C1

  3. "Specific embedding model needed?" → Yes + not supported by inference API → C2 + D2

OptionWhen to Use
B1: Built-in Models via EISDefault for Cloud (Serverless/ECH) on 8.15+; self-managed on 9.3+ via Cloud Connect
B1b: Built-in on ML NodesSelf-managed <9.3 (no Cloud Connect); or when dedicated ML node capacity preferred
B2: Third-Party ServiceExisting model contract or specific model needed (OpenAI, Cohere, Bedrock, Azure AI, Google AI, Mistral)
B3: Self-Hosted ModelCustom fine-tuned models — upload via Eland, deploy on ML nodes

Default recommendation: B1 (EIS) — no infrastructure to manage, no external API key needed.


Phase 2 — Data Modeling & Ingestion

Decision C: Vector Field Type
OptionWhen to UseNotes
C1: semantic_text8.15+, using inference endpoint, no existing vectorsDefault — auto chunking, auto embedding, no ingest pipeline
C2: dense_vectorBringing own vectors, need dims/similarity/HNSW control, pre-8.15Manual embedding at ingest and query time
C3: sparse_vectorELSER manual workflow, need token weight mapsRunning ELSER outside semantic_text

C1 bypasses Decision D — semantic_text handles embedding via the bound inference endpoint. If C1, skip to Configure Chunking.

C1: semantic_text Mapping

Minimal (works out of the box on Serverless — uses the platform default model, currently Jina):

PUT /my-index
{
  "mappings": {
    "properties": {
      "content": { "type": "semantic_text" },
      "title": { "type": "text" },
      "category": { "type": "keyword" },
      "created_at": { "type": "date" }
    }
  }
}

With a specific inference endpoint:

PUT /my-index
{
  "mappings": {
    "properties": {
      "content": {
        "type": "semantic_text",
        "inference_id": "my-inference-endpoint"
      }
    }
  }
}

Create the inference endpoint first:

PUT _inference/text_embedding/my-inference-endpoint
{
  "service": "elastic",
  "service_settings": {
    "model_id": "<current-eis-embedding-model-id>"
  }
}

Always fetch the current model list from EIS docs before generating this code. Model IDs change regularly. Jina v3 is the current default dense model for semantic_text; Jina v5-small is available for high-throughput / cost-sensitive workloads. ELSER remains available for English-only sparse retrieval but must be explicitly specified — it is no longer the automatic default.

C2: dense_vector Mapping
PUT /my-index
{
  "mappings": {
    "properties": {
      "content": { "type": "text" },
      "content_embedding": {
        "type": "dense_vector",
        "dims": 1536,
        "index": true,
        "similarity": "cosine",
        "index_options": {
          "type": "hnsw",
          "m": 16,
          "ef_construction": 100
        }
      },
      "category": { "type": "keyword" }
    }
  }
}

Set dims to match your model output (e.g. OpenAI text-embedding-3-small = 1536, E5-small = 384, Cohere embed-v3 = 1024).

Decision D: Embedding Generation (C2/C3 only)
OptionWhen to Use
D1: Inference Endpoint + Ingest PipelineSupported model, want server-side embedding
D2: Application-Side EmbeddingUnsupported models, existing embedding pipeline, or need full control
D1: Ingest Pipeline
PUT _ingest/pipeline/embedding-pipeline
{
  "processors": [
    {
      "inference": {
        "model_id": "my-inference-endpoint",
        "input_output": [
          { "input_field": "content", "output_field": "content_embedding" }
        ]
      }
    }
  ]
}
D2: Application-Side (Python)
import openai
from elasticsearch import Elasticsearch, helpers

es = Elasticsearch("https://your-cluster:443", api_key="your-api-key")

def embed(text):
    return openai.embeddings.create(
        model="text-embedding-3-small", input=text
    ).data[0].embedding

def generate_actions(docs):
    for doc in docs:
        yield {
            "_index": "my-index",
            "_source": {
                "content": doc["text"],
                "content_embedding": embed(doc["text"]),
                "category": doc.get("category")
            }
        }

helpers.bulk(es, generate_actions(your_docs))
Configure Chunking (C1 and D1 paths)

For semantic_text (C1), configure on the field:

"content": {
  "type": "semantic_text",
  "inference_id": "my-inference-endpoint",
  "chunking_settings": {
    "strategy": "sentence",
    "max_chunk_size": 250,
    "overlap": 1
  }
}

Strategies: sentence (default), word, recursive. Default: sentence, 250 words, 1 overlap.

For D1, chunk in application code or via a script processor before the inference processor.

Decision E: Ingestion Method
OptionWhen to Use
E1: Bulk API / Client LibrariesMost cases — programmatic ingestion from any source
E2: File Upload (Kibana UI)Testing and small datasets only

Use helpers.bulk (Python) or equivalent bulk API in the developer's language. Set request_timeout=300 on first ingest to allow time for ML model loading. Use refresh="wait_for" when indexing test data.


Phase 3 — Search Implementation

Decision F: Search Type
OptionWhen to Use
F1: Pure kNNAll queries semantic/meaning-based, no exact term matching needed
F2: HybridDefault — users search with both keywords and natural language
F3: SemanticUsing C1 path (semantic_text); simplest semantic search
F3: Semantic Search (C1 path)
POST my-index/_search
{
  "retriever": {
    "standard": {
      "query": {
        "semantic": {
          "field": "content",
          "query": "how do I configure index mappings"
        }
      }
    }
  }
}
F1: Pure kNN (C2 path)
POST my-index/_search
{
  "retriever": {
    "knn": {
      "field": "content_embedding",
      "query_vector": [0.1, 0.2, ...],
      "k": 10,
      "num_candidates": 100
    }
  }
}

Tune num_candidates (higher = better recall, slower). For exact kNN on small datasets, use script_score.

F2: Hybrid Search with RRF
POST my-index/_search
{
  "retriever": {
    "rrf": {
      "retrievers": [
        {
          "standard": {
            "query": {
              "multi_match": {
                "query": "elasticsearch index mapping",
                "fields": ["title^2", "content"]
              }
            }
          }
        },
        {
          "knn": {
            "field": "content_embedding",
            "query_vector": [0.1, 0.2, ...],
            "k": 50,
            "num_candidates": 100
          }
        }
      ],
      "window_size": 100,
      "rank_constant": 60
    }
  }
}

Tuning RRF:

  • window_size: Docs considered from each retriever. Higher = more semantic influence when BM25 is sparse.

  • rank_constant: Higher = flatter rank contribution. Lower = steeper top-rank preference.

For filtered hybrid search, add filter clauses to both the standard (via bool.filter) and knn retrievers.

Decision G: Reranking
OptionWhen to Use
G1: No RerankingDefault — start here, add G2 if relevance isn't good enough
G2: Semantic RerankerRelevance quality > latency; adds ~50-200ms
G3: Learning to RankAdvanced — requires labeled query/document pairs
G4: Query RulesMerchandising, editorial control, compliance filtering
G2: Semantic Reranker
POST my-index/_search
{
  "retriever": {
    "text_similarity_reranker": {
      "retriever": {
        "rrf": {
          "retrievers": [
            { "standard": { "query": { "multi_match": { "query": "your query", "fields": ["content"] } } } },
            { "knn": { "field": "content_embedding", "query_vector": [...], "k": 50, "num_candidates": 100 } }
          ]
        }
      },
      "field": "content",
      "inference_id": "my-reranker-endpoint",
      "inference_text": "your query",
      "rank_window_size": 50
    }
  }
}

EIS provides managed rerankers (currently Jina Reranker v2 and v3). Check reranker docs for current model IDs and inference endpoint setup.

G4: Query Rules
PUT _query_rules/my-ruleset
{
  "rules": [
    {
      "rule_id": "pin-featured",
      "type": "pinned",
      "criteria": [{ "type": "contains", "metadata": "query_string", "values": ["featured"] }],
      "actions": { "ids": ["doc-123"] }
    }
  ]
}
Decision H: Query Method

Always use Retrievers API for vector and hybrid search (all examples above use it). Use Query DSL for pure keyword search. ES|QL is for analytics and data exploration only, not vector retrieval.

Decision I: App Integration

AI pipeline: Use the direct API via a client library, or use Elastic Agent Builder / Playground for LLM integration.

Human-facing: Use the direct API, Search Templates for parameterized server-side queries, or Search UI — see the search-ui skill.

LangChain Integration
pip install langchain-elasticsearch langchain-openai
from langchain_elasticsearch import ElasticsearchStore
from langchain_openai import OpenAIEmbeddings
from elasticsearch import Elasticsearch

es_client = Elasticsearch(
    "https://your-cluster.es.us-central1.gcp.elastic.cloud:443",
    api_key="your-api-key"
)

vector_store = ElasticsearchStore(
    es_connection=es_client,
    index_name="my_docs",
    embedding=OpenAIEmbeddings(model="text-embedding-3-small"),
)

vector_store.add_documents([
    {"page_content": "Elasticsearch is a distributed search engine.", "metadata": {"source": "docs"}},
])

results = vector_store.similarity_search("How do I visualize data?", k=3)

Use vector_store.as_retriever() in a LangChain chain for RAG.

LlamaIndex Integration

pip install llama-index llama-index-vector-stores-elasticsearch — use ElasticsearchVectorStore with es_url and es_api_key params. Wrap in VectorStoreIndex.from_documents() and query via .as_query_engine(similarity_top_k=5).

Search API Endpoint (Human-facing)

Build a /search endpoint using the hybrid RRF pattern from F2, wrapping it in the developer's framework (Flask, Express, Spring, etc.). Always include pagination — from/size for up to 10,000 results, search_after with PIT for deeper pagination.


Phase 4 — Production & Optimization

Step 4.0: Performance Requirements

Skip for Serverless (auto-managed). For ECH / Self-Managed, ask about peak QPS, traffic spikiness, and latency targets.

RequirementConfiguration Lever
High QPSMore replicas; more shards for large indices
Spiky trafficAutoscaling deciders on ECH; pre-warm cache after force-merge
Strict latencyLower num_candidates; quantization; fewer shards for small-medium indices
Max recallHigher num_candidates; hnsw (no quantization); exact kNN for small datasets

Serverless: Only num_candidates is tunable for the recall/latency tradeoff.

Step 4.1: Performance Tuning

Quantization — reduces vector memory footprint:

"content_embedding": {
  "type": "dense_vector",
  "dims": 1536,
  "index": true,
  "similarity": "cosine",
  "index_options": {
    "type": "int8_hnsw"
  }
}
TypeMemory ReductionRecall Impact
hnswBaselineBaseline
int8_hnsw~4xMinimal
int4_hnsw~8xSmall
bbq_hnsw~32xModerate — test with your data

Use bbq_hnsw when memory is the constraint and you can tolerate slightly lower recall. Use int8_hnsw as the safe default.

Post-ingestion: Force-merge segments (max_num_segments=1), then clear cache and run warm-up queries.

Step 4.2: Shard Sizing
  • Target 10–50 GB per shard, max 200M docs per shard

  • Use ILM for rollover on time-series data:

PUT _ilm/policy/vector-rollover
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": { "max_size": "50gb", "max_docs": 200000000 }
        }
      }
    }
  }
}
Decision J: Scaling Strategy

Resolved from Decision A: Serverless → automatic; ECH → policy-based autoscaling + adaptive allocations; Self-Managed → manual provisioning (K8s HPA for ECK).

Decision K: Monitoring

Resolved from Decision A: Cloud → AutoOps (auto-enabled, recommendations and alerts); Self-Managed → Stack Monitoring (Metricbeat/Filebeat/Kibana) or external (Prometheus, Grafana, Datadog).


Phase 5 — Iteration & Continuous Improvement

Step 5.1: Evaluate Search Quality

Ranking Evaluation API:

POST my-index/_rank_eval
{
  "requests": [
    {
      "id": "query_1",
      "request": {
        "query": { "multi_match": { "query": "elasticsearch mapping", "fields": ["content"] } }
      },
      "ratings": [
        { "_index": "my-index", "_id": "doc-1", "rating": 3 },
        { "_index": "my-index", "_id": "doc-2", "rating": 1 }
      ]
    }
  ],
  "metric": { "ndcg": { "k": 10 } }
}

Use "profile": true in search requests to diagnose latency.

Step 5.2: Refine Pipeline

Work through these levers in order:

LeverWhat It Fixes
Swap embedding modelPoor semantic recall — wrong language, domain mismatch
Adjust chunking strategy/sizeChunks too large (noisy) or too small (missing context)
Tune window_size, rank_constantBM25 or semantic dominating when it shouldn't
Add reranking (G2)Top results semantically close but not the best answer
Add query rules (G4)Specific queries need editorial override
Try quantization levelMemory pressure or latency too high
Step 5.3: Extend to RAG

If retrieval quality is acceptable and the developer wants generated answers, add an LLM layer. The pattern: retrieve top-k chunks using the hybrid RRF query from F2, concatenate chunk text into a context string, pass to an LLM with a grounding system prompt ("Answer based only on the provided context"), and return the answer with source references.

For Elastic-native RAG without external LLM keys, see Agent Builder and Playground. For full RAG implementation details, use the rag-chatbot skill.


Metadata Filtering Patterns

Store tenant_id, user_ids, groups as keyword fields. Filter at query time with bool.filter using term / terms clauses inside both the standard and knn retrievers. For large-scale multi-tenancy, use separate indices per tenant instead of row-level filtering.


Common Follow-ups

QuestionAnswer
"Results aren't relevant enough"Run _rank_eval, then work through Step 5.2 levers
"Results are too semantic / too keyword-heavy"Tune window_size — higher favors semantic, lower favors BM25
"Memory is too high"Add quantization to dense_vector mapping, reindex

When to Use Other Skills

SituationSkill
Pure keyword search, no vectors neededkeyword-search
RAG / Q&A chatbot with LLM answer generationrag-chatbot
React search frontendsearch-ui
Product catalog with facets and merchandisingcatalog-ecommerce

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

The author says: Elasticsearch 8.x or 9.x, self-managed, Elastic Cloud Hosted, or Elastic Cloud Serverless. Requires the `elastic` CLI with `stack es` support for cluster reads and writes.

Security

What our scanner noticed· Low risk

  • Instructions that use the network

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
elastic
Publisher
Elastic (Official)
Source
elastic/agent-skills · skills/elasticsearch/elasticsearch-onboarding · commit 09d879d
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Also distributed in
elastic/agent-skills

AutoGineer is not affiliated with or endorsed by elastic or Elastic.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download elasticsearch-onboarding.zip