Module org.elasticsearch.xcore
Class IndexTemplateConfig
java.lang.Object
org.elasticsearch.xpack.core.template.IndexTemplateConfig
Describes an index template to be loaded from a resource file for use with an
IndexTemplateRegistry.-
Constructor Summary
ConstructorsConstructorDescriptionIndexTemplateConfig(String templateName, String fileName, int version, String versionProperty) Describes a template to be loaded from a resource file.IndexTemplateConfig(String templateName, String fileName, int version, String versionProperty, Map<String, String> variables) Describes a template to be loaded from a resource file. -
Method Summary
Modifier and TypeMethodDescriptionintbyte[]Loads the template from disk as a UTF-8 byte array.
-
Constructor Details
-
IndexTemplateConfig
public IndexTemplateConfig(String templateName, String fileName, int version, String versionProperty) Describes a template to be loaded from a resource file. Includes handling for substituting a version property into the template. TheversionPropertyparameter will be used to substitute the value ofversioninto the template. For example, this template:{"myTemplateVersion": "${my.version.property}"}Withversion = "42"; versionProperty = "my.version.property"will result in{"myTemplateVersion": "42"}. Note that this code does not automatically insert theversionindex template property - include that in the JSON file defining the template, preferably using the version variable provided to this constructor.- Parameters:
templateName- The name that will be used for the index template. Literal, include the version in this string if it should be used.fileName- The filename the template should be loaded from. Literal, should include leading / and extension if necessary.version- The version of the template. Substituted forversionPropertyas described above.versionProperty- The property that will be replaced with theversionstring as described above.
-
IndexTemplateConfig
public IndexTemplateConfig(String templateName, String fileName, int version, String versionProperty, Map<String, String> variables) Describes a template to be loaded from a resource file. Includes handling for substituting a version property into the template. TheversionPropertyparameter will be used to substitute the value ofversioninto the template. For example, this template:{"myTemplateVersion": "${my.version.property}"}Withversion = "42"; versionProperty = "my.version.property"will result in{"myTemplateVersion": "42"}.- Parameters:
templateName- The name that will be used for the index template. Literal, include the version in this string if it should be used.fileName- The filename the template should be loaded from. Literal, should include leading / and extension if necessary.version- The version of the template. Substituted forversionPropertyas described above.versionProperty- The property that will be replaced with theversionstring as described above.variables- A map of additional variable substitutions. The map's keys are the variable names. The corresponding values will replace the variable names.
-
-
Method Details
-
getFileName
-
getTemplateName
-
getVersion
public int getVersion() -
loadBytes
public byte[] loadBytes()Loads the template from disk as a UTF-8 byte array.- Returns:
- The template as a UTF-8 byte array.
-