-
Notifications
You must be signed in to change notification settings - Fork 9
/
number_precision.sh
executable file
·38 lines (38 loc) · 1.24 KB
/
number_precision.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
# This script demonstrates the effect of changing precision_step on numbers
#
curl -XDELETE localhost:9200/test-precision-1,test-precision-8,test-precision-64
echo
for i in 1 8 64; do curl -XPUT localhost:9200/test-precision-$i -d "{
\"settings\": {
\"index\": {
\"number_of_shards\": 1,
\"number_of_replicas\": 0
}
},
\"mappings\": {
\"doc\": {
\"_source\": {
\"enabled\": false
},
\"_all\": {
\"enabled\": false
},
\"properties\": {
\"num\": {
\"type\": \"long\",
\"precision_step\": $i
}
}
}
}
}"; echo; done
echo
echo Indexing....
for i in 1 8 64; do for n in {1..10000}; do curl -s -XPUT localhost:9200/test-precision-$i/doc/$n -d "{\"num\":$RANDOM}" > /dev/null; done; done
echo Done
echo Optimizing
curl -XPOST 'http://localhost:9200/test-precision-1,test-precision-8,test-precision-64/_optimize?max_num_segments=1&flush=true&wait_for_merge=true'
echo
for i in {1,8,64}; do curl -s -XGET "http://localhost:9200/test-precision-$i/_segments?pretty=true" | grep "test-precision\|size_in_bytes"; done