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) commandline for this would be: GET /_snapshot/my_backup/_all
.
Actually my question boils down to: How to make a specific GET request if I already know the syntax, it seems the Elasticsearch.get()
function is only suited to retrieve documents.
Ofcourse I could quite easily do this using the Requests module, but this is not what I want.
The snapshot helper functions 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
我终于意识到你可以在需要所有快照时使用_all
关键字,方法如下:
all_snapshots = es.snapshot.get(repository = 'my_backup', snapshot = '_all')
Just adding one of my own as this got me in the right path. If you need to get the general snapshot status ie if a snapshot is being run:
es_session.snapshot.status('_all')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.