Skip to content

Instantly share code, notes, and snippets.

@andrross
Last active December 6, 2021 21:44
Show Gist options
  • Save andrross/c9e228ec0636d4cce4ef00352dfd413d to your computer and use it in GitHub Desktop.
Save andrross/c9e228ec0636d4cce4ef00352dfd413d to your computer and use it in GitHub Desktop.
#!/bin/bash
read -r -d '' QUERY<<'EOF'
{
"profile": true,
"size": 0,
"query": {
"range": {
"dropoff_datetime": {
"from": "2015-01-01 00:00:00",
"to": "2015-01-01 12:00:00"
}
}
},
"_source": false,
"aggregations": {
"2": {
"terms": {
"field": "payment_type",
"size": 1000
},
"aggregations": {
"3": {
"date_histogram": {
"field": "dropoff_datetime",
"fixed_interval": "5s"
},
"aggregations": {
"1": {
"top_hits": {
"size": 1,
"sort": [
{
"dropoff_datetime": {
"order": "desc"
}
}
]
}
}
}
}
}
}
}
}
EOF
for i in $(seq 0 2); do
printf "es7.9 "
curl -s -XPOST 'localhost:7090/nyc_taxis/_search?pretty' -H 'Content-Type:application/json' \
-d "$QUERY" \
| grep 'took'
printf "es7.10.2 "
curl -s -XPOST 'localhost:7100/nyc_taxis/_search?pretty' -H 'Content-Type:application/json' \
-d "$QUERY" \
| grep 'took'
printf "es7.15.2 "
curl -s -XPOST 'localhost:7150/nyc_taxis/_search?pretty' -H 'Content-Type:application/json' \
-d "$QUERY" \
| grep 'took'
printf "os1.2 "
curl -s -XPOST 'localhost:1200/nyc_taxis/_search?pretty' -H 'Content-Type:application/json' \
-d "$QUERY" \
| grep 'took'
echo '------'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment