mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[console] highlighting for scripted metric agg scripts (#15377)
* highlighting for scripted metric agg scripts Adding detection for [scripted metric aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-metrics-scripted-metric-aggregation.html) ```json POST ledger/_search?size=0 { "query" : { "match_all" : {} }, "aggs": { "profit": { "scripted_metric": { "init_script" : "params._agg.transactions = []", "map_script" : "params._agg.transactions.add(doc.type.value == 'sale' ? doc.amount.value : -1 * doc.amount.value)", "combine_script" : "double profit = 0; for (t in params._agg.transactions) { profit += t } return profit", "reduce_script" : "double profit = 0; for (a in params._aggs) { profit += a } return profit" } } } } ``` * Update x_json_highlight_rules.js * [console] Remove capture group from *_script check * allow source
This commit is contained in:
parent
bbfd72b8cd
commit
af49683bed
1 changed files with 1 additions and 1 deletions
|
@ -7,7 +7,7 @@ var jsonRules = function (root) {
|
|||
rules[root] = [
|
||||
{
|
||||
token: ["variable", "whitespace", "ace.punctuation.colon", "whitespace", "punctuation.start_triple_quote"],
|
||||
regex: '("script"|"inline")(\\s*?)(:)(\\s*?)(""")',
|
||||
regex: '("(?:[^"]*_)?script"|"inline"|"source")(\\s*?)(:)(\\s*?)(""")',
|
||||
next: "script-start",
|
||||
merge: false,
|
||||
push: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue