Size of document


(Juan Andres Ramirez) #1

Hello Guys,
I have an index and I need get size data of specifyc source, and I executed the following query:

curl -XGET http://localhost:9200/graylog2_62/_search?pretty -d '{
"query": {
"query_string": {"default_field":"source","query": "CVIADDBA08"}}}'
{

Response:

 "took" : 767,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
      "hits" : {
"total" : 43194300,
"max_score" : 1.8460549,
"hits" : [ {
  "_index" : "graylog2_62",
  "_type" : "message",
  "_id" : "38db1ca5-a49e-11e5-bc77-005056a9199b",
  "_score" : 1.8460549,
      "_source":{.......etc.....

The field "total" : 43194300, is the size of data in bytes?.

Thank you.


#2

Hi. It's number of matched documents. It looks like a total documents count in index, because you should use -XPOST instead of -XGET.


(Luca Cavanna) #3

"total" holds the total number of documents that match the query, not the size in bytes. I am not aware of a straightforward way to get the size in bytes of all the results for a specific query, unless you are willing to scroll over all your results.

If you want to know how much an index takes though you can have a look at the indices stats api, but that is for the whole index, not only for documents that match a specific query. https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html


(Juan Andres Ramirez) #4

Thank you so much for your answerded.
Problem solved with indices stats.


(system) #5