Elastic v3.0.0 Elastic.Scroller View Source

Provides an API for working with Elastic Search’s Scroll API

Example

{:ok, pid} = Elastic.Scroller.start_link(%{index: "answer"})
# get the first "page" of results
Elastic.Scroller.results(pid)
# Request the second page
Elastic.Scroller.next_page(pid)
# get the second "page" of results
Elastic.Scroller.results(pid)

Then you can choose to kill the search context yourself… keeping in mind of course that Elastic Search will do this automatically after the keepalive (default of 1 minute) expires for the scroll.

Elastic.Scroller.clear(pid)

Link to this section Summary

Functions

Fetches the next page of results and returns a scroll ID

Returns the results of the current scroll location

Starts an Elastic.Scroller server

Link to this section Functions

Link to this function next_page(pid) View Source
next_page(pid()) ::
  {:ok, String.t()} |
  {:error, :search_context_not_found, map()} |
  {:error, String.t()}

Fetches the next page of results and returns a scroll ID.

To retrieve the results that come from this request, make a call to Elastic.Scroller.results/1.

Elastic.Scroller.next_page(pid)
Link to this function results(pid) View Source
results(pid()) :: [map()]

Returns the results of the current scroll location.

Elastic.Scroller.results(pid)
Link to this function start_link(opts) View Source
start_link(%{:index => String.t(), optional(:body) => map(), optional(:size) => pos_integer(), optional(:keepalive) => String.t()}) :: {:ok, pid()}

Starts an Elastic.Scroller server.

For usage information refer to the documentation at the top of this module.