更新时间:2023-02-07 18:04:41
***的是脚本字段。只要您启用了动态脚本功能,并且将这些日期字段定义为映射中的日期,上述搜索查询就可以正常工作。
Your best best is scripted fields. The above search query should work , provided you have enabled dynamic scripting and these date fields are defined as date in the mapping.
{
"script_fields": {
"test1": {
"script": "doc['acctstoptime'].value - doc['acctstarttime'].value"
}
}
}
请注意,您将在epoch中获得结果您需要转换为面额。
Note that you would be getting result in epoch , which you need to convert to your denomination.
You can read about scripted field here and some of its examples here.