java.lang.Object
org.elasticsearch.common.IndexNameGenerator
Generates valid Elasticsearch index names.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic String
generateValidIndexName
(String prefix, String indexName) This generates a valid unique index name by using the provided prefix, appended with a generated UUID, and the index name.static String
generateValidIndexSuffix
(Supplier<String> randomGenerator) Generates a valid index suffix, removing any illegal characters.validateGeneratedIndexName
(String generatedIndexName, ClusterState state) Validates the provided index name against the provided cluster state.
-
Field Details
-
ILLEGAL_INDEXNAME_CHARS_REGEX
-
MAX_GENERATED_UUID_LENGTH
public static final int MAX_GENERATED_UUID_LENGTH- See Also:
-
-
Method Details
-
generateValidIndexName
This generates a valid unique index name by using the provided prefix, appended with a generated UUID, and the index name. -
generateValidIndexSuffix
Generates a valid index suffix, removing any illegal characters.- Parameters:
randomGenerator
- supplier of the initial (random) suffix- Returns:
- a valid index suffix without any illegal characters
- Throws:
IllegalArgumentException
- if removing illegal characters resulted in an empty string
-
validateGeneratedIndexName
@Nullable public static ActionRequestValidationException validateGeneratedIndexName(String generatedIndexName, ClusterState state) Validates the provided index name against the provided cluster state. This checks the index name for invalid characters and that it doesn't clash with existing indices or aliases. Returns null for valid indices.
-