티스토리 뷰

개발

elasticsearch DocWriteResponse type is null

달리는개발자 2022. 10. 9. 17:22

DocWriteResponse 에 type이 _doc으로 안 들어가고 null이 되어서 NPE가 나는 현상

아래처럼 호환되는 기본 헤더를 설정해야된다.

HttpHeaders defaultHeaders = new HttpHeaders();
defaultHeaders.add("Accept", "application/vnd.elasticsearch+json;compatible-with=7");
defaultHeaders.add("Content-Type", "application/vnd.elasticsearch+json;compatible-with=7");

ClientConfiguration clientConfiguration = ClientConfiguration.builder()
	.connectedTo("localhost:9200")
        .withDefaultHeaders(defaultHeaders)
	.build();

 

참고

https://github.com/spring-projects/spring-data-elasticsearch/issues/2084

 

Mismatch versions Client and Cluster · Issue #2084 · spring-projects/spring-data-elasticsearch

I'm using spring-data-elasticsearch v4.2.7 with a ES Cluster v8.0 and I got the next response: Unable to parse response body for Response{requestLine=POST /_bulk?timeout=1m HTTP/1.1, host=http:...

github.com

 

반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함