Skip to content

Commit

Permalink
Add model index to system index plugin (#630)
Browse files Browse the repository at this point in the history
Extends SystemIndexPlugin. Adds k-NN model system index plugin to
SystemIndexPlugin list of system index descriptors.

Signed-off-by: John Mazanec <[email protected]>
  • Loading branch information
jmazanec15 authored Dec 13, 2022
1 parent eef3f29 commit 6ba2b5d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/java/org/opensearch/knn/plugin/KNNPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.opensearch.common.ParseField;
import org.opensearch.index.codec.CodecServiceFactory;
import org.opensearch.index.engine.EngineFactory;
import org.opensearch.indices.SystemIndexDescriptor;
import org.opensearch.knn.index.KNNCircuitBreaker;
import org.opensearch.knn.index.KNNClusterUtil;
import org.opensearch.knn.index.query.KNNQueryBuilder;
Expand Down Expand Up @@ -83,6 +84,7 @@
import org.opensearch.plugins.Plugin;
import org.opensearch.plugins.ScriptPlugin;
import org.opensearch.plugins.SearchPlugin;
import org.opensearch.plugins.SystemIndexPlugin;
import org.opensearch.repositories.RepositoriesService;
import org.opensearch.rest.RestController;
import org.opensearch.rest.RestHandler;
Expand All @@ -105,6 +107,7 @@

import static java.util.Collections.singletonList;
import static org.opensearch.knn.common.KNNConstants.KNN_THREAD_POOL_PREFIX;
import static org.opensearch.knn.common.KNNConstants.MODEL_INDEX_NAME;
import static org.opensearch.knn.common.KNNConstants.TRAIN_THREAD_POOL;

/**
Expand Down Expand Up @@ -137,7 +140,15 @@
* }
*
*/
public class KNNPlugin extends Plugin implements MapperPlugin, SearchPlugin, ActionPlugin, EnginePlugin, ScriptPlugin, ExtensiblePlugin {
public class KNNPlugin extends Plugin
implements
MapperPlugin,
SearchPlugin,
ActionPlugin,
EnginePlugin,
ScriptPlugin,
ExtensiblePlugin,
SystemIndexPlugin {

public static final String LEGACY_KNN_BASE_URI = "/_opendistro/_knn";
public static final String KNN_BASE_URI = "/_plugins/_knn";
Expand Down Expand Up @@ -323,4 +334,8 @@ public List<NamedXContentRegistry.Entry> getNamedXContent() {
return entries;
}

@Override
public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings settings) {
return ImmutableList.of(new SystemIndexDescriptor(MODEL_INDEX_NAME, "Index for storing models used for k-NN indices"));
}
}

0 comments on commit 6ba2b5d

Please sign in to comment.