Elasticsearch:[scroll]中VALUE_STRING的未知键

时间:2017-09-21 05:59:39

标签: elasticsearch

Elasticsearch scroll api给了我这个错误

didFinishPickingMediaWithInfo

使用scroll api获取文档的代码是

{
   "error": {
      "root_cause": [
         {
            "type": "parsing_exception",
            "reason": "Unknown key for a VALUE_STRING in [scroll].",
            "line": 2,
            "col": 15
         }
      ],
      "type": "parsing_exception",
      "reason": "Unknown key for a VALUE_STRING in [scroll].",
      "line": 2,
      "col": 15
   },
   "status": 400
}

这给了我GET index/type/_search?scroll=1m { "size": 1000, "query": { "match_all": {} } }

的好结果
"_scroll_id"

现在根据文档,我应该这样做

{
   "_scroll_id": "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAB1dFmJRbm9UR3h4UUFTVHFzV1dJMHpuOVEAAAAAAAAdXxZiUW5vVEd4eFFBU1Rxc1dXSTB6bjlRAAAAAAAAHV4WYlFub1RHeHhRQVNUcXNXV0kwem45UQAAAAAAAB1gFmJRbm9UR3h4UUFTVHFzV1dJMHpuOVEAAAAAAAAdYhZiUW5vVEd4eFFBU1Rxc1dXSTB6bjlR",
   "took": 37,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },

这给了我上面的错误。我是否以错误的方式使用滚动API? ES版本为5.5.1,kibana版本为5.5.1。我正在使用kibana访问ES服务器。

1 个答案:

答案 0 :(得分:3)

问题在于我需要

GET /_search/scroll
{
    "scroll": "1m",
    "scroll_id": "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAB1dFmJRbm9UR3h4UUFTVHFzV1dJMHpuOVEAAAAAAAAdXxZiUW5vVEd4eFFBU1Rxc1dXSTB6bjlRAAAAAAAAHV4WYlFub1RHeHhRQVNUcXNXV0kwem45UQAAAAAAAB1gFmJRbm9UR3h4UUFTVHFzV1dJMHpuOVEAAAAAAAAdYhZiUW5vVEd4eFFBU1Rxc1dXSTB6bjlR"
}

我忘记在/scroll之后添加_search。它现在有效