ElasticSearch count returned result -


i want count number of document returned result of query size limit. example, run following query:

curl -xget http://localhost:9200/logs_-*/a_logs/_search?pretty=true -d ' { "query" : {     "match_all" : {  } }, "size" : 5, "from" : 8318 }' 

and get:

{ "took" : 5, "timed_out" : false, "_shards" : { "total" : 159, "successful" : 159, "failed" : 0 },   "hits" : {   "total" : 8319,   "max_score" : 1.0,   "hits" : [ { .... 

total documents matching query 8319, fetched @ max 5. 1 document returned since queried "from" 8318.

in response, not know how many documents returned. want write query such number of documents being returned present in field. maybe facet may help, not figure out. kindly help.

your query :

{ "query" : {     "match_all" : {  } }, 

=> means ask data

"size" : 5,

=> want display 5 results

"from" : 8318

=> start 8318 records

elasticsearch respons :

....

"hits" : {   "total" : 8319, 

... => elastic search told there 8319 results in index.

you ask him result , start 8318.

8319 - 8318 = 1 have 1 result.

try removing from.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -