Package org.elasticsearch.indices
Class SystemIndices
org.elasticsearch.indices.SystemIndices
public class SystemIndices
extends
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
Modifier and TypeFieldDescriptionstatic
static
-
Constructor Summary
ConstructorDescription<,SystemIndices.Feature> pluginAndModulesDescriptors)
Initialize the SystemIndices object -
Method Summary
Modifier and TypeMethodDescriptiondataStreamAccessException(ThreadContext threadContext, <> names)
name)
Finds a single matchingSystemDataStreamDescriptor
, if any, for the given DataStream name.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
indexName)
boolean
name)
Determines whether the provided name matches that of a system data stream that has been defined by aSystemDataStreamDescriptor
boolean
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
name)
Determines whether the provided name matches that of an index that backs a system data stream.boolean
name)
Checks whether the given name matches a reserved name or pattern that is intended for use by a system component.netNewSystemIndexAccessException(ThreadContext threadContext, <> names)
static SystemIndices.Feature
pluginToFeature(SystemIndexPlugin plugin, Settings settings)
dataStreamName, ThreadContext threadContext)
static void
name, plugin)
Check that a feature name is not reservedMethods inherited from class java.lang.
, , , , , , , , , ,
-
Field Details
-
SYSTEM_INDEX_ACCESS_CONTROL_HEADER_KEY
public static final SYSTEM_INDEX_ACCESS_CONTROL_HEADER_KEY- See Also:
- Constant Field Values
-
EXTERNAL_SYSTEM_INDEX_ACCESS_CONTROL_HEADER_KEY
public static final 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
public boolean isSystemName( name)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
public boolean isSystemIndex( indexName)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
public boolean isSystemDataStream( name)Determines whether the provided name matches that of a system data stream that has been defined by aSystemDataStreamDescriptor
-
isSystemIndexBackingDataStream
public boolean isSystemIndexBackingDataStream( name)Determines whether the provided name matches that of an index that backs a system data stream. -
isNetNewSystemIndex
public boolean isNetNewSystemIndex( indexName) -
findMatchingDescriptor
@Nullable public name)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:
- if multiple descriptors match the name
-
findMatchingDataStreamDescriptor
@Nullable public name)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:
- 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 dataStreamName, ThreadContext threadContext) -
dataStreamAccessException
-
netNewSystemIndexAccessException
-
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
public static void validateFeatureName( name, plugin)Check that a feature name is not reserved- Parameters:
name
- Name of featureplugin
- Name of plugin providing the feature
-
pluginToFeature
-
getExecutorSelector
-