Skip to content

Commit 7674de9

Browse files
authored
Move human flag under always accepted query_string params (#22562)
There are some parameters that are accepted by each and every api we expose. Those (pretty, source, error_trace and filter_path) are not explicitly listed in the spec of every api, rather whitelisted in clients test runners so that they are always accepted. The `human` flag has been treated up until now as a parameter that's accepted by only some stats and info api, but that doesn't reflect reality as es core treats it exactly like `pretty` (relevant especially now that we validate params and throw exception when we find one that is not supported). Furthermore, the human flag has effect on every api that outputs a date, time, percentage or byte size field. For instance the tasks api outputs a date field although they don't have the human flag explicitly listed in their spec. There are other similar cases. This commit removes the human flag from the rest spec and makes it an always accepted query_string param.
1 parent 0f7d52d commit 7674de9

File tree

10 files changed

+1
-46
lines changed

10 files changed

+1
-46
lines changed

rest-api-spec/src/main/resources/rest-api-spec/api/cluster.stats.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
"type": "boolean",
1717
"description": "Return settings in flat format (default: false)"
1818
},
19-
"human": {
20-
"type": "boolean",
21-
"description": "Whether to return time and byte values in human-readable format.",
22-
"default": false
23-
},
2419
"timeout": {
2520
"type" : "time",
2621
"description" : "Explicit operation timeout"

rest-api-spec/src/main/resources/rest-api-spec/api/indices.get.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@
4040
"type": "boolean",
4141
"description": "Return settings in flat format (default: false)"
4242
},
43-
"human": {
44-
"type": "boolean",
45-
"description": "Whether to return version and creation date values in human-readable format.",
46-
"default": false
47-
},
4843
"include_defaults": {
4944
"type": "boolean",
5045
"description": "Whether to return all default setting for each of the indices.",

rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_settings.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@
3838
"type": "boolean",
3939
"description": "Return local information, do not retrieve the state from master node (default: false)"
4040
},
41-
"human": {
42-
"type": "boolean",
43-
"description": "Whether to return version and creation date values in human-readable format.",
44-
"default": false
45-
},
4641
"include_defaults": {
4742
"type": "boolean",
4843
"description": "Whether to return all default setting for each of the indices.",

rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_upgrade.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525
"options" : ["open","closed","none","all"],
2626
"default" : "open",
2727
"description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both."
28-
},
29-
"human": {
30-
"type": "boolean",
31-
"description": "Whether to return time and byte values in human-readable format.",
32-
"default": false
3328
}
3429
}
3530
},

rest-api-spec/src/main/resources/rest-api-spec/api/indices.recovery.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
"type": "boolean",
2222
"description": "Display only those recoveries that are currently on-going",
2323
"default": false
24-
},
25-
"human": {
26-
"type": "boolean",
27-
"description": "Whether to return time and byte values in human-readable format.",
28-
"default": false
2924
}
3025
}
3126
},

rest-api-spec/src/main/resources/rest-api-spec/api/indices.segments.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
"default" : "open",
2727
"description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both."
2828
},
29-
"human": {
30-
"type": "boolean",
31-
"description": "Whether to return time and byte values in human-readable format.",
32-
"default": false
33-
},
3429
"operation_threading": {
3530
"description" : "TODO: ?"
3631
},

rest-api-spec/src/main/resources/rest-api-spec/api/indices.stats.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@
3838
"type" : "list",
3939
"description" : "A comma-separated list of search groups for `search` index metric"
4040
},
41-
"human": {
42-
"type": "boolean",
43-
"description": "Whether to return time and byte values in human-readable format.",
44-
"default": false
45-
},
4641
"level": {
4742
"type" : "enum",
4843
"description": "Return stats aggregated at cluster, index or shard level",

rest-api-spec/src/main/resources/rest-api-spec/api/nodes.info.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
"type": "boolean",
2222
"description": "Return settings in flat format (default: false)"
2323
},
24-
"human": {
25-
"type": "boolean",
26-
"description": "Whether to return time and byte values in human-readable format.",
27-
"default": false
28-
},
2924
"timeout": {
3025
"type" : "time",
3126
"description" : "Explicit operation timeout"

rest-api-spec/src/main/resources/rest-api-spec/api/nodes.stats.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@
4545
"type" : "boolean",
4646
"description" : "A comma-separated list of search groups for `search` index metric"
4747
},
48-
"human": {
49-
"type": "boolean",
50-
"description": "Whether to return time and byte values in human-readable format.",
51-
"default": false
52-
},
5348
"level": {
5449
"type" : "enum",
5550
"description": "Return indices stats aggregated at index, node or shard level",

test/framework/src/main/java/org/elasticsearch/test/rest/yaml/ClientYamlTestClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class ClientYamlTestClient {
5959
* Query params that don't need to be declared in the spec, they are supported by default.
6060
*/
6161
private static final Set<String> ALWAYS_ACCEPTED_QUERY_STRING_PARAMS = Sets.newHashSet(
62-
"error_trace", "filter_path", "pretty", "source");
62+
"error_trace", "filter_path", "human", "pretty", "source");
6363

6464
private final ClientYamlSuiteRestSpec restSpec;
6565
private final RestClient restClient;

0 commit comments

Comments
 (0)