File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed
server/src/main/java/org/elasticsearch Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -158,13 +158,13 @@ public void writeTo(StreamOutput out) throws IOException {
158158
159159 @ Override
160160 public Iterator <? extends ToXContent > toXContentChunked (ToXContent .Params params ) {
161- return ChunkedToXContent .builder (params ).object (ob -> {
162- ob .field (ERRORS , hasFailures ());
163- ob .field (TOOK , tookInMillis );
161+ return ChunkedToXContent .builder (params ).object (ob -> ob . append (( b , p ) -> {
162+ b .field (ERRORS , hasFailures ());
163+ b .field (TOOK , tookInMillis );
164164 if (ingestTookInMillis != BulkResponse .NO_INGEST_TOOK ) {
165- ob .field (INGEST_TOOK , ingestTookInMillis );
165+ b .field (INGEST_TOOK , ingestTookInMillis );
166166 }
167- ob . array ( ITEMS , Iterators . forArray ( responses )) ;
168- });
167+ return b ;
168+ }). array ( ITEMS , Iterators . forArray ( responses ))) ;
169169 }
170170}
Original file line number Diff line number Diff line change @@ -58,19 +58,15 @@ private void endObject() {
5858 * Creates an object, with the specified {@code contents}
5959 */
6060 public ChunkedToXContentBuilder xContentObject (ToXContent contents ) {
61- startObject ();
62- append (contents );
63- endObject ();
61+ addChunk ((b , p ) -> contents .toXContent (b .startObject (), p ).endObject ());
6462 return this ;
6563 }
6664
6765 /**
6866 * Creates an object named {@code name}, with the specified {@code contents}
6967 */
7068 public ChunkedToXContentBuilder xContentObject (String name , ToXContent contents ) {
71- startObject (name );
72- append (contents );
73- endObject ();
69+ addChunk ((b , p ) -> contents .toXContent (b .startObject (name ), p ).endObject ());
7470 return this ;
7571 }
7672
You can’t perform that action at this time.
0 commit comments