Meyra
Meyra

Reputation: 59

Elasticsearch - How to index a calculated field?

Is it possible to put a calculation with a "Today" comparison in the index, that I can search and filter the calculated field?

For example:

or something like that:

There are multiple indices and they are user specific. A user can create their own raws and calculation and the only problem is with a "Today" calculation like "Age" or "new_certification_needed". Something like the "Full_Name" is always up to date when saved.

Upvotes: 1

Views: 804

Answers (1)

Stefano Branco
Stefano Branco

Reputation: 658

The closest thing that comes to mind is using a scripted field in your query, see here. There are some complications to getting the current date in scripts, so you'd have to pass the current time as a parameter with the search query.

Upvotes: 2

Related Questions