按工作日分类查看文档? 我的数据是这样的格式:简单的日期直方图?
{"text": "hi","created_at": "2016-02-21T18:30:36.000Z"}
对于这个我使用的是dateConversion.groovy
脚本保存在脚本文件夹中的ES 5.1.1。
Date date = new Date(doc[date_field].value);
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat(format);
format.format(date)
当我执行以下代码中ES插件:
"aggs": {
"byDays": {
"terms": {
"script": {
"lang": "groovy",
"file": "dateConversion",
"params": {
"date_field": "created_at",
"format": "EEEEEE"
}
}
}
} ``
I am getting an exception like this:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Unable to find on disk file script [dateConversion] using lang [groovy]"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "testindex-stats",
"node": "vVhZxH7pQ7CO3qpbYm_uew",
"reason": {
"type": "illegal_argument_exception",
"reason": "Unable to find on disk file script [dateConversion] using lang [groovy]"
}
}
],
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Unable to find on disk file script [dateConversion] using lang [groovy]"
}
},
"status": 400
}
@doelleri我执行你的代码,并获得这样的错误? – Seeker
该脚本文件是否真的在每个节点的正确目录中? – doelleri
我保存在config/scripts/dateConversion.groovy中,每个节点上的什么是正确的目录?你可以详细解释,因为我是这个环境的新手 – Seeker