From c180defb10db8181506c9dafa731675b8d32804b Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Fri, 28 Aug 2015 11:15:44 -0400 Subject: [PATCH 1/2] [CAT] Default verbose to false Closes #13156 --- .../rest/action/support/RestTable.java | 2 +- .../rest-api-spec/api/cat.aliases.json | 2 +- .../rest-api-spec/api/cat.allocation.json | 2 +- .../rest-api-spec/api/cat.count.json | 2 +- .../rest-api-spec/api/cat.fielddata.json | 2 +- .../rest-api-spec/api/cat.health.json | 2 +- .../rest-api-spec/api/cat.indices.json | 2 +- .../rest-api-spec/api/cat.master.json | 2 +- .../rest-api-spec/api/cat.nodeattrs.json | 2 +- .../rest-api-spec/api/cat.nodes.json | 2 +- .../rest-api-spec/api/cat.pending_tasks.json | 2 +- .../rest-api-spec/api/cat.plugins.json | 2 +- .../rest-api-spec/api/cat.recovery.json | 2 +- .../rest-api-spec/api/cat.segments.json | 2 +- .../rest-api-spec/api/cat.shards.json | 2 +- .../rest-api-spec/api/cat.thread_pool.json | 2 +- .../test/cat.aliases/10_basic.yaml | 21 ++++--------------- .../test/cat.allocation/10_basic.yaml | 12 ++--------- .../test/cat.count/10_basic.yaml | 9 ++------ .../test/cat.fielddata/10_basic.yaml | 3 +-- .../test/cat.health/10_basic.yaml | 3 +-- .../test/cat.indices/10_basic.yaml | 6 ++---- .../test/cat.nodeattrs/10_basic.yaml | 3 +-- .../test/cat.nodes/10_basic.yaml | 3 +-- .../test/cat.recovery/10_basic.yaml | 6 ++---- .../test/cat.segments/10_basic.yaml | 11 +++------- .../test/cat.shards/10_basic.yaml | 12 +++-------- .../test/cat.thread_pool/10_basic.yaml | 4 +--- 28 files changed, 39 insertions(+), 86 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/RestTable.java b/core/src/main/java/org/elasticsearch/rest/action/support/RestTable.java index 3e6eb713529..e1c62049843 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/RestTable.java +++ b/core/src/main/java/org/elasticsearch/rest/action/support/RestTable.java @@ -68,7 +68,7 @@ public class RestTable { public static RestResponse buildTextPlainResponse(Table table, RestChannel channel) throws IOException { RestRequest request = channel.request(); - boolean verbose = request.paramAsBoolean("v", true); + boolean verbose = request.paramAsBoolean("v", false); List headers = buildDisplayHeaders(table, request); int[] width = buildWidths(table, request, verbose, headers); diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.aliases.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.aliases.json index eabc596360c..07c72a2ac98 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.aliases.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.aliases.json @@ -32,7 +32,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.allocation.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.allocation.json index 11d0915fce0..9de5a729faa 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.allocation.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.allocation.json @@ -37,7 +37,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.count.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.count.json index 79c347d2548..2661af347d0 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.count.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.count.json @@ -32,7 +32,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.fielddata.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.fielddata.json index b070281b92f..a380b558e89 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.fielddata.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.fielddata.json @@ -37,7 +37,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false }, "fields": { "type": "list", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.health.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.health.json index 68bad5bc675..bd0cfcedd53 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.health.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.health.json @@ -33,7 +33,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.indices.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.indices.json index 0a5fe158136..b5c487b9521 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.indices.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.indices.json @@ -42,7 +42,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.master.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.master.json index ccce8d6dd2c..d3e35330e1d 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.master.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.master.json @@ -28,7 +28,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.nodeattrs.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.nodeattrs.json index 157a33f0408..cdbe75ac936 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.nodeattrs.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.nodeattrs.json @@ -28,7 +28,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.nodes.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.nodes.json index 8a801c018dc..1d8bcda3c01 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.nodes.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.nodes.json @@ -28,7 +28,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.pending_tasks.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.pending_tasks.json index c8512a9f16d..88afa9b0c40 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.pending_tasks.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.pending_tasks.json @@ -28,7 +28,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.plugins.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.plugins.json index eab71f0ac40..55ee66a2792 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.plugins.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.plugins.json @@ -26,7 +26,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.recovery.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.recovery.json index 2fe2049ce40..c235406221a 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.recovery.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.recovery.json @@ -33,7 +33,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.segments.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.segments.json index f032f4d38e6..ebb989b4cf6 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.segments.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.segments.json @@ -24,7 +24,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.shards.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.shards.json index 5aa8e7c8e34..6d941f17d10 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.shards.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.shards.json @@ -32,7 +32,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false } } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.thread_pool.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.thread_pool.json index c1431ae0d61..cb8e5e13632 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.thread_pool.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.thread_pool.json @@ -28,7 +28,7 @@ "v": { "type": "boolean", "description": "Verbose mode. Display column headers", - "default": true + "default": false }, "full_id": { "type": "boolean", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.aliases/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.aliases/10_basic.yaml index dea14a45bd3..640d77e0183 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.aliases/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.aliases/10_basic.yaml @@ -17,8 +17,7 @@ "Empty cluster": - do: - cat.aliases: - v: false + cat.aliases: {} - match: $body: | @@ -38,8 +37,7 @@ name: test_alias - do: - cat.aliases: - v: false + cat.aliases: {} - match: $body: | @@ -75,8 +73,7 @@ term: foo: bar - do: - cat.aliases: - v: false + cat.aliases: {} - match: $body: | @@ -108,14 +105,12 @@ - do: cat.aliases: name: test_1 - v: false - match: $body: /^test_1 .+ \n$/ - do: cat.aliases: - v: false name: test_2 - match: @@ -123,7 +118,6 @@ - do: cat.aliases: - v: false name: test_* - match: @@ -178,8 +172,7 @@ - do: cat.aliases: - v: false - h: [index, alias] + h: [index, alias] - match: $body: /^ test \s+ test_1 \s+ $/ @@ -195,9 +188,3 @@ index \s+ alias \s+ \n test \s+ test_1 \s+ \n $/ - - - - - - diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.allocation/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.allocation/10_basic.yaml index ea508e15919..04a534e18b6 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.allocation/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.allocation/10_basic.yaml @@ -3,7 +3,6 @@ - do: cat.allocation: help: true - v: false - match: $body: | @@ -21,8 +20,7 @@ "Empty cluster": - do: - cat.allocation: - v: false + cat.allocation: {} - match: $body: | @@ -51,8 +49,7 @@ wait_for_status: yellow - do: - cat.allocation: - v: false + cat.allocation: {} - match: $body: | @@ -82,7 +79,6 @@ - do: cat.allocation: node_id: _master - v: false - match: $body: | @@ -102,7 +98,6 @@ - do: cat.allocation: node_id: non_existent - v: false - match: $body: | @@ -116,7 +111,6 @@ - do: cat.allocation: node_id: "*" - v: false - match: $body: | @@ -215,7 +209,6 @@ - do: cat.allocation: bytes: g - v: false - match: $body: | @@ -231,4 +224,3 @@ \n )+ $/ - diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.count/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.count/10_basic.yaml index 76755327140..1a62ab063d9 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.count/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.count/10_basic.yaml @@ -14,8 +14,7 @@ "Test cat count output": - do: - cat.count: - v: false + cat.count: {} - match: $body: | @@ -31,8 +30,7 @@ refresh: true - do: - cat.count: - v: false + cat.count: {} - match: $body: | @@ -50,7 +48,6 @@ - do: cat.count: h: count - v: false - match: $body: | @@ -61,7 +58,6 @@ - do: cat.count: index: index1 - v: false - match: $body: | @@ -77,4 +73,3 @@ $body: | /^ epoch \s+ timestamp \s+ count \s+ \n \d+ \s+ \d{2}:\d{2}:\d{2} \s+ \d+ \s+ \n $/ - diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.fielddata/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.fielddata/10_basic.yaml index ada97021e6e..bc362fae58c 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.fielddata/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.fielddata/10_basic.yaml @@ -17,8 +17,7 @@ "Test cat fielddata output": - do: - cat.fielddata: - v: false + cat.fielddata: {} - do: index: diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yaml index ad4fd2f5521..9bfde46a371 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yaml @@ -28,8 +28,7 @@ "Empty cluster": - do: - cat.health: - v: false + cat.health: {} - match: $body: | diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.indices/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.indices/10_basic.yaml index d8beff155c7..a5a67d1a557 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.indices/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.indices/10_basic.yaml @@ -2,8 +2,7 @@ "Test cat indices output": - do: - cat.indices: - v: false + cat.indices: {} - match: $body: | @@ -20,8 +19,7 @@ cluster.health: wait_for_status: yellow - do: - cat.indices: - v: false + cat.indices: {} - match: $body: | diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodeattrs/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodeattrs/10_basic.yaml index 5af720effec..f076a3b1859 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodeattrs/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodeattrs/10_basic.yaml @@ -6,8 +6,7 @@ reason: "Waiting for #12558" - do: - cat.nodeattrs: - v: false + cat.nodeattrs: {} - match: $body: | diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodes/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodes/10_basic.yaml index 12545f0a64b..66145f47b0a 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodes/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodes/10_basic.yaml @@ -2,8 +2,7 @@ "Test cat nodes output": - do: - cat.nodes: - v: false + cat.nodes: {} - match: $body: | diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.recovery/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.recovery/10_basic.yaml index 8ac01eaf317..4bc3e996fca 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.recovery/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.recovery/10_basic.yaml @@ -2,8 +2,7 @@ "Test cat recovery output": - do: - cat.recovery: - v: false + cat.recovery: {} - match: $body: | @@ -20,8 +19,7 @@ cluster.health: wait_for_status: yellow - do: - cat.recovery: - v: false + cat.recovery: {} - match: $body: | diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.segments/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.segments/10_basic.yaml index b64d14ebd50..c31eb1b79c5 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.segments/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.segments/10_basic.yaml @@ -26,8 +26,7 @@ "Test cat segments output": - do: - cat.segments: - v: false + cat.segments: {} - match: $body: | @@ -50,8 +49,7 @@ cluster.health: wait_for_status: green - do: - cat.segments: - v: false + cat.segments: {} - match: $body: | /^(index1 \s+ \d \s+ (p|r) \s+ \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} \s+ _\d (\s\d){3} \s+ @@ -81,8 +79,7 @@ - do: - cat.segments: - v: false + cat.segments: {} - match: $body: | /^(index(1|2) .+ \n?){2}$/ @@ -90,7 +87,6 @@ - do: cat.segments: index: index2 - v: false - match: $body: | /^(index2 .+ \n?)$/ @@ -118,4 +114,3 @@ catch: forbidden cat.segments: index: index1 - v: false diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.shards/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.shards/10_basic.yaml index 2838dcb1a55..40f8740db96 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.shards/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.shards/10_basic.yaml @@ -77,8 +77,7 @@ "Test cat shards output": - do: - cat.shards: - v: false + cat.shards: {} - match: $body: | @@ -95,8 +94,7 @@ cluster.health: wait_for_status: yellow - do: - cat.shards: - v: false + cat.shards: {} - match: $body: | @@ -115,8 +113,7 @@ wait_for_relocating_shards: 0 - do: - cat.shards: - v: false + cat.shards: {} - match: $body: | /^(index(1|2) \s+ \d \s+ (p|r) \s+ ((STARTED|INITIALIZING|RELOCATING) \s+ (\d \s+ (\d+|\d+[.]\d+)(kb|b) \s+)? \d{1,3}.\d{1,3}.\d{1,3}.\d{1,3} \s+ .+|UNASSIGNED \s+) \n?){15}$/ @@ -124,7 +121,6 @@ - do: cat.shards: index: index2 - v: false - match: $body: | /^(index2 \s+ \d \s+ (p|r) \s+ ((STARTED|INITIALIZING|RELOCATING) \s+ (\d \s+ (\d+|\d+[.]\d+)(kb|b) \s+)? \d{1,3}.\d{1,3}.\d{1,3}.\d{1,3} \s+ .+|UNASSIGNED \s+) \n?){5}$/ @@ -146,8 +142,6 @@ - do: cat.shards: index: index3 - v: false - match: $body: | /^(index3 \s+ \d \s+ (p|s) \s+ ((STARTED|INITIALIZING|RELOCATING) \s+ (\d \s+ (\d+|\d+[.]\d+)(kb|b) \s+)? \d{1,3}.\d{1,3}.\d{1,3}.\d{1,3} \s+ .+|UNASSIGNED \s+) \n?){2}$/ - diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.thread_pool/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.thread_pool/10_basic.yaml index edb87ce27b9..0c8ac5b4028 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.thread_pool/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.thread_pool/10_basic.yaml @@ -2,8 +2,7 @@ "Test cat thread_pool output": - do: - cat.thread_pool: - v: false + cat.thread_pool: {} - match: $body: | @@ -22,7 +21,6 @@ - do: cat.thread_pool: h: pid,id,h,i,po - v: false - match: $body: | From 8a75d33ee6dd3cbab95b08648814eba6089ba2ba Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Fri, 28 Aug 2015 11:24:58 -0400 Subject: [PATCH 2/2] Remove migration note about cat verbosity Its no longer true. --- docs/reference/migration/migrate_2_0/stats.asciidoc | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docs/reference/migration/migrate_2_0/stats.asciidoc b/docs/reference/migration/migrate_2_0/stats.asciidoc index 84635f5713e..b75246e4f11 100644 --- a/docs/reference/migration/migrate_2_0/stats.asciidoc +++ b/docs/reference/migration/migrate_2_0/stats.asciidoc @@ -45,16 +45,6 @@ used separately to control whether `routing_nodes` should be returned. The deprecated index status API has been removed. -==== `cat` APIs verbose by default - -The `cat` APIs now default to being verbose, which means they output column -headers by default. Verbosity can be turned off with the `v` parameter: - -[source,sh] ------------------ -GET _cat/shards?v=0 ------------------ - ==== Nodes Stats API Queue lengths are now reported as basic numeric so they can easily processed by code. Before we used a human