平日の分類ごとにドキュメントを表示しますか? 私のデータは次のような形式です。
{"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 PLUGIN で次のコードを実行したとき:
"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
}