`rebuild()` of bulk operations (`IndexOperation`, `CreateOperation`, `UpdateOperation`) drops most fields
@l-trotta がすでに取り組んでいます。
2026年10月15日 から。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 50/100
調査の方向性
The bug is in the private Builder(IndexOperation), Builder(CreateOperation) and Builder(UpdateOperation) constructors, which copy too few fields. Those classes inherit from BulkOperationBase and WriteOperation, and the reproducer in the issue shows which properties go missing. The likely cause is the code generator, so check whether the fix belongs in the generated sources or in the generator. Done means op.rebuild().build() equals op for all three operation types, with the builder typed as Builder<TDocument>.
索引モデルが issue の本文から書いたものです。
説明
Java API client version
9.5.4 (also current main)
Java version
25
Elasticsearch Version
9.5.4
Problem description
(full disclosure: analysis by copilot)
rebuild() should return a builder "initialized with field values of this instance". For the bulk operation classes it doesn't: most fields are lost.
Expected: op.rebuild().build() is equal to op.
Actual:
-
IndexOperationandCreateOperation: the privateBuilder(IndexOperation<TDocument> instance)/Builder(CreateOperation<TDocument> instance)constructors are empty. Nothing is copied:- fields inherited from
BulkOperationBase:id,index,routing,ifSeqNo,ifPrimaryTerm,version,versionType; - fields inherited from
WriteOperation:pipeline,requireAlias,dynamicTemplates; - their own fields:
documentandtDocumentSerializer.
Because
documentis required,rebuild().build()throws aMissingRequiredPropertyException. If you set a new document first (for example.document(binaryData)), it builds without errors, but without_id,_index, routing and so on. - fields inherited from
-
UpdateOperation: onlyrequireAliasandretryOnConflictare copied. The inheritedBulkOperationBasefields,action,binaryActionand the serializers are lost.
This looks like a code generator problem. Fields inherited from a generated base class are never copied, and neither are fields of the generic type parameter. Request classes without a base class, such as IndexRequest, copy their fields correctly.
Reproducer:
IndexOperation<Map<String, Object>> op = IndexOperation.of(b -> b
.index("my-index")
.id("1")
.routing("r1")
.ifSeqNo(5L)
.ifPrimaryTerm(1L)
.pipeline("my-pipeline")
.document(Map.of("field", "value")));
// throws MissingRequiredPropertyException: Missing required property 'IndexOperation.document'
op.rebuild().build();
// builds without errors, but all values are lost
IndexOperation<?> copy = op.rebuild().document(Map.of("field", "value")).build();
System.out.println(copy.index()); // null, expected "my-index"
System.out.println(copy.id()); // null, expected "1"
System.out.println(copy.routing()); // null, expected "r1"
System.out.println(copy.pipeline()); // null, expected "my-pipeline"
CreateOperation behaves the same. For UpdateOperation, rebuild().build() does not throw, but only requireAlias and retryOnConflict are kept:
UpdateOperation<Object, Object> op = UpdateOperation.of(b -> b
.index("my-index")
.id("1")
.routing("r1")
.retryOnConflict(3)
.action(a -> a.docAsUpsert(true)));
UpdateOperation<?, ?> copy = op.rebuild().build();
System.out.println(copy.index()); // null, expected "my-index"
System.out.println(copy.id()); // null, expected "1"
System.out.println(copy.routing()); // null, expected "r1"
System.out.println(copy.retryOnConflict()); // 3
System.out.println(copy.action()); // null
Context: I hit this in Spring Data Elasticsearch. Like the client's own BulkIngester, it needs to replace the document of an operation with a pre-serialized BinaryData so that it can measure its size. The obvious way is op.rebuild().document(binaryData).build(), but that silently drops _id and _index. So we copy all properties by hand, as IngesterOperation.copyIndexProperties() / copyBaseProperties() do.
see https://github.com/spring-projects/spring-data-elasticsearch/pull/3357
Note: rebuild() also returns the raw type Builder instead of Builder<TDocument>, so callers get unchecked warnings.
- 主要言語
- Java
- スター
- 525
- フォーク
- 299
- 平均マージ
- 13時間 9分
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
elastic/elasticsearch-java のほかの issue
-
Transport options set on the client builder drop SafeResponseConsumer対応中かも @RaphaelFakhri が 2 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 54/100
elastic/elasticsearch-java#1354 ·
-
Delete By Query deserialization will not account for search failures対応中かも @l-trotta が 19 日前に担当しました。 オープン
elastic/elasticsearch-java#1349 · コメント 1 件 · 担当者 1 名 ·
-
Nested index settings that do not end up deserialized in otherSettings leads to requiring properties on parent JSON nodes対応中かも @l-trotta が 19 日前に担当しました。 オープンArea: Specification Category: Bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
elastic/elasticsearch-java#1347 · コメント 1 件 · 担当者 1 名 ·
-
RestClientTransport sends bulk bodies as one HTTP chunk / TLS record / syscall per NDJSON buffer, burning ~45x the reactor CPU of the HLRC再び着手できるかも @l-trotta が 35 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
elastic/elasticsearch-java#1339 · コメント 7 件 · 担当者 1 名 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
elastic/elasticsearch-java#1212 · コメント 8 件 ·
elastic/elasticsearch-java の issue をすべて見る
似ている issue
-
human-required sync-failed
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/osdu-spi-file#63 ·
メンテナーはふだん 1 日以内に返信
-
frontend quick win
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
CodeForPhilly/benefit-decision-toolkit#571 ·
メンテナーはふだん 1 日以内に返信
-
approved
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
checkstyle/checkstyle#22129 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Add Hardcharger JDBC driver対応中かも @prmoore77 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信