Skip to content

Commit 682b4cd

Browse files
committed
[XPACK] Update methods: when body is required, always use POST
1 parent cec4de7 commit 682b4cd

File tree

3 files changed

+10
-25
lines changed

3 files changed

+10
-25
lines changed

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/eql/search.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,8 @@ def search(arguments = {})
4242

4343
_index = arguments.delete(:index)
4444

45-
method = if arguments[:body]
46-
Elasticsearch::API::HTTP_POST
47-
else
48-
Elasticsearch::API::HTTP_GET
49-
end
50-
51-
path = "#{Elasticsearch::API::Utils.__listify(_index)}/_eql/search"
45+
method = Elasticsearch::API::HTTP_POST
46+
path = "#{Elasticsearch::API::Utils.__listify(_index)}/_eql/search"
5247
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
5348

5449
body = arguments[:body]

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/rollup/rollup_search.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,12 @@ def rollup_search(arguments = {})
4848

4949
_type = arguments.delete(:type)
5050

51-
method = if arguments[:body]
52-
Elasticsearch::API::HTTP_POST
51+
method = Elasticsearch::API::HTTP_POST
52+
path = if _index && _type
53+
"#{Elasticsearch::API::Utils.__listify(_index)}/#{Elasticsearch::API::Utils.__listify(_type)}/_rollup_search"
5354
else
54-
Elasticsearch::API::HTTP_GET
55+
"#{Elasticsearch::API::Utils.__listify(_index)}/_rollup_search"
5556
end
56-
57-
path = if _index && _type
58-
"#{Elasticsearch::API::Utils.__listify(_index)}/#{Elasticsearch::API::Utils.__listify(_type)}/_rollup_search"
59-
else
60-
"#{Elasticsearch::API::Utils.__listify(_index)}/_rollup_search"
61-
end
6257
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
6358

6459
body = arguments[:body]

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/security/has_privileges.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,12 @@ def has_privileges(arguments = {})
3737

3838
_user = arguments.delete(:user)
3939

40-
method = if arguments[:body]
41-
Elasticsearch::API::HTTP_POST
40+
method = Elasticsearch::API::HTTP_POST
41+
path = if _user
42+
"_security/user/#{Elasticsearch::API::Utils.__listify(_user)}/_has_privileges"
4243
else
43-
Elasticsearch::API::HTTP_GET
44+
"_security/user/_has_privileges"
4445
end
45-
46-
path = if _user
47-
"_security/user/#{Elasticsearch::API::Utils.__listify(_user)}/_has_privileges"
48-
else
49-
"_security/user/_has_privileges"
50-
end
5146
params = {}
5247

5348
body = arguments[:body]

0 commit comments

Comments
 (0)