Filter by script

I would like to get records had updatedAt value at least 6 months ago from now.

filter: {
script: {
// 186 * 24 * 60 * 60 * 1000 = 16070400000 (186 days ago ~ 6 months)
script: "doc['latestScrape'].value <= (new Date().getTime() - 16070400000")
}
}

I'm not sure my script is correct. Need someone help!

While a script is a possibility here, why can't you use a regular range as it will be MUCH faster than any script query.

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