Just starting to use Painless as excercise before certification.
Am wondering how to attack the problem of updating/increasing a date field by using a Painless script?
I know how to for example increase a simple counter:
POST test/_update/1
{
"script":
{
"source": "ctx._source.counter += params.count",
"lang": "painless",
"params": {
"count": 1
}
}
}
, but don´t really get it when it comes to date formats.
See extract from my sample mapping below, how would I go about to update any of those by 1 day?
"revision_date" : {
"type" : "date"
},
"revision_date_epoch" : {
"type" : "date",
"format" : "epoch_second"
},
"revision_date_epochm" : {
"type" : "date",
"format" : "epoch_millis"
}
Been trying according to posts that I´ve found but hope to get the strategy explained here to get going.
Thx