Skip to content

Commit ad1e794

Browse files
committed
[API] Regenerates APIs with ignore 404 fix
Adds option to use ignore: 404 in `clear_scroll`. As a side fix, it also fixes security.get_role and watcher.delete_watch which also supported the feature to ignore 404, but the parameters were coming empty, so they'd return a boolean instead of the Response from Elasticsearch.
1 parent 5d06e3b commit ad1e794

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/clear_scroll.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,19 @@ def clear_scroll(arguments = {})
4848
else
4949
"_search/scroll"
5050
end
51-
params = {}
51+
params = Utils.process_params(arguments)
5252

53-
Elasticsearch::API::Response.new(
54-
perform_request(method, path, params, body, headers)
55-
)
53+
if Array(arguments[:ignore]).include?(404)
54+
Utils.__rescue_from_not_found {
55+
Elasticsearch::API::Response.new(
56+
perform_request(method, path, params, body, headers)
57+
)
58+
}
59+
else
60+
Elasticsearch::API::Response.new(
61+
perform_request(method, path, params, body, headers)
62+
)
63+
end
5664
end
5765
end
5866
end

elasticsearch-api/lib/elasticsearch/api/actions/security/get_role.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def get_role(arguments = {})
4343
else
4444
"_security/role"
4545
end
46-
params = {}
46+
params = Utils.process_params(arguments)
4747

4848
if Array(arguments[:ignore]).include?(404)
4949
Utils.__rescue_from_not_found {

elasticsearch-api/lib/elasticsearch/api/actions/watcher/delete_watch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def delete_watch(arguments = {})
4141

4242
method = Elasticsearch::API::HTTP_DELETE
4343
path = "_watcher/watch/#{Utils.__listify(_id)}"
44-
params = {}
44+
params = Utils.process_params(arguments)
4545

4646
if Array(arguments[:ignore]).include?(404)
4747
Utils.__rescue_from_not_found {

0 commit comments

Comments
 (0)