Elastix.Search (Elastix v0.10.0) View Source
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
Specs
count( elastic_url :: String.t(), index :: String.t(), types :: list(), data :: map() ) :: Elastix.HTTP.resp()
Returns the number of results for a query using the Count API.
Examples
iex> Elastix.Search.count("http://localhost:9200", "twitter", ["tweet"], %{query: %{term: %{user: "kimchy"}}})
{:ok, %HTTPoison.Response{...}}
count(elastic_url, index, types, data, query_params, options \\ [])
View SourceSpecs
count( elastic_url :: String.t(), index :: String.t(), types :: list(), data :: map(), query_params :: Keyword.t(), options :: Keyword.t() ) :: Elastix.HTTP.resp()
Same as count/4
but allows to specify query params and options for
HTTPoison.request/5
.
Specs
scroll(elastic_url :: String.t(), data :: map(), options :: Keyword.t()) :: Elastix.HTTP.resp()
Uses the Scroll API to allow scrolling through a list of results.
Examples
iex> Elastix.Search.scroll("http://localhost:9200", %{query: %{term: %{user: "kimchy"}}})
{:ok, %HTTPoison.Response{...}}
Specs
search( elastic_url :: String.t(), index :: String.t() | list(), types :: list(), data :: map() | list() ) :: Elastix.HTTP.resp()
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> Elastix.Search.search("http://localhost:9200", "twitter", ["tweet"], %{query: %{term: %{user: "kimchy"}}})
{:ok, %HTTPoison.Response{...}}
iex> Elastix.Search.search("http://localhost:9200", ["twitter", "other-index"], ["tweet"], %{query: %{term: %{user: "kimchy"}}})
{:ok, %HTTPoison.Response{...}}
search(elastic_url, index, types, data, query_params, options \\ [])
View SourceSpecs
search( elastic_url :: String.t(), index :: String.t() | list(), types :: list(), data :: map() | list(), query_params :: Keyword.t(), options :: Keyword.t() ) :: Elastix.HTTP.resp()
Same as search/4
but allows to specify query params and options for
HTTPoison.request/5
.