Elasticsearch migration from warm to hot storage

Job ID: 36426975

Budget: $30 – $250 USD

Hello i have an elastic search and i want to write a python script to migrate all the indices from warm tier to hot storage. Need this to be done asap.
Index names are in this format - agentstatisticrecord-2022-01-10 and goes till 2023-04-04.
Note : all indices should be migrated to the hot storage.

I usually use the below code to create client and do the operations like create snapshot etc. And i think the first block of code should ne the same.

from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
from requests_aws4auth import AWS4Auth
import boto3
import io
import json

# Define the Elasticsearch endpoint and region
endpoint = 'https://search-lilyhma-asrdom-mtbnzhuba42vblu3bmb6xrs5su.us-west-2.es.amazonaws.com'
region = 'us-west-2'
service = 'es'
credentials = boto3.Session().get_credentials()
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service, session_token=credentials.token)


# Create the Elasticsearch client
es = Elasticsearch(endpoint, http_auth=awsauth)
Related categories: Python Linux Software Architecture MySQL Elasticsearch