Elasticsearch Painless script which aims to calculate the difference in days between a date indexed into a document and the current date.
GET days_compare/_search
{
"script_fields": {
"diffdate": {
"script": {
"lang": "painless",
"source": """