Helpful Commands for OpenSearch Dev Tools Console

Osama Atif
1 min readJun 14, 2023

This article has all the commands for OpenSearch, which may come in handy when using it for taking snapshots, and restoring them among other operations.

RETRIEVE ALL THE REPOSITORIES: This command retrieves all the repositories

GET _snapshot

TAKE A SNAPSHOT AND PUT IT IN A GIVEN REPOSITORY: The following command can be used to take a snapshot and put it in a given repository. Note: Make sure to use the repo-name of the repository in the following command

PUT _snapshot/repo-name/snapshotname

GET THE SNAPSHOT FROM THE REPOSITORY: Fetches the snapshot from the repository in S3 Bucket

GET _snapshot/repo-name/snapshotname

GET ALL REPOSITORIES: This fetches all the repositories in the S3 Bucket:

GET _snapshot/_all

FETCHES ALL THE SNAPSHOTS IN A REPOSITORY:

GET _snapshot/repo-name/_all?pretty

FETCH ALL THE SNAPSHOTS FROM THE AUTOMATED SNAPSHOTS REPOSITORY (STORES UPTO 14 DAYS WORTH OF SNAPSHOTS EACH TAKEN ONCE PER HOUR),

cs-automated-enc is the automated snapshot repository.

GET /_cat/snapshots/cs-automated-enc

GET _snapshot/cs-automated-enc/_all

TO RESTORE A SNAPSHOT FROM THE PAST, SELECT THE WHOLE NAME OF THE SNAPSHOT, ENTER IT NEXT TO THE REPOSITORY NAME/ AND THEN _RESTORE.

POST _snapshot/REPO-NAME/SNAPSHOT-NAME/_restore

THIS OPERATION LISTS INFORMATION RELATED TO INDICES: The cat indices operation lists information related to indices⁠ — how much disk space they are using, how many shards they have, their health status, and so on.

GET _cat/indices/

--

--

Osama Atif

Technology | Etiquette | Desi Culture | Books | Personal Opinion | Sports | Cricket