Skip to content

Instantly share code, notes, and snippets.

@rugyoga
Last active July 21, 2022 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rugyoga/cae0c10a9787b2106f7b6fbedea5749a to your computer and use it in GitHub Desktop.
Save rugyoga/cae0c10a9787b2106f7b6fbedea5749a to your computer and use it in GitHub Desktop.
Delete a ES Point In Time ID
@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