Elastic.HTTP (Elastic v3.7.0) View Source
Used to make raw calls to Elastic Search.
Each function returns a tuple indicating whether or not the request
succeeded or failed (:ok
or :error
), the status code of the response,
and then the processed body of the response.
For example, a request like this:
Elastic.HTTP.get("/answer/_search")
Would return a response like this:
{:ok, 200,
%{"_shards" => %{"failed" => 0, "successful" => 5, "total" => 5},
"hits" => %{"hits" => [%{"_id" => "1", "_index" => "answer", "_score" => 1.0,
"_source" => %{"text" => "I like using Elastic Search"}, "_type" => "answer"}],
"max_score" => 1.0, "total" => 1}, "timed_out" => false, "took" => 7}}
Link to this section Summary
Functions
Makes a request using the DELETE HTTP method
Makes a request using the GET HTTP method, and can take a body.
Makes a request using the HEAD HTTP method
Makes a request using the POST HTTP method, and can take a body.
Makes a request using the PUT HTTP method
Link to this section Functions
Makes a request using the DELETE HTTP method:
Elastic.HTTP.delete("/answers/answer/1")
Makes a request using the GET HTTP method, and can take a body.
Elastic.HTTP.get("/answer/_search", body: %{query: ...})
Makes a request using the HEAD HTTP method:
Elastic.HTTP.head("/answers")
Makes a request using the POST HTTP method, and can take a body.
Makes a request using the PUT HTTP method:
Elastic.HTTP.put("/answers/answer/1", body: %{
text: "I like using Elastic Search"
})