How to check the total amount of data stored in a particular type


(justin) #1

How to check the total amount of data stored in a particular type.
I have different types and want to check the growth of the data in each type

current size and want to predict the growth


(Jimferenczi) #2

If by "total amount of data" you mean the number of documents per type then you have multiple options. You can run a match_all query for each type using the count API:

curl -XGET 'http://localhost:9200/twitter/tweet/_count' -d '
{ "match_all": {} }'

Or you can use a term aggregation on the _type field to get the number of documents per type in one query:

{
    "aggs" : {
        "per_type" : {
            "terms" : { "field" : "_type" }
        }
    }
}

(justin) #3

I want to check the size of a type in mb or gb ...


(justin) #4

bank
size: 470ki (940ki) -------------------this is the size of the bank index,wil have more types ... i want to know the size of each type
docs: 1,000 (2,000)


(Jimferenczi) #5

The types are shared in a single index thus it is not possible to get the size that each type takes on disk. The type is just an abstraction inside the index that is materialized by a single field named _type. Everything is interleaved inside the index, some fields are shared among the types so the size of each type is hardly computable. You can read this post for further information: https://www.elastic.co/blog/index-vs-type


(system) #6