Class IndexTemplateMetaData.Builder
- java.lang.Object
-
- org.elasticsearch.cluster.metadata.IndexTemplateMetaData.Builder
-
- Enclosing class:
- IndexTemplateMetaData
public static class IndexTemplateMetaData.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder(java.lang.String name)
Builder(IndexTemplateMetaData indexTemplateMetaData)
-
Method Summary
Modifier and Type Method Description IndexTemplateMetaData
build()
static IndexTemplateMetaData
fromXContent(XContentParser parser, java.lang.String templateName)
IndexTemplateMetaData.Builder
order(int order)
IndexTemplateMetaData.Builder
patterns(java.util.List<java.lang.String> indexPatterns)
IndexTemplateMetaData.Builder
putAlias(AliasMetaData aliasMetaData)
IndexTemplateMetaData.Builder
putAlias(AliasMetaData.Builder aliasMetaData)
IndexTemplateMetaData.Builder
putMapping(java.lang.String mappingType, java.lang.String mappingSource)
IndexTemplateMetaData.Builder
putMapping(java.lang.String mappingType, CompressedXContent mappingSource)
static void
removeType(IndexTemplateMetaData indexTemplateMetaData, XContentBuilder builder)
Removes the nested type in the xContent representation ofIndexTemplateMetaData
.IndexTemplateMetaData.Builder
settings(Settings settings)
IndexTemplateMetaData.Builder
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.IndexTemplateMetaData.Builder
version(java.lang.Integer version)
-
-
-
Constructor Detail
-
Builder
public Builder(java.lang.String name)
-
Builder
public Builder(IndexTemplateMetaData indexTemplateMetaData)
-
-
Method Detail
-
order
public IndexTemplateMetaData.Builder order(int order)
-
version
public IndexTemplateMetaData.Builder version(java.lang.Integer version)
-
patterns
public IndexTemplateMetaData.Builder patterns(java.util.List<java.lang.String> indexPatterns)
-
settings
public IndexTemplateMetaData.Builder settings(Settings.Builder settings)
-
settings
public IndexTemplateMetaData.Builder settings(Settings settings)
-
putMapping
public IndexTemplateMetaData.Builder putMapping(java.lang.String mappingType, CompressedXContent mappingSource)
-
putMapping
public IndexTemplateMetaData.Builder putMapping(java.lang.String mappingType, java.lang.String mappingSource) throws java.io.IOException
- Throws:
java.io.IOException
-
putAlias
public IndexTemplateMetaData.Builder putAlias(AliasMetaData aliasMetaData)
-
putAlias
public IndexTemplateMetaData.Builder putAlias(AliasMetaData.Builder aliasMetaData)
-
build
public IndexTemplateMetaData build()
-
toXContentWithTypes
public static void toXContentWithTypes(IndexTemplateMetaData indexTemplateMetaData, XContentBuilder builder, ToXContent.Params params) throws java.io.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:
java.io.IOException
-
removeType
public static void removeType(IndexTemplateMetaData indexTemplateMetaData, XContentBuilder builder) throws java.io.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:
java.io.IOException
-
toXContent
public static void toXContent(IndexTemplateMetaData indexTemplateMetaData, XContentBuilder builder, ToXContent.Params params) throws java.io.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:
java.io.IOException
-
fromXContent
public static IndexTemplateMetaData fromXContent(XContentParser parser, java.lang.String templateName) throws java.io.IOException
- Throws:
java.io.IOException
-
-