6
votes

Using Elasticsearch 1.4.0

Is there a way to find out the various size stats of a particular document given it's id?

So just to see how ES breaks down each individual document?

1
I don't think so. You can see stats at index level and at field level, but not per document.Andrei Stefan
Ah ok! Thanks just wanted to confirm.user432024

1 Answers

2
votes

Elasticsearch has a _size field that you can request for a document. In order to use it, you may have to enable it on the mapping for your document type by adding "_size": {"enabled": true, "store": true}. There isn't much documentation on its specifics, but it appears to match the total length of the _source field for that document. Totaling the _size of all documents in an index, however, will not match the primary store size for that index. This makes sense, as the underlying lucene indices are storing a tokenized representation of the document, not necessarily its _source.

Example Query:

curl localhost:9200/myIndex/sometype/28c53efe-2eaf-11e5-80c3-000d1fc9a922?fields=_size

Result:

{
    "_index": "myIndex",
    "_type": "sometype",
    "_id": "28c53efe-2eaf-11e5-80c3-000d1fc9a922",
    "_version": 1,
    "found": true,
    "fields": {
        "_size": 905
    }
}