|
9 | 9 | import org.apache.logging.log4j.Logger;
|
10 | 10 | import org.apache.logging.log4j.message.ParameterizedMessage;
|
11 | 11 | import org.elasticsearch.action.ActionListener;
|
| 12 | +import org.elasticsearch.common.Strings; |
12 | 13 | import org.elasticsearch.common.unit.ByteSizeUnit;
|
13 | 14 | import org.elasticsearch.common.unit.ByteSizeValue;
|
14 | 15 | import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig;
|
@@ -57,10 +58,16 @@ private MemoryUsageEstimationResult runJob(String jobId,
|
57 | 58 | DataFrameDataExtractorFactory dataExtractorFactory) {
|
58 | 59 | DataFrameDataExtractor dataExtractor = dataExtractorFactory.newExtractor(false);
|
59 | 60 | DataFrameDataExtractor.DataSummary dataSummary = dataExtractor.collectDataSummary();
|
60 |
| - Set<String> categoricalFields = dataExtractor.getCategoricalFields(config.getAnalysis()); |
61 | 61 | if (dataSummary.rows == 0) {
|
62 |
| - return new MemoryUsageEstimationResult(ByteSizeValue.ZERO, ByteSizeValue.ZERO); |
| 62 | + throw ExceptionsHelper.badRequestException( |
| 63 | + "[{}] Unable to estimate memory usage as no documents in the source indices [{}] contained all the fields selected for " |
| 64 | + + "analysis. If you are relying on automatic field selection then there are currently mapped fields that do not exist " |
| 65 | + + "in any indexed documents, and you will have to switch to explicit field selection and include only fields that " |
| 66 | + + "exist in indexed documents.", |
| 67 | + jobId, |
| 68 | + Strings.arrayToCommaDelimitedString(config.getSource().getIndex())); |
63 | 69 | }
|
| 70 | + Set<String> categoricalFields = dataExtractor.getCategoricalFields(config.getAnalysis()); |
64 | 71 | AnalyticsProcessConfig processConfig =
|
65 | 72 | new AnalyticsProcessConfig(
|
66 | 73 | jobId,
|
|
0 commit comments