Skip to content

Update from 8.13.4 to 8.14.1 break the dynamic template creation #841

Closed
@TakiuGit

Description

@TakiuGit

Java API client version

8.14.1

Java version

openjdk 11.0.21 2023-10-17 LTS

Elasticsearch Version

8.4.3

Problem description

Upgrading the driver from 8.13.4 to 8.14.1 I've come up with the following issue

Pushing to an ES server v8.4.3 introduce brackets in the "path_match" field in "dynamic_templates".
ex : from "titles.*" to "[titles.*]"
This is an actual breaking change as the template does not match anymore with the targeted fields names

Here is a minimal example to reproduce:

 public static void main(String[] args) throws IOException {
        RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200)).build();
        ElasticsearchClient client = new ElasticsearchClient(
                    new RestClientTransport(restClient, new JacksonJsonpMapper()));

        Map<String, DynamicTemplate> value = Map.of("titles",
            new DynamicTemplate.Builder().pathMatch("titles.*")
                .mapping(new Property.Builder().text(new TextProperty.Builder().build()).build())
                .build());

        CreateIndexRequest indexRequest = new CreateIndexRequest.Builder().index("test_index")
            .mappings(new TypeMapping.Builder().dynamicTemplates(value).build())
            .build();
        client.indices().create(indexRequest);
    }

This is not reproducible with the server version 8.13.4, I've not tested with other versions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions