Elasticsearch has a field _sizethat you can request for a document. To use it, you may need to enable it when displayed for your document type by adding "_size": {"enabled": true, "store": true}. There is not much documentation on its specifics, but it seems to correspond to the total field length _sourcefor this document. However, when calculating _sizeall the documents in the index, it will not correspond to the size of the primary storage for this index. This makes sense since the lucene base indexes store a tokenized representation of the document, not necessarily it _source.
Request example:
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
}
}
Dusty source
share