Restore kibana json file via curl

Hello expert,
I want to backup and restore kibana saved objects via curl command. For backup purpose, I created kibana_backup.sh which and below is the backup curl command:-

curl --user ericadmin:xxxxx -XPOST "http://localhost:9200/$KIBANA_INDEX/search?size=1000&pretty" -d'{"query":{"match_all":{}}}' > $backupdir/kibana_saved_objects$timestamp.json 2> /dev/null

This generates a kibana_saved_objects_2019_x_x.json file. Attached is the json file. ES and Kibana version=5.6.3 . Could you please assist in how can I recover the json file via restore command?

[root@labelk ~]# cd /usr/local/scripts/
[root@labelk scripts]# ls -ltr
total 8
-rwxr-xr-x 1 root root 1034 Jan 8 11:08 kibana_backup.sh
-rwxr-xr-x 1 root root 363 Jan 8 11:10 kibana_restore.sh
[root@labelk scripts]# cat kibana_backup.sh
#!/bin/bash
#########################
KIBANA_VERSION=5.6.3
KIBANA_INDEX=.kibana
timestamp=$(date +%F)
backupdir=/var/backup

Backup kibana saved objects

curl --user ericadmin:q.3#edsM! -XPOST "http://localhost:9200/$KIBANA_INDEX/search?size=1000&pretty" -d'{"query":{"match_all":{}}}' > $backupdir/kibana_saved_objects$timestamp.json 2> /dev/null

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.