Unable to Parse response from elastic search in Java Spring Data Elasticsearch

I am just creating/posting new entry that is created successful but while responding its getting issue of parsing .

testRepository.save(application);

I am not using any client because JavaHighlevel Rest client was deprecated in new . I am using latest spring boot and spring data Elasticsearch

nested exception is java.lang.RuntimeException: Unable to parse response body for Response{requestLine=POST /vip/_doc?timeout=1m HTTP/1.1, host=http://localhost:9200, response=HTTP/1.1 201 Created}] with root cause

{
  "name" : "Test",
  "cluster_name" : "Test",
  "cluster_uuid" : "Test",
  "version" : {
    "number" : "8.2.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "b174af62e8dd9f4ac4d25875e9381ffe2b9282c5",
    "build_date" : "2022-04-20T10:35:10.180408517Z",
    "build_snapshot" : false,
    "lucene_version" : "9.1.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

Can you advise please thanks

1 Like

I have created Elasticsearch Java ApI client and it solved problem as REST highlevel client is deprecated in new version .

 @Bean
    public ElasticsearchClient elasticsearchClient() {

        RestClient httpClient = RestClient.builder(new HttpHost("localhost", 9200)).build();

        ElasticsearchTransport transport = new RestClientTransport(httpClient, new JacksonJsonpMapper());

        ElasticsearchClient esClient = new ElasticsearchClient(transport);

        return esClient;
    }
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.