Last active
January 2, 2024 21:03
-
-
Save nik9000/c127adc6accf4e8df9f3b44181aa7ff6 to your computer and use it in GitHub Desktop.
docs
This file contains hidden or 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
echo '{ | |
"settings": { | |
"mapping.total_fields.limit": 20000, | |
"number_of_shards": 10, | |
"number_of_replicas": 0 | |
}, | |
"mappings": { | |
"properties": { | |
"f00000": {"type": "long"}' > /tmp/idx | |
for f in {1..9999}; do | |
printf ', | |
"f%04d": {"type": "long"}' $f >> /tmp/idx | |
done | |
echo ' | |
} | |
} | |
}' >> /tmp/idx | |
echo -n '{"f0000": 1' > /tmp/doc | |
for f in {1..9999}; do | |
printf ', "f%04d": 1' $f >> /tmp/doc | |
done | |
echo '}' >> /tmp/doc | |
rm -f /tmp/bulk | |
for i in {0..19}; do | |
echo '{"index": {}}' >> /tmp/bulk | |
cat /tmp/doc >> /tmp/bulk | |
done | |
for i in {0..99}; do | |
printf "%02d: " $i; | |
curl -XDELETE -uelastic:password localhost:9200/$(printf "idx%02d" $i) | |
curl -XPUT -HContent-Type:application/json -uelastic:password localhost:9200/$(printf "idx%02d" $i) -d @/tmp/idx | |
echo | |
done | |
for i in {0..19}; do | |
printf "%02d: " $i; | |
curl -s -XPOST -HContent-Type:application/json -uelastic:password localhost:9200/$(printf "idx%02d" $i)/_bulk?pretty --data-binary @/tmp/bulk | grep errors | |
done | |
curl -XPOST -uelastic:password localhost:9200/_refresh | |
while true; do | |
time curl -XPOST -uelastic:password -HContent-Type:application/json localhost:9200/_query -d'{ | |
"query": "FROM *" | |
}' | |
done | |
# Before: | |
# [2024-01-02T16:02:21,516][INFO ][o.e.x.e.a.RestEsqlQueryAction] [runTask-0] Beginning execution of ESQL query. | |
# Query string: [FROM *] | |
# [2024-01-02T16:02:22,779][INFO ][o.e.x.e.a.EsqlResponseListener] [runTask-0] Finished execution of ESQL query. | |
# Query string: [FROM *] | |
# Execution time: [1262]ms | |
# After: | |
# [2024-01-02T15:55:52,332][INFO ][o.e.x.e.a.RestEsqlQueryAction] [runTask-0] Beginning execution of ESQL query. | |
# Query string: [FROM *] | |
# [2024-01-02T15:55:52,924][INFO ][o.e.x.e.a.EsqlResponseListener] [runTask-0] Finished execution of ESQL query. | |
# Query string: [FROM *] | |
# Execution time: [591]ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment