Help in Export Elasticsearch data

Hello Team,

I am new to Elasticsearch I have an situation where I want to reindex data from elasticsearch to opensearch

I dont have any cluster so its a single node I wan some clarity on my below queries

  1. How to export data that can be imported to opensearch (something like export to json and import in opensearch)

  2. what if I copy data from /elasticsearch/nodes/0/indices/* to /opensearch/nodes/0/indices/ and then run reindex like below will it work

curl 'localhost:9200/_cat/indices?v'|awk '{print $3}'| tail -n +2 |sort | grep -v .geoip_databases >> oldindex.txt

ES_HOST="localhost"
ES_PORT="9200"
NEW_INDEX="-new"

for index in `cat oldindex.txt | grep gl-system-events_*`
            do
			newindex=$index${NEW_INDEX}
            echo "Reindex process starting for index: $index to $newindex"

            curl -X PUT "${ES_HOST}:${ES_PORT}/$newindex" -H 'Content-Type: application/json' -d @/pl/jsons/gl-system-events-new.json 

            echo "New index: $index-new created"

            echo "Starting reindexing elastic data from original index:$index to new index:$newindex"

            curl -s -X POST "${ES_HOST}:${ES_PORT}/_reindex" -H 'Content-Type: application/json' -d'
				{
					"source": {
						"index": "'$index'"
					},
					"dest": {
					"index": "'$newindex'"
					}
				}'
            echo "Reindexing completed from original index:$index to new index:$newindex"

            done;

I cant do remote reindexing want some help where we can do manual dump/export which can be imported in opensearch.

Please guide.

Regards,
SAM

OpenSearch/OpenDistro are AWS run products and differ from the original Elasticsearch and Kibana products that Elastic builds and maintains. You may need to contact them directly for further assistance.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

This is probably the best way to go forward and you might have a look at elasticsearch-dump (have not personally used).

This is very unlikely to work.

1 Like

Hello!

Don't touch the data folders directly, never.

Here are a few tools and methods that could help: Data Export from Elasticsearch or OpenSearch - BigData Boutique blog

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.