| 1 | #!/bin/sh |
| 2 | set -eu |
| 3 | |
| 4 | ES_URL="${ES_URL:-http://elasticsearch:9200}" |
| 5 | |
| 6 | until curl -fsS "$ES_URL/_cluster/health?wait_for_status=yellow&timeout=5s" > /dev/null; do |
| 7 | sleep 2 |
| 8 | done |
| 9 | |
| 10 | curl -fsS -X PUT "$ES_URL/netdata" -H 'Content-Type: application/json' -d '{ |
| 11 | "settings": { "number_of_shards": 1, "number_of_replicas": 0 } |
| 12 | }' > /dev/null || true |
| 13 | |
| 14 | { |
| 15 | i=1 |
| 16 | while [ "$i" -le 1000 ]; do |
| 17 | echo "{\"index\":{\"_index\":\"netdata\",\"_id\":\"$i\"}}" |
| 18 | echo "{\"value\":$i,\"text\":\"value-$i\"}" |
| 19 | i=$((i + 1)) |
| 20 | done |
| 21 | } | curl -fsS -X POST "$ES_URL/_bulk" -H 'Content-Type: application/x-ndjson' --data-binary @- > /dev/null |
| 22 | |
| 23 | curl -fsS -X POST "$ES_URL/netdata/_refresh" > /dev/null |