I wanted to write code inside scripted_fields in kibana

I wanted to have a ratio of sum of the document when its suggestion is auto (doc['driverSuggestion'].value== 'AUTO') to divide it by sum of the document when its suggestion is auto plus manual. sum(doc['driverSuggestion'].value== 'AUTO')/(sum(doc['driverSuggestion'].value== 'AUTO')+sum(doc['driverSuggestion'].value== 'MANUAL'))

How to do it?

Can you provide an example document? I do not really understand what numbers are trying to sum.

{
"driverSuggestion": "MANUAL",
"expiryDriverIds": [
"only1curtis5@gmail.com",
"pdburbanks5@gmail.com"]
}

I don't see anything that can be summed in this document. Are you trying to count the items in the expiryDriverIds array?

previous issue got resolved can you help with this one?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.