Search against a scripted field


I can't make my search work based on a scripted field which returns a number or null. I've tried through the Kibana QL or Lucene but no luck so far.

Some examples:

  • ratio :* returns all the documents, even the ones with a null value
  • ratio >= 0 doesn't filter anything
  • ratio = 0 does filter but looks like it filters against other fields, as the highlight suggests

All in all it looks like the scripted field cannot be queried. What am I doing wrong?

Thanks for your help.

Hey @martin_edge, welcome to the discussion boards!

Which version of Kibana are you using? Your issue sounds similar to, although that linked issue mentions an error message being returned, and it doesn't sound like that's the case here. Are you seeing an error at all, or is it just not working as expected?

Thanks for your reply.

I'm using the version 7.5.2 on elastic cloud.

I don't see any error message, but it's definitely not working as expected.

I've found the problem: the script was returning null for some documents and it made the Kibana call fail silently. After making sure that the scripted field never returns null, everything seems to work as expected.

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