diff --git a/docs/reference/cluster/stats.asciidoc b/docs/reference/cluster/stats.asciidoc index 26b3553c3c17f..0dd73219cd1cf 100644 --- a/docs/reference/cluster/stats.asciidoc +++ b/docs/reference/cluster/stats.asciidoc @@ -227,6 +227,10 @@ 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. + +`total_size`:: +(string) +Total size across all primary shards assigned to selected nodes, as a human-readable string. ===== `store`:: @@ -1600,6 +1604,7 @@ The API returns the following response: "count": 10, "deleted": 0, "total_size_in_bytes": 8833 + "total_size": "8.6kb" }, "store": { "size": "16.2kb", diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.stats/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.stats/10_basic.yml index 283125832254e..9e9461186fc2f 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.stats/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.stats/10_basic.yml @@ -33,13 +33,13 @@ --- "cluster stats with human flag returns docs as human readable size": - requires: + test_runner_features: [capabilities] capabilities: - method: GET path: /_cluster/stats capabilities: - "human-readable-total-docs-size" - test_runner_feature: [capabilities] - reason: Capability required to run test + reason: "Capability required to run test" - do: index: @@ -53,8 +53,8 @@ cluster.stats: human: true - - is_true: indices.docs.total_size_in_bytes - - is_true: indices.docs.total_size + - exists: indices.docs.total_size_in_bytes + - exists: indices.docs.total_size --- "get cluster stats returns cluster_uuid at the top level": diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndicesStatsMonitoringDocTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndicesStatsMonitoringDocTests.java index c6f02637a8bde..0d1a0374d4fc3 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndicesStatsMonitoringDocTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndicesStatsMonitoringDocTests.java @@ -180,7 +180,7 @@ public void testToXContent() throws IOException { private CommonStats mockCommonStats() { final CommonStats commonStats = new CommonStats(CommonStatsFlags.ALL); - commonStats.getDocs().add(new DocsStats(1L, 0L, randomNonNegativeLong())); + commonStats.getDocs().add(new DocsStats(1L, 0L, randomNonNegativeLong() >> 8)); // >> 8 to avoid overflow - we add these things up commonStats.getStore().add(new StoreStats(2L, 0L, 0L)); final IndexingStats.Stats indexingStats = new IndexingStats.Stats(3L, 4L, 0L, 0L, 0L, 0L, 0L, 0L, true, 5L, 0, 0);