Wednesday, July 13, 2016

Show all document in an index in Elasticsearch

To show all document in an index in Elasticsearch, do as follows:

$ curl 'localhost:9200/logstash/_search?pretty=true&q=*:*'
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "logstash",
      "_type" : "logstash",
      "_id" : "AVXjVaB4eRCf5XO_Qkwg",
      "_score" : 1.0,
      "_source" : {
        "firstName" : "Johnny",
        "lastName" : "Lim"
      }
    } ]
  }
}
$

Reference:
http://stackoverflow.com/questions/8829468/elasticsearch-query-to-return-all-records

No comments:

Post a Comment