Class IndexTemplateMetaData.Builder
- java.lang.Object
-
- org.elasticsearch.cluster.metadata.IndexTemplateMetaData.Builder
-
- Enclosing class:
- IndexTemplateMetaData
public static class IndexTemplateMetaData.Builder extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder(String name)Builder(IndexTemplateMetaData indexTemplateMetaData)
-
Method Summary
-
-
-
Constructor Detail
-
Builder
public Builder(String name)
-
Builder
public Builder(IndexTemplateMetaData indexTemplateMetaData)
-
-
Method Detail
-
order
public IndexTemplateMetaData.Builder order(int order)
-
version
public IndexTemplateMetaData.Builder version(Integer version)
-
patterns
public IndexTemplateMetaData.Builder patterns(List<String> indexPatterns)
-
settings
public IndexTemplateMetaData.Builder settings(Settings.Builder settings)
-
settings
public IndexTemplateMetaData.Builder settings(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
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 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
-
-