bkelley
(Butch)
September 11, 2018, 8:22pm
1
Hi -
I'm trying to create a scripted field in Kibana that checks the value of two fields then returns 0 or 1 depending on whether they match the values shown below.
My script is:
if (doc['counter.name'].value == '% items OK') && (doc['counter.value'].value == '100') {
return 0
} else {
return 1
}
For some reason this is failing with a "Courier Fetch: 2 of 131 shards failed". Does anyone know where my problem is?
Thanks,
Butch
bhavyarm
(Bhavya R M)
September 11, 2018, 8:40pm
2
Hi,
Which version of the stack you are on? We have a preview and validate your scripted fields in 6.4.0.
I suspect this might be the problem? '% items OK' What's the % in here?
Thanks
Bhavya
bkelley
(Butch)
September 11, 2018, 9:59pm
3
Hi Bhavya -
I'm running 6.2. The '% items OK' is the value of 'counter.name' that I'm trying to match. Do I need to backslash the %?
Thanks for your response,
Butch
bkelley
(Butch)
September 13, 2018, 1:24pm
4
To follow up - this code is now working. I found that this will only work on fields that are listed as "aggregatable".
if ((doc['counter.name.keyword'].value == '% items OK') && (doc['counter.value.keyword'].value == '100')) { return 100; } else { return 1; }
system
(system)
Closed
October 11, 2018, 1:24pm
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.