Delete By Query deserialization will not account for search failures
@l-trotta đang làm issue này rồi.
Từ ngày 2/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Java API client version
8.14.3
Java version
21
Elasticsearch Version
8.19.11
Problem description
Delete by query's response field has a section for failures that is strictly typed as BulkIndexByScrollFailure. However, in the DeleteByQueryResponse that upstream Elasticsearch can return, the failures list is a union of search failures and indexing failures, and the search failures has a different serialization format than the indexing failures (ES9, ES8). Specifically, search failures put the error under reason, and the bulk failures put the error under cause. The result is that if a search failure is serialized by the server, the client fails to deserialize into a DeleteByQueryResponse correctly unless the default deserializer is overridden accordingly.
Reproducing this is challenging in an isolated case because it requires actually reproducing a search failure that serializes this way. The following is contrived, but can sometimes show the issue if given enough attempts - it tries to specifically close the index under deletion in the middle of one of the scroll iterations of a delete by query job.
ElasticsearchClient client = <create client here>;
String prefix = "dbq-search-failure-" + UUID.randomUUID();
String available = prefix + "-available";
String disappearing = prefix + "-disappearing";
ExecutorService executor = Executors.newSingleThreadExecutor();
try {
for (String index : List.of(available, disappearing)) {
client.indices().create(request -> request.index(index)
.settings(settings -> settings.numberOfShards("1").numberOfReplicas("0")));
}
// Sorting keeps the first batches on the available index, avoiding a bulk write failure when the
// other index closes. Its scroll context still participates, so a later scroll has a search failure.
for (int position = 0; position < 5; position++) {
String id = Integer.toString(position);
Map<String, Integer> document = Map.of("position", position);
client.index(request -> request.index(available).id(id).document(document));
}
client.index(request -> request.index(disappearing).id("last").document(Map.of("position", 100)));
client.indices().refresh(request -> request.index(available, disappearing));
Future<DeleteByQueryResponse> deletion = executor.submit(() -> client.deleteByQuery(request -> request
.index(available, disappearing)
.query(query -> query.matchAll(all -> all))
.sort("position:asc")
.scrollSize(1L)
.scroll(scroll -> scroll.time("1m"))
.requestsPerSecond(0.1f)));
// The first deletion proves the initial search succeeded and both scroll contexts were created.
long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(15);
while (client.exists(request -> request.index(available).id("0")).value()) {
if (System.nanoTime() >= deadline) {
throw new AssertionError("Delete-by-query did not finish its first batch");
}
Thread.sleep(50);
}
client.indices().close(request -> request.index(disappearing));
try {
// Expected: a result with failures[0].reason.type == search_context_missing_exception.
// Actual: the generated client models every failure as BulkIndexByScrollFailure.
return deletion.get(45, TimeUnit.SECONDS);
} catch (ExecutionException failure) {
if (failure.getCause() instanceof Exception cause) {
throw cause;
}
throw failure;
}
} finally {
executor.shutdownNow();
client.indices().delete(request -> request.index(available, disappearing).ignoreUnavailable(true));
}
- Ngôn ngữ chính
- Java
- Star
- 525
- Fork
- 299
- Merge trung bình
- 16 giờ 25 phút
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của elastic/elasticsearch-java
-
Transport options set on the client builder drop SafeResponseConsumerCó thể đã có người làm @RaphaelFakhri đã nhận 8 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 54/100
elastic/elasticsearch-java#1354 ·
-
`rebuild()` of bulk operations (`IndexOperation`, `CreateOperation`, `UpdateOperation`) drops most fieldsCó thể đã có người làm @l-trotta đã nhận 12 ngày trước. Đang mởArea: Generator Category: Bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 50/100
elastic/elasticsearch-java#1353 · 1 bình luận · 1 người được giao ·
-
Nested index settings that do not end up deserialized in otherSettings leads to requiring properties on parent JSON nodesCó thể đã có người làm @l-trotta đã nhận 25 ngày trước. Đang mởArea: Specification Category: Bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
elastic/elasticsearch-java#1347 · 1 bình luận · 1 người được giao ·
-
RestClientTransport sends bulk bodies as one HTTP chunk / TLS record / syscall per NDJSON buffer, burning ~45x the reactor CPU of the HLRCCó thể làm lại được @l-trotta đã nhận 41 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
elastic/elasticsearch-java#1339 · 7 bình luận · 1 người được giao ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
elastic/elasticsearch-java#1212 · 8 bình luận ·
Tất cả issue của elastic/elasticsearch-java
Issue tương tự
-
agent:working bug follow-up lane:auto
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Sanne/incus-spawn#1765 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Mend: dependency security vulnerability untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
opensearch-project/data-prepper#7219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Update Java flags pageĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
PaperMC/docs#824 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày