Can anyone please tell me, if this is possible ?
I am trying to create a pipeline but I want it to run in particular intervals on the same index
For example :
{
"description":"Find the Progress",
"processors":[
{
"set":{
"field":"_source.now",
"value":"{{_ingest.timestamp}}"
}
},
{
"script":{
"lang":"painless",
"source": """
ctx['SubmitDate']=ctx['SubmitDate'].substring(0,10)+'T'+ctx['SubmitDate'].substring(11,16)+':00Z';
if(ctx.containsKey("now") && ctx.containsKey("SubmitDate"))
{
ctx['daysleft']=ChronoUnit.DAYS.between(ZonedDateTime.parse(ctx['now']),ZonedDateTime.parse(ctx['SubmitDate']));
if(ctx['daysleft']>0)
{
ctx['Progress']="In Progress";
}
if(ctx['daysleft']<=0)
{
ctx['Progress']="Completed";
}
}
"""
}
}
]
}
In the above example I want to refresh the Progress field for every day using some calculation.
I am not able find about this any where, I am just curious if that's possible using pipeline and also , I don't know if this is the right way to refresh the fields with some calculation.
Please suggest any methods to perform such calculation and refresh.