From e1f761dfc7525e4c318308e84164ee39a6e2ffd0 Mon Sep 17 00:00:00 2001 From: David Kyle Date: Wed, 26 Jun 2019 16:35:14 +0100 Subject: [PATCH] [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 --- .../dataframe/persistence/DataFrameTransformsConfigManager.java | 1 + .../persistence/DataFrameTransformsConfigManagerTests.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/persistence/DataFrameTransformsConfigManager.java b/x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/persistence/DataFrameTransformsConfigManager.java index bce929e23a7..5d3a664054a 100644 --- a/x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/persistence/DataFrameTransformsConfigManager.java +++ b/x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/persistence/DataFrameTransformsConfigManager.java @@ -341,6 +341,7 @@ public class DataFrameTransformsConfigManager { SearchRequest searchRequest = client.prepareSearch(DataFrameInternalIndex.INDEX_NAME) .addSort(DataFrameField.ID.getPreferredName(), SortOrder.ASC) .setQuery(builder) + .setSize(Math.min(transformIds.size(), 10_000)) .request(); executeAsyncWithOrigin(client.threadPool().getThreadContext(), DATA_FRAME_ORIGIN, searchRequest, diff --git a/x-pack/plugin/data-frame/src/test/java/org/elasticsearch/xpack/dataframe/persistence/DataFrameTransformsConfigManagerTests.java b/x-pack/plugin/data-frame/src/test/java/org/elasticsearch/xpack/dataframe/persistence/DataFrameTransformsConfigManagerTests.java index eef5ce099b5..e7485e02e5b 100644 --- a/x-pack/plugin/data-frame/src/test/java/org/elasticsearch/xpack/dataframe/persistence/DataFrameTransformsConfigManagerTests.java +++ b/x-pack/plugin/data-frame/src/test/java/org/elasticsearch/xpack/dataframe/persistence/DataFrameTransformsConfigManagerTests.java @@ -261,7 +261,7 @@ public class DataFrameTransformsConfigManagerTests extends DataFrameSingleNodeTe } public void testGetStateAndStatsMultiple() throws InterruptedException { - int numStats = randomInt(5); + int numStats = randomIntBetween(10, 15); List expectedStats = new ArrayList<>(); for (int i=0; i