Skip to content

Commit

Permalink
Fix cluster level dense vector stats (#107962)
Browse files Browse the repository at this point in the history
The cluster level dense vector stats returns the total number of dense vector indices globally including the replicas.
This commit fixes the total to only include the value count of the primary indices.
This change aligns with the docs stats which also reports the number of primary documents when used in cluster stats.
The indices stats API still reports granular results for replicas and primaries so the information is not lost.
  • Loading branch information
jimczi committed Jun 18, 2024
1 parent b147d07 commit a6470fb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 4 additions & 0 deletions docs/reference/rest-api/common-parms.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@ Return all statistics.
`completion`::
<<completion-suggester,Completion suggester>> statistics.

`dense_vector`::
Total number of dense vectors indexed.
<<indices-refresh,Index refreshes>> can affect this statistic.

`docs`::
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,12 @@
---
"Dense vector stats":
- requires:
cluster_features: [ "gte_v8.10.0" ]
reason: "dense vector stats added in 8.10"
cluster_features: [ "gte_v8.15.0" ]
reason: "dense vector stats reports from primary indices in 8.15"
- do:
indices.create:
index: test1
body:
settings:
number_of_replicas: 0
mappings:
properties:
vector:
Expand All @@ -283,8 +281,6 @@
indices.create:
index: test2
body:
settings:
number_of_replicas: 0
mappings:
properties:
vector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ public ClusterStatsIndices(
if (shardStats.getShardRouting().primary()) {
indexShardStats.primaries++;
docs.add(shardCommonStats.getDocs());
denseVectorStats.add(shardCommonStats.getDenseVectorStats());
sparseVectorStats.add(shardCommonStats.getSparseVectorStats());
}
store.add(shardCommonStats.getStore());
fieldData.add(shardCommonStats.getFieldData());
queryCache.add(shardCommonStats.getQueryCache());
completion.add(shardCommonStats.getCompletion());
segments.add(shardCommonStats.getSegments());
denseVectorStats.add(shardCommonStats.getDenseVectorStats());
}

searchUsageStats.add(r.searchUsageStats());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ protected Table getTableWithHeader(final RestRequest request) {
);
table.addCell(
"dense_vector.value_count",
"alias:dvc,denseVectorCount;default:false;text-align:right;desc:total count of indexed dense vector"
"alias:dvc,denseVectorCount;default:false;text-align:right;desc:number of indexed dense vectors in shard"
);
table.addCell(
"sparse_vector.value_count",
Expand Down

0 comments on commit a6470fb

Please sign in to comment.