Welcome, Guest! Registration

loc2log

Tuesday, 2024-04-23
Main » 2015 » October » 22

Basic Elastic Search commands over terminal (Command Line Interface) can be handy when Kibana or any other fancy interface is not available and you need to do a basic troubleshooting.

We will use curl - to make HTTP requests from command line. In the example it is assumed you are at the same box as the Elastic Search instance. Replace localhost with your actual host name/IP if you are doing debug from a remote terminal. We also assume you are using standard Elastic Search port 9200. Replace it with your value if you tweaked it. MY_INDEX is a placeholder for whatever index you'll be working with. pretty=1 is to get nice multiline output.

Get all indexes from the Elastic Search:

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

Make a query to Elastic Search. In this example that's just trivial search for all "response" fields with value "200". You may caonstruct way more complex queries with lucene syntax.

curl -XGET 'http://localhost:9200/MY_INDEX/_search?q=response=200&pretty=1'

Delete a given index:

curl -XDELETE 'localhost:9200/MY_INDEX/'

Views: 826 | Added by: ep | Date: 2015-10-21 | Comments (0)