|
5 | 5 | */
|
6 | 6 | package org.elasticsearch.xpack.ml.integration;
|
7 | 7 |
|
| 8 | +import org.elasticsearch.ResourceNotFoundException; |
8 | 9 | import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
9 | 10 | import org.elasticsearch.action.bulk.BulkResponse;
|
10 | 11 | import org.elasticsearch.action.index.IndexRequest;
|
|
14 | 15 | import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig;
|
15 | 16 | import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsSource;
|
16 | 17 | import org.elasticsearch.xpack.core.ml.dataframe.analyses.Classification;
|
| 18 | +import org.elasticsearch.xpack.core.ml.dataframe.analyses.OutlierDetection; |
17 | 19 | import org.elasticsearch.xpack.core.ml.utils.QueryProvider;
|
18 | 20 |
|
19 | 21 | import java.io.IOException;
|
20 | 22 |
|
| 23 | +import static org.hamcrest.Matchers.equalTo; |
21 | 24 | import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
22 | 25 |
|
23 | 26 | public class ExplainDataFrameAnalyticsIT extends MlNativeDataFrameAnalyticsIntegTestCase {
|
24 | 27 |
|
| 28 | + public void testExplain_GivenMissingSourceIndex() { |
| 29 | + DataFrameAnalyticsConfig config = new DataFrameAnalyticsConfig.Builder() |
| 30 | + .setSource(new DataFrameAnalyticsSource(new String[] {"missing_index"}, null, null)) |
| 31 | + .setAnalysis(new OutlierDetection.Builder().build()) |
| 32 | + .buildForExplain(); |
| 33 | + |
| 34 | + ResourceNotFoundException e = expectThrows(ResourceNotFoundException.class, () -> explainDataFrame(config)); |
| 35 | + assertThat(e.getMessage(), equalTo("cannot retrieve data because index [missing_index] does not exist")); |
| 36 | + } |
| 37 | + |
25 | 38 | public void testSourceQueryIsApplied() throws IOException {
|
26 | 39 | // To test the source query is applied when we extract data,
|
27 | 40 | // we set up a job where we have a query which excludes all but one document.
|
|
0 commit comments