我的编译器一直在说我的toString方法中的“分”超出了范围,但是我不明白为什么这是因为我已经在类中声明了它。
这是我的代码:
{
"aggregations": {
"lists": {
"composite": {
"sources": [
{
"parentId": {
"terms": {
"field": "parentId"
}
}
}
],
"size": 10000
},
"aggregations": {
"most_recent": {
"max": {
"script": {
"source": "doc['modifiedOn'].size() == 0 || doc['modifiedOn'].value.millis == null ? doc['createdOn'].value.millis : doc['modifiedOn'].value.millis"
}
}
},
"most_recent_filter": {
"bucket_selector": {
"buckets_path": {
"modified_on": "most_recent"
},
"script": "params.modified_on >= 1552003847225L"
}
},
"top_items": {
"top_hits": {
"_source": [
"parentId",
"otherFields",
"createdOn",
"modifiedOn"
],
"sort": {
"_script": {
"type": "number",
"script": {
"source": "doc['modifiedOn'].size() == 0 || doc['modifiedOn'].value.millis == null ? doc['createdOn'].value.millis : doc['modifiedOn'].value.millis"
},
"order": "desc",
"mode": "max"
}
},
"size": 10
}
}
}
}
},
"size": 0
}
}
答案 0 :(得分:0)
由于您希望使用两个精度(即%.2f中的格式值)作为值,因此可以考虑使用以下内容
sleep 20s
输出: 美分:34 $ 12.34