Skip to content

Index Templates API - Set Source #1860

@nhuray

Description

@nhuray

This issue refers to this discussion

Context :

There's no way with the Java client API to create a template and set the source like that :

PutIndexTemplateResponse response = client.admin().indices()
   .preparePutTemplate("twitter_template").
   .setSource(sourceTemplate)
   .execute()
   .actionGet();

instead to set settings, mappings ... like that :

PutIndexTemplateResponse response = client.admin().indices()
   .preparePutTemplate("twitter_template")
   .setTemplate("twitter*")
   .addMapping("tweet", sourceMapping)
   .setSettings(sourceSettings)
   .execute()
   .actionGet();

Solution :

We have to move the parsing logic from RestPutIndexTemplateAction.handleRequest() method to the PutIndexTemplateRequest.setSource() method

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions