File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/transform Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -22,20 +22,30 @@ module Transform
22
22
module Actions
23
23
# Previews a transform.
24
24
#
25
+ # @option arguments [String] :transform_id The id of the transform to preview.
25
26
# @option arguments [Hash] :headers Custom HTTP headers
26
- # @option arguments [Hash] :body The definition for the transform to preview (*Required*)
27
+ # @option arguments [Hash] :body The definition for the transform to preview
27
28
#
28
29
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/preview-transform.html
29
30
#
30
31
def preview_transform ( arguments = { } )
31
- raise ArgumentError , "Required argument 'body' missing" unless arguments [ :body ]
32
-
33
32
headers = arguments . delete ( :headers ) || { }
34
33
35
34
arguments = arguments . clone
36
35
37
- method = Elasticsearch ::API ::HTTP_POST
38
- path = "_transform/_preview"
36
+ _transform_id = arguments . delete ( :transform_id )
37
+
38
+ method = if arguments [ :body ]
39
+ Elasticsearch ::API ::HTTP_POST
40
+ else
41
+ Elasticsearch ::API ::HTTP_GET
42
+ end
43
+
44
+ path = if _transform_id
45
+ "_transform/#{ Elasticsearch ::API ::Utils . __listify ( _transform_id ) } /_preview"
46
+ else
47
+ "_transform/_preview"
48
+ end
39
49
params = { }
40
50
41
51
body = arguments [ :body ]
You can’t perform that action at this time.
0 commit comments