elasticsearch v0.3.0 Elasticsearch.Store behaviour View Source

A behaviour for fetching data to index. Used by mix elasticsearch.build.

Link to this section Summary

Types

Instances of the data source. For example, %Post{} structs

A limit on the number of elements to return

The current offset for the query

A data source. For example, Post, where Post is an Ecto.Schema. Each datum returned must implement Elasticsearch.Document

Callbacks

Loads data based on the given source, offset, and limit

Link to this section Types

Link to this type data() View Source
data() :: any()

Instances of the data source. For example, %Post{} structs.

Link to this type limit() View Source
limit() :: integer()

A limit on the number of elements to return.

Link to this type offset() View Source
offset() :: integer()

The current offset for the query.

Link to this type source() View Source
source() :: any()

A data source. For example, Post, where Post is an Ecto.Schema. Each datum returned must implement Elasticsearch.Document.

Link to this section Callbacks

Link to this callback load(source, offset, limit) View Source
load(source(), offset(), limit()) :: [data()]

Loads data based on the given source, offset, and limit.

Example

def load(Post, offset, limit) do
  Post
  |> offset(^offset)
  |> limit(^limit)
  |> Repo.all()
end