# Date field generated with field value change

**URL:** <https://discuss.elastic.co/t/date-field-generated-with-field-value-change/253059>\
**Category:** Kibana\
**Created:** [October 22, 2020, 7:15pm UTC](https://discuss.elastic.co/t/date-field-generated-with-field-value-change/253059 "2020-10-22T19:15:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![osmosis](https://avatars.discourse-cdn.com/v4/letter/o/59ef9b/32.png) [@osmosis](https://discuss.elastic.co/u/osmosis)\
**Post date:** [October 22, 2020, 7:15pm UTC](https://discuss.elastic.co/t/date-field-generated-with-field-value-change/253059/1 "2020-10-22T19:15:46Z")

</div>

I am a beginner to elastic so beware.

I am attempting to create a date field that will update based on a certain value in another field.

For example:  
Field------------Value

```auto
Complete: No
Complete_Date: -

```

A change is made to the complete field such as:

```auto
Complete: Yes
Complete_Date: (CurrentDate)

```

I'm thinking a scripted field may be the best way to go, but I am not sure.

Thank you

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [October 29, 2020, 5:44pm UTC](https://discuss.elastic.co/t/date-field-generated-with-field-value-change/253059/2 "2020-10-29T17:44:12Z")

</div>

A scripted field is always calculated as the data is queried, so it would always show the current date for any doc which had `Complete: Yes`. I'm guessing you want it to indicate the date it was completed?

We should take a step back and ask how your data is getting into Elasticsearch. The two main ways are

1. time-based data where each doc has a timestamp and you can trend things over time and aggregate data based on time intervals (connections per hour, etc). These docs are usually not updated once they are ingested into Elasticsearch.
2. the other common way is things that are not time-based. Like inventory items which could have a quantity that gets updated. Or some other docs which start out with `Complete: No` and get updated to `Complete: Yes`.

If you are updating docs to indicate when they are completed, that same task could update the `Complete_Date:` with the current date.

How you do that depends on how that data is getting written into Elasticsearch. If you can explain more of that I can provide more detailed steps.

Regards,  
Lee

---

<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:** [November 26, 2020, 5:44pm UTC](https://discuss.elastic.co/t/date-field-generated-with-field-value-change/253059/3 "2020-11-26T17:44:14Z")

</div>

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