按工作日分類查看文檔? 我的數據是這樣的格式:簡單的日期直方圖?
{"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