|
@@ -30,6 +30,7 @@ import org.elasticsearch.ingest.IngestMetadata;
|
|
|
import org.elasticsearch.ingest.PipelineConfiguration;
|
|
|
import org.elasticsearch.test.ESTestCase;
|
|
|
import org.elasticsearch.threadpool.ThreadPool;
|
|
|
+import org.elasticsearch.xpack.core.ml.inference.results.InferenceResults;
|
|
|
import org.elasticsearch.xpack.core.ml.inference.trainedmodel.ClassificationConfig;
|
|
|
import org.elasticsearch.xpack.core.ml.inference.trainedmodel.RegressionConfig;
|
|
|
import org.junit.Before;
|
|
@@ -158,7 +159,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
|
|
|
Map<String, Object> config = new HashMap<>() {{
|
|
|
put(InferenceProcessor.FIELD_MAP, Collections.emptyMap());
|
|
|
- put(InferenceProcessor.MODEL_ID, "my_model");
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, "my_model");
|
|
|
put(InferenceProcessor.TARGET_FIELD, "result");
|
|
|
put(InferenceProcessor.INFERENCE_CONFIG, Collections.singletonMap("unknown_type", Collections.emptyMap()));
|
|
|
}};
|
|
@@ -170,7 +171,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
|
|
|
Map<String, Object> config2 = new HashMap<>() {{
|
|
|
put(InferenceProcessor.FIELD_MAP, Collections.emptyMap());
|
|
|
- put(InferenceProcessor.MODEL_ID, "my_model");
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, "my_model");
|
|
|
put(InferenceProcessor.TARGET_FIELD, "result");
|
|
|
put(InferenceProcessor.INFERENCE_CONFIG, Collections.singletonMap("regression", "boom"));
|
|
|
}};
|
|
@@ -181,7 +182,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
|
|
|
Map<String, Object> config3 = new HashMap<>() {{
|
|
|
put(InferenceProcessor.FIELD_MAP, Collections.emptyMap());
|
|
|
- put(InferenceProcessor.MODEL_ID, "my_model");
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, "my_model");
|
|
|
put(InferenceProcessor.TARGET_FIELD, "result");
|
|
|
put(InferenceProcessor.INFERENCE_CONFIG, Collections.emptyMap());
|
|
|
}};
|
|
@@ -199,7 +200,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
|
|
|
Map<String, Object> regression = new HashMap<>() {{
|
|
|
put(InferenceProcessor.FIELD_MAP, Collections.emptyMap());
|
|
|
- put(InferenceProcessor.MODEL_ID, "my_model");
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, "my_model");
|
|
|
put(InferenceProcessor.TARGET_FIELD, "result");
|
|
|
put(InferenceProcessor.INFERENCE_CONFIG,
|
|
|
Collections.singletonMap(RegressionConfig.NAME.getPreferredName(), Collections.emptyMap()));
|
|
@@ -212,7 +213,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
|
|
|
Map<String, Object> classification = new HashMap<>() {{
|
|
|
put(InferenceProcessor.FIELD_MAP, Collections.emptyMap());
|
|
|
- put(InferenceProcessor.MODEL_ID, "my_model");
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, "my_model");
|
|
|
put(InferenceProcessor.TARGET_FIELD, "result");
|
|
|
put(InferenceProcessor.INFERENCE_CONFIG, Collections.singletonMap(ClassificationConfig.NAME.getPreferredName(),
|
|
|
Collections.singletonMap(ClassificationConfig.NUM_TOP_CLASSES.getPreferredName(), 1)));
|
|
@@ -231,7 +232,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
processorFactory.accept(builderClusterStateWithModelReferences(Version.V_7_5_0, "model1"));
|
|
|
|
|
|
Map<String, Object> minimalConfig = new HashMap<>() {{
|
|
|
- put(InferenceProcessor.MODEL_ID, "my_model");
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, "my_model");
|
|
|
put(InferenceProcessor.TARGET_FIELD, "result");
|
|
|
}};
|
|
|
|
|
@@ -247,7 +248,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
|
|
|
Map<String, Object> regression = new HashMap<>() {{
|
|
|
put(InferenceProcessor.FIELD_MAP, Collections.emptyMap());
|
|
|
- put(InferenceProcessor.MODEL_ID, "my_model");
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, "my_model");
|
|
|
put(InferenceProcessor.TARGET_FIELD, "result");
|
|
|
put(InferenceProcessor.INFERENCE_CONFIG,
|
|
|
Collections.singletonMap(RegressionConfig.NAME.getPreferredName(), Collections.emptyMap()));
|
|
@@ -258,7 +259,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
|
|
|
Map<String, Object> classification = new HashMap<>() {{
|
|
|
put(InferenceProcessor.FIELD_MAP, Collections.emptyMap());
|
|
|
- put(InferenceProcessor.MODEL_ID, "my_model");
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, "my_model");
|
|
|
put(InferenceProcessor.TARGET_FIELD, "result");
|
|
|
put(InferenceProcessor.INFERENCE_CONFIG, Collections.singletonMap(ClassificationConfig.NAME.getPreferredName(),
|
|
|
Collections.singletonMap(ClassificationConfig.NUM_TOP_CLASSES.getPreferredName(), 1)));
|
|
@@ -267,7 +268,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
processorFactory.create(Collections.emptyMap(), "my_inference_processor", null, classification);
|
|
|
|
|
|
Map<String, Object> mininmal = new HashMap<>() {{
|
|
|
- put(InferenceProcessor.MODEL_ID, "my_model");
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, "my_model");
|
|
|
put(InferenceProcessor.TARGET_FIELD, "result");
|
|
|
}};
|
|
|
|
|
@@ -281,7 +282,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
|
|
|
Map<String, Object> regression = new HashMap<>() {{
|
|
|
put(InferenceProcessor.FIELD_MAP, Collections.emptyMap());
|
|
|
- put(InferenceProcessor.MODEL_ID, "my_model");
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, "my_model");
|
|
|
put(InferenceProcessor.TARGET_FIELD, "ml");
|
|
|
put(InferenceProcessor.INFERENCE_CONFIG, Collections.singletonMap(RegressionConfig.NAME.getPreferredName(),
|
|
|
Collections.singletonMap(RegressionConfig.RESULTS_FIELD.getPreferredName(), "warning")));
|
|
@@ -348,7 +349,7 @@ public class InferenceProcessorFactoryTests extends ESTestCase {
|
|
|
private static Map<String, Object> inferenceProcessorForModel(String modelId) {
|
|
|
return Collections.singletonMap(InferenceProcessor.TYPE,
|
|
|
new HashMap<>() {{
|
|
|
- put(InferenceProcessor.MODEL_ID, modelId);
|
|
|
+ put(InferenceResults.MODEL_ID_RESULTS_FIELD, modelId);
|
|
|
put(InferenceProcessor.INFERENCE_CONFIG,
|
|
|
Collections.singletonMap(RegressionConfig.NAME.getPreferredName(), Collections.emptyMap()));
|
|
|
put(InferenceProcessor.TARGET_FIELD, "new_field");
|