Browse Source

[DOCS] Add additional example to ingest pipeline docs (#70677)

James Rodewig 4 years ago
parent
commit
026c02b1ee

+ 54 - 5
docs/reference/ingest.asciidoc

@@ -84,6 +84,27 @@ PUT _ingest/pipeline/my-pipeline
 ----
 // TESTSETUP
 
+[discrete]
+[[manage-pipeline-versions]]
+=== Manage pipeline versions
+
+When you create or update a pipeline, you can specify an optional `version`
+integer. {es} doesn't use this `version` number internally, but you can use it
+to track changes to a pipeline.
+
+[source,console]
+----
+PUT /_ingest/pipeline/my-pipeline-id
+{
+  "version" : 1,
+  "processors": [ ... ]
+}
+----
+// TEST[s/\.\.\./{"lowercase": {"field":"my-keyword-field"}}/]
+
+To unset the `version` number using the API, replace or update the pipeline
+without specifying the `version` parameter.
+
 [discrete]
 [[test-pipeline]]
 === Test a pipeline
@@ -97,7 +118,8 @@ the pipeline**.
 image::images/ingest/test-a-pipeline.png[Test a pipeline in Kibana,align="center"]
 
 You can also test pipelines using the <<simulate-pipeline-api,simulate pipeline
-API>>.
+API>>. You can specify a configured pipeline in the request path. For example,
+the following request tests `my-pipeline`.
 
 [source,console]
 ----
@@ -118,6 +140,37 @@ POST _ingest/pipeline/my-pipeline/_simulate
 }
 ----
 
+Alternatively, you can specify a pipeline and its processors in the request
+body.
+
+[source,console]
+----
+POST _ingest/pipeline/_simulate
+{
+  "pipeline" : {
+    "processors": [
+      {
+        "lowercase": {
+          "field": "my-keyword-field"
+        }
+      }
+    ]
+  },
+  "docs": [
+    {
+      "_source": {
+        "my-keyword-field": "FOO"
+      }
+    },
+    {
+      "_source": {
+        "my-keyword-field": "BAR"
+      }
+    }
+  ]
+}
+----
+
 The API returns transformed documents:
 
 [source,console-result]
@@ -129,8 +182,6 @@ The API returns transformed documents:
         "_index": "_index",
         "_id": "_id",
         "_source": {
-          "my-long-field": 10,
-          "my-boolean-field": true,
           "my-keyword-field": "foo"
         },
         "_ingest": {
@@ -143,8 +194,6 @@ The API returns transformed documents:
         "_index": "_index",
         "_id": "_id",
         "_source": {
-          "my-long-field": 10,
-          "my-boolean-field": true,
           "my-keyword-field": "bar"
         },
         "_ingest": {

+ 0 - 47
docs/reference/ingest/apis/get-pipeline.asciidoc

@@ -97,50 +97,3 @@ The API returns the following response:
   }
 }
 ----
-
-
-[[get-pipeline-api-version-ex]]
-===== Get the version of an ingest pipeline
-
-When you create or update an ingest pipeline,
-you can specify an optional `version` parameter.
-The version is useful for managing changes to pipeline
-and viewing the current pipeline for an ingest node.
-
-
-To check the pipeline version,
-use the `filter_path` query parameter
-to <<common-options-response-filtering, filter the response>>
-to only the version.
-
-[source,console]
-----
-GET /_ingest/pipeline/my-pipeline-id?filter_path=*.version
-----
-// TEST[continued]
-
-The API returns the following response:
-
-[source,console-result]
-----
-{
-  "my-pipeline-id" : {
-    "version" : 123
-  }
-}
-----
-
-////
-[source,console]
-----
-DELETE /_ingest/pipeline/my-pipeline-id
-----
-// TEST[continued]
-
-[source,console-result]
-----
-{
-"acknowledged": true
-}
-----
-////

+ 0 - 67
docs/reference/ingest/apis/put-pipeline.asciidoc

@@ -68,70 +68,3 @@ Version number used by external systems to track ingest pipelines.
 +
 This parameter is intended for external systems only. {es} does not use or
 validate pipeline version numbers.
-
-
-[[put-pipeline-api-example]]
-==== {api-examples-title}
-
-
-[[versioning-pipelines]]
-===== Pipeline versioning
-
-When creating or updating an ingest pipeline,
-you can specify an optional `version` parameter.
-The version is useful for managing changes to pipeline
-and viewing the current pipeline for an ingest node.
-
-The following request sets a version number of `123`
-for `my-pipeline-id`.
-
-[source,console]
---------------------------------------------------
-PUT /_ingest/pipeline/my-pipeline-id
-{
-  "description" : "describe pipeline",
-  "version" : 123,
-  "processors" : [
-    {
-      "set" : {
-        "field": "foo",
-        "value": "bar"
-      }
-    }
-  ]
-}
---------------------------------------------------
-
-To unset the version number,
-replace the pipeline without specifying a `version` parameter.
-
-[source,console]
---------------------------------------------------
-PUT /_ingest/pipeline/my-pipeline-id
-{
-  "description" : "describe pipeline",
-  "processors" : [
-    {
-      "set" : {
-        "field": "foo",
-        "value": "bar"
-      }
-    }
-  ]
-}
---------------------------------------------------
-
-////
-[source,console]
---------------------------------------------------
-DELETE /_ingest/pipeline/my-pipeline-id
---------------------------------------------------
-// TEST[continued]
-
-[source,console-result]
---------------------------------------------------
-{
-"acknowledged": true
-}
---------------------------------------------------
-////