Created
July 3, 2017 05:33
-
-
Save jclosure/8e103dee2f7e9491845a2c0bb64c6b7a to your computer and use it in GitHub Desktop.
Kibana Painless scripted field checks if field exists or is empty and returns default, otherwise value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!doc.containsKey('myfield') || doc['myfield'].empty) { return "unavailable" } else { return doc['myfield'].value } |
Thank you!
Thanks! Exactly what I was after.
+1
An hour of googling has lead me here, this has solved my issue +1
Thanks 🙏
Thanks!
Thanks. !doc.containsKey is the secret.
+1
+1
cool code
Thank you
Thank you so much !!!!
+1, thanks in 2024!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!!