给定文档示例:https://www.elastic.co/guide/en/elasticsearch/reference/current/runtime-mapping-fields.html
PUT my-index-000001/
{
"mappings": {
"runtime": {
"day_of_week": {
"type": "keyword",
"script": {
"source": "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))"
}
}
},
"properties": {
"@timestamp": {"type": "date"}
}
}
}
如何为查询提供timestamp
值(以及如何从脚本访问它)?
1条答案
按热度按时间myzjeezk1#
current_date参数是timestamp中的当前日期。有一个脚本可以计算文档字段日期和参数传递的当前日期之间的差异。