# Ingest Node

**URL:** https://discuss.elastic.co/t/ingest-node/266763
**Category:** Kibana
**Created:** [March 10, 2021, 5:12am UTC](https://discuss.elastic.co/t/ingest-node/266763 "2021-03-10T05:12:01Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Changra](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@Changra](https://discuss.elastic.co/u/Changra)
#### Post date: [March 10, 2021, 5:12am UTC](https://discuss.elastic.co/t/ingest-node/266763/1 "2021-03-10T05:12:01Z")

</div>

I added the ingest pipeline with the name "transfer-pipeline" in the logstash output as below,

output {

if "mm" in [service\_name]

{

elasticsearch {

ssl =\> true

ssl\_certificate\_verification =\> true

ilm\_rollover\_alias =\> "mm"

ilm\_pattern =\> "{now/d}-000001"

ilm\_policy =\> "rollover-size-wise"

pipeline =\> "transf"

}

}

But it constantly gives me this error while reloading the pipeline "reason"=\>"unable to parse date ", "caused\_by"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"cannot parse empty date"}}}}}

Can u please help me out what could be the reason , the ingest pipeline is as below

PUT \_ingest/pipeline/transfer/

{

"description" : "log",

"processors" : [

{

"set": {

"field": "request\_time",

"value": "{{\_source.request\_time}}"

}

},

{

"set": {

"field": "response\_time",

"value":"{{\_source.response\_time}}"

}

},

{

"date":{

"field":"request\_time",

"formats":["yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"]

}

},

{

"date":{

"field":"response\_time",

"formats":["yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"]

}

},

{

"script": {

"lang": "painless",

"source": """

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [March 10, 2021, 6:12am UTC](https://discuss.elastic.co/t/ingest-node/266763/2 "2021-03-10T06:12:25Z")

</div>

Hi @Changra Welcome to the community.

So that we can help you can you please edit your post and format your code using the \</\> format button.

 ![Screen Shot 2021-03-09 at 9.52.38 PM](https://us1.discourse-cdn.com/elastic/original/3X/2/1/21d702408857e3c4ce6ededdcb8a9ba6d7b22944.png)

2nd I see this

```
pipeline => "transf"

```

and yet you said it should be `transfer`

2nd these are probably redundant, if the `_source.request_time` exist you do not need to set it again

```
{
"set": {
  "field": "request_time",
  "value": "{{_source.request_time}}"
}

```

Finally you probably need guards something like this, you probably have empty fields.

```
"date":{
  "if": "ctx.response_time != null",
  "field":"response_time",
  "formats":["yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"]
}

```

There is also a nice section on handling errors in ingest pipelines [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/handling-failure-in-pipelines.html)

---

<div class="post-metadata">

### Author: ![Changra](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@Changra](https://discuss.elastic.co/u/Changra)
#### Post date: [March 10, 2021, 6:58am UTC](https://discuss.elastic.co/t/ingest-node/266763/3 "2021-03-10T06:58:54Z")

</div>

```
HI Stephenb,

Thank you for the reply i changed the pipeline code a bit but the still see the error in my script sectipn below is the ingest pipeline code

PUT _ingest/pipeline/transfer-pipeline/
{
  "description" : "transfer of ownership logs",
  "processors" : [         
    {
    "set": {
      "field": "request_time",
      "value": "{{_source.request_time}}"
      
    }
  },
  {
    "set": {
      "field": "response_time",
      "value":"{{_source.response_time}}"
     
    }
  },
  {
  "date":{
    "if": "ctx.request_time != null",
    "field":"request_time", 
    "formats":["yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"]
  }
  },
{
  "date":{
    "if":"ctx.response_time != null",
    "field":"response_time", 
    "formats":["yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"]
  }
  },
  {
  "script": {
    "lang": "painless",
    "source": """
    
 String datetime = ctx['request_time'];
ZonedDateTime zdt = ZonedDateTime.parse(datetime);
String datetime_new = ctx['response_time'];
ZonedDateTime edt = ZonedDateTime.parse(datetime_new);

long request_time_milli = zdt.toInstant().toEpochMilli();
ctx['request_time_milli']= request_time_milli;

long response_time_milli = edt.toInstant().toEpochMilli();
ctx['response_time_milli']= response_time_milli;
if (response_time_milli >= request_time_milli)
{
        ctx['duration'] = (ctx['response_time_milli'] - ctx['request_time_milli']); 
 }
     """
  }
  }

here is the error which i see

"script"=>"\n \n String datetime = ctx['request_time'];\nZonedDateTime zdt = ZonedDateTime.parse(datetime);\nString datetime_new = ctx['response_time'];\nZonedDateTime edt = ZonedDateTime.parse(datetime_new);\n\nlong request_time_milli = zdt.toInstant().toEpochMilli();\nctx['request_time_milli']= request_time_milli;\n\nlong response_time_milli = edt.toInstant().toEpochMilli();\nctx['response_time_milli']= response_time_milli;\nif (response_time_milli >= request_time_milli)\n{\n ctx['duration'] = (ctx['response_time_milli'] - ctx['request_time_milli']); \n }\n ", "lang"=>"painless", "position"=>{"offset"=>86, "start"=>60, "end"=>104}, "caused_by"=>{"type"=>"date_time_parse_exception", "reason"=>"Text '' could not be parsed at index 0

here is the output section 

```

output {  
if "mm" in [service\_name]  
{  
elasticsearch {`Preformatted text`  
ssl =\> true  
ssl\_certificate\_verification =\> true  
ilm\_rollover\_alias =\> "provisioning\_service"  
ilm\_pattern =\> "{now/d}-000001"  
ilm\_policy =\> "rollover-size-wise"  
pipeline =\> "transfer-pipeline"  
}  
}

I still get the same error

["index", {:\_id=\>nil, :\_index=\>"provisioning\_service", :routing=\>nil, :\_type=\>"\_doc", :pipeline=\>"transfer-pipeline"}, #LogStash::Event:0x4a13394], :response=\>{"index"=\>{"\_index"=\>"provisioning\_service", "\_type"=\>"\_doc", "\_id"=\>nil, "status"=\>400, "error"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"unable to parse date ", "caused\_by"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"cannot parse empty date"}}}}}

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [March 10, 2021, 7:08am UTC](https://discuss.elastic.co/t/ingest-node/266763/4 "2021-03-10T07:08:21Z")

</div>

Well that is a lot more complex code you are going to need to debug, you still have and empty or an empty string date somewhere.

Did you read the docs on error handling you can put in messages

Also you can try the [simulate API](https://www.elastic.co/guide/en/elasticsearch/reference/current/simulate-pipeline-api.html) to make it easier to debug.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 7, 2021, 7:09am UTC](https://discuss.elastic.co/t/ingest-node/266763/5 "2021-04-07T07:09:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
