Created
September 30, 2014 21:12
-
-
Save brusic/e9a4fa6393576425abb3 to your computer and use it in GitHub Desktop.
Convert Elasticsearch search results to Elasticsearch bulk index format
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
sed -e 's/{"took":[0-9]*,"timed_out":false,"_shards":{"total":[0-9]*,"successful":[0-9]*,"failed":0},"hits":{"total":[0-9]*,"max_score":[0-9\.]*,"hits":\[\(.*\)\]}}$/\1/' -e 's/}},/}}\n/g' -e 's/{"_index"/{ "index":{"_index"/' -e 's/,"_score":[0-9\.]*, "_source" : /}}\n/g' |
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
sed -e 's/{"took":[0-9]*,"timed_out":false,"_shards":{"total":[0-9]*,"successful":[0-9]*,"failed":0},"hits":{"total":[0-9]*,"max_score":[0-9\.]*,"hits":\[\(.*\)\]}}$/\1/' -e 's/}},/}}\ | |
/g' -e 's/{"_index"/{ "index":{"_index"/' -e 's/,"_score":[0-9\.]*, "_source" : /}}\ | |
/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment