How to display Due, Over Due and Not Due based on a date field in Saved Search

For example I have a date field delivery_datetime in Index, I have to show the user for current day whether a particular parcel is Due today or Over Due or Not Due

I can't create a separate field and do reindex because it's based on current date and that changes every day, for instance if I have to calculate while indexing I have to reindex every day, and that's not feasible because I have a lot of data.

I may use update by query but my index is frequently updated via a Python script, thought we don't have ACID property here I we'll have version conflict.

For my knowledge I think my only option is to use Scripted Field.

If I have to write the logic in pseudocode:

Due - delivery_datetime.dateOnly == now.dateOnly
Over Due - delivery_datetime.dateOnly < now.dateOnly
Not Due - delivery_datetime.dateOnly > now.dateOnly

Thought I have a lot of data if I generate CSV I don't want scripted field to make major impact on cluster performance.

So I need some help to do this efficiently in scripted field, or if there were any completely different solution will also be greatly helpful.

Expecting help by providing painless script for Scripted Field.

Answered here now https://stackoverflow.com/q/64734208/1464519

2 Likes

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