Permalink
Browse files

improving language in bulk API documentation

  • Loading branch information...
amckinley committed Jun 30, 2011
1 parent 49eecad commit 7fa67d41178ef4b2bbc4511ee83f42fab06aee7a
Showing with 9 additions and 11 deletions.
  1. +9 −11 guide/reference/api/bulk.textile
@@ -5,7 +5,7 @@ cat: guide
sidebar: reference_api
---
-p. The bulk API allows to index and delete several documents in a single API. This can greatly increase the indexing speed.The REST API endpoint is /_bulk and it follows the following structure (for @json@):
+p. The bulk API makes it possible to perform many index/delete operations in a single API call. This can greatly increase the indexing speed. The REST API endpoint is /_bulk, and it expects the following JSON structure:
<pre class="prettyprint">
action_and_meta_data\n
@@ -19,7 +19,7 @@ optional_source\n
p. *NOTE*: the final line of data must end with a newline character @\n@.
-p. The json format relies on the fact that Json string values must have @\n@ escaped, and that the actual json actions and sources are not pretty printed. Here is an example:
+p. Because this format uses literal @\n@'s as delimiters, please be sure that the JSON actions and sources are not pretty printed. Here is an example of a correct sequence of bulk commands:
<pre class="prettyprint">
{ "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
@@ -30,15 +30,13 @@ p. The json format relies on the fact that Json string values must have @\n@ esc
</pre>
-p. In the optional source part, the `type` is optional as is when indexing data.
+p. 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 redirected to other shards on other nodes, only @action_meta_data@ is parsed on the receiving node side.
-p. 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.
+p. Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible.
-p. 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.
+p. The response to a bulk action is a large JSON structure with the individual results of each action that was performed. The failure of a single action does not affect the remaining actions.
-p. 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).
-
-p. 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.
+p. There is no "correct" number of actions to perform in a single bulk call. You should experiment with different settings to find the optimum size for your particular workload.
p. If using the HTTP API, make sure that the client does not send HTTP chunks, as this will slow things down.
@@ -52,18 +50,18 @@ p. Each bulk item can include the routing value using the @_routing@/@routing@ f
h1. Percolator
-p. Each index bulk item can include a percolate value using the @_percolate@ field.
+p. Each bulk index action can include a percolate value using the @_percolate@ field.
h1. Parent
p. Each bulk item can include the parent value using the @_parent@/@parent@ field. It automatically follows the behavior of the index / delete operation based on the @_parent@ / @_routing@ mapping.
h1. Write Consistency
-p. Control if the operation will be allowed to execute based on the number of active shards within that partition (replication group). The values allowed are @one@, @quorum@, and @all@. The parameter to set it is @consistency@, and it defaults to the node level setting of @action.write_consistency@ which in turn defaults to @quorum@.
+p. When making bulk calls, you can require a minimum number of active shards in the partition through the @consistency@ parameter. The values allowed are @one@, @quorum@, and @all@. It defaults to the node level setting of @action.write_consistency@, which in turn defaults to @quorum@.
p. For example, in a N shards with 2 replicas index, there will have to be at least 2 active shards within the relevant partition (@quorum@) for the operation to succeed. In a N shards with 1 replica scenario, there will need to be a single shard active (in this case, @one@ and @quorum@ is the same).
h1. Refresh
-p. The @refresh@ parameter can be set to @true@ in order to refresh the relevant shards after the bulk operation has occurred and make it searchable. Setting it to @true@ should be done after careful thought and verification that this does not cause a heavy load on the system (and slows down indexing).
+p. The @refresh@ parameter can be set to @true@ in order to refresh the relevant shards immediately after the bulk operation has occurred and make it searchable, instead of waiting for the normal refresh interval to expire. Setting it to @true@ can trigger additional load, and may slow down indexing.

0 comments on commit 7fa67d4

Please sign in to comment.