REST APIs —— Document APIs —— Reindex API
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/docs-reindex.html#docs-reindex
Copies documents from a source to a destination.
将文档从源复制到目标。
The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself.
源可以是任何现有的索引、别名或数据流。目标必须与源不同。例如,您不能将数据流重新索引到自身。
Reindex requires _source to be enabled for all documents in the source.
重新索引要求源中所有文档启用 _source。
The destination should be configured as wanted before calling _reindex. Reindex does not copy the settings from the source or its associated template.
在调用 _reindex 之前,应按照所需配置目标。重新索引不会复制源或其关联模板的设置。
The destination should be configured as wanted before calling _reindex. Reindex does not copy the settings from the source or its associated template.
必须提前配置映射、分片数量、副本等内容。
curl -X POST "localhost:9200/_reindex?pretty" -H 'Content-Type: application/json' -d'
{
"source": {
"index": "my-index-000001"
},
"dest": {
"index": "my-new-index-000001"
}
}'