Skip to content

ElasticSearch and Kibana

Jo Cook edited this page Mar 24, 2021 · 2 revisions

GeoNetwork uses ElasticSearch for indexing, and Kibana for display of dashboards.

Indexing should happen automatically, but occasionally you may need to re-index. This can be done in Admin Console -> Tools -> (beta) Index in remote index.

Dashboards are available for the following and can be accessed at Admin Console -> Statistics and Status (then choose from the list on the left):

  • Content Statistics
  • Validation Statistics
  • Search Statistics

Annoyingly, by default you can't use the really nice time filter that is available when editing a dashboard, but the "add filter" button should allow you to query by timestamp.

There is a full admin interface for kibana, but by default it has no authentication in place. Until this is fixed, we're going for security by obscurity.

The info below is deprecated but kept for reference

The aim is to make this part of the container set up but for now it must be done manually

Get the container name for the kibana container by sshing onto the EC2 instance and running:

docker ps -a | grep kibana

Go onto the docker container and create an indices directory (you will need to do the following every time the kibana container restarts):

docker exec -i -t [kibana container] /bin/bash
mkdir indices
exit

Change to the os-custom-geonetwork/elasticsearch directory and copy the json to the running kibana container:

for f in *.json; do docker cp $f [kibana container]:/usr/share/kibana/indices/$f
cd ../kibana
docker cp export.ndjson [kibana container]:/usr/share/kibana/indices/export.ndjson

Go back onto the kibana container and run the following commands to check the cluster health (yellow or green are OK, red is not) and then check whether the indices have already been loaded, and if not, load them:

docker exec -i -t [kibana container] /bin/bash
cd indices
curl -X GET 'http://localhost:9200/_cat/health?h=st'
for f in *.json ; do if [ $(curl -LI "http://localhost:9200/gn-${f%.*}" -o /dev/null -w '%{http_code}\n' -s) == "200" ] ; \
then echo "gn-${f##*/} exists" ; else echo "gn-${f%.*} missing" \
&& curl -X PUT "http://localhost:9200/gn-${f%.*}" \
-H "Content-Type:application/json"  -d @$f ; fi ; done
curl -X POST "http://localhost:5601/api/saved_objects/_import?overwrite=true" -H "kbn-xsrf:true" --form [email protected]

Note that the final cURL command will report an error at present but it can be ignored