The current java API for elastic search documentation does not say anything about creating an index template.
I know I can create an index template using crud, but my elastic search index is going grow depending on the data I get. The data I have right now, it may be possible that the data may change. So instead of manually making an index and a template, I want to know if it can be done through writing a code in Java.
You can use the IndicesAdminClient to create a template
PutIndexTemplateRequest has other methods to programatically build the template if you'd prefer to build it as a Java map, etc.