Skip to content

Commit

Permalink
ingest: Made the response format of the get pipeline api match with t…
Browse files Browse the repository at this point in the history
…he response format of the index template api

Closes #19585
  • Loading branch information
martijnvg committed Jul 29, 2016
1 parent 30b4976 commit a91bb29
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@ public RestStatus status() {

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startArray("pipelines");
for (PipelineConfiguration pipeline : pipelines) {
pipeline.toXContent(builder, params);
builder.field(pipeline.getId(), pipeline.getConfigAsMap());
}
builder.endArray();
return builder;
}
}
23 changes: 10 additions & 13 deletions docs/reference/ingest/ingest-node.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,17 @@ Example response:
[source,js]
--------------------------------------------------
{
"pipelines": [ {
"id": "my-pipeline-id",
"config": {
"description": "describe pipeline",
"processors": [
{
"set" : {
"field": "foo",
"value": "bar"
}
"my-pipeline-id" : {
"description" : "describe pipeline",
"processors" : [
{
"set" : {
"field" : "foo",
"value" : "bar"
}
]
}
} ]
}
]
}
}
--------------------------------------------------
// TESTRESPONSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ teardown:
- do:
ingest.get_pipeline:
id: "my_pipeline"
- match: { pipelines.0.id: "my_pipeline" }
- match: { pipelines.0.config.description: "_description" }
- match: { my_pipeline.description: "_description" }

- do:
ingest.get_pipeline: {}
- match: { pipelines.0.id: "my_pipeline" }
- match: { pipelines.0.config.description: "_description" }
- match: { my_pipeline.description: "_description" }

- do:
ingest.delete_pipeline:
Expand All @@ -54,7 +52,7 @@ teardown:
id: "my_pipeline"

---
"Test Get All Pipelines (unordered)":
"Test Get All Pipelines":
- do:
ingest.put_pipeline:
id: "first_pipeline"
Expand All @@ -79,11 +77,10 @@ teardown:
"processors": []
}
# Order is not guaranteed by the response, so we check for length instead; above tests that we get appropriate values
- do:
ingest.get_pipeline: {}
- length: { pipelines: 2 }

- match: { first_pipeline.description: "first" }
- match: { second_pipeline.description: "second" }

---
"Test invalid config":
Expand Down Expand Up @@ -155,8 +152,7 @@ teardown:
- do:
ingest.get_pipeline:
id: "my_pipeline"
- match: { pipelines.0.id: "my_pipeline" }
- match: { pipelines.0.config.description: "_description" }
- match: { my_pipeline.description: "_description" }

- do:
ingest.delete_pipeline:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
- do:
ingest.get_pipeline:
id: "my_pipeline"
- match: { pipelines.0.id: "my_pipeline" }
- match: { pipelines.0.config.description: "_description" }
- match: { my_pipeline.description: "_description" }

- do:
ingest.delete_pipeline:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
- do:
ingest.get_pipeline:
id: "my_pipeline"
- match: { pipelines.0.id: "my_pipeline" }
- match: { pipelines.0.config.description: "_description" }
- match: { my_pipeline.description: "_description" }

- do:
ingest.delete_pipeline:
Expand All @@ -27,6 +26,30 @@
ingest.get_pipeline:
id: "my_pipeline"

---
"Test Get All Pipelines":
- do:
ingest.put_pipeline:
id: "first_pipeline"
body: >
{
"description": "first",
"processors": []
}
- do:
ingest.put_pipeline:
id: "second_pipeline"
body: >
{
"description": "second",
"processors": []
}
- do:
ingest.get_pipeline: {}
- match: { first_pipeline.description: "first" }
- match: { second_pipeline.description: "second" }

---
"Test invalid config":
- do:
Expand All @@ -36,10 +59,6 @@
body: >
{
"description": "_description",
"processors": [
{
"set" : {
}
}
]
"processors": [],
"invalid_field" : {}
}

0 comments on commit a91bb29

Please sign in to comment.