-
Notifications
You must be signed in to change notification settings - Fork 3
/
data-reset.sh
executable file
·17 lines (13 loc) · 948 Bytes
/
data-reset.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# Refresh data
curl -k -X GET -u $USER:$PASSWORD "https://localhost:8012/api/v1/locations/services"
curl -k -X GET -u $USER:$PASSWORD "https://localhost:8012/api/v1/locations/combined"
# Delete indices
curl -s -XDELETE http://localhost:9200/locations/ ; echo
curl -s -XDELETE http://localhost:9200/services/ ; echo
# Upload template mappings
curl -s -H "Content-Type: application/json" -XPOST http://localhost:9200/_template/template_2 --data-binary "@ES-services-index-template.json"; echo
curl -s -H "Content-Type: application/json" -XPOST http://localhost:9200/_template/template_1 --data-binary "@ES-locations-index-template.json"; echo
# Upload documents to ES
curl -s -H "Content-Type: application/json" -XPOST localhost:9200/locations/locations/_bulk --data-binary "@locations-combined.json"; echo
curl -s -H "Content-Type: application/json" -XPOST localhost:9200/services/services/_bulk --data-binary "@services.json"; echo