dcam
(dcam)
November 27, 2017, 1:14pm
1
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
Both above versions do not work.
rjernst
(Ryan Ernst)
November 27, 2017, 4:50pm
2
You need to use brackets to access a key from a map.
ctx.payload.buckets[0]['Error Message.keyword']
dcam
(dcam)
November 27, 2017, 5:01pm
3
Worked!
Why do I get "[] ? How can I get rid of []?
"payload": {
"error": "[no user found]"
}
system
(system)
Closed
December 25, 2017, 5:01pm
4
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.