Elastix.Mapping (Elastix v0.10.0) View Source

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 \\ [])

View Source

Specs

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

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

Examples

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

get_all(elastic_url, query_params \\ [])

View Source

Specs

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

Gets info on every mapping.

Examples

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

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

View Source

Specs

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

Gets info on every given mapping.

Examples

iex> Elastix.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 \\ [])

View Source

Specs

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

Creates a new mapping.

Examples

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