21
21
import org .elasticsearch .action .ActionResponse ;
22
22
import org .elasticsearch .common .ParseField ;
23
23
import org .elasticsearch .common .ParsingException ;
24
+ import org .elasticsearch .common .xcontent .ConstructingObjectParser ;
24
25
import org .elasticsearch .common .xcontent .ToXContentFragment ;
26
+ import org .elasticsearch .common .xcontent .ToXContentObject ;
25
27
import org .elasticsearch .common .xcontent .XContentBuilder ;
26
- import org .elasticsearch .common .xcontent .XContentParser ;
27
28
import org .elasticsearch .common .xcontent .XContentLocation ;
28
- import org .elasticsearch .common .xcontent .ConstructingObjectParser ;
29
+ import org .elasticsearch .common .xcontent .XContentParser ;
29
30
import org .elasticsearch .common .xcontent .XContentParser .Token ;
30
31
31
- import static org .elasticsearch .common .xcontent .ConstructingObjectParser .constructorArg ;
32
- import static org .elasticsearch .common .xcontent .ConstructingObjectParser .optionalConstructorArg ;
33
- import static org .elasticsearch .common .xcontent .XContentParserUtils .ensureExpectedToken ;
34
-
35
32
import java .io .IOException ;
36
- import java .util .Map ;
37
- import java .util .HashMap ;
33
+ import java .util .ArrayList ;
38
34
import java .util .Collections ;
35
+ import java .util .HashMap ;
39
36
import java .util .List ;
40
- import java .util .ArrayList ;
37
+ import java .util .Map ;
41
38
42
- public class SyncedFlushResponse extends ActionResponse implements ToXContentFragment {
39
+ import static org .elasticsearch .common .xcontent .ConstructingObjectParser .constructorArg ;
40
+ import static org .elasticsearch .common .xcontent .ConstructingObjectParser .optionalConstructorArg ;
41
+ import static org .elasticsearch .common .xcontent .XContentParserUtils .ensureExpectedToken ;
42
+
43
+ public class SyncedFlushResponse extends ActionResponse implements ToXContentObject {
43
44
44
45
public static final String SHARDS_FIELD = "_shards" ;
45
46
@@ -86,6 +87,7 @@ ShardCounts getShardCounts() {
86
87
87
88
@ Override
88
89
public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
90
+ builder .startObject ();
89
91
builder .startObject (SHARDS_FIELD );
90
92
totalCounts .toXContent (builder , params );
91
93
builder .endObject ();
@@ -96,6 +98,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
96
98
indexResult .toXContent (builder , params );
97
99
builder .endObject ();
98
100
}
101
+ builder .endObject ();
99
102
return builder ;
100
103
}
101
104
0 commit comments