2017-09-05 21:33:13 +02:00
|
|
|
#!/bin/bash
|
2018-05-26 07:26:17 +02:00
|
|
|
if [ "$(curl -IHEAD -w '%{http_code}' 'localhost:9200/claims' -o /dev/null --connect-timeout 3 --max-time 5)" == "200" ] ;
|
2017-09-26 17:52:05 +02:00
|
|
|
then
|
|
|
|
echo "Index already exists." ;
|
|
|
|
exit 1;
|
|
|
|
else
|
|
|
|
echo "Index did not exist, creating..." ;
|
2018-07-09 14:50:21 +02:00
|
|
|
curl -H 'Content-Type: application/json' -H 'Accept: application/json' -X PUT -d '{ "settings" : { "number_of_shards" : 1 }, "mappings" : { "claim" : { "properties" : { "value" : { "type" : "nested" }, "suggest_name": { "type": "completion" }, "suggest_desc": { "type": "completion" } } } } }' http://localhost:9200/claims;
|
2017-09-26 17:52:05 +02:00
|
|
|
exit 0;
|
2018-05-26 07:26:17 +02:00
|
|
|
fi
|