Reputation: 387
I'm using the elasticsearch python api to communicate with my elasticsearch database. How can I make a specific GET request to get an overview of all the snapshots that have been created?
The Kibana command for this would be: GET /_snapshot/my_backup/_all
.
It seems the Elasticsearch.get()
function is only suited to retrieve documents.
I would rather not use the Requests module.
The snapshot helper functions I found only have the option to get an overview of snapshots that are currently running.
from elasticsearch import Elasticsearch
es = Elasticsearch()
es.snapshot.get_repository('my_backup') # configuration information
es.snapshot.status('my_backup') # currently running snapshots
Upvotes: 2
Views: 2336
Reputation: 5941
Just adding one of my own as this got me in the right path. If you need to get the general snapshot status i.e if a snapshot is being run:
es_session.snapshot.status('_all')
Upvotes: 1
Reputation: 387
I finally realized you can use the _all
keyword when needing all snapshots, in the following way:
all_snapshots = es.snapshot.get(repository = 'my_backup', snapshot = '_all')
Upvotes: 5