|
@@ -12,6 +12,7 @@ import org.elasticsearch.cluster.service.ClusterService;
|
|
|
import org.elasticsearch.common.inject.Inject;
|
|
|
import org.elasticsearch.common.unit.ByteSizeUnit;
|
|
|
import org.elasticsearch.common.unit.ByteSizeValue;
|
|
|
+import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
|
|
import org.elasticsearch.tasks.Task;
|
|
|
import org.elasticsearch.transport.TransportService;
|
|
|
import org.elasticsearch.xpack.core.ml.MachineLearningField;
|
|
@@ -19,9 +20,12 @@ import org.elasticsearch.xpack.core.ml.MlMetadata;
|
|
|
import org.elasticsearch.xpack.core.ml.action.MlInfoAction;
|
|
|
import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig;
|
|
|
import org.elasticsearch.xpack.core.ml.job.config.AnalysisLimits;
|
|
|
+import org.elasticsearch.xpack.core.ml.job.config.CategorizationAnalyzerConfig;
|
|
|
import org.elasticsearch.xpack.core.ml.job.config.Job;
|
|
|
import org.elasticsearch.xpack.ml.process.MlControllerHolder;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.TimeoutException;
|
|
@@ -29,13 +33,15 @@ import java.util.concurrent.TimeoutException;
|
|
|
public class TransportMlInfoAction extends HandledTransportAction<MlInfoAction.Request, MlInfoAction.Response> {
|
|
|
|
|
|
private final ClusterService clusterService;
|
|
|
+ private final NamedXContentRegistry xContentRegistry;
|
|
|
private final Map<String, Object> nativeCodeInfo;
|
|
|
|
|
|
@Inject
|
|
|
- public TransportMlInfoAction(TransportService transportService, ActionFilters actionFilters,
|
|
|
- ClusterService clusterService, MlControllerHolder mlControllerHolder) {
|
|
|
+ public TransportMlInfoAction(TransportService transportService, ActionFilters actionFilters, ClusterService clusterService,
|
|
|
+ NamedXContentRegistry xContentRegistry, MlControllerHolder mlControllerHolder) {
|
|
|
super(MlInfoAction.NAME, transportService, actionFilters, MlInfoAction.Request::new);
|
|
|
this.clusterService = clusterService;
|
|
|
+ this.xContentRegistry = xContentRegistry;
|
|
|
|
|
|
try {
|
|
|
nativeCodeInfo = mlControllerHolder.getMlController().getNativeCodeInfo();
|
|
@@ -70,6 +76,13 @@ public class TransportMlInfoAction extends HandledTransportAction<MlInfoAction.R
|
|
|
defaults.put(AnalysisLimits.MODEL_MEMORY_LIMIT.getPreferredName(), defaultModelMemoryLimit());
|
|
|
defaults.put(AnalysisLimits.CATEGORIZATION_EXAMPLES_LIMIT.getPreferredName(), AnalysisLimits.DEFAULT_CATEGORIZATION_EXAMPLES_LIMIT);
|
|
|
defaults.put(Job.MODEL_SNAPSHOT_RETENTION_DAYS.getPreferredName(), Job.DEFAULT_MODEL_SNAPSHOT_RETENTION_DAYS);
|
|
|
+ try {
|
|
|
+ defaults.put(CategorizationAnalyzerConfig.CATEGORIZATION_ANALYZER.getPreferredName(),
|
|
|
+ CategorizationAnalyzerConfig.buildDefaultCategorizationAnalyzer(Collections.emptyList())
|
|
|
+ .asMap(xContentRegistry).get(CategorizationAnalyzerConfig.CATEGORIZATION_ANALYZER.getPreferredName()));
|
|
|
+ } catch (IOException e) {
|
|
|
+ logger.error("failed to convert default categorization analyzer to map", e);
|
|
|
+ }
|
|
|
return defaults;
|
|
|
}
|
|
|
|