elasticsearch v1.0.0 Elasticsearch.Store behaviour View Source

A behaviour for fetching data to index using a streaming strategy.

Link to this section Summary

Callbacks

Returns a stream of the given datasource

Returns a transaction wrapper to execute the stream returned by stream/1 within. This is required when using Ecto

Link to this section Callbacks

Returns a stream of the given datasource.

Example

def stream(Post) do
  Repo.stream(Post)
end
Link to this callback transaction(function) View Source
transaction((... -> any())) :: any()

Returns a transaction wrapper to execute the stream returned by stream/1 within. This is required when using Ecto.

Example

def transaction(fun) do
  {:ok, result} = Repo.transaction(fun, timeout: :infinity)
  result
end

If you are not using Ecto and do not require transactions, simply call the function passed as a parameter.

def transaction(fun) do
  fun.()
end