美文网首页
ElasticSearch批量操作

ElasticSearch批量操作

作者: 思记享 | 来源:发表于2017-06-13 20:25 被阅读0次

    Batch Processing

    支持批量操作可以减少网络交互流量

    POST /customer/external/_bulk?pretty
    {"index":{"_id":"1"}}
    {"name": "John Doe" }
    {"index":{"_id":"2"}}
    {"name": "Jane Doe" }

    POST /customer/external/_bulk?pretty
    {"update":{"_id":"1"}}
    {"doc": { "name": "John Doe becomes Jane Doe" } }
    {"delete":{"_id":"2"}}

    Note above that for the delete action, there is no corresponding source document after it since deletes only require the ID of the document to be deleted.

    The Bulk API does not fail due to failures in one of the actions. If a single action fails for whatever reason, it will continue to process the remainder of the actions after it. When the bulk API returns, it will provide a status for each action (in the same order it was sent in) so that you can check if a specific action failed or not.

    相关文章

      网友评论

          本文标题:ElasticSearch批量操作

          本文链接:https://www.haomeiwen.com/subject/vgrjqxtx.html