[Painless] Stored script - Multiline - Parsing Error

I'm new with the usage of script. I understand they are 2 modes to write the script itseft, in a single line and in multiline with the usage of """. But I found sample on Web, but in all cases I have a parsing exception.

"script": {
"source": """
doc['price'].value * params.factor;

Error :

"caused_by": {
"type": "json_parse_exception",
"reason": "Unexpected character ('"' (code 34)): was expecting comma to separate Object entries\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@42bd8f7; line: 3, column: 18]"

What I've missed? (I wish to create a stored script in multiline format)
ES Version: 7.4.1
REST Client: Postman

This triple ticks notation only works within the Kibana Dev-Tools Console, where those triple ticks are replaced and regular JSON is formed from that script, before it is sent to Elasticsearch.

Ok thank you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.