ElasticsearchElixirBulkProcessor.Helpers.Events (Elasticsearch Elixir Bulk Processor v0.1.7)

Link to this section Summary

Functions

Return the size of the string in bytes

Split list of strings into chunks of given byte size and rest of the list.

Split list of strings into first chunk of given byte size and rest of the list.

Link to this section Functions

Link to this function

byte_sum(item_list)

Return the size of the string in bytes

Examples

iex> ElasticsearchElixirBulkProcessor.Helpers.Events.byte_sum([%ElasticsearchElixirBulkProcessor.Items.Index{index: "test", source: %{"test" => "test"}}]) 43

iex> ElasticsearchElixirBulkProcessor.Helpers.Events.byte_sum([ ...> %ElasticsearchElixirBulkProcessor.Items.Index{index: "test", source: %{"test" => "test"}}, ...> %ElasticsearchElixirBulkProcessor.Items.Index{index: "test", source: %{"test" => "test"}} ...> ]) 86

iex> ElasticsearchElixirBulkProcessor.Helpers.Events.byte_sum([]) 0

Link to this function

chunk_bytes(list, chunk_byte_size)

Split list of strings into chunks of given byte size and rest of the list.

Examples

iex> alias ElasticsearchElixirBulkProcessor.Items.Index ...> [ ...> %Index{index: "test", source: %{"test" => "test"}}, ...> %Index{index: "test", source: %{"test" => "test"}} ...> ] ...> |> ElasticsearchElixirBulkProcessor.Helpers.Events.chunk_bytes(10) alias ElasticsearchElixirBulkProcessor.Items.Index [[%Index{index: "test", source: %{"test" => "test"}}], [%Index{index: "test", source: %{"test" => "test"}}]]

iex> alias ElasticsearchElixirBulkProcessor.Items.Index ...> [ ...> %Index{index: "test", source: %{"test" => "test"}}, ...> %Index{index: "test", source: %{"test" => "test"}} ...> ] ...> |> ElasticsearchElixirBulkProcessor.Helpers.Events.chunk_bytes(10) alias ElasticsearchElixirBulkProcessor.Items.Index [[%Index{index: "test", source: %{"test" => "test"}}], [%Index{index: "test", source: %{"test" => "test"}}]]

Link to this function

split_first_bytes(list, first_byte_size)

Split list of strings into first chunk of given byte size and rest of the list.

Examples

iex> alias ElasticsearchElixirBulkProcessor.Items.Index ...> [ ...> %Index{index: "test", source: %{"test" => "test"}}, ...> %Index{index: "test", source: %{"test" => "test"}}, ...> %Index{index: "test", source: %{"test" => "test"}} ...> ] ...> |> ElasticsearchElixirBulkProcessor.Helpers.Events.split_first_bytes(43) alias ElasticsearchElixirBulkProcessor.Items.Index {

[%Index{index: "test", source: %{"test" => "test"}}],
[%Index{index: "test", source: %{"test" => "test"}}, %Index{index: "test", source: %{"test" => "test"}}]

}

iex> alias ElasticsearchElixirBulkProcessor.Items.Index ...> [ ...> %Index{index: "test", source: %{"test" => "test"}}, ...> %Index{index: "test", source: %{"test" => "test"}}, ...> %Index{index: "test", source: %{"test" => "test"}} ...> ] ...> |> ElasticsearchElixirBulkProcessor.Helpers.Events.split_first_bytes(43 * 2) alias ElasticsearchElixirBulkProcessor.Items.Index {

[%Index{index: "test", source: %{"test" => "test"}}, %Index{index: "test", source: %{"test" => "test"}}],
[%Index{index: "test", source: %{"test" => "test"}}]

}

iex> alias ElasticsearchElixirBulkProcessor.Items.Index ...> [ ...> %Index{index: "test", source: %{"test" => "test"}}, ...> %Index{index: "test", source: %{"test" => "test"}}, ...> %Index{index: "test", source: %{"test" => "test"}} ...> ] ...> |> ElasticsearchElixirBulkProcessor.Helpers.Events.split_first_bytes(0) alias ElasticsearchElixirBulkProcessor.Items.Index {

[],
[%Index{index: "test", source: %{"test" => "test"}}, %Index{index: "test", source: %{"test" => "test"}}, %Index{index: "test", source: %{"test" => "test"}}]

}