zoukankan      html  css  js  c++  java
  • (十三)Batch Processing

    In addition to being able to index, update, and delete individual documents, Elasticsearch also provides the ability to perform any of the above operations in batches using the _bulk API. This functionality is important in that it provides a very efficient mechanism to do multiple operations as fast as possible with as few network roundtrips as possible.

    批处理过程 除了能够索引,更新和删除单个文档之外,Elasticsearch还提供了使用_bulk API批量执行上述任何操作的功能。此功能非常重要,因为它提供了一种非常有效的机制,可以尽可能快地执行多个操作,并尽可能少地进行网络往返。
     
     As a quick example, the following call indexes two documents (ID 1 - John Doe and ID 2 - Jane Doe) in one bulk operation:
    作为一个简单示例,以下调用在一个批量操作中索引两个文档(ID 1 - John Doe和ID 2 - Jane Doe):
    curl -X POST "localhost:9200/customer/_doc/_bulk?pretty" -H 'Content-Type: application/json' -d'
    {"index":{"_id":"1"}}
    {"name": "John Doe" }
    {"index":{"_id":"2"}}
    {"name": "Jane Doe" }
    '
    使用postMan调用时
    {"index":{"_id":"1"}}
    {"name": "John Doe" }
    //此处必须换行 {"index":{"_id":"2"}} {"name": "Jane Doe" }
    //此处必须换行

    This example updates the first document (ID of 1) and then deletes the second document (ID of 2) in one bulk operation:

    此示例更新第一个文档(ID为1),然后在一个批量操作中删除第二个文档(ID为2):
    curl -X POST "localhost:9200/customer/_doc/_bulk?pretty" -H 'Content-Type: application/json' -d'
    {"update":{"_id":"1"}}
    {"doc": { "name": "John Doe becomes Jane Doe" } }
    {"delete":{"_id":"2"}}
    '
    使用postMan调用时
    与上面一样,需要通过换行分隔

    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.

    请注意,对于删除操作,之后没有相应的源文档,因为删除只需要删除文档的ID。
     
     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.
      Bulk API不会因其中一个操作失败而失败。如果单个操作因任何原因失败,它将继续处理其后的其余操作。批量API返回时,它将为每个操作提供一个状态(按照发送的顺序),以便您可以检查特定操作是否失败。
     
  • 相关阅读:
    is_enable()、is_displayed()、isSelected()
    python selenium(常用关键字)
    Jenkins 构建 Jmeter 项目之源代码管理(SVN)
    Jenkins 构建 Jmeter 项目
    SAP SD基础知识之现金销售
    SAP SD基础知识之与FI集成相关的流程与配置
    SAP SD 基础知识之计划行类别(Schedule Line Category)
    SAP MM 事务代码MRKO触发的财务凭证不会出现在PO History里
    SAP MM 对于MRKO事务代码的几点优化建议
    SAP SD 销售中的借贷项凭证
  • 原文地址:https://www.cnblogs.com/shuaiandjun/p/10272878.html
Copyright © 2011-2022 走看看