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":""}}
{"name": "John Doe" }
{"index":{"_id":""}}
{"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":""}}
{"doc": { "name": "John Doe becomes Jane Doe" } }
{"delete":{"_id":""}}
'
使用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返回时,它将为每个操作提供一个状态(按照发送的顺序),以便您可以检查特定操作是否失败。
 

(十三)Batch Processing的更多相关文章

  1. SAP OData $batch processing

    例として.1回の呼び出しで100個の新しい商品を作成したい場合.最も簡単な方法は.$ batch要求を使用して100個のPOST呼び出しすべてを単一のサービス呼び出しにまとめることです. URIの末尾 ...

  2. RabbitMQ and batch processing 批提交

    RabbitMQ - RabbitMQ and batch processinghttp://rabbitmq.1065348.n5.nabble.com/RabbitMQ-and-batch-pro ...

  3. Spring Batch 中文参考文档 V3.0.6 - 1 Spring Batch介绍

    1 Spring Batch介绍 企业领域中许多应用系统需要采用批处理的方式在特定环境中运行业务操作任务.这种业务作业包括自动化,大量信息的复杂操作,他们不需要人工干预,并能高效运行.这些典型作业包括 ...

  4. 腾讯大数据平台Oceanus: A one-stop platform for real time stream processing powered by Apache Flink

    January 25, 2019Use Cases, Apache Flink The Big Data Team at Tencent     In recent years, the increa ...

  5. An Overview of End-to-End Exactly-Once Processing in Apache Flink (with Apache Kafka, too!)

    01 Mar 2018 Piotr Nowojski (@PiotrNowojski) & Mike Winters (@wints) This post is an adaptation o ...

  6. Coursera, Big Data 3, Integration and Processing (week 4)

    Week 4 Big Data Precessing Pipeline 上图可以generalize 成下图,也就是Big data pipeline some high level processi ...

  7. Spring Batch 批量处理策略

    为了帮助设计和实现批量处理系统,基本的批量应用是通过块和模式来构建的,同时也应该能够为程序开发人员和设计人员提供结构的样例和基础的批量处理程序. 当你开始设计一个批量作业任务的时候,商业逻辑应该被拆分 ...

  8. Stream Processing 101: From SQL to Streaming SQL in 10 Minutes

    转自:https://wso2.com/library/articles/2018/02/stream-processing-101-from-sql-to-streaming-sql-in-ten- ...

  9. Stream processing with Apache Flink and Minio

    转自:https://blog.minio.io/stream-processing-with-apache-flink-and-minio-10da85590787 Modern technolog ...

随机推荐

  1. 按行切割大文件(linux split 命令简版)

    按行切割大文件(linux split 命令简版) #-*- coding:utf-8 -*- __author__ = 'KnowLifeDeath' ''' Linux上Split命令可以方便对大 ...

  2. jmeter 分布式压测(Linux)

    之前一篇博文写的是如何在Linux上使用jmeter压测,这篇介绍下Linux上jmeter的分布式压测. 和windows上的分布式类似,需要配置agent节点和控制机 一.Agent节点配置 1. ...

  3. Linux常用命令详解(week1_day1_1)--技术流ken

    本节内容 基础命令:lsmanpwdcdmkdirechotouchcpmvrmrmdircatmorelessheadtailclearpoweroffreboot进阶命令(下一章节):aliasu ...

  4. 怎么获取泛型T.class类?

    public <T> void get(List<T> list){ getA(T.class); //报错,不能调用T.class } public void getA(Cl ...

  5. 用python爬取杭电oj的数据

    暑假集训主要是在杭电oj上面刷题,白天与算法作斗争,晚上望干点自己喜欢的事情! 首先,确定要爬取哪些数据: 如上图所示,题目ID,名称,accepted,submissions,都很有用. 查看源代码 ...

  6. HTTPS 站点的性能优化

    HTTPS 站中的几大难题 性能,包括: HTTPS需要多次握手,因此网络耗时变长,用户从HTTP跳转到HTTPS需要一些时间: HTTPS要做RSA校验,这会影响到设备性能: 所有CDN节点要支持H ...

  7. 用JS编写一个函数,返回数组中重复出现过的元素

    用JS编写一个函数,返回数组中重复出现过的元素,见下面的代码: , , , , , , , ]; var getRepeat = function (arr) { var obj = {}; , le ...

  8. PhpStorm 运行出现502 Bad Gateway

    打开PhpStorm,菜单栏File --> Settings... 一.点开Languages & Frameworks 选PHP PHP language level:选PHP版本, ...

  9. 国人如此浮躁为哪般? --- 我看2018年度AI圈八大造假事件华人独占6件

    国人如此浮躁为哪般? ---  我看2018年度AI圈八大造假事件华人独占6件 人工智能在2018年发展很快,取得了很多成绩:很多新的产品,框架,软硬件系统,层出不穷:以七巨头为首的业界头部企业也取得 ...

  10. SAP MM 预留单据里的Base date和Requirement date

    SAP MM 预留单据里的Base date和Requirement date Base date可以在预留创建的初始界面指定, 这个日期可以作为预留各个行项目默认的requirement date. ...