Skip to content

Instantly share code, notes, and snippets.

@amatai
Last active November 20, 2017 14:42
Show Gist options
  • Save amatai/40892c3d8555081925de0d19a8bf2b00 to your computer and use it in GitHub Desktop.
Save amatai/40892c3d8555081925de0d19a8bf2b00 to your computer and use it in GitHub Desktop.
ElasticSearch

Cluster

  • Basic Cluster Info

curl http://localhost:9200/?pretty

  • Cluster status

curl http://localhost:9200/_cluster/health?pretty

  • List of nodes

curl -XGET 'http://localhost:9200/_nodes' | python -m json.tool | less

Indexes

  • More debug info

curl http://localhost:9200/_cat

  • List indexes:

curl http://localhost:9200/_cat/indices?v&s=index:asc

  • List indexes and their aliases:

curl http://localhost:9200/_aliases?pretty=1 | less

  • Delete Index

curl -X DELETE http://localhost:9200/udplog-2016.09.03/

Mappings

  • List the mappings for type in an index

curl -XGET 'http://localhost:9200/logstash-2016.11.15/_mapping' | python -m json.tool

Documents

  • List all documentes in an Index:

curl http://localhost:9200/<IndexName>/_search | jq '.' | less

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment