Skip to content

Instantly share code, notes, and snippets.

@devansvd
Created June 6, 2019 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devansvd/f795de93d063439687fc6896bd13a4f9 to your computer and use it in GitHub Desktop.
Save devansvd/f795de93d063439687fc6896bd13a4f9 to your computer and use it in GitHub Desktop.
ElasticSearch Cheat sheet
Create an Index via SENSE
PUT /movies
{
"settings" : {
"number_of_shards" : 5,
"number_of_replicas" : 1
}
}
DELETE /movies
# Elasticsearch Cheatsheet - an overview of commonly used Elasticsearch API commands
# cat paths
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
# Important Things
bin/elasticsearch # Start Elastic instance
curl -X GET 'http://localhost:9200/?pretty=true' # View instance metadata
curl -X POST 'http://localhost:9200/_shutdown' # Shutdown Elastic instance
curl -X GET 'http://localhost:9200/_cat?pretty=true' # List all admin methods
curl -X GET 'http://localhost:9200/_cat/indices?pretty=true' # List all indices
curl -X GET 'http://localhost:9200/_cluster/health?pretty=true' # View Cluster Health
# Index, Type Basics
curl -X GET 'http://localhost:9200/<index name>' # View specific index
curl -X POST 'http://localhost:9200/<index name>' # Create an index
curl -X DELETE 'http://localhost:9200/<index name>' # Delete an index
curl -X GET 'http://locahost:9200/<index name>/<type>/<id>' # Retrieve a specific document
curl -X POST 'http://locahost:9200/<index name>/<type>/' # Create a document
curl -X PUT 'http://locahost:9200/<index name>/<type>/<id>' # Create/Update a specific document
curl -X DELETE 'http://localhost:9200/<index name>/<type>/<id>' # Delete a specific document
curl -X GET 'http://localhost:9200/<index name>/_mappings' # View mappings for index
curl -X GET 'http://localhost:9200/<index name>/_settings' # View setting information for an index
curl -X GET 'http://localhost:9200/<index name>/<type>/_mappings' # View mappings for an index type
curl -X GET 'http://localhost:9200/<index name>/<type>/_settings' # View setting information for an index type
curl -X GET
curl -X PUT 'http://locahost:9200/<index name>/<type>/<id>' # Create/Update a specific document
curl -X GET 'http://localhost:9200/_cat/indices?pretty=true'
https://stackoverflow.com/questions/44647778/how-to-run-shell-script-file-using-nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment