ElasticSearch:在磁盘中找不到脚本

时间:2016-11-04 10:05:09

标签: elasticsearch

我在/usr/share/elasticsearch/config/scripts上复制了几个脚本:

#ls /usr/share/elasticsearch/config/scripts
day.groovy  dayDateDiff.groovy  month.groovy  year.groovy

我正在尝试执行此请求:

{
  "error" : {
    "root_cause" : [ {
      "type" : "illegal_argument_exception",
      "reason" : "Unable to find on disk file script [dayDateDiff.groovy] using lang [groovy]"
    } ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query_fetch",
    "grouped" : true,
    "failed_shards" : [ {
      "shard" : 3,
      "index" : "living_v1",
      "node" : "2sER_Ua7SkCqh2a852JFfg",
      "reason" : {
        "type" : "illegal_argument_exception",
        "reason" : "Unable to find on disk file script [dayDateDiff.groovy] using lang [groovy]"
      }
    } ]
  },
  "status" : 400
}

正如您所看到的,它告诉我ES无法访问此dayDateDiff常规脚本。

但是,我可以执行day.groovy脚本:

#docker exec -it es curl -XGET 'http://localhost:9200/living_team/fuas/_search?pretty' -d '
{
  "script_fields": {
    "my_script": {
      "script": {
        "file": "day",
        "params": {
          "field": "timestamp"
        }
      }
    }
  }
}
'

响应:

{
  "took" : 538,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 2,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "living_v1",
      "_type" : "fuas",
      "_id" : "58fb4509-9452-11e6-a361-02420a016207",
      "_score" : 1.0,
      "_routing" : "living_team",
      "fields" : {
        "my_script" : [ 17 ]
      }
    }, {
      "_index" : "living_v1",
      "_type" : "fuas",
      "_id" : "2298eab3-9a8a-11e6-8f4a-02420a010a07",
      "_score" : 1.0,
      "_routing" : "living_team",
      "fields" : {
        "my_script" : [ 25 ]
      }
    } ]
  }
}

有什么想法吗?

修改

我看了一下日志,并且:

  

bbd8b73ce0b0dd070d07e63f11dcdad4fa12121d:1:无法解析课程   时间11月04日10:27:21 core-01 docker [3876]:@第1行,第1列   04 10:27:21 core-01 docker [3876]:新的   周期(DOC [firstDateField] .date,   DOC [secondDateField] .date).getHours(); 11月04日10:27:21 core-01   docker [3876]:^

other post.

0 个答案:

没有答案