ElastixFork Fork v0.0.1 ElastixFork.Mapping

The mapping API is used to define how documents are stored and indexed.

Elastic documentation

Link to this section Summary

Functions

Gets info on one or a list of mappings for one or a list of indices.

Gets info on every mapping.

Link to this section Functions

Link to this function

get(elastic_url, index_names, type_names, query_params \\ [])

get(
  elastic_url :: String.t(),
  index_names :: String.t() | list(),
  type_names :: String.t() | list(),
  query_params :: Keyword.t()
) :: ElastixFork.HTTP.resp()

Gets info on one or a list of mappings for one or a list of indices.

Examples

iex> ElastixFork.Mapping.get("http://localhost:9200", "twitter", "tweet")
{:ok, %HTTPoison.Response{...}}
Link to this function

get_all(elastic_url, query_params \\ [])

get_all(elastic_url :: String.t(), query_params :: Keyword.t()) ::
  ElastixFork.HTTP.resp()

Gets info on every mapping.

Examples

iex> ElastixFork.Mapping.get_all("http://localhost:9200")
{:ok, %HTTPoison.Response{...}}
Link to this function

get_all_with_type(elastic_url, type_names, query_params \\ [])

get_all_with_type(
  elastic_url :: String.t(),
  type_names :: String.t() | list(),
  query_params :: Keyword.t()
) :: ElastixFork.HTTP.resp()

Gets info on every given mapping.

Examples

iex> ElastixFork.Mapping.get_all("http://localhost:9200", ["tweet", "user"])
{:ok, %HTTPoison.Response{...}}
Link to this function

put(elastic_url, index_names, type_name, data, query_params \\ [])

put(
  elastic_url :: String.t(),
  index_names :: String.t() | list(),
  type_name :: String.t(),
  data :: map(),
  query_params :: Keyword.t()
) :: ElastixFork.HTTP.resp()

Creates a new mapping.

Examples

iex> mapping = %{properties: %{user: %{type: "text"}, post_date: %{type: "date"}, message: %{type: "text"}}}
iex> ElastixFork.Mapping.put("http://localhost:9200", "twitter", "tweet", mapping)
{:ok, %HTTPoison.Response{...}}