@@ -44,128 +44,117 @@ class Client
44
44
Elasticsearch ::API ::COMMON_PARAMS . push :job_id , :datafeed_id , :filter_id , :snapshot_id , :category_id , :policy_id
45
45
46
46
module 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
65
53
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 )
68
57
end
58
+ end
69
59
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
73
63
74
- def security
75
- @security ||= xpack . security
76
- end
64
+ def security
65
+ @security ||= xpack . security
66
+ end
77
67
78
- def ml
79
- @ml ||= xpack . ml
80
- end
68
+ def ml
69
+ @ml ||= xpack . ml
70
+ end
81
71
82
- def rollup
83
- @rollup ||= xpack . rollup
84
- end
72
+ def rollup
73
+ @rollup ||= xpack . rollup
74
+ end
85
75
86
- def watcher
87
- @watcher ||= xpack . watcher
88
- end
76
+ def watcher
77
+ @watcher ||= xpack . watcher
78
+ end
89
79
90
- def graph
91
- @graph ||= xpack . graph
92
- end
80
+ def graph
81
+ @graph ||= xpack . graph
82
+ end
93
83
94
- def migration
95
- @migration ||= xpack . migration
96
- end
84
+ def migration
85
+ @migration ||= xpack . migration
86
+ end
97
87
98
- def sql
99
- @sql ||= xpack . sql
100
- end
88
+ def sql
89
+ @sql ||= xpack . sql
90
+ end
101
91
102
- def deprecation
103
- @deprecation ||= xpack . deprecation
104
- end
92
+ def deprecation
93
+ @deprecation ||= xpack . deprecation
94
+ end
105
95
106
- def data_frame
107
- @data_frame ||= xpack . data_frame
108
- end
96
+ def data_frame
97
+ @data_frame ||= xpack . data_frame
98
+ end
109
99
110
- def ilm
111
- @ilm ||= xpack . ilm
112
- end
100
+ def ilm
101
+ @ilm ||= xpack . ilm
102
+ end
113
103
114
- def license
115
- @license ||= xpack . license
116
- end
104
+ def license
105
+ @license ||= xpack . license
106
+ end
117
107
118
- def transform
119
- @transform ||= xpack . transform
120
- end
108
+ def transform
109
+ @transform ||= xpack . transform
110
+ end
121
111
122
- def async_search
123
- @async_search ||= xpack . async_search
124
- end
112
+ def async_search
113
+ @async_search ||= xpack . async_search
114
+ end
125
115
126
- def cat
127
- @cat ||= xpack . cat
128
- end
116
+ def cat
117
+ @cat ||= xpack . cat
118
+ end
129
119
130
- def indices
131
- @indices ||= xpack . indices
132
- end
120
+ def indices
121
+ @indices ||= xpack . indices
122
+ end
133
123
134
- def searchable_snapshots
135
- @searchable_snapshots ||= xpack . searchable_snapshots
136
- end
124
+ def searchable_snapshots
125
+ @searchable_snapshots ||= xpack . searchable_snapshots
126
+ end
137
127
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
141
131
142
- def autoscaling
143
- @autoscaling ||= xpack . autoscaling
144
- end
132
+ def autoscaling
133
+ @autoscaling ||= xpack . autoscaling
134
+ end
145
135
146
- def enrich
147
- @enrich ||= xpack . enrich
148
- end
136
+ def enrich
137
+ @enrich ||= xpack . enrich
138
+ end
149
139
150
- def eql
151
- @eql ||= xpack . eql
152
- end
140
+ def eql
141
+ @eql ||= xpack . eql
142
+ end
153
143
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
157
147
158
- def text_structure
159
- @text_structure ||= xpack . text_structure
160
- end
148
+ def text_structure
149
+ @text_structure ||= xpack . text_structure
150
+ end
161
151
162
- def logstash
163
- @logstash ||= xpack . logstash
164
- end
152
+ def logstash
153
+ @logstash ||= xpack . logstash
154
+ end
165
155
166
- def fleet
167
- @fleet ||= xpack . fleet
168
- end
156
+ def fleet
157
+ @fleet ||= xpack . fleet
169
158
end
170
159
end
171
- end if defined? ( Elasticsearch ::Transport :: Client )
160
+ end if defined? ( Elasticsearch ::Client )
0 commit comments