@@ -44,128 +44,117 @@ class Client
4444Elasticsearch ::API ::COMMON_PARAMS . push :job_id , :datafeed_id , :filter_id , :snapshot_id , :category_id , :policy_id
4545
4646module Elasticsearch
47- module Transport
48- class Client
49- # When a method is called on the client, if it's one of the xpack root
50- # namespace methods, send them to the xpack client.
51- # E.g.: client.xpack.usage => client.usage
52- # Excluding `info` since OSS and XPACK both have info endpoints.
53- TOP_LEVEL_METHODS = [
54- :open_point_in_time ,
55- :close_point_in_time ,
56- :terms_enum ,
57- :usage
58- ] . freeze
59-
60- def method_missing ( method , *args , &block )
61- return xpack . send ( method , *args , &block ) if TOP_LEVEL_METHODS . include? ( method )
62-
63- super
64- end
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 = [ :open_point_in_time , :close_point_in_time , :terms_enum , :usage ] . freeze
6553
66- def respond_to_missing? ( method_name , *args )
67- TOP_LEVEL_METHODS . include? ( method_name ) || super
54+ TOP_LEVEL_METHODS . each do |method |
55+ define_method :"#{ method } " do |value |
56+ xpack . send ( method , *[ value ] )
6857 end
58+ end
6959
70- def xpack
71- @xpack ||= Elasticsearch ::XPack ::API ::Client . new ( self )
72- end
60+ def xpack
61+ @xpack ||= Elasticsearch ::XPack ::API ::Client . new ( self )
62+ end
7363
74- def security
75- @security ||= xpack . security
76- end
64+ def security
65+ @security ||= xpack . security
66+ end
7767
78- def ml
79- @ml ||= xpack . ml
80- end
68+ def ml
69+ @ml ||= xpack . ml
70+ end
8171
82- def rollup
83- @rollup ||= xpack . rollup
84- end
72+ def rollup
73+ @rollup ||= xpack . rollup
74+ end
8575
86- def watcher
87- @watcher ||= xpack . watcher
88- end
76+ def watcher
77+ @watcher ||= xpack . watcher
78+ end
8979
90- def graph
91- @graph ||= xpack . graph
92- end
80+ def graph
81+ @graph ||= xpack . graph
82+ end
9383
94- def migration
95- @migration ||= xpack . migration
96- end
84+ def migration
85+ @migration ||= xpack . migration
86+ end
9787
98- def sql
99- @sql ||= xpack . sql
100- end
88+ def sql
89+ @sql ||= xpack . sql
90+ end
10191
102- def deprecation
103- @deprecation ||= xpack . deprecation
104- end
92+ def deprecation
93+ @deprecation ||= xpack . deprecation
94+ end
10595
106- def data_frame
107- @data_frame ||= xpack . data_frame
108- end
96+ def data_frame
97+ @data_frame ||= xpack . data_frame
98+ end
10999
110- def ilm
111- @ilm ||= xpack . ilm
112- end
100+ def ilm
101+ @ilm ||= xpack . ilm
102+ end
113103
114- def license
115- @license ||= xpack . license
116- end
104+ def license
105+ @license ||= xpack . license
106+ end
117107
118- def transform
119- @transform ||= xpack . transform
120- end
108+ def transform
109+ @transform ||= xpack . transform
110+ end
121111
122- def async_search
123- @async_search ||= xpack . async_search
124- end
112+ def async_search
113+ @async_search ||= xpack . async_search
114+ end
125115
126- def cat
127- @cat ||= xpack . cat
128- end
116+ def cat
117+ @cat ||= xpack . cat
118+ end
129119
130- def indices
131- @indices ||= xpack . indices
132- end
120+ def indices
121+ @indices ||= xpack . indices
122+ end
133123
134- def searchable_snapshots
135- @searchable_snapshots ||= xpack . searchable_snapshots
136- end
124+ def searchable_snapshots
125+ @searchable_snapshots ||= xpack . searchable_snapshots
126+ end
137127
138- def cross_cluster_replication
139- @cross_cluster_replication ||= xpack . cross_cluster_replication
140- end
128+ def cross_cluster_replication
129+ @cross_cluster_replication ||= xpack . cross_cluster_replication
130+ end
141131
142- def autoscaling
143- @autoscaling ||= xpack . autoscaling
144- end
132+ def autoscaling
133+ @autoscaling ||= xpack . autoscaling
134+ end
145135
146- def enrich
147- @enrich ||= xpack . enrich
148- end
136+ def enrich
137+ @enrich ||= xpack . enrich
138+ end
149139
150- def eql
151- @eql ||= xpack . eql
152- end
140+ def eql
141+ @eql ||= xpack . eql
142+ end
153143
154- def snapshot_lifecycle_management
155- @snapshot_lifecycle_management ||= xpack . snapshot_lifecycle_management
156- end
144+ def snapshot_lifecycle_management
145+ @snapshot_lifecycle_management ||= xpack . snapshot_lifecycle_management
146+ end
157147
158- def text_structure
159- @text_structure ||= xpack . text_structure
160- end
148+ def text_structure
149+ @text_structure ||= xpack . text_structure
150+ end
161151
162- def logstash
163- @logstash ||= xpack . logstash
164- end
152+ def logstash
153+ @logstash ||= xpack . logstash
154+ end
165155
166- def fleet
167- @fleet ||= xpack . fleet
168- end
156+ def fleet
157+ @fleet ||= xpack . fleet
169158 end
170159 end
171- end if defined? ( Elasticsearch ::Transport :: Client )
160+ end if defined? ( Elasticsearch ::Client )
0 commit comments