Hi Team,
I have been to substract the date value and store the value in the variable defined as " duration" and then check if the value is smaller than 2 then return a value through scripted filed in kibana
` ``
if (doc['request_time'].size()!=0 && doc['response_time']!=0 && doc['response_time'].value.getMillis() > doc['request_time'].value.getMillis())
{
return doc['response_time_milli'].value.getMillis() - doc['request_time_milli'].value.getMillis()= doc['duration'].value.getMillis();
}
if (doc['duration'].value.getMillis() < 2)
{
return doc['duration_2'].value.getMillis() = 1;
}
```
although i get an error
"script": "if (doc['request_time'].size()!=0 && doc['response_time']!=0 && doc['response_time'].value.getMillis() > doc['request_time'].value.getMillis())\n {\n return doc['response_time_milli'].value.getMillis() - doc['request_time_milli'].value.getMillis()= doc['duration'].value.getMillis();\n }\n if (doc['duration'].value.getMillis() < 2)\n {\n return doc['duration_2'].value.getMillis() = 1;\n }\n ",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Left-hand side cannot be assigned a value."
}
```
Regards,
Neha Changra