Skip to content

Commit

Permalink
[API] Adds ignore 404 parameter to query_rules.delete_ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
picandocodigo committed Oct 15, 2024
1 parent 04b8450 commit c6709b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,19 @@ def delete_ruleset(arguments = {})

method = Elasticsearch::API::HTTP_DELETE
path = "_query_rules/#{Utils.__listify(_ruleset_id)}"
params = {}
params = Utils.process_params(arguments)

Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)
if Array(arguments[:ignore]).include?(404)
Utils.__rescue_from_not_found do
Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)
end
else
Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)
end
end
end
end
Expand Down
1 change: 1 addition & 0 deletions elasticsearch-api/utils/thor/endpoint_specifics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module EndpointSpecifics
indices.delete
indices.delete_template
indices.flush_synced
query_rules.delete_ruleset
security.get_role
security.get_user
snapshot.delete
Expand Down

0 comments on commit c6709b9

Please sign in to comment.