Using PutComposableIndexTemplateRequest in Custom Plugin

32 Views Asked by At

I have been working on a custom Elasticsearch plugin that should create an index template and its components when an Elasticsearch instance loads this plugin.

The only client that I can access is NodeClient and there is no way to create PutComposableIndexTemplateRequest as it is not available in the below dependency. (Maven)

    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>7.17.6</version>
        <scope>provided</scope>
    </dependency>

I can create an index template with client.admin().indices().putTemplate(...); method but there is no way to use the ComposableIndexTemplate class with this client. If I need to add a dependency like RestHighLevelClient, then I must set the host and port parameters to connect the cluster with this client even though this plugin is already running in an Elasticsearch cluster. It seems weird for the custom plugins, from my point of view.

Is there a way to add components to the ES instance using NodeClient? If not, which client needs to be used for such a case?

Thanks in advance.

0

There are 0 best solutions below