Skip to content

Commit a91bb29

Browse files
committed
ingest: Made the response format of the get pipeline api match with the response format of the index template api
Closes #19585
1 parent 30b4976 commit a91bb29

File tree

5 files changed

+45
-36
lines changed

5 files changed

+45
-36
lines changed

core/src/main/java/org/elasticsearch/action/ingest/GetPipelineResponse.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,9 @@ public RestStatus status() {
7676

7777
@Override
7878
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
79-
builder.startArray("pipelines");
8079
for (PipelineConfiguration pipeline : pipelines) {
81-
pipeline.toXContent(builder, params);
80+
builder.field(pipeline.getId(), pipeline.getConfigAsMap());
8281
}
83-
builder.endArray();
8482
return builder;
8583
}
8684
}

docs/reference/ingest/ingest-node.asciidoc

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,17 @@ Example response:
7171
[source,js]
7272
--------------------------------------------------
7373
{
74-
"pipelines": [ {
75-
"id": "my-pipeline-id",
76-
"config": {
77-
"description": "describe pipeline",
78-
"processors": [
79-
{
80-
"set" : {
81-
"field": "foo",
82-
"value": "bar"
83-
}
74+
"my-pipeline-id" : {
75+
"description" : "describe pipeline",
76+
"processors" : [
77+
{
78+
"set" : {
79+
"field" : "foo",
80+
"value" : "bar"
8481
}
85-
]
86-
}
87-
} ]
82+
}
83+
]
84+
}
8885
}
8986
--------------------------------------------------
9087
// TESTRESPONSE

modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/20_crud.yaml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ teardown:
3535
- do:
3636
ingest.get_pipeline:
3737
id: "my_pipeline"
38-
- match: { pipelines.0.id: "my_pipeline" }
39-
- match: { pipelines.0.config.description: "_description" }
38+
- match: { my_pipeline.description: "_description" }
4039

4140
- do:
4241
ingest.get_pipeline: {}
43-
- match: { pipelines.0.id: "my_pipeline" }
44-
- match: { pipelines.0.config.description: "_description" }
42+
- match: { my_pipeline.description: "_description" }
4543

4644
- do:
4745
ingest.delete_pipeline:
@@ -54,7 +52,7 @@ teardown:
5452
id: "my_pipeline"
5553

5654
---
57-
"Test Get All Pipelines (unordered)":
55+
"Test Get All Pipelines":
5856
- do:
5957
ingest.put_pipeline:
6058
id: "first_pipeline"
@@ -79,11 +77,10 @@ teardown:
7977
"processors": []
8078
}
8179
82-
# Order is not guaranteed by the response, so we check for length instead; above tests that we get appropriate values
8380
- do:
8481
ingest.get_pipeline: {}
85-
- length: { pipelines: 2 }
86-
82+
- match: { first_pipeline.description: "first" }
83+
- match: { second_pipeline.description: "second" }
8784

8885
---
8986
"Test invalid config":
@@ -155,8 +152,7 @@ teardown:
155152
- do:
156153
ingest.get_pipeline:
157154
id: "my_pipeline"
158-
- match: { pipelines.0.id: "my_pipeline" }
159-
- match: { pipelines.0.config.description: "_description" }
155+
- match: { my_pipeline.description: "_description" }
160156

161157
- do:
162158
ingest.delete_pipeline:

qa/smoke-test-ingest-disabled/src/test/resources/rest-api-spec/test/ingest_mustache/10_ingest_disabled.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
- do:
2121
ingest.get_pipeline:
2222
id: "my_pipeline"
23-
- match: { pipelines.0.id: "my_pipeline" }
24-
- match: { pipelines.0.config.description: "_description" }
23+
- match: { my_pipeline.description: "_description" }
2524

2625
- do:
2726
ingest.delete_pipeline:

rest-api-spec/src/main/resources/rest-api-spec/test/ingest/10_basic.yaml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
- do:
1515
ingest.get_pipeline:
1616
id: "my_pipeline"
17-
- match: { pipelines.0.id: "my_pipeline" }
18-
- match: { pipelines.0.config.description: "_description" }
17+
- match: { my_pipeline.description: "_description" }
1918

2019
- do:
2120
ingest.delete_pipeline:
@@ -27,6 +26,30 @@
2726
ingest.get_pipeline:
2827
id: "my_pipeline"
2928

29+
---
30+
"Test Get All Pipelines":
31+
- do:
32+
ingest.put_pipeline:
33+
id: "first_pipeline"
34+
body: >
35+
{
36+
"description": "first",
37+
"processors": []
38+
}
39+
- do:
40+
ingest.put_pipeline:
41+
id: "second_pipeline"
42+
body: >
43+
{
44+
"description": "second",
45+
"processors": []
46+
}
47+
48+
- do:
49+
ingest.get_pipeline: {}
50+
- match: { first_pipeline.description: "first" }
51+
- match: { second_pipeline.description: "second" }
52+
3053
---
3154
"Test invalid config":
3255
- do:
@@ -36,10 +59,6 @@
3659
body: >
3760
{
3861
"description": "_description",
39-
"processors": [
40-
{
41-
"set" : {
42-
}
43-
}
44-
]
62+
"processors": [],
63+
"invalid_field" : {}
4564
}

0 commit comments

Comments
 (0)