Official agent skill

Elasticsearch Reindex

by elastic in elastic/agent-skills

Guide Elasticsearch reindex for performance: local and remote, slicing, throttling, task API.

OfficialApache-2.0Auto-check passedBackend & APIs

Install Elasticsearch Reindex

skills CLI
$ npx skills add elastic/agent-skills --skill elasticsearch-reindex -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install elastic/agent-skills elasticsearch-reindex --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/elastic/agent-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/elasticsearch/elasticsearch-reindex .claude/skills/elasticsearch-reindex && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
elasticsearch-reindex
GitHub stars
592
Token cost
~3.2k tokens
SKILL.md length
1,214 words
Files
5 (incl. references)
Skills in repo
26
Repo updated
First seen
Licence
Apache-2.0

At a glance

Guide Elasticsearch reindex for performance: local and remote, slicing, throttling, task API.

  • Works in 7 steps: Confirm connectivity and deployment… → Decide local versus remote reindex.… → Inspect the source — never guess field… → …
  • Migrating indices
  • SKILL.md covers Environment Configuration, Process, Deployment constraints and Consider alternatives first, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Elasticsearch Reindex is an agent skill from elastic/agent-skills, published by the product's own GitHub organization. Guide Elasticsearch reindex for performance: local and remote, slicing, throttling, task API. Use when copying or migrating indices, changing mappings, or transforming during reindex.

Its SKILL.md is about 3.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files (for example `references/api-reference.md`, `references/patterns.md` and `references/troubleshooting.md`). Compatibility notes: Elasticsearch 8.x or 9.x, self-managed, Elastic Cloud Hosted, or Elastic Cloud Serverless; local reindex works on all deployment types, while remote reindex…

It sits in Backend & APIs, covering Search implementation. It works with Elasticsearch. The repository describes itself as: Official Elastic Skills. The licence is Apache-2.0.

When your agent uses it

  • Migrating indices
  • Changing mappings
  • Transforming during reindex

Example prompts

  • “/elasticsearch-reindex”

Requirements

  • Compatibility (from SKILL.md): Elasticsearch 8.x or 9.x, self-managed, Elastic Cloud Hosted, or Elastic Cloud Serverless; local reindex works on all deployment types, while remote reindex requires host allowlisting on self-managed / Elastic Cloud Hosted (Serverless supports Elastic Cloud Hosted remotes only, Tech Preview). Requires the `elastic` CLI ≥ 0.2 with `stack es` support.

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Confirm connectivity and deployment type. Call GET /. Read build_flavor and version.number to know whether
  2. Decide local versus remote reindex. Compare where the source and destination live.
  3. Inspect the source — never guess field names or counts. Call GET /{source}/_mapping to ground field names and
  4. Prepare the destination index before copying. _reindex does not copy mappings, shard counts, or analyzers.
  5. Build and submit the reindex request. Call POST /_reindex?wait_for_completion=false for any copy that may take
  6. Track the task to completion. Store the task id from the reindex response. Poll GET /_tasks/{task_id} until
  7. Verify and report the destination count. Call GET /{dest}/_count (works on all deployment types). On

What it can do on your machine

Read from SKILL.md and the folder at commit baa5111. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are json).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Elasticsearch 8.x or 9.x, self-managed, Elastic Cloud Hosted, or Elastic Cloud Serverless; local reindex works on all deployment types, while remote reindex requires host allowlisting on self-managed / Elastic Cloud Hosted (Serverless supports Elastic Cloud Hosted remotes only, Tech Preview). Requires the `elastic` CLI ≥ 0.2 with `stack es` support.

    From compatibility in the SKILL.md frontmatter.

Context cost

Elasticsearch Reindex loads about 3.2k tokens when it runs, and up to ~12k if it reads all its reference files. Until then it costs about 51 tokens; SKILL.md has 1,214 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~51
When it runs · the whole SKILL.md, loaded when a task matches
~3.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~12k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from elastic/agent-skills at commit baa5111, republished under its Apache-2.0 licence (© elastic). 1,214 words, ~3,223 tokens.

