@@ -22,37 +22,40 @@ module Elasticsearch
2222  module  API 
2323    module  Inference 
2424      module  Actions 
25-         # Configure an  inference endpoint that uses the Elastic Inference Service (EIS)  
25+         # Perform  inference 
2626        # 
27+         # @option arguments [String] :inference_id The inference Id 
2728        # @option arguments [String] :task_type The task type 
28-         # @option arguments [String] :eis_inference_id The inference ID 
2929        # @option arguments [Hash] :headers Custom HTTP headers 
30-         # @option arguments [Hash] :body The inference endpoint's task and service settings  
30+         # @option arguments [Hash] :body The inference payload  
3131        # 
32-         # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.17/infer-service-elastic .html 
32+         # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.17/post-inference-api .html 
3333        # 
34-         def  put_eis ( arguments  =  { } ) 
35-           request_opts  =  {  endpoint : arguments [ :endpoint ]  || 'inference.put_eis '  } 
34+         def  inference ( arguments  =  { } ) 
35+           request_opts  =  {  endpoint : arguments [ :endpoint ]  || 'inference.inference '  } 
3636
37-           defined_params  =  %i[ task_type   eis_inference_id ] . each_with_object ( { } )  do  |variable ,  set_variables |
37+           defined_params  =  %i[ inference_id   task_type ] . each_with_object ( { } )  do  |variable ,  set_variables |
3838            set_variables [ variable ]  =  arguments [ variable ]  if  arguments . key? ( variable ) 
3939          end 
4040          request_opts [ :defined_params ]  =  defined_params  unless  defined_params . empty? 
4141
42-           raise  ArgumentError ,  "Required argument 'task_type' missing"  unless  arguments [ :task_type ] 
43-           raise  ArgumentError ,  "Required argument 'eis_inference_id' missing"  unless  arguments [ :eis_inference_id ] 
42+           raise  ArgumentError ,  "Required argument 'inference_id' missing"  unless  arguments [ :inference_id ] 
4443
4544          arguments  =  arguments . clone 
4645          headers  =  arguments . delete ( :headers )  || { } 
4746
4847          body  =  arguments . delete ( :body ) 
4948
50-           _task_type  =  arguments . delete ( :task_type  ) 
49+           _inference_id  =  arguments . delete ( :inference_id  ) 
5150
52-           _eis_inference_id  =  arguments . delete ( :eis_inference_id  ) 
51+           _task_type  =  arguments . delete ( :task_type  ) 
5352
54-           method  =  Elasticsearch ::API ::HTTP_PUT 
55-           path    =  "_inference/#{ Utils . __listify ( _task_type ) }  /#{ Utils . __listify ( _eis_inference_id ) }  " 
53+           method  =  Elasticsearch ::API ::HTTP_POST 
54+           path    =  if  _task_type  && _inference_id 
55+                      "_inference/#{ Utils . __listify ( _task_type ) }  /#{ Utils . __listify ( _inference_id ) }  " 
56+                    else 
57+                      "_inference/#{ Utils . __listify ( _inference_id ) }  " 
58+                    end 
5659          params  =  { } 
5760
5861          Elasticsearch ::API ::Response . new ( 
0 commit comments