diff --git a/rest-api-spec/test/cat.thread_pool/10_basic.yaml b/rest-api-spec/test/cat.thread_pool/10_basic.yaml index 37994201191..283e353b7a3 100755 --- a/rest-api-spec/test/cat.thread_pool/10_basic.yaml +++ b/rest-api-spec/test/cat.thread_pool/10_basic.yaml @@ -36,7 +36,7 @@ - match: $body: | - /^ bulk.max \s+ bulk.min \s+ \n + /^ bulk.min \s+ bulk.max \s+ \n (\s+ \d+ \s+ \d+ \s+ \n)+ $/ #(\s+ \d+ \s+ \d+ \n)+ $/ diff --git a/src/main/java/org/elasticsearch/rest/action/support/RestTable.java b/src/main/java/org/elasticsearch/rest/action/support/RestTable.java index 0b5b44112f4..3e6eb713529 100644 --- a/src/main/java/org/elasticsearch/rest/action/support/RestTable.java +++ b/src/main/java/org/elasticsearch/rest/action/support/RestTable.java @@ -157,16 +157,15 @@ public class RestTable { private static Set expandHeadersFromRequest(Table table, RestRequest request) { Set headers = new LinkedHashSet<>(table.getHeaders().size()); - Map headerMap = table.getHeaderMap(); // check headers and aliases for (String header : Strings.splitStringByCommaToArray(request.param("h"))) { if (Regex.isSimpleMatchPattern(header)) { - for (Map.Entry configuredHeaderEntry : headerMap.entrySet()) { - String configuredHeader = configuredHeaderEntry.getKey(); + for (Table.Cell tableHeaderCell : table.getHeaders()) { + String configuredHeader = tableHeaderCell.value.toString(); if (Regex.simpleMatch(header, configuredHeader)) { headers.add(configuredHeader); - } else if (configuredHeaderEntry.getValue().attr.containsKey("alias")) { - String[] aliases = Strings.splitStringByCommaToArray(configuredHeaderEntry.getValue().attr.get("alias")); + } else if (tableHeaderCell.attr.containsKey("alias")) { + String[] aliases = Strings.splitStringByCommaToArray(tableHeaderCell.attr.get("alias")); for (String alias : aliases) { if (Regex.simpleMatch(header, alias)) { headers.add(configuredHeader); diff --git a/src/test/java/org/elasticsearch/rest/action/support/RestTableTest.java b/src/test/java/org/elasticsearch/rest/action/support/RestTableTest.java index bdf0a07cbf5..3faa0ea3673 100644 --- a/src/test/java/org/elasticsearch/rest/action/support/RestTableTest.java +++ b/src/test/java/org/elasticsearch/rest/action/support/RestTableTest.java @@ -57,7 +57,7 @@ public class RestTableTest extends ElasticsearchTestCase { List headers = buildDisplayHeaders(table, restRequest); List headerNames = getHeaderNames(headers); - assertThat(headerNames, containsInAnyOrder("bulk.foo", "bulk.bar", "aliasedBulk", "aliasedSecondBulk")); + assertThat(headerNames, contains("bulk.foo", "bulk.bar", "aliasedBulk", "aliasedSecondBulk")); assertThat(headerNames, not(hasItem("unmatched"))); } @@ -67,7 +67,7 @@ public class RestTableTest extends ElasticsearchTestCase { List headers = buildDisplayHeaders(table, restRequest); List headerNames = getHeaderNames(headers); - assertThat(headerNames, containsInAnyOrder("bulk.foo", "bulk.bar", "aliasedBulk", "aliasedSecondBulk")); + assertThat(headerNames, contains("bulk.foo", "bulk.bar", "aliasedBulk", "aliasedSecondBulk")); assertThat(headerNames, not(hasItem("unmatched"))); }