Search code examples
elasticsearch-java-api

Unexpected JSON event 'VALUE_FALSE' instead of '[KEY_NAME, VALUE_STRING]' when calling client.indices().getTemplate()


I am writing some code to manage ElasticSearch templates. When running the code snippet below I am getting

co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'VALUE_FALSE' instead of '[KEY_NAME, VALUE_STRING]'

(See https://discuss.elastic.co/t/java-unexpected-json-event-value-true-instead-of-key-name-value-string/295740 for full callstack - too long to paste here)

Code

// simplified code for demo this issue, but does reproduce.
private static stackoverflowIssue(ElasticsearchClient client) {
  GetIndexTemplateResponse r = client.indices().getIndexTemplate();
}

ES info:

{
  "name" : "1ec11a1cb3c9",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "7e0zLYxmQsST0EllSlc_KA",
  "version" : {
    "number" : "7.16.2",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "2b937c44140b6559905130a8650c64dbd0879cfb",
    "build_date" : "2021-12-18T19:42:46.604893745Z",
    "build_snapshot" : false,
    "lucene_version" : "8.10.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

ES dependency in pom.xml

        <dependency>
            <groupId>co.elastic.clients</groupId>
            <artifactId>elasticsearch-java</artifactId>
            <version>7.16.3</version>
        </dependency>

        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <version>2.0.1</version>
        </dependency>

Please help, thanks!


Solution

  • This is a valid issue tracked by

    https://github.com/elastic/elasticsearch-java/issues/139