ElastixFork Fork v0.0.1 ElastixFork.Document

The document APIs expose CRUD operations on documents.

Elastic documentation

Link to this section Summary

Link to this section Functions

Link to this function

delete(elastic_url, index_name, type_name, id, query_params \\ [])

delete(
  elastic_url :: String.t(),
  index :: String.t(),
  type :: String.t(),
  id :: String.t(),
  query_params :: Keyword.t()
) :: ElastixFork.HTTP.resp()

Deletes the documents matching the given id.

Examples

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

delete_matching(elastic_url, index_name, query, query_params \\ [])

delete_matching(
  elastic_url :: String.t(),
  index :: String.t(),
  query :: map(),
  query_params :: Keyword.t()
) :: ElastixFork.HTTP.resp()

Deletes the documents matching the given query using the Delete By Query API.

Link to this function

get(elastic_url, index_name, type_name, id, query_params \\ [])

get(
  elastic_url :: String.t(),
  index :: String.t(),
  type :: String.t(),
  id :: String.t(),
  query_params :: Keyword.t()
) :: ElastixFork.HTTP.resp()

Fetches a document matching the given id.

Examples

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

index(elastic_url, index_name, type_name, id, data, query_params \\ [])

index(
  elastic_url :: String.t(),
  index :: String.t(),
  type :: String.t(),
  id :: String.t(),
  data :: map(),
  query_params :: Keyword.t()
) :: ElastixFork.HTTP.resp()

(Re)Indexes a document with the given id.

Examples

iex> ElastixFork.Document.index("http://localhost:9200", "twitter", "tweet", "42", %{user: "kimchy", post_date: "2009-11-15T14:12:12", message: "trying out ElastixFork"})
{:ok, %HTTPoison.Response{...}}
Link to this function

index_new(elastic_url, index_name, type_name, data, query_params \\ [])

index_new(
  elastic_url :: String.t(),
  index :: String.t(),
  type :: String.t(),
  data :: map(),
  query_params :: Keyword.t()
) :: ElastixFork.HTTP.resp()

Indexes a new document.

Examples

iex> ElastixFork.Document.index_new("http://localhost:9200", "twitter", "tweet", %{user: "kimchy", post_date: "2009-11-15T14:12:12", message: "trying out ElastixFork"})
{:ok, %HTTPoison.Response{...}}
Link to this function

mget(elastic_url, query, index_name \\ nil, type_name \\ nil, query_params \\ [])

mget(
  elastic_url :: String.t(),
  query :: map(),
  index :: String.t(),
  type :: String.t(),
  query_params :: Keyword.t()
) :: ElastixFork.HTTP.resp()

Fetches multiple documents matching the given query using the Multi Get API.

Link to this function

update(elastic_url, index_name, type_name, id, data, query_params \\ [])

update(
  elastic_url :: String.t(),
  index :: String.t(),
  type :: String.t(),
  id :: String.t(),
  data :: map(),
  query_params :: Keyword.t()
) :: ElastixFork.HTTP.resp()

Updates the document with the given id.

Examples

iex> ElastixFork.Document.update("http://localhost:9200", "twitter", "tweet", "42", %{user: "kimchy", message: "trying out ElastixFork.Document.update/5"})
{:ok, %HTTPoison.Response{...}}