Package org.elasticsearch.indices
Class SystemIndices
java.lang.Object
org.elasticsearch.indices.SystemIndices
This class holds the
SystemIndexDescriptor
objects that represent system indices the
node knows about. Methods for determining if an index should be a system index are also provided
to reduce the locations within the code that need to deal with SystemIndexDescriptor
s.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class holding a description of a stateful feature.static class
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSystemIndices(Map<String,SystemIndices.Feature> pluginAndModulesDescriptors)
Initialize the SystemIndices object -
Method Summary
Modifier and TypeMethodDescriptiondataStreamAccessException(ThreadContext threadContext, Collection<String> names)
Finds a single matchingSystemDataStreamDescriptor
, if any, for the given DataStream name.findMatchingDescriptor(String name)
Finds a single matchingSystemIndexDescriptor
, if any, for the given index name.getProductSystemIndexMetadataPredicate(ThreadContext threadContext)
Builds a predicate that tests if a system index should be accessible based on the provided product name contained in headers.getProductSystemIndexNamePredicate(ThreadContext threadContext)
Builds a predicate that tests if a system index name should be accessible based on the provided product name contained in headers.getSystemIndexAccessLevel(ThreadContext threadContext)
Determines what level of system index access should be allowed in the current context.boolean
isNetNewSystemIndex(String indexName)
boolean
isSystemDataStream(String name)
Determines whether the provided name matches that of a system data stream that has been defined by aSystemDataStreamDescriptor
boolean
isSystemIndex(String indexName)
Determines whether a given index is a system index by comparing its name to the collection of loadedSystemIndexDescriptor
s.boolean
isSystemIndex(Index index)
Determines whether a given index is a system index by comparing its name to the collection of loadedSystemIndexDescriptor
sboolean
Determines whether the provided name matches that of an index that backs a system data stream.boolean
isSystemName(String name)
Checks whether the given name matches a reserved name or pattern that is intended for use by a system component.netNewSystemIndexAccessException(ThreadContext threadContext, Collection<String> names)
static SystemIndices.Feature
pluginToFeature(SystemIndexPlugin plugin, Settings settings)
validateDataStreamAccess(String dataStreamName, ThreadContext threadContext)
static void
validateFeatureName(String name, String plugin)
Check that a feature name is not reserved
-
Field Details
-
SYSTEM_INDEX_ACCESS_CONTROL_HEADER_KEY
- See Also:
- Constant Field Values
-
EXTERNAL_SYSTEM_INDEX_ACCESS_CONTROL_HEADER_KEY
- See Also:
- Constant Field Values
-
-
Constructor Details
-
SystemIndices
Initialize the SystemIndices object- Parameters:
pluginAndModulesDescriptors
- A map of this node's feature names to feature objects.
-
-
Method Details
-
isSystemName
Checks whether the given name matches a reserved name or pattern that is intended for use by a system component. The name is checked against index names, aliases, data stream names, and the names of indices that back a system data stream. -
isSystemIndex
Determines whether a given index is a system index by comparing its name to the collection of loadedSystemIndexDescriptor
s- Parameters:
index
- theIndex
object to check against loadedSystemIndexDescriptor
s- Returns:
- true if the
Index
's name matches a pattern from aSystemIndexDescriptor
-
isSystemIndex
Determines whether a given index is a system index by comparing its name to the collection of loadedSystemIndexDescriptor
s. This will also match alias names that belong to system indices.- Parameters:
indexName
- the index name to check against loadedSystemIndexDescriptor
s- Returns:
- true if the index name matches a pattern from a
SystemIndexDescriptor
-
isSystemDataStream
Determines whether the provided name matches that of a system data stream that has been defined by aSystemDataStreamDescriptor
-
isSystemIndexBackingDataStream
Determines whether the provided name matches that of an index that backs a system data stream. -
isNetNewSystemIndex
-
findMatchingDescriptor
Finds a single matchingSystemIndexDescriptor
, if any, for the given index name.- Parameters:
name
- the name of the index- Returns:
- The matching
SystemIndexDescriptor
ornull
if no descriptor is found - Throws:
IllegalStateException
- if multiple descriptors match the name
-
findMatchingDataStreamDescriptor
Finds a single matchingSystemDataStreamDescriptor
, if any, for the given DataStream name.- Parameters:
name
- the name of the DataStream- Returns:
- The matching
SystemDataStreamDescriptor
ornull
if no descriptor is found - Throws:
IllegalStateException
- if multiple descriptors match the name
-
getProductSystemIndexMetadataPredicate
Builds a predicate that tests if a system index should be accessible based on the provided product name contained in headers.- Parameters:
threadContext
- the threadContext containing headers used for system index access- Returns:
- Predicate to check external system index metadata with
-
getProductSystemIndexNamePredicate
Builds a predicate that tests if a system index name should be accessible based on the provided product name contained in headers.- Parameters:
threadContext
- the threadContext containing headers used for system index access- Returns:
- Predicate to check external system index names with
-
getFeatures
-
validateDataStreamAccess
public SystemDataStreamDescriptor validateDataStreamAccess(String dataStreamName, ThreadContext threadContext) -
dataStreamAccessException
public IllegalArgumentException dataStreamAccessException(ThreadContext threadContext, Collection<String> names) -
netNewSystemIndexAccessException
public IllegalArgumentException netNewSystemIndexAccessException(ThreadContext threadContext, Collection<String> names) -
getSystemIndexAccessLevel
Determines what level of system index access should be allowed in the current context.- Returns:
SystemIndices.SystemIndexAccessLevel.ALL
if unrestricted system index access should be allowed,SystemIndices.SystemIndexAccessLevel.RESTRICTED
if a subset of system index access should be allowed, orSystemIndices.SystemIndexAccessLevel.NONE
if no system index access should be allowed.
-
validateFeatureName
Check that a feature name is not reserved- Parameters:
name
- Name of featureplugin
- Name of plugin providing the feature
-
pluginToFeature
-
getExecutorSelector
-