Core: fix upgrade response serialization

This commit is contained in:
Igor Motov 2015-05-28 09:19:13 -10:00
parent 3db9caf7a1
commit 6980286ba4
2 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,16 @@
---
"Basic test for upgrade indices":
- do:
indices.create:
index: test_index
- do:
cluster.health:
wait_for_status: yellow
- do:
indices.upgrade:
index: test_index
- match: {upgraded_indices.test_index: '/(\d\.)+\d/'}

View File

@ -85,7 +85,7 @@ public class RestUpgradeAction extends BaseRestHandler {
public RestResponse buildResponse(UpgradeResponse response, XContentBuilder builder) throws Exception { public RestResponse buildResponse(UpgradeResponse response, XContentBuilder builder) throws Exception {
builder.startObject(); builder.startObject();
buildBroadcastShardsHeader(builder, request, response); buildBroadcastShardsHeader(builder, request, response);
builder.startArray("upgraded_indices"); builder.startObject("upgraded_indices");
for (Map.Entry<String, String> entry : response.versions().entrySet()) { for (Map.Entry<String, String> entry : response.versions().entrySet()) {
builder.field(entry.getKey(), entry.getValue(), XContentBuilder.FieldCaseConversion.NONE); builder.field(entry.getKey(), entry.getValue(), XContentBuilder.FieldCaseConversion.NONE);
} }