Module org.elasticsearch.security
Class SecurityIndexManager
java.lang.Object
org.elasticsearch.xpack.security.support.SecurityIndexManager
- All Implemented Interfaces:
ClusterStateListener
Manages the lifecycle, mapping and data upgrades/migrations of the
RestrictedIndicesNames#SECURITY_MAIN_ALIAS
and RestrictedIndicesNames#SECURITY_MAIN_ALIAS alias-index pair.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhen checking availability, check for availability of search or availability of all primariesclassstatic enumstatic enum -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStateListener(TriConsumer<ProjectId, SecurityIndexManager.IndexState, SecurityIndexManager.IndexState> listener) Add a listener for notifications on state changes to the configured index.static SecurityIndexManagerbuildSecurityIndexManager(Client client, ClusterService clusterService, FeatureService featureService, ProjectResolver projectResolver, SystemIndexDescriptor descriptor) voidRetrieves the project scoped index state for thecurrent project.static intgetMigrationVersionFromIndexMetadata(IndexMetadata indexMetadata) getProject(ProjectId project) Retrieves the project scoped index state.static booleanisIndexDeleted(SecurityIndexManager.IndexState previousState, SecurityIndexManager.IndexState currentState) Return true if the state moves from the index existing to the index not existing.static booleanisMoveFromRedToNonRed(SecurityIndexManager.IndexState previousState, SecurityIndexManager.IndexState currentState) Return true if the state moves from an unhealthy ("RED") index state to a healthy ("non-RED") state.voidremoveStateListener(TriConsumer<ProjectId, SecurityIndexManager.IndexState, SecurityIndexManager.IndexState> listener) Remove a listener from notifications on state changes to the configured index.static IndexMetadataresolveConcreteIndex(String indexOrAliasName, ProjectMetadata project) Resolves a concrete index name or alias to aIndexMetadatainstance.voidwhenProjectStateAvailable(ProjectId targetProject, Consumer<SecurityIndexManager.IndexState> stateConsumer)
-
Field Details
-
SECURITY_VERSION_STRING
- See Also:
-
FILE_SETTINGS_METADATA_NAMESPACE
- See Also:
-
-
Method Details
-
buildSecurityIndexManager
public static SecurityIndexManager buildSecurityIndexManager(Client client, ClusterService clusterService, FeatureService featureService, ProjectResolver projectResolver, SystemIndexDescriptor descriptor) -
forCurrentProject
Retrieves the project scoped index state for thecurrent project.- See Also:
-
getProject
Retrieves the project scoped index state. This is a point-in-time copy of the current state of the index in that project. Its internal representation will not change even if the index's underlying state changes in the cluster metadata. -
aliasName
-
addStateListener
public void addStateListener(TriConsumer<ProjectId, SecurityIndexManager.IndexState, SecurityIndexManager.IndexState> listener) Add a listener for notifications on state changes to the configured index. The previous and current state are provided. -
removeStateListener
public void removeStateListener(TriConsumer<ProjectId, SecurityIndexManager.IndexState, SecurityIndexManager.IndexState> listener) Remove a listener from notifications on state changes to the configured index. -
clusterChanged
- Specified by:
clusterChangedin interfaceClusterStateListener
-
getMigrationVersionFromIndexMetadata
-
whenProjectStateAvailable
public void whenProjectStateAvailable(ProjectId targetProject, Consumer<SecurityIndexManager.IndexState> stateConsumer) -
resolveConcreteIndex
Resolves a concrete index name or alias to aIndexMetadatainstance. Requires that if supplied with an alias, the alias resolves to at most one concrete index. -
isMoveFromRedToNonRed
public static boolean isMoveFromRedToNonRed(SecurityIndexManager.IndexState previousState, SecurityIndexManager.IndexState currentState) Return true if the state moves from an unhealthy ("RED") index state to a healthy ("non-RED") state. -
isIndexDeleted
public static boolean isIndexDeleted(SecurityIndexManager.IndexState previousState, SecurityIndexManager.IndexState currentState) Return true if the state moves from the index existing to the index not existing.
-