I followed documentation to create a simple scripted field to calculate HourOfDay
doc['@timestamp'].date.hourOfDay
error:
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 9,
"successful": 8,
"skipped": 8,
"failed": 1,
"failures": [
{
"shard": 0,
"index": "sanitas-apitsl-000009",
"node": "OdEMJt__QDK1fSI1zeU3IA",
"reason": {
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"doc['@timestamp'].date.hourOfDay",
" ^---- HERE"
],
"script": "doc['@timestamp'].date.hourOfDay",
"lang": "painless",
"position": {
"offset": 17,
"start": 0,
"end": 32
},
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Illegal list shortcut value [date]."
}
}
}
]
},
"hits": {
"max_score": null,
"hits": []
}
}
What I'm doing wrong?
Elasticsearch/Kibana: 8.1.3