ElasticsearchElixirBulkProcessor.Helpers.BulkResponse (Elasticsearch Elixir Bulk Processor v0.1.3)

Link to this section Summary

Functions

Given a list of items return true if all have an error.

Given a list of items from a bulk response and the data sent as a string payload return the items that match the error.

Link to this section Functions

Link to this function

all_items_error?(items)

Given a list of items return true if all have an error.

Examples

iex> items = [%{"index" => %{"error" => %{}}}, %{"update" => %{"error" => %{}}}, %{"create" => %{"error" => %{}}}, %{"delete" => %{"error" => %{}}}] ...> ElasticsearchElixirBulkProcessor.Helpers.BulkResponse.all_items_error?(items) true

iex> items = [%{"index" => %{}}, %{"update" => %{"error" => %{}}}, %{"create" => %{}}, %{"delete" => %{}}] ...> ElasticsearchElixirBulkProcessor.Helpers.BulkResponse.all_items_error?(items) false

Link to this function

gather_error_items(items, data)

Given a list of items from a bulk response and the data sent as a string payload return the items that match the error.

Examples

iex> items = [%{"index" => %{}}, %{"update" => %{"error" => %{}}}, %{"create" => %{}}, %{"delete" => %{}}] ...> data = "item\nitem_with_errors\nitem\nitem" ...> ElasticsearchElixirBulkProcessor.Helpers.BulkResponse.gather_error_items(items, data) "item_with_errors"

iex> items = [%{"index" => %{"error" => %{}}}, %{"update" => %{"error" => %{}}}, %{"create" => %{"error" => %{}}}, %{"delete" => %{"error" => %{}}}] ...> data = "item1\nitem2\nitem3\nitem4" ...> ElasticsearchElixirBulkProcessor.Helpers.BulkResponse.gather_error_items(items, data) "item1\nitem2\nitem3\nitem4"