View Source Elastix.Mapping (Elastix Search v1.0.1)

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

View Source
@spec get(
  elastic_url :: String.t(),
  index_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

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
@spec get_all(elastic_url :: String.t(), query_params :: Keyword.t()) ::
  Elastix.HTTP.resp()

Gets info on every mapping.

examples

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
@spec 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

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
@spec 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

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{...}}