vscode-elastic
vscode-elastic copied to clipboard
Support multi-line """-separated Painless scripts
When the multiline syntax with """ separators is used, the highlighter reports it as an error.
Initially I thought it it's just because of the " inside, but it's not (just) that. It seems the highlighter is using JSON rules, while painless is more permissive
This makes it very hard for script editing.
"script_fields": {
"flattened_events": {
"script": {
"lang": "painless",
"source": """
Map events = new HashMap();
for (def transaction : doc['external_card_transactions']) {
Map transData = new HashMap();
transData.put("created_at", transaction['created_at'].value);
transData.put("type", transaction['type'].value);
transData.put("amount", transaction['amount'].value);
transData.put("currency_code", transaction['currency_code'].value);
transData.put("original_amount", transaction['currency_conversion.network.original_amount'].value);
transData.put("original_currency_code", transaction['currency_conversion.network.original_currency_code'].value);
transData.put("conversion_rate", transaction['currency_conversion.network.conversion_rate'].value);
events.put(transaction, transData);
}
return events.toString();
"""
}
}
},
Do you find any alternative to this?
Do you find any alternative to this?
Nope, I stopped using ES and OS and didn't follow up on this.