elastic / kibana

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

[ResponseOps] add mustache array function support #168729

Open pmuellr opened 1 year ago

pmuellr commented 1 year ago

extracted from https://github.com/elastic/kibana/issues/84217

There is a request to add some basic array functions to deal with context variables that are arrays - uniq, sort, filter.

Some of this can be handled by Jexl, which we could add support for. Jexl is not currently used by Kibana, so would need to be vetted (since it is an interpreter itself - so that vetting may be expensive).

See https://github.com/elastic/kibana/pull/146487 for an example of how Jexl could be integrated into our Mustache story. It looks like Jexl already supports filter, uniq is likely easy, and sort seems like it could be problematic in how to determine what to sort on, since typically that involves defining a function.

cc: @shanisagiv1

elasticmachine commented 1 year ago

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

pmuellr commented 10 months ago

join has also been requested - for instance, join an array of strings with a (blank character)

pmuellr commented 9 months ago

Something like map has been requested, basically to extract fields from objects in an array. Full map support would imply a lot of functionality (hard!), so perhaps something simpler like pick, where you can select a single field from an array of elements, or similar.