Skip to content

Commit c88f2f2

Browse files
PnPieywelsch
authored andcommitted
Make Recovery API support detailed params (#29076)
Properly forwards the `detailed` parameter to show the recovery stats details. Closes #28910
1 parent 90e151e commit c88f2f2

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

docs/reference/indices/recovery.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Response:
249249
}
250250
--------------------------------------------------
251251
// TESTRESPONSE[s/"source" : \{[^}]*\}/"source" : $body.$_path/]
252-
// TESTRESPONSE[s/"details" : \[[^\]]*\]//]
252+
// TESTRESPONSE[s/"details" : \[[^\]]*\]/"details" : $body.$_path/]
253253
// TESTRESPONSE[s/: (\-)?[0-9]+/: $body.$_path/]
254254
// TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
255255
////

rest-api-spec/src/main/resources/rest-api-spec/test/indices.recovery/10_basic.yml

+25
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,28 @@
130130
index: [v*]
131131

132132
- match: { $body: {} }
133+
---
134+
"Indices recovery test with detailed parameter":
135+
- skip:
136+
version: " - 7.2.99"
137+
reason: bug with detailed parameter fixed in 7.3
138+
139+
- do:
140+
indices.create:
141+
index: test_3
142+
body:
143+
settings:
144+
index:
145+
number_of_replicas: 0
146+
147+
- do:
148+
cluster.health:
149+
wait_for_status: green
150+
151+
- do:
152+
indices.recovery:
153+
index: [test_3]
154+
human: true
155+
detailed: true
156+
157+
- match: { test_3.shards.0.index.files.details: [] }

server/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ public synchronized XContentBuilder toXContent(XContentBuilder builder, Params p
929929
builder.field(Fields.REUSED, reusedFileCount());
930930
builder.field(Fields.RECOVERED, recoveredFileCount());
931931
builder.field(Fields.PERCENT, String.format(Locale.ROOT, "%1.1f%%", recoveredFilesPercent()));
932-
if (params.paramAsBoolean("details", false)) {
932+
if (params.paramAsBoolean("detailed", false)) {
933933
builder.startArray(Fields.DETAILS);
934934
for (File file : fileDetails.values()) {
935935
file.toXContent(builder, params);

0 commit comments

Comments
 (0)