【问题标题】:Elasticsearch 5.1 Bulk ActionElasticsearch 5.1 批量操作
【发布时间】:2017-05-17 12:59:12
【问题描述】:

我正在尝试进行批量更新

方法:发布 网址:/customer/external/_bulk

Json 身体:

{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }

Id 1 已更新,但 id 2 未更新。不知道为什么?

回复在这里:

{
  "took": 138,
  "errors": false,
  "items": [
    {
      "index": {
        "_index": "customer",
        "_type": "external",
        "_id": "1",
        "_version": 15,
        "result": "updated",
        "_shards": {
          "total": 2,
          "successful": 1,
          "failed": 0
        },
        "created": false,
        "status": 200
      }
    }
  ]
}

【问题讨论】:

  • 您确定在第四行之后添加新行吗??

标签: java php elasticsearch elastica


【解决方案1】:

正如@Val 提到的,您应该在json 正文的最后一行末尾添加换行符\n:

{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }\n

如bulk_api 中所述。希望对您有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-26
    • 2021-02-13
    • 2015-09-27
    • 2012-12-11
    • 2019-07-19
    • 1970-01-01
    相关资源
    最近更新 更多