You can use IndicesAdminClient to create a template.
node.client().admin().indices().putTemplate( new PutIndexTemplateRequest("templatename").source(templateString) );
PutIndexTemplateRequest has other methods for programmatically building a template if you prefer to create it as a Java map, etc.
Andrew Rueckert
source share