ElasticsearchElixirBulkProcessor.Helpers.BulkResponse (Elasticsearch Elixir Bulk Processor v0.1.8)
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. Incoming data is split every second new line.
Link to this section Functions
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
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. Incoming data is split every second new line.
Examples
iex> items = [%{"index" => %{}}, %{"update" => %{"error" => %{}}}, %{"create" => %{}}, %{"delete" => %{}}] ...> data = "meta\nitem\nmeta_with_errors\nitem_with_errors\nmeta\nitem\nmeta\nitem" ...> ElasticsearchElixirBulkProcessor.Helpers.BulkResponse.gather_error_items(items, data) "meta_with_errors\nitem_with_errors"
iex> items = [%{"index" => %{"error" => %{}}}, %{"update" => %{"error" => %{}}}, %{"create" => %{"error" => %{}}}, %{"delete" => %{"error" => %{}}}] ...> data = "meta\nitem1\nmeta\nitem2\nmeta\nitem3\nmeta\nitem4" ...> ElasticsearchElixirBulkProcessor.Helpers.BulkResponse.gather_error_items(items, data) "meta\nitem1\nmeta\nitem2\nmeta\nitem3\nmeta\nitem4"