Created
April 24, 2025 16:15
-
-
Save nik9000/5fcce107fedd9de55b0eacc676fad47d 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":"text '$(printf %04d $a)'"}' >> /tmp/bulk | |
done | |
curl -s -uelastic:password -HContent-Type:application/json -XDELETE localhost:9200/test | |
for a in {1..1000}; do | |
echo -n $a: | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST localhost:9200/test/_bulk?pretty --data-binary @/tmp/bulk | grep errors | |
done | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST localhost:9200/test/_forcemerge?max_num_segments=1 | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST localhost:9200/test/_refresh | |
echo | |
for a in {1..100}; do | |
echo -n "%100.0 " | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
"query": "FROM test | STATS SUM(LENGTH(text))", | |
"pragma": { | |
"data_partitioning": "shard" | |
} | |
}' | jq -c '{took, documents_found}' | |
echo -n "%099.9 " | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
"query": "FROM test | WHERE NOT text.keyword IN (\"text 0998\") | STATS SUM(LENGTH(text))", | |
"pragma": { | |
"data_partitioning": "shard" | |
} | |
}' | jq -c '{took, documents_found}' | |
echo -n "%099.0 " | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
"query": "FROM test | WHERE NOT STARTS_WITH(text.keyword, \"text 099\") | STATS SUM(LENGTH(text))", | |
"pragma": { | |
"data_partitioning": "shard" | |
} | |
}' | jq -c '{took, documents_found}' | |
echo -n "%090.0 " | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
"query": "FROM test | WHERE NOT STARTS_WITH(text.keyword, \"text 09\") | STATS SUM(LENGTH(text))", | |
"pragma": { | |
"data_partitioning": "shard" | |
} | |
}' | jq -c '{took, documents_found}' | |
echo -n "%010.0 " | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
"query": "FROM test | WHERE STARTS_WITH(text.keyword, \"text 09\") | STATS SUM(LENGTH(text))", | |
"pragma": { | |
"data_partitioning": "shard" | |
} | |
}' | jq -c '{took, documents_found}' | |
echo -n "%009.0 " | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
"query": "FROM test | WHERE STARTS_WITH(text.keyword, \"text 099\") OR STARTS_WITH(text.keyword, \"text 098\") OR STARTS_WITH(text.keyword, \"text 097\") OR STARTS_WITH(text.keyword, \"text 096\") OR STARTS_WITH(text.keyword, \"text 095\") OR STARTS_WITH(text.keyword, \"text 094\") OR STARTS_WITH(text.keyword, \"text 093\") OR STARTS_WITH(text.keyword, \"text 092\") OR STARTS_WITH(text.keyword, \"text 091\") | STATS SUM(LENGTH(text))", | |
"pragma": { | |
"data_partitioning": "shard" | |
} | |
}' | jq -c '{took, documents_found}' | |
echo -n "%008.0 " | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
"query": "FROM test | WHERE STARTS_WITH(text.keyword, \"text 099\") OR STARTS_WITH(text.keyword, \"text 098\") OR STARTS_WITH(text.keyword, \"text 097\") OR STARTS_WITH(text.keyword, \"text 096\") OR STARTS_WITH(text.keyword, \"text 095\") OR STARTS_WITH(text.keyword, \"text 094\") OR STARTS_WITH(text.keyword, \"text 093\") OR STARTS_WITH(text.keyword, \"text 092\") | STATS SUM(LENGTH(text))", | |
"pragma": { | |
"data_partitioning": "shard" | |
} | |
}' | jq -c '{took, documents_found}' | |
echo -n "%007.0 " | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
"query": "FROM test | WHERE STARTS_WITH(text.keyword, \"text 099\") OR STARTS_WITH(text.keyword, \"text 098\") OR STARTS_WITH(text.keyword, \"text 097\") OR STARTS_WITH(text.keyword, \"text 096\") OR STARTS_WITH(text.keyword, \"text 095\") OR STARTS_WITH(text.keyword, \"text 094\") OR STARTS_WITH(text.keyword, \"text 093\") | STATS SUM(LENGTH(text))", | |
"pragma": { | |
"data_partitioning": "shard" | |
} | |
}' | jq -c '{took, documents_found}' | |
echo -n "%005.0 " | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
"query": "FROM test | WHERE STARTS_WITH(text.keyword, \"text 099\") OR STARTS_WITH(text.keyword, \"text 098\") OR STARTS_WITH(text.keyword, \"text 097\") OR STARTS_WITH(text.keyword, \"text 096\") OR STARTS_WITH(text.keyword, \"text 095\") | STATS SUM(LENGTH(text))", | |
"pragma": { | |
"data_partitioning": "shard" | |
} | |
}' | jq -c '{took, documents_found}' | |
echo -n "%001.0 " | |
curl -s -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/_query?pretty' -d'{ | |
"query": "FROM test | WHERE STARTS_WITH(text.keyword, \"text 099\") | STATS SUM(LENGTH(text))", | |
"pragma": { | |
"data_partitioning": "shard" | |
} | |
}' | jq -c '{took, documents_found}' | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment