Porton
(Porton)
October 5, 2020, 8:27am
1
What is the best way to pretty JSON response from Elasticsearch Watch ?
Currently doing webhook to MS Teams,
body": "{ title: 'Server Metrics Alert', text: '{{#toJson}}ctx.payload.hits{{/toJson}}' }",
Everything works, however (as expected) ctx.payload.hits is NOT pretty.
What is the easiest way to prettify that ctx.payload.hits ?
spinscale
(Alexander Reelsen)
October 5, 2020, 9:46am
2
Use a transform in your action to get the data into a proper format first.
Porton
(Porton)
October 8, 2020, 3:49am
3
The format is fine, just want to prettify the json text.
Do you see anything in transform that can be used to prettify JSON text?
spinscale
(Alexander Reelsen)
October 8, 2020, 8:31am
4
I don't see a way to do this right now, but soon you will be able to use Json.dump()
with a prettyfying option in Painless.
See https://github.com/elastic/elasticsearch/pull/63278
system
(system)
Closed
November 5, 2020, 8:31am
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.