2022-02-04 10:37:42 -05:00
---
layout: default
title: Simulate an ingest pipeline
parent: Ingest APIs
nav_order: 13
---
# Simulate a pipeline
2022-02-04 12:44:49 -05:00
Simulates an ingest pipeline with any example documents you specify.
2022-02-04 10:37:42 -05:00
## Example
```
2022-02-07 13:49:43 -05:00
POST /_ingest/pipeline/35678/_simulate
2022-02-04 10:37:42 -05:00
{
"docs": [
{
"_index": "index",
"_id": "id",
"_source": {
"location": "document-name"
}
},
{
"_index": "index",
"_id": "id",
"_source": {
"location": "document-name"
}
}
]
}
```
## Path and HTTP methods
2022-02-04 12:45:12 -05:00
Simulate the last ingest pipeline created.
2022-02-04 10:37:42 -05:00
```
GET _ingest/pipeline/_simulate
POST _ingest/pipeline/_simulate
```
Simulate a single pipeline based on the pipeline's ID.
```
GET _ingest/pipeline/{id}/_simulate
POST _ingest/pipeline/{id}/_simulate
```
## URL parameters
2022-02-07 13:49:43 -05:00
All URL parameters are optional.
2022-02-04 10:37:42 -05:00
Parameter | Type | Description
:--- | :--- | :---
2022-02-04 12:44:49 -05:00
verbose | boolean | Verbose mode. Display data output for each processor in executed pipeline.
2022-02-04 10:37:42 -05:00
## Request body fields
2022-02-07 13:49:43 -05:00
Field | Required | Type | Description
:--- | :--- | :--- | :---
`pipeline` | Optional | object | The pipeline you want to simulate. When included without the pipeline `{id}` inside the request path, the response simulates the last pipeline created.
`docs` | Required | array of objects | The documents you want to use to test the pipeline.
2022-02-04 10:37:42 -05:00
The `docs` field can include the following subfields:
2022-02-07 13:49:43 -05:00
Field | Required | Type | Description
2022-02-04 10:37:42 -05:00
:--- | :--- | :---
2022-02-07 13:49:43 -05:00
`id` | Optional |string | An optional identifier for the document. The identifier cannot be used elsewhere in the index.
`index` | Optional | string | The index where the document's transformed data appears.
`source` | Required | object | The document's JSON body.
2022-02-04 10:37:42 -05:00
## Response
2022-02-07 14:22:55 -05:00
Responses vary based on which path and HTTP method you choose.
2022-02-07 13:49:43 -05:00
2022-02-04 10:37:42 -05:00
### Specify pipeline in request body
```json
{
"docs" : [
{
"doc" : {
"_index" : "index",
"_id" : "id",
"_source" : {
"location" : "new-new",
"field2" : "_value"
},
"_ingest" : {
2022-02-07 13:49:43 -05:00
"timestamp" : "2022-02-07T18:47:57.479230835Z"
2022-02-04 10:37:42 -05:00
}
}
},
{
"doc" : {
"_index" : "index",
"_id" : "id",
"_source" : {
"location" : "new-new",
"field2" : "_value"
},
"_ingest" : {
2022-02-07 13:49:43 -05:00
"timestamp" : "2022-02-07T18:47:57.47933496Z"
2022-02-04 10:37:42 -05:00
}
}
}
]
}
2022-02-07 14:22:55 -05:00
```
2022-02-04 10:37:42 -05:00
2022-02-07 13:49:43 -05:00
### Specify pipeline ID inside HTTP path
2022-02-04 10:37:42 -05:00
```json
{
"docs" : [
{
"doc" : {
"_index" : "index",
"_id" : "id",
"_source" : {
"field-name" : "value",
"location" : "document-name"
},
"_ingest" : {
"timestamp" : "2022-02-03T21:47:05.382744877Z"
}
}
},
{
"doc" : {
"_index" : "index",
"_id" : "id",
"_source" : {
"field-name" : "value",
"location" : "document-name"
},
"_ingest" : {
"timestamp" : "2022-02-03T21:47:05.382803544Z"
}
}
}
]
}
```
### Receive verbose response
2022-02-07 13:49:43 -05:00
With the `verbose` parameter set to `true` , the response shows how each processor transforms the specified document.
2022-02-04 10:37:42 -05:00
```json
{
"docs" : [
{
"processor_results" : [
{
"processor_type" : "set",
"status" : "success",
"doc" : {
"_index" : "index",
"_id" : "id",
"_source" : {
"field-name" : "value",
"location" : "document-name"
},
"_ingest" : {
"pipeline" : "35678",
"timestamp" : "2022-02-03T21:45:09.414049004Z"
}
}
}
]
},
{
"processor_results" : [
{
"processor_type" : "set",
"status" : "success",
"doc" : {
"_index" : "index",
"_id" : "id",
"_source" : {
"field-name" : "value",
"location" : "document-name"
},
"_ingest" : {
"pipeline" : "35678",
"timestamp" : "2022-02-03T21:45:09.414093212Z"
}
}
}
]
}
]
}
```