Elastic.Scroller (Elastic v3.7.0) 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
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.init/1
.
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
Returns a specification to start this module under a supervisor.
See Supervisor
.
Specs
init(%{ index: String.t(), body: map(), size: pos_integer(), keepalive: String.t() }) :: {:ok, pid()} | {:stop, String.t()}
Callback implementation for GenServer.init/1
.
Specs
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)
Specs
Returns the results of the current scroll location.
Elastic.Scroller.results(pid)
Specs
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.