java.lang.Object
org.elasticsearch.cluster.metadata.ProjectMetadata
- All Implemented Interfaces:
Iterable<IndexMetadata>,Diffable<ProjectMetadata>,Writeable,ChunkedToXContent
public class ProjectMetadata
extends Object
implements Iterable<IndexMetadata>, Diffable<ProjectMetadata>, ChunkedToXContent
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
EMPTY -
Method Summary
Modifier and TypeMethodDescriptionaliasedIndices(String aliasName) Returns all the indices that the alias with the provided alias name refers to.static ProjectMetadata.Builderstatic ProjectMetadata.Builderbuilder(ProjectMetadata projectMetadata) copyAndUpdate(Consumer<ProjectMetadata.Builder> updater) <T extends Metadata.ProjectCustom>
T<T extends Metadata.ProjectCustom>
Tcustoms()Return a map of DataStreamAlias objects by DataStream nameorg.elasticsearch.cluster.metadata.ProjectMetadata.ProjectMetadataDiffdiff(ProjectMetadata previousState) Returns serializable object representing differences between this and previousStatebooleanequalsAliases(ProjectMetadata other) findAliases(String[] aliases, String[] concreteIndices) Finds the specific index aliases that match with the specified aliases directly or partially via wildcards, and that point to the specified concrete indices (directly or matching indices via wildcards).findAllAliases(String[] concreteIndices) Finds the specific index aliases that point to the requested concrete indices directly or that match with the indices via wildcards.findDataStreamAliases(String[] aliases, String[] dataStreams) Finds the specific data stream aliases that match with the specified aliases directly or partially via wildcards, and that point to the specified data streams (directly or matching data streams via wildcards).findDataStreams(String... concreteIndices) Finds the parent data streams, if any, for the specified concrete indices.findMappings(String[] concreteIndices, Function<String, ? extends Predicate<String>> fieldFilter, Runnable onNextIndex) Finds all mappings for concrete indices.String[]Returns all of the concrete indices that are closed.String[]Returns all the concrete indices.String[]Returns all of the concrete indices that are open.String[]Returns all of the concrete indices that are closed and not hidden.String[]Returns all the concrete indices that are not hidden.String[]Returns all of the concrete indices that are open and not hidden.getIndexSafe(Index index) Returns theIndexMetadatafor this index.intGets the total number of shards from all indices, including replicas and closed indices.intGets the total number of open shards from all indices.booleanReturns whether an alias exists with provided alias name.booleanChecks whether an index exists (as of thisProjectMetadatawith the given name.booleanChecks whether an index exists.booleanhasIndexAbstraction(String index) Checks whether an index abstraction (that is, index, alias, or data stream) exists (as of thisMetadatawith the given name.booleanhasIndexMetadata(IndexMetadata indexMetadata) Returns true iff existing index has the sameIndexMetadatainstanceid()The collection of index deletions in the cluster.booleanindexIsADataStream(String indexName) Checks whether the provided index is a data stream.indices()booleanbooleanisIndexManagedByILM(IndexMetadata indexMetadata) Indicates if the provided index is managed by ILM.iterator()static ProjectMetadatareadFrom(StreamInput in) resolveIndexRouting(String routing, String aliasOrIndex) Returns indexing routing for the given index.resolveWriteIndexRouting(String routing, String aliasOrIndex) Returns indexing routing for the givenaliasOrIndex.retrieveIndexModeFromTemplate(ComposableIndexTemplate indexTemplate) booleansameIndicesLookup(ProjectMetadata other) intsize()stream()toString()Iterator<? extends ToXContent> Create an iterator ofToXContentchunks for a REST response.withAddedIndex(IndexMetadata index) Creates a copy of this instance with the givenindexadded.Creates a copy of this instance updated with the givenIndexMetadatathat must only contain changes to primary terms and in-sync allocation ids relative to the existing entries.withIndexSettingsUpdates(Map<Index, Settings> updates) withLifecycleState(Index index, LifecycleExecutionState lifecycleState) Given an index and lifecycle state, returns a metadata where the lifecycle state will be associated with the given index.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
isFragment, toXContentChunked, toXContentChunkedV8Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
PROJECT_UNDER_DELETION_BLOCK
-
-
Method Details
-
withLifecycleState
Given an index and lifecycle state, returns a metadata where the lifecycle state will be associated with the given index. The passed-in index must already be present in the cluster state, this method cannot be used to add an index.- Parameters:
index- A non-null indexlifecycleState- A non-null lifecycle execution state- Returns:
- a
Metadatainstance where the index has the provided lifecycle state
-
withIndexSettingsUpdates
-
withAllocationAndTermUpdatesOnly
Creates a copy of this instance updated with the givenIndexMetadatathat must only contain changes to primary terms and in-sync allocation ids relative to the existing entries. This method is only used byIndexMetadataUpdater.applyChanges(Metadata, GlobalRoutingTable).- Parameters:
updates- map of index name toIndexMetadata.- Returns:
- updated metadata instance
-
withAddedIndex
Creates a copy of this instance with the givenindexadded.- Parameters:
index- index to add- Returns:
- copy with added index
-
id
- Returns:
- The identifier of this project
-
toString
-
hasIndex
Checks whether an index exists (as of thisProjectMetadatawith the given name. Does not check aliases or data streams.- Parameters:
index- An index name that may or may not exist in the cluster.- Returns:
trueif a concrete index with that name exists,falseotherwise.
-
hasIndex
Checks whether an index exists. Similar tohasIndex(String), but ensures that the index has the same UUID as the givenIndex.- Parameters:
index- AnIndexobject that may or may not exist in the cluster.- Returns:
trueif an index exists with the same name and UUID as the given index object,falseotherwise.
-
hasIndexMetadata
Returns true iff existing index has the sameIndexMetadatainstance -
hasIndexAbstraction
Checks whether an index abstraction (that is, index, alias, or data stream) exists (as of thisMetadatawith the given name.- Parameters:
index- An index name that may or may not exist in the cluster.- Returns:
trueif an index abstraction with that name exists,falseotherwise.
-
index
-
index
-
indexGraveyard
The collection of index deletions in the cluster. -
getIndexSafe
Returns theIndexMetadatafor this index.- Throws:
IndexNotFoundException- if no metadata for this index is found
-
getIndicesLookup
-
sameIndicesLookup
-
hasAlias
Returns whether an alias exists with provided alias name.- Parameters:
aliasName- The provided alias name- Returns:
- whether an alias exists with provided alias name
-
findAllAliases
Finds the specific index aliases that point to the requested concrete indices directly or that match with the indices via wildcards.- Parameters:
concreteIndices- The concrete indices that the aliases must point to in order to be returned.- Returns:
- A map of index name to the list of aliases metadata. If a concrete index does not have matching aliases then the result will not include the index's key.
-
findAliases
Finds the specific index aliases that match with the specified aliases directly or partially via wildcards, and that point to the specified concrete indices (directly or matching indices via wildcards).- Parameters:
aliases- The aliases to look for. Might contain include or exclude wildcards.concreteIndices- The concrete indices that the aliases must point to in order to be returned- Returns:
- A map of index name to the list of aliases metadata. If a concrete index does not have matching aliases then the result will not include the index's key.
-
aliasedIndices
Returns all the indices that the alias with the provided alias name refers to. These are aliased indices. Not that, this only return indices that have been aliased and not indices that are behind a data stream or data stream alias.- Parameters:
aliasName- The provided alias name- Returns:
- all aliased indices by the alias with the provided alias name
-
aliasedIndices
- Returns:
- the names of all indices aliases.
-
equalsAliases
-
findMappings
public Map<String,MappingMetadata> findMappings(String[] concreteIndices, Function<String, ? extends Predicate<String>> fieldFilter, Runnable onNextIndex) Finds all mappings for concrete indices. Only fields that match the provided field filter will be returned (default is a predicate that always returns true, which can be overridden via plugins)- Parameters:
onNextIndex- a hook that gets notified for each index that's processed- See Also:
-
getMappingsByHash
-
indices
-
templates
-
indexIsADataStream
Checks whether the provided index is a data stream. -
getTotalNumberOfShards
public int getTotalNumberOfShards()Gets the total number of shards from all indices, including replicas and closed indices. -
getTotalOpenIndexShards
public int getTotalOpenIndexShards()Gets the total number of open shards from all indices. Includes replicas, but does not include shards that are part of closed indices. -
getConcreteAllIndices
Returns all the concrete indices. -
getConcreteVisibleIndices
Returns all the concrete indices that are not hidden. -
getConcreteAllOpenIndices
Returns all of the concrete indices that are open. -
getConcreteVisibleOpenIndices
Returns all of the concrete indices that are open and not hidden. -
getConcreteAllClosedIndices
Returns all of the concrete indices that are closed. -
getConcreteVisibleClosedIndices
Returns all of the concrete indices that are closed and not hidden. -
indicesLookupInitialized
public boolean indicesLookupInitialized() -
oldestIndexVersion
-
resolveWriteIndexRouting
Returns indexing routing for the givenaliasOrIndex. Resolves routing from the alias metadata used in the write index. -
resolveIndexRouting
Returns indexing routing for the given index. -
iterator
- Specified by:
iteratorin interfaceIterable<IndexMetadata>
-
stream
-
size
public int size() -
custom
-
custom
-
customs
-
reservedStateMetadata
-
dataStreams
-
dataStreamAliases
-
dataStreamAliasesByDataStream
Return a map of DataStreamAlias objects by DataStream name -
findDataStreams
Finds the parent data streams, if any, for the specified concrete indices. -
findDataStreamAliases
public Map<String,List<DataStreamAlias>> findDataStreamAliases(String[] aliases, String[] dataStreams) Finds the specific data stream aliases that match with the specified aliases directly or partially via wildcards, and that point to the specified data streams (directly or matching data streams via wildcards).- Parameters:
aliases- The aliases to look for. Might contain include or exclude wildcards.dataStreams- The data streams that the aliases must point to in order to be returned- Returns:
- A map of data stream name to the list of DataStreamAlias objects that match. If a data stream does not have matching aliases then the result will not include the data stream's key.
-
componentTemplates
-
templatesV2
-
retrieveIndexModeFromTemplate
-
isIndexManagedByILM
Indicates if the provided index is managed by ILM. This takes into account if the index is part of data stream that's potentially managed by data stream lifecycle and the value of theIndexSettings.PREFER_ILM_SETTING -
getSecret
-
builder
-
builder
-
copyAndUpdate
-
toXContentChunked
Description copied from interface:ChunkedToXContentCreate an iterator ofToXContentchunks for a REST response. Each chunk is serialized with the sameXContentBuilderandToXContent.Params, which is also the same as theToXContent.Paramspassed as theparamsargument. For best results, all chunks should beO(1)size. The last chunk in the iterator must always yield at least one byte of output. See alsoChunkedToXContentHelperfor some handy utilities.Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.
- Specified by:
toXContentChunkedin interfaceChunkedToXContent- Returns:
- iterator over chunks of
ToXContent
-
readFrom
- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
diff
public org.elasticsearch.cluster.metadata.ProjectMetadata.ProjectMetadataDiff diff(ProjectMetadata previousState) Description copied from interface:DiffableReturns serializable object representing differences between this and previousState- Specified by:
diffin interfaceDiffable<ProjectMetadata>
-