Last active
July 17, 2025 06:47
-
-
Save erdii/359263c2f24e08b0eda1f6ef04b2f421 to your computer and use it in GitHub Desktop.
Copy an elasticsearch index definition (settings and mapping - no data) to another server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copy index definition | |
INDEX_NAME="my_index" | |
curl -X GET "http://source-server:9200/$INDEX_NAME" | curl -X PUT "http://destination-server:9200/$INDEX_NAME" -d @- | |
# copy mapping for "my_doc_type" | |
DOC_TYPE="my_doc_type" | |
curl -X GET "http://source-server:9200/$INDEX_NAME/_mapping" | jq .$INDEX_NAME.mappings.$DOC_TYPE | curl -X PUT "http://destination-server:9200/$INDEX_NAME/_mapping/$DOC_TYPE" -d @- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @ferzerkerx, worked perfectly.