Hi Benjamin,
Try changing this:
{
"script": "doc['@timestamp'].date.dayOfWeek().getAsText()",
"lang" : "groovy"
}
To this:
{
"script": "doc['@timestamp'].date.dayOfWeek().getAsText()",
"lang" : "groovy",
"valueType": "string"
}
By the way, I was able to get this working a slightly different way (but I don't think it is better or worse than yours):
When you create the scripted field, you can enter the script, doc['@timestamp'].date.dayOfWeek().getAsText()
in the scripted field definition itself:
Then, in the visualization editor, in the advanced section for the terms aggregation on the scripted field, you only need to specify { "lang": "groovy", "valueType": "string" }
: