Class IndexTemplateMetadata.Builder
java.lang.Object
org.elasticsearch.cluster.metadata.IndexTemplateMetadata.Builder
- Enclosing class:
- IndexTemplateMetadata
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
static IndexTemplateMetadata
fromXContent
(XContentParser parser, String templateName) order
(int order) putAlias
(AliasMetadata aliasMetadata) putAlias
(AliasMetadata.Builder aliasMetadata) putMapping
(String mappingType, String mappingSource) putMapping
(String mappingType, CompressedXContent mappingSource) static void
removeType
(IndexTemplateMetadata indexTemplateMetadata, XContentBuilder builder) Removes the nested type in the xContent representation ofIndexTemplateMetadata
.settings
(Settings.Builder settings) static void
toXContent
(IndexTemplateMetadata indexTemplateMetadata, XContentBuilder builder, ToXContent.Params params) Serializes the template to xContent, making sure not to nest mappings under the type name.static void
toXContentWithTypes
(IndexTemplateMetadata indexTemplateMetadata, XContentBuilder builder, ToXContent.Params params) Serializes the template to xContent, using the legacy format where the mappings are nested under the type name.
-
Constructor Details
-
Builder
-
Builder
-
-
Method Details
-
order
-
version
-
patterns
-
settings
-
settings
-
putMapping
public IndexTemplateMetadata.Builder putMapping(String mappingType, CompressedXContent mappingSource) -
putMapping
public IndexTemplateMetadata.Builder putMapping(String mappingType, String mappingSource) throws IOException - Throws:
IOException
-
putAlias
-
putAlias
-
build
-
toXContentWithTypes
public static void toXContentWithTypes(IndexTemplateMetadata indexTemplateMetadata, XContentBuilder builder, ToXContent.Params params) throws IOException Serializes the template to xContent, using the legacy format where the mappings are nested under the type name. This method is used for serializing templates before storing them in the cluster metadata, and also in the REST layer when returning a deprecated typed response.- Throws:
IOException
-
removeType
public static void removeType(IndexTemplateMetadata indexTemplateMetadata, XContentBuilder builder) throws IOException Removes the nested type in the xContent representation ofIndexTemplateMetadata
. This method is useful to help bridge the gap between an the internal representation which still uses (the legacy format) a nested type in the mapping, and the external representation which does not use a nested type in the mapping.- Throws:
IOException
-
toXContent
public static void toXContent(IndexTemplateMetadata indexTemplateMetadata, XContentBuilder builder, ToXContent.Params params) throws IOException Serializes the template to xContent, making sure not to nest mappings under the type name. Note that this method should currently only be used for creating REST responses, and not when directly updating stored templates. Index templates are still stored in the old, typed format, and have yet to be migrated to be typeless.- Throws:
IOException
-
fromXContent
public static IndexTemplateMetadata fromXContent(XContentParser parser, String templateName) throws IOException - Throws:
IOException
-