How to reindex in OpenSearch?
Reindexing creates a new version of an index with different settings or mappings, or copies documents from one index to another. On Logit.io you can run a reindex from OpenSearch Dashboards Dev Tools or programmatically via the OpenSearch REST API.
Prerequisites
- Active Logit.io account (opens in a new tab) with a Logs stack.
- Familiarity with OpenSearch Dashboards or your stack's OpenSearch API credentials from Settings → Endpoints (Connect to Your Cluster).
- Basic understanding of JSON and OpenSearch Query DSL.
Option 1: Reindex using OpenSearch Dashboards Dev Tools
Step 1: Open Dev Tools
- Sign in to your Logit.io account.
- Open Launch Logs to open OpenSearch Dashboards.
- In the left menu, select Dev Tools.
Step 2: Plan your reindex
Decide on:
- Source index — the index (or indexes) to copy from
- Destination index — the target index (created automatically if it does not exist)
- Script (optional) — transformations to apply during reindexing
Step 3: Run the reindex command
In the Dev Tools console:
POST /_reindex
{
"source": {
"index": "source_index_name"
},
"dest": {
"index": "destination_index_name"
}
}Replace source_index_name and destination_index_name with your index names.
For transformations or filtering during reindex, see the OpenSearch reindex API (opens in a new tab) documentation for the script and query fields. See also Document APIs.
Step 4: Monitor and verify
Reindex duration depends on index size and any scripts used. Monitor progress in OpenSearch Dashboards.
After completion, verify document count in the destination index:
GET /destination_index_name/_countCompare the result with the source index count.
Option 2: Reindex using the OpenSearch REST API
Use the same POST /_reindex request against your stack endpoint. Copy credentials from Settings → Endpoints.
Basic authentication:
curl -X POST "@elasticsearch.endpointAddress:443/_reindex" \
-u "@elasticsearch.username:@elasticsearch.password" \
-H "Content-Type: application/json" \
-d '{
"source": { "index": "source_index_name" },
"dest": { "index": "destination_index_name" }
}'API key authentication:
curl -X POST "@elasticsearch.endpointAddress:443/_reindex?apikey=@elasticsearch.apiKey" \
-H "Content-Type: application/json" \
-d '{
"source": { "index": "source_index_name" },
"dest": { "index": "destination_index_name" }
}'Check the destination index count:
curl -X GET "@elasticsearch.endpointAddress:443/destination_index_name/_count?pretty" \
-u "@elasticsearch.username:@elasticsearch.password"Troubleshooting
Failed reindexing — Check the response body for errors. Common causes include script errors, mapping conflicts, or insufficient cluster resources.
Performance — Large reindexes can affect cluster performance. Run them during quieter periods where possible.
For complex reindex jobs or persistent errors, contact the Logit.io support team (opens in a new tab).