I'm using the latest version of elasticsearch npm with elasticsearch version 6.4 and trying to put new script.
According to thier documentation; putScript function takes id and body properties.
So when i try to call it, for instance:
client.putScript({
id: 'date_formatter',
body: {
lang: "painless",
source: `// Get each field value as string
String datetime = doc[params.field].value.toString();
// Create format object based on string
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(params.format);
// cast datetime into ZonedDateTime to use format function
ZonedDateTime zdt = ZonedDateTime.parse(datetime);
// return formatted date
return zdt.format(formatter);`
}
})
It returns { acknowledged: true } as expected, But when i check it through kibana, it returns:
{
"_id": "date_formatter",
"found": true,
"script": {
"lang": "mustache",
"source": """{"lang":"painless"}"""
}
}
Is there any way to put script into elasticsearch through node client?
landshould readlang