Class MetaDataCreateIndexService
- java.lang.Object
-
- org.elasticsearch.cluster.metadata.MetaDataCreateIndexService
-
public class MetaDataCreateIndexService extends java.lang.Object
Service responsible for submitting create index requests
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_INDEX_NAME_BYTES
-
Constructor Summary
Constructors Constructor Description MetaDataCreateIndexService(Settings settings, ClusterService clusterService, IndicesService indicesService, AllocationService allocationService, AliasValidator aliasValidator, Environment env, IndexScopedSettings indexScopedSettings, ThreadPool threadPool, NamedXContentRegistry xContentRegistry, boolean forbidPrivateIndexSettings)
-
Method Summary
Modifier and Type Method Description static void
checkShardLimit(Settings settings, ClusterState clusterState, DeprecationLogger deprecationLogger)
Checks whether an index can be created without going over the cluster shard limit.void
createIndex(CreateIndexClusterStateUpdateRequest request, ActionListener<CreateIndexClusterStateUpdateResponse> listener)
Creates an index in the cluster state and waits for the specified number of shard copies to become active (as specified inCreateIndexClusterStateUpdateRequest.waitForActiveShards()
) before sending the response on the listener.static void
validateIndexName(java.lang.String index, ClusterState state)
Validate the name for an index against some static rules and a cluster state.static void
validateIndexOrAliasName(java.lang.String index, java.util.function.BiFunction<java.lang.String,java.lang.String,? extends java.lang.RuntimeException> exceptionCtor)
Validate the name for an index or alias against some static rules.void
validateIndexSettings(java.lang.String indexName, Settings settings, ClusterState clusterState, boolean forbidPrivateIndexSettings)
-
-
-
Field Detail
-
MAX_INDEX_NAME_BYTES
public static final int MAX_INDEX_NAME_BYTES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MetaDataCreateIndexService
public MetaDataCreateIndexService(Settings settings, ClusterService clusterService, IndicesService indicesService, AllocationService allocationService, AliasValidator aliasValidator, Environment env, IndexScopedSettings indexScopedSettings, ThreadPool threadPool, NamedXContentRegistry xContentRegistry, boolean forbidPrivateIndexSettings)
-
-
Method Detail
-
validateIndexName
public static void validateIndexName(java.lang.String index, ClusterState state)
Validate the name for an index against some static rules and a cluster state.
-
validateIndexOrAliasName
public static void validateIndexOrAliasName(java.lang.String index, java.util.function.BiFunction<java.lang.String,java.lang.String,? extends java.lang.RuntimeException> exceptionCtor)
Validate the name for an index or alias against some static rules.
-
createIndex
public void createIndex(CreateIndexClusterStateUpdateRequest request, ActionListener<CreateIndexClusterStateUpdateResponse> listener)
Creates an index in the cluster state and waits for the specified number of shard copies to become active (as specified inCreateIndexClusterStateUpdateRequest.waitForActiveShards()
) before sending the response on the listener. If the index creation was successfully applied on the cluster state, thenClusterStateUpdateResponse.isAcknowledged()
will return true, otherwise it will return false and no waiting will occur for started shards (CreateIndexClusterStateUpdateResponse.isShardsAcknowledged()
will also be false). If the index creation in the cluster state was successful and the requisite shard copies were started before the timeout, thenCreateIndexClusterStateUpdateResponse.isShardsAcknowledged()
will return true, otherwise if the operation timed out, then it will return false.- Parameters:
request
- the index creation cluster state update requestlistener
- the listener on which to send the index creation cluster state update response
-
validateIndexSettings
public void validateIndexSettings(java.lang.String indexName, Settings settings, ClusterState clusterState, boolean forbidPrivateIndexSettings) throws IndexCreationException
- Throws:
IndexCreationException
-
checkShardLimit
public static void checkShardLimit(Settings settings, ClusterState clusterState, DeprecationLogger deprecationLogger)
Checks whether an index can be created without going over the cluster shard limit.- Parameters:
settings
- the settings of the index to be createdclusterState
- the current cluster statedeprecationLogger
- the logger to use to emit a deprecation warning, if appropriate- Throws:
ValidationException
- if creating this index would put the cluster over the cluster shard limit
-
-