# Replacing timestamp field null value with constant date value through ingest pipeline

**URL:** <https://discuss.elastic.co/t/replacing-timestamp-field-null-value-with-constant-date-value-through-ingest-pipeline/245409>\
**Category:** Elasticsearch\
**Created:** [August 18, 2020, 11:36am UTC](https://discuss.elastic.co/t/replacing-timestamp-field-null-value-with-constant-date-value-through-ingest-pipeline/245409 "2020-08-18T11:36:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![InfiniteDreamer](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@InfiniteDreamer](https://discuss.elastic.co/u/InfiniteDreamer)\
**Post date:** [August 18, 2020, 11:36am UTC](https://discuss.elastic.co/t/replacing-timestamp-field-null-value-with-constant-date-value-through-ingest-pipeline/245409/1 "2020-08-18T11:36:20Z")

</div>

We want to know the possibilities of replaing a null valued field with connstant value suplied in ingest pipeline.

We are pushing data to elasticsearch where we have field salesdate in all docs and it may be null in few cases, instead of salesdate as null we want it to be replaced by some constant date like 2020-01-01 00:00.00.

How to acheive this, kindly help us.

---

<div class="post-metadata">

**Author:** ![whatgeorgemade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whatgeorgemade/32/103246_2.png) [@whatgeorgemade](https://discuss.elastic.co/u/whatgeorgemade)\
**Post date:** [August 18, 2020, 2:17pm UTC](https://discuss.elastic.co/t/replacing-timestamp-field-null-value-with-constant-date-value-through-ingest-pipeline/245409/2 "2020-08-18T14:17:00Z")

</div>

This is possible. You can use a `set` processor in the pipeline, with an `if` check to make sure the field doesn't exist. i.e. `!ctx.containsKey('myField')`.

---

<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:** [September 15, 2020, 2:17pm UTC](https://discuss.elastic.co/t/replacing-timestamp-field-null-value-with-constant-date-value-through-ingest-pipeline/245409/3 "2020-09-15T14:17:01Z")

</div>

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