Create an index template using java api in search of elasticity

The current java API for elastic search documentation does not say anything about creating an index template. I know that I can create an index template using crud, but my elastic search index grows depending on the data I get. The data that I have now is possible that the data may change. Therefore, instead of manually creating the index and template, I want to know if this can be done by writing Java code.

+7
java elasticsearch
source share
1 answer

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.

+6
source share

All Articles