This is an English translation of a Japanese blog. Some content may not be fully translated.
☁️

My Personal Collection of Frequently Used Elasticsearch Commands

Assumes command execution on Amazon Elasticsearch Service. Updated as needed.

Create an Index

curl -X PUT "<Amazon Elasticsearch Service endpoint>/<index_name>"

Check Indices

curl <Amazon Elasticsearch Service endpoint>/_aliases?pretty

Check Index Details

curl <Amazon Elasticsearch Service endpoint>/<index_name>/_settings?pretty

Delete an Index

curl -XDELETE <Amazon Elasticsearch Service endpoint>/<index_name>?pretty=true

Search Data (No Conditions)

curl <Amazon Elasticsearch Service endpoint>/<index_name>/_search?pretty

Check Index

curl <Amazon Elasticsearch Service endpoint>/_cat/indices?v

Check Count

curl <Amazon Elasticsearch Service endpoint>/_cat/count/<index_name>?v
curl <Amazon Elasticsearch Service endpoint>/<index_name>/_count?pretty

Statistics

curl <Amazon Elasticsearch Service endpoint>/<index_name>/_stats?pretty

Check Aliases

curl <Amazon Elasticsearch Service endpoint>/_aliases?pretty

Create Aliases

curl  -H "Content-Type: application/json" -XPOST '<Amazon Elasticsearch Service endpoint>/_aliases' -d '
{
  "actions" : [
    { "add" : { "index" : "my_index1", "alias" : "my_ind1" } },
    { "add" : { "index" : "my_index2", "alias" : "my_ind2" } }
  ]
}'

Delete Aliases

curl  -H "Content-Type: application/json" -XPOST '<Amazon Elasticsearch Service endpoint>/_aliases' -d '
{
  "actions" : [
    { "remove" : { "index" : "my_index1", "alias" : "my_ind1" } },
    { "remove" : { "index" : "my_index2", "alias" : "my_ind2" } }
  ]
}'

List Available cat Commands

curl <Amazon Elasticsearch Service endpoint>/_cat

Check Mapping

curl <Amazon Elasticsearch Service endpoint>/<index_name>/_mapping?pretty

Check Each Node’s Role

curl <Amazon Elasticsearch Service endpoint>/_cat/nodes

Check the Master Node

curl <Amazon Elasticsearch Service endpoint>/_cat/master

Check Which Node Contains Which Shards

curl <Amazon Elasticsearch Service endpoint>/_cat/shards

Check Field Data

curl -XGET <Amazon Elasticsearch Service endpoint>/_stats/fielddata?pretty
Suggest an edit on GitHub