Rubber v0.9.0 Rubber.Search
The search APIs are used to query indices.
Link to this section Summary
Functions
Returns the number of results for a query using the Count API
Same as count/4
but allows to specify query params and options for
HTTPoison.request/5
Uses the Scroll API to allow scrolling through a list of results
Makes a request to the _search
or the _msearch
endpoint depending on the type of
data
Same as search/4
but allows to specify query params and options for
HTTPoison.request/5
Link to this section Functions
count( elastic_url :: String.t(), index :: String.t(), types :: list(), data :: map() ) :: Rubber.HTTP.resp()
Returns the number of results for a query using the Count API.
Examples
iex> Rubber.Search.count("http://localhost:9200", "twitter", ["tweet"], %{query: %{term: %{user: "kimchy"}}})
{:ok, %HTTPoison.Response{...}}
Same as count/4
but allows to specify query params and options for
HTTPoison.request/5
.
scroll(elastic_url :: String.t(), data :: map(), options :: Keyword.t()) :: Rubber.HTTP.resp()
Uses the Scroll API to allow scrolling through a list of results.
Examples
iex> Rubber.Search.scroll("http://localhost:9200", %{query: %{term: %{user: "kimchy"}}})
{:ok, %HTTPoison.Response{...}}
Makes a request to the _search
or the _msearch
endpoint depending on the type of
data
.
When passing a map for data, it’ll make a simple search, but you can pass a list of header and body params to make a multi search.
Examples
iex> Rubber.Search.search("http://localhost:9200", "twitter", ["tweet"], %{query: %{term: %{user: "kimchy"}}})
{:ok, %HTTPoison.Response{...}}
Same as search/4
but allows to specify query params and options for
HTTPoison.request/5
.