Skip to content

Commit 75cabc5

Browse files
committed
[Ml Data Frame] Size the GET stats search by number of Ids requested (#43206)
Set the size of the search request to the number of ids limited by 10,000
1 parent b441113 commit 75cabc5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/persistence/DataFrameTransformsConfigManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ public void getTransformStats(Collection<String> transformIds, ActionListener<Li
335335
SearchRequest searchRequest = client.prepareSearch(DataFrameInternalIndex.INDEX_NAME)
336336
.addSort(DataFrameField.ID.getPreferredName(), SortOrder.ASC)
337337
.setQuery(builder)
338+
.setSize(Math.min(transformIds.size(), 10_000))
338339
.request();
339340

340341
executeAsyncWithOrigin(client.threadPool().getThreadContext(), DATA_FRAME_ORIGIN, searchRequest,

x-pack/plugin/data-frame/src/test/java/org/elasticsearch/xpack/dataframe/persistence/DataFrameTransformsConfigManagerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public void testStateAndStats() throws InterruptedException {
239239
}
240240

241241
public void testGetStateAndStatsMultiple() throws InterruptedException {
242-
int numStats = randomInt(5);
242+
int numStats = randomIntBetween(10, 15);
243243
List<DataFrameTransformStateAndStats> expectedStats = new ArrayList<>();
244244
for (int i=0; i<numStats; i++) {
245245
DataFrameTransformStateAndStats stat =

0 commit comments

Comments
 (0)