Skip to content

Instantly share code, notes, and snippets.

@rjurney
Created December 19, 2020 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rjurney/a362b0930da26de2ebe5279922938164 to your computer and use it in GitHub Desktop.
Save rjurney/a362b0930da26de2ebe5279922938164 to your computer and use it in GitHub Desktop.
How to bulk load gzip'd JSON in Elastic
# 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