ElasticsearchStatusException[Unable to parse response body]; nested: ResponseException[method [POST]

Hello, I am new to ES and I am getting below exception and our ES(7.12.1) instance is on kubernetes.

ElasticsearchStatusException[Unable to parse response body]; nested: ResponseException[method [POST], host [http://es.com], URI [/_search?typed_keys=true&max_concurrent_shard_requests=5&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled=true&search_type=query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true], status line [HTTP/1.0 302 Found]
];

when I hit search function

 SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
    String query =
                "{\"match_all\" : {} }";
        WrapperQueryBuilder wrapQB = QueryBuilders.wrapperQuery(query);
        searchSourceBuilder.query(wrapQB);

        SearchRequest searchRequest = new SearchRequest();
        searchRequest.source(searchSourceBuilder);
        
        SearchResponse searchResponse =
                elasticsearchClient.search(searchRequest, RequestOptions.DEFAULT);

could anyone please help me with this.

It strongly suspect that you aren't actually hitting an Elasticsearch node. This response:

HTTP/1.0 302 Found

probably isn't coming from ES itself.

host [http://es.com]

Are you really targeting es.com ? That doesn't sounds right.

Hi Tim, actually host is https://es-dev.intranet.xxxx.com/ and its hosted on kubernetes. However I get the result/response when i do

 GetResponse getResponse = elasticsearchClient.get(getRequest, RequestOptions.DEFAULT);

but i get exception for

SearchResponse searchResponse =
                elasticsearchClient.search(searchRequest, RequestOptions.DEFAULT);

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