Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Transport options set on the client builder drop SafeResponseConsumer

Đang mở
#1,354 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

@RaphaelFakhri đang làm issue này rồi.

Từ ngày 19/10/2026.

  • #1355 của @RaphaelFakhri — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
54/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
api, backend

Hướng nghiên cứu

Start by reading RestClientOptions.of(), Rest5ClientOptions.of(), and initialOptions() to trace how TransportOptions are converted; compare with the ElasticsearchClient.of(...) builder methods transportOptions(fn) and retryConfig(...). Check both the default and legacy transports against the expected safe consumer, then add or update tests showing that builder-configured options retain SafeResponseConsumer.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Java API client version

main (f920563)

Java version

21

Elasticsearch Version

Any (client-side)

Problem description

RestClientOptions.of() and Rest5ClientOptions.of() convert other TransportOptions implementations starting from RequestOptions.DEFAULT, while initialOptions() starts from SafeResponseConsumer.DEFAULT_REQUEST_OPTIONS. Converted options therefore lose SafeResponseConsumer.

The ElasticsearchClient.of(...) builder methods transportOptions(fn) and retryConfig(...) produce DefaultTransportOptions, so a client configured like this runs without the safe consumer:

ElasticsearchClient client = ElasticsearchClient.of(b -> b
    .host("http://localhost:9200")
    .transportOptions(o -> o.addHeader("Foo", "bar"))
);

Rest5ClientOptions options = (Rest5ClientOptions) client._transportOptions();
// Expected: SafeResponseConsumer.DEFAULT_FACTORY
// Actual:   HttpAsyncResponseConsumerFactory$BasicAsyncResponseConsumerFactory
System.out.println(options.restClientRequestOptions().getHttpAsyncResponseConsumerFactory());

The legacy transport (useLegacyTransport(true)) shows the same behavior with HeapBufferedResponseConsumerFactory. An Error thrown while consuming a response can then stop the I/O reactor, the failure that SafeResponseConsumer prevents (#1046).

Ngôn ngữ chính
Java
Star
525
Fork
299
Merge trung bình
13 giờ 9 phút
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của elastic/elasticsearch-java

Tất cả issue của elastic/elasticsearch-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.