Calculate date using another field?

Hello,

I have a few documents which contain relative dates such as:

2 Weeks Ago
3 Months Ago

I've been looking into formatting the date field as well as date math but was unable to find something which would specifically address this case.

Would it be possible to set ES to interpret the text and if, for example, x Months Ago is detected, extract the X, and use date math along another date field inside my document to subtract from it the number of months and create a new date to be stored ?

Any help si greatly appreciated. Thanks!

You should do this interpretation on the client side before sending the document to elasticsearch.

You're right, however, we already have a lot of documents indexed, so I was looking into ways to do this through reindexing.

Thanks though! I'll look into going through all the documents and processing them outside of ES!

For reindexing, you could do it through ingest, I think.

I'll look into it, thanks!

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