View Source Elastix.Document (Elastix Search v1.0.1)
The document APIs expose CRUD operations on documents.
Link to this section Summary
Functions
Deletes the documents matching the given id.
Deletes the documents matching the given query using the
Delete By Query API.
Fetches a document matching the given id.
(Re)Indexes a document with the given id.
Indexes a new document.
Fetches multiple documents matching the given query using the
Multi Get API.
Updates the document with the given id.
Updates the documents matching the given query using the
Update By Query API.
Link to this section Functions
delete(elastic_url, index_name, type_name, id, query_params \\ [])
View Source@spec delete( elastic_url :: String.t(), index :: String.t(), type :: String.t(), id :: String.t(), query_params :: Keyword.t() ) :: Elastix.HTTP.resp()
Deletes the documents matching the given id.
examples
Examples
iex> Elastix.Document.delete("http://localhost:9200", "twitter", "tweet", "42")
{:ok, %HTTPoison.Response{...}}
delete_matching(elastic_url, index_name, query, query_params \\ [])
View Source@spec delete_matching( elastic_url :: String.t(), index :: String.t(), query :: map(), query_params :: Keyword.t() ) :: Elastix.HTTP.resp()
Deletes the documents matching the given query using the
Delete By Query API.
@spec get( elastic_url :: String.t(), index :: String.t(), type :: String.t(), id :: String.t(), query_params :: Keyword.t() ) :: Elastix.HTTP.resp()
Fetches a document matching the given id.
examples
Examples
iex> Elastix.Document.get("http://localhost:9200", "twitter", "tweet", "42")
{:ok, %HTTPoison.Response{...}}
index(elastic_url, index_name, type_name, id, data, query_params \\ [])
View Source@spec index( elastic_url :: String.t(), index :: String.t(), type :: String.t(), id :: String.t(), data :: map(), query_params :: Keyword.t() ) :: Elastix.HTTP.resp()
(Re)Indexes a document with the given id.
examples
Examples
iex> Elastix.Document.index("http://localhost:9200", "twitter", "tweet", "42", %{user: "kimchy", post_date: "2009-11-15T14:12:12", message: "trying out Elastix"})
{:ok, %HTTPoison.Response{...}}
index_new(elastic_url, index_name, type_name, data, query_params \\ [])
View Source@spec index_new( elastic_url :: String.t(), index :: String.t(), type :: String.t(), data :: map(), query_params :: Keyword.t() ) :: Elastix.HTTP.resp()
Indexes a new document.
examples
Examples
iex> Elastix.Document.index_new("http://localhost:9200", "twitter", "tweet", %{user: "kimchy", post_date: "2009-11-15T14:12:12", message: "trying out Elastix"})
{:ok, %HTTPoison.Response{...}}
mget(elastic_url, query, index_name \\ nil, type_name \\ nil, query_params \\ [])
View Source@spec mget( elastic_url :: String.t(), query :: map(), index :: String.t(), type :: String.t(), query_params :: Keyword.t() ) :: Elastix.HTTP.resp()
Fetches multiple documents matching the given query using the
Multi Get API.
update(elastic_url, index_name, type_name, id, data, query_params \\ [])
View Source@spec update( elastic_url :: String.t(), index :: String.t(), type :: String.t(), id :: String.t(), data :: map(), query_params :: Keyword.t() ) :: Elastix.HTTP.resp()
Updates the document with the given id.
examples
Examples
iex> Elastix.Document.update("http://localhost:9200", "twitter", "tweet", "42", %{user: "kimchy", message: "trying out Elastix.Document.update/5"})
{:ok, %HTTPoison.Response{...}}
update_by_query(elastic_url, index_name, query, script, query_params \\ [])
View Source@spec update_by_query( elastic_url :: String.t(), index :: String.t(), query :: map(), script :: map(), query_params :: Keyword.t() ) :: Elastix.HTTP.resp()
Updates the documents matching the given query using the
Update By Query API.
examples
Examples
iex> Elastix.Document.update_by_query("http://localhost:9200", "twitter", %{"term" => %{"user" => "kimchy"}}, %{inline: "ctx._source.user = 'kimchy updated'", lang: "painless"})
{:ok, %HTTPoison.Response{...}}