-
-
Save Rotzke/73e27992d7ca35d18d3223349db740c4 to your computer and use it in GitHub Desktop.
How to bulk load gzip'd JSON in Elastic
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
# Bulk load the Foo data we prepared via PySpark in etl/transform_foo.spark.py | |
for path in data/foo/elastic/part* | |
do | |
file=$(basename ${path}) | |
echo "Submitting ${path} to Elastic index foo ..." | |
curl ${USER_STRING} \ | |
-X POST \ | |
-H "Content-encoding: gzip" \ | |
-H "Content-Type: application/x-ndjson" \ | |
"http://${HOSTNAME}:${PORT}/foo/_bulk" \ | |
--data-binary "@${path}" \ | |
> "data/foo/elastic_report/${file}.json" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment