Skip to content

Commit 91f1c5b

Browse files
Register system index descriptors through SystemIndexPlugin.getSystemIndexDescriptors (opensearch-project#2586) (opensearch-project#2668)
* Register system index descriptors through SystemIndexPlugin.getSystemIndexDescriptors Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review feedback Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused imports Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused comments Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com> (cherry picked from commit 6c8720e) Co-authored-by: Craig Perkins <craig5008@gmail.com>
1 parent c8545e5 commit 91f1c5b

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

common/src/main/java/org/opensearch/ml/common/CommonValue.java

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public class CommonValue {
7474
public static final String ML_MEMORY_META_INDEX = ".plugins-ml-memory-meta";
7575
public static final Integer ML_MEMORY_META_INDEX_SCHEMA_VERSION = 1;
7676
public static final String ML_MEMORY_MESSAGE_INDEX = ".plugins-ml-memory-message";
77+
public static final String ML_STOP_WORDS_INDEX = ".plugins-ml-stop-words";
7778
public static final Set<String> stopWordsIndices = ImmutableSet.of(".plugins-ml-stop-words");
7879
public static final Integer ML_MEMORY_MESSAGE_INDEX_SCHEMA_VERSION = 1;
7980
public static final String USER_FIELD_MAPPING = " \""

plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java

+25-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55

66
package org.opensearch.ml.plugin;
77

8+
import static org.opensearch.ml.common.CommonValue.ML_AGENT_INDEX;
89
import static org.opensearch.ml.common.CommonValue.ML_CONFIG_INDEX;
910
import static org.opensearch.ml.common.CommonValue.ML_CONNECTOR_INDEX;
1011
import static org.opensearch.ml.common.CommonValue.ML_CONTROLLER_INDEX;
12+
import static org.opensearch.ml.common.CommonValue.ML_MEMORY_MESSAGE_INDEX;
13+
import static org.opensearch.ml.common.CommonValue.ML_MEMORY_META_INDEX;
14+
import static org.opensearch.ml.common.CommonValue.ML_MODEL_GROUP_INDEX;
1115
import static org.opensearch.ml.common.CommonValue.ML_MODEL_INDEX;
16+
import static org.opensearch.ml.common.CommonValue.ML_STOP_WORDS_INDEX;
1217
import static org.opensearch.ml.common.CommonValue.ML_TASK_INDEX;
1318

1419
import java.nio.file.Path;
@@ -38,6 +43,7 @@
3843
import org.opensearch.core.xcontent.NamedXContentRegistry;
3944
import org.opensearch.env.Environment;
4045
import org.opensearch.env.NodeEnvironment;
46+
import org.opensearch.indices.SystemIndexDescriptor;
4147
import org.opensearch.ml.action.agents.DeleteAgentTransportAction;
4248
import org.opensearch.ml.action.agents.GetAgentTransportAction;
4349
import org.opensearch.ml.action.agents.TransportRegisterAgentAction;
@@ -284,6 +290,7 @@
284290
import org.opensearch.plugins.Plugin;
285291
import org.opensearch.plugins.SearchPipelinePlugin;
286292
import org.opensearch.plugins.SearchPlugin;
293+
import org.opensearch.plugins.SystemIndexPlugin;
287294
import org.opensearch.repositories.RepositoriesService;
288295
import org.opensearch.rest.RestController;
289296
import org.opensearch.rest.RestHandler;
@@ -310,7 +317,8 @@ public class MachineLearningPlugin extends Plugin
310317
SearchPlugin,
311318
SearchPipelinePlugin,
312319
ExtensiblePlugin,
313-
IngestPlugin {
320+
IngestPlugin,
321+
SystemIndexPlugin {
314322
public static final String ML_THREAD_POOL_PREFIX = "thread_pool.ml_commons.";
315323
public static final String GENERAL_THREAD_POOL = "opensearch_ml_general";
316324
public static final String EXECUTE_THREAD_POOL = "opensearch_ml_execute";
@@ -1017,4 +1025,20 @@ public Map<String, org.opensearch.ingest.Processor.Factory> getProcessors(org.op
10171025
);
10181026
return Collections.unmodifiableMap(processors);
10191027
}
1028+
1029+
@Override
1030+
public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings settings) {
1031+
List<SystemIndexDescriptor> systemIndexDescriptors = new ArrayList<>();
1032+
systemIndexDescriptors.add(new SystemIndexDescriptor(ML_AGENT_INDEX, "ML Commons Agent Index"));
1033+
systemIndexDescriptors.add(new SystemIndexDescriptor(ML_CONFIG_INDEX, "ML Commons Configuration Index"));
1034+
systemIndexDescriptors.add(new SystemIndexDescriptor(ML_CONNECTOR_INDEX, "ML Commons Connector Index"));
1035+
systemIndexDescriptors.add(new SystemIndexDescriptor(ML_CONTROLLER_INDEX, "ML Commons Controller Index"));
1036+
systemIndexDescriptors.add(new SystemIndexDescriptor(ML_MODEL_GROUP_INDEX, "ML Commons Model Group Index"));
1037+
systemIndexDescriptors.add(new SystemIndexDescriptor(ML_MODEL_INDEX, "ML Commons Model Index"));
1038+
systemIndexDescriptors.add(new SystemIndexDescriptor(ML_TASK_INDEX, "ML Commons Task Index"));
1039+
systemIndexDescriptors.add(new SystemIndexDescriptor(ML_MEMORY_META_INDEX, "ML Commons Memory Meta Index"));
1040+
systemIndexDescriptors.add(new SystemIndexDescriptor(ML_MEMORY_MESSAGE_INDEX, "ML Commons Memory Message Index"));
1041+
systemIndexDescriptors.add(new SystemIndexDescriptor(ML_STOP_WORDS_INDEX, "ML Commons Stop Words Index"));
1042+
return systemIndexDescriptors;
1043+
}
10201044
}

0 commit comments

Comments
 (0)