Elasticsearch Chinese API Bulk (vi)

Source: Internet
Author: User

Bulk API

The bulk API allows developers to index and delete multiple documents in a single request. Here is the usage instance.

ImportStatic org.elasticsearch.common.xcontent.xcontentfactory.*; Bulkrequestbuilder bulkrequest = Client.preparebulk ();Either use Client#prepare, or use requests# to directly build Index/delete Requestsbulkrequest.add (client.prepareindex ("Twitter","Tweet","1"). SetSource (Jsonbuilder (). StartObject (). Field ("User","Kimchy"). Field ( "postdate", new Date ()). Field (" trying out Elasticsearch "). EndObject (Bulkrequest.add)) ( "tweet",  "2"). SetSource (Jsonbuilder (). StartObject (). Field ( "user",  "Kimchy "). Field (" postdate ", new Date ()). Field (  "message",  "another post"). EndObject ()); Bulkresponse bulkresponse = Bulkrequest.execute (). Actionget (); if (Bulkresponse.hasfailures ()) {//process failures by Iterating through each bulk response item}           

Elasticsearch Chinese API Bulk (vi)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.