Date field generated with field value change

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:

Complete: No
Complete_Date: -

A change is made to the complete field such as:

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

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.


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