Last active
July 21, 2022 08:44
-
-
Save rugyoga/cae0c10a9787b2106f7b6fbedea5749a to your computer and use it in GitHub Desktop.
Delete a ES Point In Time ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@spec delete(pit_t()) :: :ok | {:error, HTTPoison.AsyncResponse | HTTPoison.MaybeRedirect | HTTPoison.Response} | |
def delete(pit) do | |
url = HTTP.generate_url("_pit", ES.no_index(), HTTP.no_options()) | |
with {:ok, payload} <- Poison.encode(%{"id" => pit}), | |
%HTTPoison.Response{status_code: 200} <- | |
HTTPoison.request!(:delete, url, payload, HTTP.headers(HTTP.json_encoding())) do | |
:ok | |
else | |
error -> {:error, error} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment