Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog/106840.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 106840
summary: Add total size in bytes to doc stats
area: Stats
type: enhancement
issues:
- 97670
7 changes: 6 additions & 1 deletion docs/reference/cluster/stats.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ selected nodes.
+
This number is based on documents in Lucene segments. {es} reclaims the disk
space of deleted Lucene documents when a segment is merged.

`total_size_in_bytes`::
(integer)
Total size in bytes across all primary shards assigned to selected nodes.
=====

`store`::
Expand Down Expand Up @@ -1594,7 +1598,8 @@ The API returns the following response:
},
"docs": {
"count": 10,
"deleted": 0
"deleted": 0,
"total_size_in_bytes": 8833
},
"store": {
"size": "16.2kb",
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/rest-api/common-parms.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ Return all statistics.
<<completion-suggester,Completion suggester>> statistics.

`docs`::
Number of documents and deleted docs, which have not yet merged out.
Number of documents, number of deleted docs which have not yet merged out, and total size in bytes.
<<indices-refresh,Index refreshes>> can affect this statistic.

`fielddata`::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.startObject(Fields.DOCS);
builder.field(Fields.COUNT, count);
builder.field(Fields.DELETED, deleted);
builder.field(Fields.TOTAL_SIZE_IN_BYTES, totalSizeInBytes);
builder.endObject();
return builder;
}
Expand All @@ -102,5 +103,6 @@ static final class Fields {
static final String DOCS = "docs";
static final String COUNT = "count";
static final String DELETED = "deleted";
static final String TOTAL_SIZE_IN_BYTES = "total_size_in_bytes";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,8 @@ public void testToXContent() throws IOException {
},
"docs": {
"count": 0,
"deleted": 0
"deleted": 0,
"total_size_in_bytes": 0
},
"store": {
"size_in_bytes": 0,
Expand Down