To use a script in an aggregation the script
value is not a string but another object. I think you also need to specify lang
alongside file
.
"aggs": {
"byDays": {
"terms": {
"script": {
"lang": "groovy",
"file": "dateConversion",
"params": {
"date_field": "created_at",
"format": "EEEEEE"
}
}
}
}
}