我正在尝试获取两个日志条目之间的时间差,例如 RequestExecuted 和 RequestReceived ,其文件名为 MessageIdentifier。这些值由名为 TransactionId 的唯一 ID 链接。下面是我执行逻辑的代码。
int timetaken=0;
int start=0;
String TransactionId;
int end=0;
for(int i = 0; i < 10; ++i){
if (doc['dissect.MessageIdentifier'].value[i]=='RequestReceived') {
start=params._source.dissect.timestamp[i];
TransactionId=params._source.dissect.TransactionId[i];
}
if( doc['dissect.MessageIdentifier'].value[i] =='RequestExecuted'
&& params._source.dissect.TransactionId == TransactionId) {
end=params._source.dissect.timestamp[i];
timetaken = end - start;
return timetaken;
}
}
当我编译我的无痛脚本时,它给了我一个错误:
lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Attempting to address a non-array-like type [java.lang.String] as an array."
这是索引片段:
您的帮助将非常感激。