Sorry~ my english is not good....
here is my mapping .
{
"orders": {
"aliases": {},
"mappings": {
"properties": {
"created_at": {
"type": "date"
},
"expect_pick_start_time": {
"type": "long"
},
"id": {
"type": "long"
},
"performance": {
"type": "long"
}
}
}
}
}
I wated to update performance like this ....
update orders set performance=if(expect_pick_start_time>0,expect_pick_start_time-UNIX_TIMESTAMP(created_at),0)
here is my script:
{
"script": {
"inline": "if(ctx._source['expect_pick_start_time'] > 0){ ctx._source['performance']= ctx._source['expect_pick_start_time']-ctx._source['created_at'].toInstant().toEpochMilli() } else{ ctx._source['performance']=0 }"
}
}