Skip to content

Instantly share code, notes, and snippets.

@thyandrecardoso
Created May 6, 2022 16:38
Show Gist options
  • Save thyandrecardoso/cfe24e872d911c524ac7b3d071f82377 to your computer and use it in GitHub Desktop.
Save thyandrecardoso/cfe24e872d911c524ac7b3d071f82377 to your computer and use it in GitHub Desktop.
Testing Elasticsearch indexing
#!/usr/bin/env bash
port=9201
branch=$(git describe --tags)
jvm=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
for indexIdx in {1..3}; do
curl -sX DELETE "http://localhost:$port/test-index-temp-$indexIdx" >/dev/null
done
start_time=$(date +%s)
for indexIdx in {1..3}; do
for d in {1..100}; do
curl -sX POST "http://localhost:$port/test-index-temp-$indexIdx/_doc/" -H 'Content-Type: application/json' -d'{"user": {"id": "'"test-$d"'"}}' >/dev/null
done
done
end_time=$(date +%s)
elapsed=$((end_time - start_time))
echo "Testing in branch '$branch' and JVM '$jvm' took $elapsed seconds."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment