- I am able to get response from Elastic search (deployed on AWS) using postman at my machine.
- However when I am trying to use elasticsearch API to get the response, I am getting ElasticsearchStatusException[Unable to parse response body].
Explanation starts from here :
I am hitting my Elasticsearch (deployed on AWS) using springboot microservice, however getting below error :
< ElasticsearchStatusException[Unable to parse response body]; nested: ResponseException[method [POST], host [http://b6vv-eks-kibana.verizon.com], URI [/_search?rest_total_hits_as_int=true&typed_keys=true&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled=true&search_type=query_then_fetch&batched_reduce_size=512], status line [HTTP/1.1 301 Moved Permanently]
Source Code as below :
I am using below source code as my implementation, which is copied from Elasticsearch API (Search API | Java REST Client [7.17] | Elastic)
RestHighLevelClient esClient = new RestHighLevelClient(RestClient.builder(new HttpHost("my-elastic-search-host-name")));
SearchRequest searchRequest = new SearchRequest();
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
SearchResponse searchResponse = esClient.search(searchRequest, RequestOptions.DEFAULT);
Followed elastic community discussion as below :
I checked these link in elastic discussion and did not found helpful.
Please suggest, as all the related help in community is not answered with any user.