Class Metadata
org.elasticsearch.cluster.metadata.Metadata
- All Implemented Interfaces:
<IndexMetadata>
,Diffable<Metadata>
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
public class Metadata
extends
implements <IndexMetadata>, Diffable<Metadata>, org.elasticsearch.common.xcontent.ToXContentFragment
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
static interface
static class
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic
static <Metadata.XContentContext>
Indicates that this custom metadata will be returned as part of an API call, stored as a part of a snapshot global state, and will be persisted between node restartsstatic <Metadata.XContentContext>
Indicates that this custom metadata will be returned as part of an API call and will be persisted between node restarts, but will not be a part of a snapshot global statestatic <Metadata.XContentContext>
Indicates that this custom metadata will be returned as part of an API call and stored as a part of a snapshot global state, but will not be persisted between node restartsstatic <Metadata.XContentContext>
Indicates that this custom metadata will be returned as part of an API call but will not be persistedstatic ClusterBlock
static ClusterBlock
static
static
static
static
static Metadata
static MetadataStateFormat<Metadata>
State format forMetadata
to write to and load from diskstatic
static
static >
static >
static
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Method Summary
Modifier and TypeMethodDescriptionstatic Metadata.Builder
builder()
static Metadata.Builder
boolean
Whether the current node with the given cluster state is locked into the cluster with the UUID returned byclusterUUID()
, meaning that it will not accept any cluster state with a different clusterUUID.<T extends Metadata.Custom>
Ttype)
<T extends Metadata.Custom>
Ttype, T defaultValue)
customs()
<,DataStreamAlias>
<,DataStream>
Returns serializable object representing differences between this and previousStateboolean
equalsAliases(Metadata other)
,<AliasMetadata>>
findAliases(AliasesRequest aliasesRequest, [] 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).,<AliasMetadata>>
[] concreteIndices)
Finds the specific index aliases that point to the requested concrete indices directly or that match with the indices via wildcards.[] concreteIndices)
Finds the parent data streams, if any, for the specified concrete indices.,,MappingMetadata>>
[] concreteIndices, [] types, <,<>> fieldFilter, onNextIndex)
Finds all mappings for types and concrete indices.static Metadata
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
[]
Returns all of the concrete indices that are closed.[]
Returns all the concrete indices.[]
Returns all of the concrete indices that are open.[]
Returns all of the concrete indices that are closed and not hidden.[]
Returns all the concrete indices that are not hidden.[]
Returns all of the concrete indices that are open and not hidden.getIndexSafe(Index index)
Returns theIndexMetadata
for this index.<,IndexAbstraction>
int
Gets the total number of shards from all indices, including replicas and closed indices.int
Gets the total number of open shards from all indices.boolean
alias)
boolean
[] aliases, [] concreteIndices)
Checks if at least one of the specified aliases exists in the specified concrete indices.boolean
index)
<,>
boolean
index)
boolean
boolean
hasIndexMetadata(IndexMetadata indexMetadata)
Returns true iff existing index has the sameIndexMetadata
instanceindex)
The collection of index deletions in the cluster.indices()
static boolean
[] types)
Identifies whether the array containing type names given as argument refers to all types The empty or null array identifies all typesstatic boolean
[] types)
Identifies whether the array containing type names given as argument explicitly refers to all types The empty or null array doesn't explicitly map to all typesstatic boolean
isGlobalStateEquals(Metadata metadata1, Metadata metadata2)
iterator()
readDiffFrom(StreamInput in)
static Metadata
readFrom(StreamInput in)
routing, aliasOrIndex)
Returns indexing routing for the given index.routing, aliasOrIndex)
Returns indexing routing for the givenaliasOrIndex
.boolean
concreteIndex)
settings()
Returns the merged transient and persistent settings.static Metadata
Reconciles the cluster state metadata taken at the end of a snapshot with the data streams and indices contained in the snapshot.org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
long
version()
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class java.lang.
, , , , , , , , , ,
Methods inherited from interface java.lang.
,
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
ON_NEXT_INDEX_FIND_MAPPINGS_NOOP
public static final ON_NEXT_INDEX_FIND_MAPPINGS_NOOP -
ALL
public static final ALL- See Also:
- Constant Field Values
-
UNKNOWN_CLUSTER_UUID
public static final UNKNOWN_CLUSTER_UUID- See Also:
- Constant Field Values
-
API_ONLY
Indicates that this custom metadata will be returned as part of an API call but will not be persisted -
API_AND_GATEWAY
Indicates that this custom metadata will be returned as part of an API call and will be persisted between node restarts, but will not be a part of a snapshot global state -
API_AND_SNAPSHOT
Indicates that this custom metadata will be returned as part of an API call and stored as a part of a snapshot global state, but will not be persisted between node restarts -
ALL_CONTEXTS
Indicates that this custom metadata will be returned as part of an API call, stored as a part of a snapshot global state, and will be persisted between node restarts -
SETTING_READ_ONLY_SETTING
public static final > SETTING_READ_ONLY_SETTING -
CLUSTER_READ_ONLY_BLOCK
-
SETTING_READ_ONLY_ALLOW_DELETE_SETTING
public static final > SETTING_READ_ONLY_ALLOW_DELETE_SETTING -
CLUSTER_READ_ONLY_ALLOW_DELETE_BLOCK
-
EMPTY_METADATA
-
CONTEXT_MODE_PARAM
public static final CONTEXT_MODE_PARAM- See Also:
- Constant Field Values
-
CONTEXT_MODE_SNAPSHOT
public static final CONTEXT_MODE_SNAPSHOT -
CONTEXT_MODE_GATEWAY
public static final CONTEXT_MODE_GATEWAY -
CONTEXT_MODE_API
public static final CONTEXT_MODE_API -
GLOBAL_STATE_FILE_PREFIX
public static final GLOBAL_STATE_FILE_PREFIX- See Also:
- Constant Field Values
-
FORMAT
State format forMetadata
to write to and load from disk
-
-
Method Details
-
version
public long version() -
clusterUUID
public clusterUUID() -
clusterUUIDCommitted
public boolean clusterUUIDCommitted()Whether the current node with the given cluster state is locked into the cluster with the UUID returned byclusterUUID()
, meaning that it will not accept any cluster state with a different clusterUUID. -
settings
Returns the merged transient and persistent settings. -
transientSettings
-
persistentSettings
-
hashesOfConsistentSettings
public <,> hashesOfConsistentSettings() -
coordinationMetadata
-
hasAlias
public boolean hasAlias( alias) -
equalsAliases
-
getIndicesLookup
-
findAllAliases
public ,<[] concreteIndices)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:
aliasesRequest
- The request to find aliases forconcreteIndices
- 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.
-
hasAliases
public boolean hasAliases([] aliases, [] concreteIndices)Checks if at least one of the specified aliases exists in the specified concrete indices. Wildcards are supported in the alias names for partial matches.- Parameters:
aliases
- The names of the index aliases to findconcreteIndices
- The concrete indexes the index aliases must point to order to be returned.- Returns:
- whether at least one of the specified aliases exists in one of the specified concrete indices.
-
findMappings
public ,,[] concreteIndices, [] types, <,<>> fieldFilter, onNextIndex) throwsFinds all mappings for types and concrete indices. Types are expanded to include all types that match the glob patterns in the types array. Empty types array, null or {"_all"} will be expanded to all types available for the given 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- Throws:
- See Also:
MapperPlugin.getFieldFilter()
-
findDataStreams
public ,[] concreteIndices)Finds the parent data streams, if any, for the specified concrete indices. -
getConcreteAllIndices
public [] getConcreteAllIndices()Returns all the concrete indices. -
getConcreteVisibleIndices
public [] getConcreteVisibleIndices()Returns all the concrete indices that are not hidden. -
getConcreteAllOpenIndices
public [] getConcreteAllOpenIndices()Returns all of the concrete indices that are open. -
getConcreteVisibleOpenIndices
public [] getConcreteVisibleOpenIndices()Returns all of the concrete indices that are open and not hidden. -
getConcreteAllClosedIndices
public [] getConcreteAllClosedIndices()Returns all of the concrete indices that are closed. -
getConcreteVisibleClosedIndices
public [] getConcreteVisibleClosedIndices()Returns all of the concrete indices that are closed and not hidden. -
resolveWriteIndexRouting
public resolveWriteIndexRouting(@Nullable routing, aliasOrIndex)Returns indexing routing for the givenaliasOrIndex
. Resolves routing from the alias metadata used in the write index. -
resolveIndexRouting
public resolveIndexRouting(@Nullable routing, aliasOrIndex)Returns indexing routing for the given index. -
hasIndex
public boolean hasIndex( index) -
hasIndex
-
hasConcreteIndex
public boolean hasConcreteIndex( index) -
index
public index) -
index
-
hasIndexMetadata
Returns true iff existing index has the sameIndexMetadata
instance -
getIndexSafe
Returns theIndexMetadata
for this index.- Throws:
IndexNotFoundException
- if no metadata for this index is found
-
indices
-
getIndices
-
templates
-
getTemplates
-
componentTemplates
-
templatesV2
-
dataStreams
-
dataStreamAliases
-
customs
-
getCustoms
-
indexGraveyard
The collection of index deletions in the cluster. -
custom
public <T extends type) -
custom
public <T extends type, T defaultValue) -
getTotalNumberOfShards
public int getTotalNumberOfShards()Gets the total number of shards from all indices, including replicas and closed indices.- Returns:
- The total number shards from all 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.- Returns:
- The total number of open shards from all indices.
-
isAllTypes
public static boolean isAllTypes([] types)Identifies whether the array containing type names given as argument refers to all types The empty or null array identifies all types- Parameters:
types
- the array containing types- Returns:
- true if the provided array maps to all types, false otherwise
-
isExplicitAllType
public static boolean isExplicitAllType([] types)Identifies whether the array containing type names given as argument explicitly refers to all types The empty or null array doesn't explicitly map to all types- Parameters:
types
- the array containing index names- Returns:
- true if the provided array explicitly maps to all types, false otherwise
-
routingRequired
public boolean routingRequired( concreteIndex)- Parameters:
concreteIndex
- The concrete index to check if routing is required- Returns:
- Whether routing is required according to the mapping for the specified index and type
-
iterator
- Specified by:
in interface
<IndexMetadata>
-
isGlobalStateEquals
-
snapshot
Reconciles the cluster state metadata taken at the end of a snapshot with the data streams and indices contained in the snapshot. Certain actions taken during a snapshot such as rolling over a data stream or deleting a backing index may result in situations where some reconciliation is required.- Returns:
- Reconciled
Metadata
instance
-
diff
Description copied from interface:Diffable
Returns serializable object representing differences between this and previousState -
readDiffFrom
- Throws:
-
fromXContent
public static Metadata fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws- Throws:
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
-
readFrom
- Throws:
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
builder
-
builder
-