Hi, I have the following Painless scripted field in Kibana:
return doc['a'].size() != 0 && doc['b'].size() != 0 && doc['a'].value == doc['b'].value;
And I'm not sure why but that is giving me the following error:
No field found for [a] in mapping with types
I've also tried the following:
return doc.containsKey('a') && doc.containsKey('b') && doc['a'].value == doc['b'].value;
which gives me the following error:
A document doesn't have a value for a field! Use doc[].size()==0 to check if a document is missing a field!
I have seen conflicting answers for how to verify that a field exists before using it and it seems like .size() != 0 is the correct approach, but if that is true then I'm very confused about why I'm receiving the error that I am from that. Is there anything else that I might be doing wrong here?