Welcome, Guest! Registration


Thursday, 2018-03-22
Main » 2015 » October » 22 » Elastic Search from CLI
9:59 PM
Elastic Search from CLI

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: 356 | Added by: ep | Tags: Elastic Search | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Registration | Login ]