Files
pygeoapi/docker/examples/elastic/ES/add_data.sh
T

22 lines
984 B
Bash
Executable File

#!/bin/sh
echo "Starting script to add geojson"
# move to the directory of this setup script
cd "$(dirname "$0")"
# for some reason even when port 9200 is open Elasticsearch is unable to be accessed as authentication fails
# a few seconds later it works
# incresing to 50s for wait in a slow system /_cluster/health?wait_for_status=yellow&timeout=50s
until $(curl -sSf -XGET --insecure 'http://localhost:9200/_cluster/health?wait_for_status=yellow' > /dev/null); do
printf 'No status yellow from ES, trying again in 10 seconds \n'
sleep 10
done
echo "Elastic search seems to be working - Adding ne_110m_populated_places_simple.geojson to ES"
python /load_es_data.py /usr/share/elasticsearch/data/ne_110m_populated_places_simple.geojson
echo "Seems that data was loaded"
# create a new index with the settings in es_index_config.json
#curl -v --insecure --user elastic:changeme -XPUT '0.0.0.0:9200/test?pretty' -H 'Content-Type: application/json' -d @es_index_config.json