I would like to compare an elastic search date with a format
YYY-MM-DD HH:MM:SS as to compare the results of the past 30 days. So if the given date is equal to NOW()-30D it should give me the result wanted. I have tried comparing it this way with a script but it doesn't work :
getMillis(doc["date"].value) >= (new Date().getTime() - 30 * 24 * 60 * 60 * 1000) ? 1 : 0
Another test not working :
doc["date"].value >= (new Date().getTime() - 30) ? 1 : 0
This should do this :
If doc["date"].value is higher or equal to the last 30 days it should give me 1, else it would give me 2.
How can I achieve that?