Simulate a pipeline

Simulates an ingest pipeline with any example documents you specify.

Example

  1. POST /_ingest/pipeline/35678/_simulate
  2. {
  3. "docs": [
  4. {
  5. "_index": "index",
  6. "_id": "id",
  7. "_source": {
  8. "location": "document-name"
  9. }
  10. },
  11. {
  12. "_index": "index",
  13. "_id": "id",
  14. "_source": {
  15. "location": "document-name"
  16. }
  17. }
  18. ]
  19. }

copy

Path and HTTP methods

Simulate the last ingest pipeline created.

  1. GET _ingest/pipeline/_simulate
  2. POST _ingest/pipeline/_simulate

Simulate a single pipeline based on the pipeline’s ID.

  1. GET _ingest/pipeline/{id}/_simulate
  2. POST _ingest/pipeline/{id}/_simulate

URL parameters

All URL parameters are optional.

ParameterTypeDescription
verbosebooleanVerbose mode. Display data output for each processor in executed pipeline.

Request body fields

FieldRequiredTypeDescription
pipelineOptionalobjectThe pipeline you want to simulate. When included without the pipeline {id} inside the request path, the response simulates the last pipeline created.
docsRequiredarray of objectsThe documents you want to use to test the pipeline.

The docs field can include the following subfields:

FieldRequiredTypeDescription
idOptionalstringAn optional identifier for the document. The identifier cannot be used elsewhere in the index.
indexOptionalstringThe index where the document’s transformed data appears.
sourceRequiredobjectThe document’s JSON body.

Response

Responses vary based on which path and HTTP method you choose.

Specify pipeline in request body

  1. {
  2. "docs" : [
  3. {
  4. "doc" : {
  5. "_index" : "index",
  6. "_id" : "id",
  7. "_source" : {
  8. "location" : "new-new",
  9. "field2" : "_value"
  10. },
  11. "_ingest" : {
  12. "timestamp" : "2022-02-07T18:47:57.479230835Z"
  13. }
  14. }
  15. },
  16. {
  17. "doc" : {
  18. "_index" : "index",
  19. "_id" : "id",
  20. "_source" : {
  21. "location" : "new-new",
  22. "field2" : "_value"
  23. },
  24. "_ingest" : {
  25. "timestamp" : "2022-02-07T18:47:57.47933496Z"
  26. }
  27. }
  28. }
  29. ]
  30. }

Specify pipeline ID inside HTTP path

  1. {
  2. "docs" : [
  3. {
  4. "doc" : {
  5. "_index" : "index",
  6. "_id" : "id",
  7. "_source" : {
  8. "field-name" : "value",
  9. "location" : "document-name"
  10. },
  11. "_ingest" : {
  12. "timestamp" : "2022-02-03T21:47:05.382744877Z"
  13. }
  14. }
  15. },
  16. {
  17. "doc" : {
  18. "_index" : "index",
  19. "_id" : "id",
  20. "_source" : {
  21. "field-name" : "value",
  22. "location" : "document-name"
  23. },
  24. "_ingest" : {
  25. "timestamp" : "2022-02-03T21:47:05.382803544Z"
  26. }
  27. }
  28. }
  29. ]
  30. }

Receive verbose response

With the verbose parameter set to true, the response shows how each processor transforms the specified document.

  1. {
  2. "docs" : [
  3. {
  4. "processor_results" : [
  5. {
  6. "processor_type" : "set",
  7. "status" : "success",
  8. "doc" : {
  9. "_index" : "index",
  10. "_id" : "id",
  11. "_source" : {
  12. "field-name" : "value",
  13. "location" : "document-name"
  14. },
  15. "_ingest" : {
  16. "pipeline" : "35678",
  17. "timestamp" : "2022-02-03T21:45:09.414049004Z"
  18. }
  19. }
  20. }
  21. ]
  22. },
  23. {
  24. "processor_results" : [
  25. {
  26. "processor_type" : "set",
  27. "status" : "success",
  28. "doc" : {
  29. "_index" : "index",
  30. "_id" : "id",
  31. "_source" : {
  32. "field-name" : "value",
  33. "location" : "document-name"
  34. },
  35. "_ingest" : {
  36. "pipeline" : "35678",
  37. "timestamp" : "2022-02-03T21:45:09.414093212Z"
  38. }
  39. }
  40. }
  41. ]
  42. }
  43. ]
  44. }

Simulate an ingest pipeline - 图1