File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed
elasticsearch-xpack/lib/elasticsearch Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,26 @@ class Client
45
45
module Elasticsearch
46
46
module Transport
47
47
class Client
48
+ # When a method is called on the client, if it's one of the xpack root
49
+ # namespace methods, send them to the xpack client.
50
+ # E.g.: client.xpack.usage => client.usage
51
+ # Excluding `info` since OSS and XPACK both have info endpoints.
52
+ TOP_LEVEL_METHODS = [
53
+ :open_point_in_time ,
54
+ :close_point_in_time ,
55
+ :usage
56
+ ] . freeze
57
+
58
+ def method_missing ( method , *args , &block )
59
+ return xpack . send ( method , *args , &block ) if TOP_LEVEL_METHODS . include? ( method )
60
+
61
+ super
62
+ end
63
+
64
+ def respond_to_missing? ( method_name , *args )
65
+ TOP_LEVEL_METHODS . include? ( method_name ) || super
66
+ end
67
+
48
68
def xpack
49
69
@xpack_client ||= Elasticsearch ::XPack ::API ::Client . new ( self )
50
70
end
@@ -132,14 +152,6 @@ def eql
132
152
def snapshot_lifecycle_management
133
153
@snapshot_lifecycle_management ||= xpack . snapshot_lifecycle_management
134
154
end
135
-
136
- def open_point_in_time ( arguments = { } )
137
- xpack . open_point_in_time ( arguments )
138
- end
139
-
140
- def close_point_in_time ( arguments = { } )
141
- xpack . close_point_in_time ( arguments )
142
- end
143
155
end
144
156
end
145
157
end if defined? ( Elasticsearch ::Transport ::Client )
You can’t perform that action at this time.
0 commit comments