Py学习  »  Elasticsearch

ElasticSearch在访问脚本字段中的参数[“源”]时返回空的_指针_异常

wgkoro • 4 年前 • 741 次点击  

当我搜索下面的文档时…

GET /users/_search
{
  "query": {
    "function_score": {
        "query" : {
          "match_all": {}
        },
        "score_mode" : "sum",
        "boost_mode" : "sum",
        "script_score": {
          "script": {
            "lang": "painless",
            "source": "params['_source']"
          }
        }
      }
    }
  }

我有500个错误

  {
"shard": 0,
"index": "users",
"node": "xxxxxxxxxxxxxxxxxxx",
"reason": {
  "type": "script_exception",
  "reason": "runtime error",
  "script_stack": [
    "params._source",
    "      ^---- HERE"
  ],
  "script": "params._source",
  "lang": "painless",
  "caused_by": {
    "type": "null_pointer_exception",
    "reason": null
  }
}

如果我用“script_fields”而不是“script_score”和参数“_source”]搜索,它会移动。

问题: 我可以在“脚本分数”部分使用参数[“源”]? 注:ElasticSearch版本为6.4.2。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/38324
 
741 次点击  
文章 [ 1 ]  |  最新文章 4 年前