Created
July 1, 2025 14:37
-
-
Save nik9000/c33168cdfa273fd8ac3f04fc85cda58a to your computer and use it in GitHub Desktop.
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
| rm -f /tmp/bulk* | |
| for a in {1..1000}; do | |
| echo '{"index":{}}' >> /tmp/bulk | |
| echo '{"text": "words words '$a'"}' >> /tmp/bulk | |
| done | |
| ls -l /tmp/bulk* | |
| passwd="password" | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XDELETE localhost:9200/test | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XPUT localhost:9200/test -d'{ | |
| "settings": { | |
| "index.refresh_interval": -1 | |
| }, | |
| "mappings": { | |
| "properties": { | |
| "text": { "type": "text" } | |
| } | |
| } | |
| }' | |
| for a in {1..1000}; do | |
| printf %06d: $a | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XPOST localhost:9200/test/_bulk?pretty --data-binary @/tmp/bulk | grep errors | |
| done | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XPOST localhost:9200/test/_forcemerge?max_num_segments=1 | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XPOST localhost:9200/test/_refresh | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XDELETE localhost:9200/test2 | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XPUT localhost:9200/test2 -d'{ | |
| "settings": { | |
| "index.refresh_interval": -1 | |
| }, | |
| "mappings": { | |
| "properties": { | |
| "text": { "type": "text" } | |
| } | |
| } | |
| }' | |
| for a in {1..1000}; do | |
| printf %06d: $a | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XPOST localhost:9200/test2/_bulk?pretty --data-binary @/tmp/bulk | grep errors | |
| done | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XPOST localhost:9200/test2/_forcemerge?max_num_segments=1 | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XPOST localhost:9200/test2/_refresh | |
| echo | |
| curl -sk -uelastic:$passwd localhost:9200/_cat/indices?v | |
| text_eq() { | |
| echo -n " text eq " | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
| "query": "FROM test* | WHERE text == \"words words 1\" | STATS COUNT(*)", | |
| "profile": true, | |
| "pragma": { | |
| "task_concurrency": 1 | |
| } | |
| }' | |
| } | |
| not_text_eq() { | |
| echo -n "not text eq " | |
| curl -sk -uelastic:$passwd -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
| "query": "FROM test* | WHERE NOT text == \"words words 1\" | STATS COUNT(*)", | |
| "profile": true, | |
| "pragma": { | |
| "task_concurrency": 1 | |
| } | |
| }' | |
| } | |
| for a in {1..100}; do | |
| text_eq | |
| not_text_eq | |
| done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment