# How to write a script in Ingest Pipeline to detect the null values and pushed to separate index on failure (unformattedindex)

**URL:** https://discuss.elastic.co/t/how-to-write-a-script-in-ingest-pipeline-to-detect-the-null-values-and-pushed-to-separate-index-on-failure-unformattedindex/266517
**Category:** Elasticsearch
**Created:** [March 8, 2021, 7:49am UTC](https://discuss.elastic.co/t/how-to-write-a-script-in-ingest-pipeline-to-detect-the-null-values-and-pushed-to-separate-index-on-failure-unformattedindex/266517 "2021-03-08T07:49:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sravankayitha](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sravankayitha](https://discuss.elastic.co/u/sravankayitha)
#### Post date: [March 8, 2021, 7:49am UTC](https://discuss.elastic.co/t/how-to-write-a-script-in-ingest-pipeline-to-detect-the-null-values-and-pushed-to-separate-index-on-failure-unformattedindex/266517/1 "2021-03-08T07:49:52Z")

</div>

How to detect the null values in Ingest Pipeline and Index it.  
Actual index name: myindex  
Unformatted index name: unformattedindex

i have tried the below Script Processor to detect the null values to Actual index(indexmyindex) on failure pushed to (unformattedindex), But it was not working.  
I don't see the document for null values for Ingest Pipeline.  
{  
"script" : {  
"lang" : "painless",  
"source" : "ctx.\_source.field != null",  
"on\_failure" :  
{  
"set" : {  
"field" : "\_index",  
"value" : "unformattedindex"  
}  
}  
}  
}

---

<div class="post-metadata">

### Author: ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)
#### Post date: [March 8, 2021, 8:09pm UTC](https://discuss.elastic.co/t/how-to-write-a-script-in-ingest-pipeline-to-detect-the-null-values-and-pushed-to-separate-index-on-failure-unformattedindex/266517/2 "2021-03-08T20:09:40Z")

</div>

hi @sravankayitha , this might be more of a question on the Elasticsearch side of things. I'll move the topic there.

---

<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 5, 2021, 8:09pm UTC](https://discuss.elastic.co/t/how-to-write-a-script-in-ingest-pipeline-to-detect-the-null-values-and-pushed-to-separate-index-on-failure-unformattedindex/266517/3 "2021-04-05T20:09:51Z")

</div>

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