elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.68k stars 8.23k forks source link

Add support for rendering text tables via Mustache #200857

Open pugnascotia opened 5 days ago

pugnascotia commented 5 days ago

Describe the feature:

Add support to Mustache template processing e.g. another lambda that renders tabular data as a text table.

Describe a specific use case for the feature:

I'm writing an alert based on an Elasticsearch query, and if any records are found then I was to include them in the alert body as a table. The output of the alert will be Slack messages, but Slack has no support for tables, so I want to format my results as a table (I'm using ES|QL and picking just a few fields).

For example, results like the following (only structured like an Elasticsearch result set):

[
  {
    "foo": "value",
    "bar": "another value",
    "baz": "etc"
  },
  {
    "foo": "value 2",
    "bar": "yet another val",
    "baz": "blah blah blah"
  }
]

Would yield:

+---------+-----------------+----------------+
| foo     |             bar | baz            |
+---------+-----------------+----------------+
| value   | another value   | etc            |
+---------+-----------------+----------------+
| value 2 | yet another val | blah blah blah |
+---------+-----------------+----------------+
elasticmachine commented 5 days ago

Pinging @elastic/response-ops (Team:ResponseOps)

pmuellr commented 5 days ago

A couple of notes:

pmuellr commented 4 days ago

We could likely also use real box chars, like (mostly) this. I think all the connectors are available ...

┌─────────+─────────────────+────────────────┐
│ foo     │             bar │ baz            │
+─────────┼─────────────────┼────────────────+
│ value   │ another value   │ etc            │
+─────────┼─────────────────┼────────────────+
│ value 2 │ yet another val │ blah blah blah │
└─────────+─────────────────+────────────────┘