--It is recommended to insert using the Bulk API when you want to recreate a certain index (= reindex). Since it's not a production environment in particular, I didn't need to use Alias, so I checked the memo when I implemented it with the Python API.
Elasticsearch
-Read Speed up ElasticSearch indexing before putting it in Bulk. It was very helpful. --Set replica shard to 0 --Change the commit frequency --Disable _all field
--Enter the number of shards you forgot to set in the previous index and the mapping correctly.
PUT 'XXX.XXX.XXX.XXX:9200/[new index]' -d '
index :
number_of_shards : 3
number_of_replicas : 0
'
Read the documentation for Helpers. It seems that it can be done with the following feeling.
from elasticsearch import Elasticsearch
from elasticsearch import helpers
es = Elasticsearch(host="XXX.XXX.XXX.XXX", port=9200)
helpers.reindex(es, source_index = "old-index", target_index = "new-index")
It is recommended to put about 10MB each in the index size. From the reference below. Reference: Considerations for Elasticsearch indexing performance
-Bulk API I'm glad it was easy.
Recommended Posts