Search API in Elasticsearch:

Use Following command to do the search in elasticsearch,

curl ‘localhost:9200/customer/_search?q=*&pretty’
Response:
{
“took” : 238,
“timed_out” : false,
“_shards” : {
“total” : 5,
“successful” : 5,
“skipped” : 0,
“failed” : 0
},
“hits” : {
“total” : 1,
“max_score” : 1.0,
“hits” : [
{
“_index” : “customer”,
“_type” : “external”,
“_id” : “1”,
“_score” : 1.0,
“_source” : {
“name” : “MR JUTE ECOMMERCE”
}
}
]
}
}

took – time in milliseconds for Elasticsearch to execute the search
timed_out – tells us if the search timed out or not
_shards – tells us how many shards were searched, as well as a count of the successful/failed searched shards
hits – search results
hits.total – total number of documents matching our search criteria
hits.hits – actual array of search results (defaults to first 10 documents)
_score and max_score – ignore these fields for now

For More Reference check elasticsearch developer document.

 

CORNER OF BLOG:

“SAVE WATER”

Leave a Reply