Created
December 20, 2016 17:44
-
-
Save jhonata-menezes/574c231c91249133dfd070e0c8acc8aa to your computer and use it in GitHub Desktop.
Exportar uma collection para json no formato de bulk insert do elasticsearch
This file contains 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
#export mongodb to json with pattern elasticsearch bulk insert without _id (mongodb) | |
mongoexport -h 127.0.0.1 --port 27017 -d db -c collection -f fields | sed '/"_id":/s/"_id":[^,]*,//' | awk '{print "{\"index\": {\"_index\": \"index_name\", \"_type\": \"type_name\"}}\n"$0}' > elasticsearch.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment