-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate creation of non-system dot-prefixed index names
This commit deprecates the creation of dot-prefixed index names (e.g. `.watches`) unless they are registered by a plugin that extends `SystemIndexPlugin`. This is the first step towards more thorough proections for system indices. This commit also modifies several plugins which use dot-prefixed indices to register indices they own as system indices.
- Loading branch information
Showing
12 changed files
with
191 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
server/src/main/java/org/elasticsearch/indices/SystemIndexDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.indices; | ||
|
||
/** | ||
* Describes a system index. Provides the information required to create and maintain the system index. | ||
*/ | ||
public class SystemIndexDescriptor { | ||
private final String name; | ||
private final String sourcePluginName; | ||
|
||
/** | ||
* | ||
* @param indexName The name of the system index. | ||
* @param sourcePluginName The name of the plugin responsible for this system index. | ||
*/ | ||
public SystemIndexDescriptor(String indexName, String sourcePluginName) { | ||
this.name = indexName; | ||
this.sourcePluginName = sourcePluginName; | ||
} | ||
|
||
/** | ||
* Get the name of the system index. | ||
* @return The name of the system index. | ||
*/ | ||
public String getIndexName() { | ||
return name; | ||
} | ||
|
||
/** | ||
* Get the name of the plugin responsible for this system index. It is recommended, but not required, that this is | ||
* the name of the class implementing {@link org.elasticsearch.plugins.SystemIndexPlugin}. | ||
* @return The name of the plugin responsible for this system index. | ||
*/ | ||
public String getSourcePluginName() { | ||
return sourcePluginName; | ||
} | ||
|
||
// TODO: Index settings and mapping | ||
// TODO: getThreadpool() | ||
// TODO: Upgrade handling (reindex script?) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
server/src/main/java/org/elasticsearch/plugins/SystemIndexPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.plugins; | ||
|
||
import org.elasticsearch.indices.SystemIndexDescriptor; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
/** | ||
* Plugin for defining system indices. Extends {@link ActionPlugin} because system indices must be accessed via APIs | ||
* added by the plugin that owns the system index, rather than standard APIs. | ||
*/ | ||
public interface SystemIndexPlugin extends ActionPlugin { | ||
|
||
/** | ||
* Returns a {@link Collection} of {@link SystemIndexDescriptor}s that describe this plugin's system indices, including | ||
* name, mapping, and settings. | ||
* @return Descriptions of the system indices managed by this plugin. | ||
*/ | ||
default Collection<SystemIndexDescriptor> getSystemIndexDescriptors() { | ||
return Collections.emptyList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.