flush job to ensure all results have been written (#31187)

flush ml job to ensure all results have been written

fixes #31173
This commit is contained in:
Hendrik Muhs 2018-06-08 07:51:45 +02:00 committed by GitHub
parent d6a4c14e1b
commit 253b998681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -239,6 +239,9 @@ public class ForecastIT extends MlNativeAutodetectIntegTestCase {
throw e;
}
// flushing the job forces an index refresh, see https://github.com/elastic/elasticsearch/issues/31173
flushJob(job.getId(), false);
List<ForecastRequestStats> forecastStats = getForecastStats();
assertThat(forecastStats.size(), equalTo(1));
ForecastRequestStats forecastRequestStats = forecastStats.get(0);
@ -261,6 +264,16 @@ public class ForecastIT extends MlNativeAutodetectIntegTestCase {
}
closeJob(job.getId());
forecastStats = getForecastStats();
assertThat(forecastStats.size(), equalTo(2));
for (ForecastRequestStats stats : forecastStats) {
forecasts = getForecasts(job.getId(), stats);
assertThat(forecastRequestStats.getRecordCount(), equalTo(8000L));
assertThat(forecasts.size(), equalTo(8000));
}
}
private void createDataWithLotsOfClientIps(TimeValue bucketSpan, Job.Builder job) throws IOException {