From 6980286ba46bb2f9e74494609c29c2ecbab62331 Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Thu, 28 May 2015 09:19:13 -1000 Subject: [PATCH] Core: fix upgrade response serialization --- rest-api-spec/test/indices.upgrade/10_basic.yaml | 16 ++++++++++++++++ .../admin/indices/upgrade/RestUpgradeAction.java | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 rest-api-spec/test/indices.upgrade/10_basic.yaml diff --git a/rest-api-spec/test/indices.upgrade/10_basic.yaml b/rest-api-spec/test/indices.upgrade/10_basic.yaml new file mode 100644 index 00000000000..f4844839c41 --- /dev/null +++ b/rest-api-spec/test/indices.upgrade/10_basic.yaml @@ -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/'} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java index 8c1b1c0458a..a1c9c0b3ed6 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java @@ -85,7 +85,7 @@ public class RestUpgradeAction extends BaseRestHandler { public RestResponse buildResponse(UpgradeResponse response, XContentBuilder builder) throws Exception { builder.startObject(); buildBroadcastShardsHeader(builder, request, response); - builder.startArray("upgraded_indices"); + builder.startObject("upgraded_indices"); for (Map.Entry entry : response.versions().entrySet()) { builder.field(entry.getKey(), entry.getValue(), XContentBuilder.FieldCaseConversion.NONE); }