diff --git a/flint-core/src/main/scala/org/opensearch/flint/core/table/OpenSearchIndexTable.scala b/flint-core/src/main/scala/org/opensearch/flint/core/table/OpenSearchIndexTable.scala index d016fe9b7..783163687 100644 --- a/flint-core/src/main/scala/org/opensearch/flint/core/table/OpenSearchIndexTable.scala +++ b/flint-core/src/main/scala/org/opensearch/flint/core/table/OpenSearchIndexTable.scala @@ -57,7 +57,7 @@ class OpenSearchIndexTable(metaData: MetaData, option: FlintOptions) extends Tab if (docCount == 0) { maxResultWindow } else { - val totalSizeBytes = indexStats.total().store().sizeInBytes + val totalSizeBytes = indexStats.primaries().store().sizeInBytes val docSize = Math.ceil(totalSizeBytes / docCount).toLong Math.max(Math.min(maxSplitSizeBytes / docSize, maxResultWindow), 1).toInt } diff --git a/flint-core/src/test/scala/org/opensearch/flint/core/table/OpenSearchIndexTableSpec.scala b/flint-core/src/test/scala/org/opensearch/flint/core/table/OpenSearchIndexTableSpec.scala index a30d2de8b..9f6d045fc 100644 --- a/flint-core/src/test/scala/org/opensearch/flint/core/table/OpenSearchIndexTableSpec.scala +++ b/flint-core/src/test/scala/org/opensearch/flint/core/table/OpenSearchIndexTableSpec.scala @@ -53,9 +53,9 @@ class OpenSearchIndexTableSpec when(options.supportShard()).thenReturn(supportShard) when(openSearchClient.stats(any[IndicesStatsRequest])).thenReturn(mockIndicesStatsResp) - when(mockIndicesStatsResp.indices().get(any[String]).total().docs().count()) + when(mockIndicesStatsResp.indices().get(any[String]).primaries().docs().count()) .thenReturn(docCount) - when(mockIndicesStatsResp.indices().get(any[String]).total().store().sizeInBytes) + when(mockIndicesStatsResp.indices().get(any[String]).primaries().store().sizeInBytes) .thenReturn(storeSizeInBytes) new OpenSearchIndexTable(metaData, options) {