Skip to content

Bulk API #371

Closed
Closed
@kimchy

Description

@kimchy

Expose bulk API for indexing and deleting docs. The REST AP endpoint is /_bulk and it follows the following structure (for json):

action_and_meta_data\n
optional_source\n
action_and_meta_data\n
optional_source\n
....

for example:

{ "index" : { "index" : "test", "type" : "type1", "id" : "1" } }
{ "type1" : { "field1" : "value1" } }
{ "delete" : { "index" : "test", "type" : "type1", "id" : "2" } }
{ "create" : { "index" : "test", "type" : "type1", "id" : "1" } }
{ "type1" : { "field1" : "value1" } }

A note on the format. The idea here is to make processing of this as fast as possible. As some of the actions will be needed to be redirected to other shards that exists on other nodes, only the action meta_data is parsed on the receiving node side. Also, zero copy buffers can be used on the source directly writing segments relevant to each action source to the network.

Client libraries using this protocol should try and strive to do something similar on the client side, and reduce as much as possible the creation of buffers.

The result is a full formatted json, with all the actions performed (in the same order), with possible error field indicating for each one in case of failure (on an item level).

Note, in the end, the full data needs to be represented on each server, so indexing 5GB of data should be broken down and not executed in a single batch.

If using the HTTP API, make sure that the client does not send HTTP chunks, as this will slow things down.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions