I have a field with Whitespace character: i.e 'Error Message.keyword'
How can I get this field with painless?
1 ) ctx.payload.buckets[0].'Error Message.keyword' 2 ) def error='Error Message.keyword'; ctx.payload.buckets[0].error
ctx.payload.buckets[0].'Error Message.keyword'
def error='Error Message.keyword'; ctx.payload.buckets[0].error
Both above versions do not work.
You need to use brackets to access a key from a map.
ctx.payload.buckets[0]['Error Message.keyword']
Worked!
Why do I get "[]? How can I get rid of []?
"payload": { "error": "[no user found]" }
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.