Download SKILL.mdSave it as .claude/skills/elasticsearch-reindex/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
elasticsearch-reindex
description
Guide Elasticsearch reindex for performance: local and remote, slicing, throttling, task API. Use when copying or migrating indices, changing mappings, or transforming during reindex.
compatibility
Elasticsearch 8.x or 9.x, self-managed, Elastic Cloud Hosted, or Elastic Cloud Serverless; local reindex works on all deployment types, while remote reindex requires host allowlisting on self-managed / Elastic Cloud Hosted (Serverless supports Elastic Cloud Hosted remotes only, Tech Preview). Requires the `elastic` CLI ≥ 0.2 with `stack es` support.
metadata.author
elastic
metadata.version
0.2.0
metadata.universal
true

Elasticsearch Reindex

Copy documents from source indices or data streams to a destination using POST /_reindex. An expert reindex workflow prepares the destination explicitly, chooses local versus remote execution, filters at the source when only a subset is needed, runs long copies asynchronously, tracks the task to completion, and verifies the destination document count before reporting results.

<!-- 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 -->

Process

  1. Confirm connectivity and deployment type. Call GET /. Read build_flavor and version.number to know whether shard, replica, and cluster-settings APIs are available (Serverless manages shards/replicas internally and blocks most _cluster/* APIs). The decision: continue only when the cluster is reachable. If the call fails, stop — do not guess endpoints or credentials.

  2. Decide local versus remote reindex. Compare where the source and destination live.

    • Same cluster — use local reindex: source.index and dest.index only. Do not add source.remote when both indices are on the cluster you are connected to.
    • Different cluster — use reindex from remote: add source.remote with the remote cluster URL and credentials. Remote reindex does not support slicing; compensate with query-based partitioning (date ranges, term filters) across parallel requests. Confirm the remote host is allowlisted on Self-Managed / ECH (reindex.remote.whitelist in cluster config); Serverless manages allowlisting internally (ECH remotes only, Tech Preview).

    Data needed: source index name(s), destination index name, and whether they share a cluster.

  3. Inspect the source — never guess field names or counts. Call GET /{source}/_mapping to ground field names and types. Call GET /{source}/_count (or GET /_cat/count/{source}?h=count on Self-Managed / ECH) to learn how many documents exist.

    The decision: full copy versus filtered subset.

    • Full copy — omit source.query (match-all behavior).
    • Filtered subset — add source.query with Query DSL. For time ranges, use a range filter on the timestamp field (commonly @timestamp), e.g. "gte": "2025-01-01", "lt": "2025-02-01" for January 2025. Do not run a full-index copy when the user asked for a date range or other filter.

    Data needed: the user's filter criteria and the mapping-confirmed field names.

  4. Prepare the destination index before copying. _reindex does not copy mappings, shard counts, or analyzers. Create the destination with explicit settings and mappings derived from the source mapping via PUT /{dest}.

    • On Self-Managed / ECH: set number_of_replicas: 0 and refresh_interval: "-1" on the destination during the copy for write throughput; restore production values afterward with PUT /{dest}/_settings.
    • On Serverless: omit number_of_shards and number_of_replicas (managed by Elastic); you may set refresh_interval: "-1" during the copy.
    • For data stream destinations: ensure an index template with data_stream: {} exists, create the data stream, and set dest.op_type to "create" (append-only).

    The decision: create/prepare the target rather than relying on auto-creation with dynamic mapping. Wrong or missing mappings cause partial failures or silent type coercion.

    Data needed: destination name, corrected or compatible mappings, and deployment-specific settings constraints.

  5. Build and submit the reindex request. Call POST /_reindex?wait_for_completion=false for any copy that may take more than a few seconds or when the user says the index is large — the response returns a task id immediately instead of blocking.

    Request body essentials:

    • source.index — source index or data stream (correct name, not reversed with dest.index).
    • dest.index — prepared destination from step 4.
    • source.query — include only when step 3 chose a filtered subset.
    • conflicts: "proceed" — when retrying a partially complete reindex.
    • Optional tuning: source.size (batch size), requests_per_second (throttle), slices=auto on local reindex only (parallelize per primary shard — never for remote), scroll (increase keep-alive on slow clusters), max_docs (test runs), script (transform), dest.pipeline (ingest enrichment).

    Example filtered subset (January 2025 only):

    json
    {
      "source": {
        "index": "eval-reindex-src",
        "query": {
          "range": {
            "@timestamp": { "gte": "2025-01-01", "lt": "2025-02-01" }
          }
        }
      },
      "dest": { "index": "eval-reindex-jan" }
    }

    Do not reach for _split, _shrink, or snapshot/restore when the task is a filtered subset copy or a straight document migration — those APIs solve different problems.

  6. Track the task to completion. Store the task id from the reindex response. Poll GET /_tasks/{task_id} until completed is true. Read status.total, status.created, and response.failures. On Self-Managed / ECH you may also list active reindex tasks with GET /_tasks?actions=*reindex&detailed; on Serverless, query by task id only (list/cancel are not available). Adjust throttling mid-flight with POST /_reindex/{task_id}/_rethrottle?requests_per_second=N without canceling.

  7. Verify and report the destination count. Call GET /{dest}/_count (works on all deployment types). On Self-Managed / ECH you may also use GET /_cat/count/{dest}?h=count. Compare source filter expectations to the destination count. Report the exact count from the destination — do not estimate or guess.

    After a successful full copy, restore production settings on the destination with PUT /{dest}/_settings (replicas and refresh interval on Self-Managed / ECH; refresh interval only on Serverless).

Show full SKILL.md (409 more words)Show less

Deployment constraints

CapabilitySelf-Managed / ECHServerless
Local reindexFull supportFull support
Reindex from remoteFull supportTech Preview — ECH remotes only
number_of_shards/replicasUser-configurableManaged — omit on index creation
slices=auto (local only)SupportedSupported for local reindex
GET /_cat/count/{index}SupportedNot available — use GET /{index}/_count
GET /_tasks (list/cancel)FullGet by task id only
PUT /_cluster/settingsSupportedBlocked
_split / _shrinkSupportedNot available

Consider alternatives first

  • Runtime fields — fix field-type mismatches or add computed fields without reindexing when stored values need not change.
  • Aliases — redirect queries transparently; combine with reindex for zero-downtime mapping changes.
  • Snapshot and restore (Self-Managed / ECH) — faster whole-index transfer when no transformation is needed.

See the decision tree in references/patterns.md.

Reference material

Examples

"Copy logs-2024 into a new index with a corrected mapping" — create the destination first, then reindex:

json
POST /_reindex
{ "source": { "index": "logs-2024" }, "dest": { "index": "logs-2024-v2" } }

"Reindex a large index in parallel and throttle it" — slice automatically and cap the request rate:

json
POST /_reindex?slices=auto&requests_per_second=2000
{ "source": { "index": "events" }, "dest": { "index": "events-v2" } }

"Migrate only recent documents" — filter the source with a query:

json
POST /_reindex
{
  "source": { "index": "metrics", "query": { "range": { "@timestamp": { "gte": "now-30d" } } } },
  "dest": { "index": "metrics-recent" }
}

Guidelines

  • Confirm deployment type first. Call GET / and read build_flavor; shard, replica, cluster-settings, and task APIs differ between Self-Managed / ECH and Serverless (see Deployment constraints).
  • Prefer an alternative when it fits. Runtime fields, aliases, or snapshot-and-restore often avoid a full reindex.
  • Tune the destination for the copy. On Self-Managed / ECH set number_of_replicas: 0 and refresh_interval: "-1" during the copy, then restore production settings afterward; on Serverless these are managed.
  • Parallelize large copies. Use slices=auto for local reindex and throttle with requests_per_second to protect the cluster.
  • Run big jobs asynchronously. Submit with wait_for_completion=false and poll the task instead of blocking.
  • Verify by count. Compare the source filter expectation to the exact destination GET /{dest}/_count — never estimate.

Operations

HTTP API (shorthand)elastic CLI command
GET /elastic es info
GET /{index}/_mappingelastic es indices get-mapping --index '<index>'
GET /{index}/_countelastic es count --index '<index>'
GET /_cat/count/{index}?h=countelastic es cat count --index '<index>' --h count
PUT /{index}elastic es indices create --index '<index>' --mappings '<json>' --settings '<json>'
PUT /{index}/_settingselastic es indices put-settings --index '<index>' --settings '<json>'
POST /_reindex?wait_for_completion=falseelastic es reindex --wait-for-completion false --source '<json>' --dest '<json>'
GET /_tasks/{task_id}elastic es tasks get --task-id '<task_id>'
GET /_tasks?actions=*reindex&detailedelastic es tasks list --actions '*reindex' --detailed
POST /_tasks/{task_id}/_cancelelastic es tasks cancel --task-id '<task_id>'
POST /_reindex/{task_id}/_rethrottle?requests_per_second=Nelastic es reindex-rethrottle --task-id '<task_id>' --requests-per-second <N>

© elastic, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (references) in skills/elasticsearch/elasticsearch-reindex of elastic/agent-skills.

  • SKILL.md
  • references/api-reference.md
  • references/patterns.md
  • references/troubleshooting.md
  • references/tuning.md

Open the folder on GitHubat commit baa5111

Compare with similar skills

Elasticsearch Reindex next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Elasticsearch Reindex compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Elasticsearch Reindex this skillelastic/agent-skills592—~3.2kAutomated safety check: PassApache-2.0
Product Full-Text Searchlobehub/lobehub83k—~4.1kAutomated safety check: PassCustom licence
Foundatio Repositoriesexceptionless/Exceptionless2.5k—~1.9kAutomated safety check: PassApache-2.0
Elasticsearch Authnaspectrr/deer405—~1.2kAutomated safety check: NotesMIT
Elasticsearch Authzaspectrr/deer405—~1.8kAutomated safety check: PassMIT
Elasticsearch File Ingestaspectrr/deer405—~684Automated safety check: PassMIT

Similar skills

  • Guides work on LobeHub's own product search: the shared search repository, provider choice, Elasticsearch mappings, change syncing and reindexing.

    83k GitHub stars~4.1k tokensUpdated today
    Backend & APIsAuto-check passed
  • Foundatio Repositories

    exceptionless/Exceptionless

    Query, aggregate, patch, or paginate Exceptionless data through its Elasticsearch repository abstractions.

    2.5k GitHub stars~1.9k tokensUpdated 3 days ago
    Backend & APIsAuto-check passed
  • Elasticsearch Authn

    aspectrr/deer

    Authenticate to Elasticsearch using native, file-based, LDAP/AD, SAML, OIDC, Kerberos, JWT, or certificate realms.

    405 GitHub stars~1.2k tokensUpdated 5 mo ago
    Backend & APIsAuto-check: notes
  • Elasticsearch Authz

    aspectrr/deer

    Manage Elasticsearch RBAC: native users, roles, role mappings, document- and field-level security.

    405 GitHub stars~1.8k tokensUpdated 5 mo ago
    Backend & APIsAuto-check passed
  • Ingest and transform data files (CSV/JSON/Parquet/Arrow IPC) into Elasticsearch with stream processing and custom transforms.

    405 GitHub stars~684 tokensUpdated 5 mo ago
    Backend & APIsAuto-check passed
  • Diagnose and resolve Elasticsearch security errors: 401/403 failures, TLS problems, expired API keys, role mapping mismatches, and Kibana login issues.

    405 GitHub stars~4.9k tokensUpdated 5 mo ago
    Backend & APIsAuto-check passed

More from elastic/agent-skills

All 26 skills in this repo
  • Security Alert Triage

    elastic/agent-skills

    Official

    Triage Elastic Security alerts — gather context, classify threats, create cases, and acknowledge.

    592 GitHub starsUsed in 1 repo~3.5k tokens
    Auto-check: notes
  • Security Case Management

    elastic/agent-skills

    Official

    Create, search, update, and manage SOC cases via the Kibana Cases API.

    592 GitHub starsUsed in 1 repo~2.6k tokens
    Auto-check: notes
  • Official

    Create, tune, and manage Elastic Security detection rules (SIEM and Endpoint).

    592 GitHub starsUsed in 1 repo~3.9k tokens
    Auto-check: notes
  • Kibana Dashboards

    elastic/agent-skills

    Official

    Create and manage Kibana Dashboards and Lens visualizations.

    592 GitHub starsUsed in 1 repo~3.7k tokens
    Auto-check passed
  • Official

    Generate sample security events, attack scenarios, and synthetic alerts for Elastic Security.

    592 GitHub stars~2k tokensUpdated 3 days ago
    Auto-check passed
  • Cloud Onboarding

    elastic/agent-skills

    Official

    Onboard an Elastic Cloud organization: configure the elastic CLI's Cloud context and API key, establish a default region, then invite users, assign predefined or custom Serverless project roles, and…

    592 GitHub stars~4.1k tokensUpdated 3 days ago
    Auto-check passed

Works with

Categories

Questions about Elasticsearch Reindex

What does Elasticsearch Reindex do?

Guide Elasticsearch reindex for performance: local and remote, slicing, throttling, task API. Elasticsearch Reindex is an agent skill from elastic/agent-skills, published by the product's own GitHub organization. Guide Elasticsearch reindex for performance: local and remote, slicing, throttling, task API.

When should I use Elasticsearch Reindex?

Elasticsearch Reindex fits situations like: migrating indices; changing mappings; transforming during reindex.

How do I install Elasticsearch Reindex in Claude Code?

Run `npx skills add elastic/agent-skills --skill elasticsearch-reindex -a claude-code`. Or copy the skill folder (skills/elasticsearch/elasticsearch-reindex in elastic/agent-skills) into .claude/skills/elasticsearch-reindex in your project. Claude Code loads it when a task matches its description.

How do I install Elasticsearch Reindex in Codex?

Run `npx skills add elastic/agent-skills --skill elasticsearch-reindex -a codex`. Or copy the skill folder (skills/elasticsearch/elasticsearch-reindex in elastic/agent-skills) into .agents/skills/elasticsearch-reindex in your project. Codex loads it when a task matches its description.

Can I use Elasticsearch Reindex in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add elastic/agent-skills --skill elasticsearch-reindex -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/elasticsearch-reindex, .gemini/skills/elasticsearch-reindex, .github/skills/elasticsearch-reindex and .opencode/skills/elasticsearch-reindex in your project.

What does Elasticsearch Reindex need to run?

SKILL.md names no scripts, command-line tools or credentials: Elasticsearch Reindex is instructions for the agent only. Compatibility (from SKILL.md): Elasticsearch 8.x or 9.x, self-managed, Elastic Cloud Hosted, or Elastic Cloud Serverless; local reindex works on all deployment types, while remote reindex requires host allowlisting on self-managed / Elastic Cloud Hosted (Serverless supports Elastic Cloud Hosted remotes only, Tech Preview). Requires the `elastic` CLI ≥ 0.2 with `stack es` support..

Does Elasticsearch Reindex access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Elasticsearch Reindex safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Elasticsearch Reindex use?

Elasticsearch Reindex is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Elasticsearch Reindex use?

About 3.2k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 8.9k tokens, read only when the agent opens those files.

What are the alternatives to Elasticsearch Reindex?

Skills that share tags, products or a category with Elasticsearch Reindex: Product Full-Text Search (lobehub/lobehub, 83k stars), Foundatio Repositories (exceptionless/Exceptionless, 2.5k stars), Elasticsearch Authn (aspectrr/deer, 405 stars) and Elasticsearch Authz (aspectrr/deer, 405 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Elasticsearch Reindex?

elastic (a GitHub organization, an official publisher) maintains it in elastic/agent-skills, which has 592 GitHub stars. The repository holds 26 skills in this directory. The repository was last updated on October 7, 2026.

Source: elastic/agent-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.