We can read into the elasticsearch-ruby CHANGELOG (Vewsion 7.7.0) That we have New API Endpoints availables. Transforms included. Here they are.
We are using elasticsearch-ruby 7.15.0. But don't know how to use it.
Here is my example...
require 'elasticsearch'
elasticsearch = Elasticsearch::Client.new(
cloud_id: '******',
user: '******',
password: '******',
log: false
)
elasticsearch.transform.stop_transform transform_id: 'my_transform'
But we get an error...
/usr/local/rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/elasticsearch-7.15.0/lib/elasticsearch.rb:43:in `method_missing': undefined method `transform' for #<Elasticsearch::Client:0x0000556a2ad72bb8> (NoMethodError)
The code it's inside the folder /lib/elasticsearch/api/actions. Just as indices.
We can use indices like that...
if elasticsearch.indices.exists? index: 'mi_index'
<do what ever we want>
end
We can't find nothing into de doc. https://rubydoc.info/gems/elasticsearch-api/Elasticsearch/API
So, how can we use the transform endopints?
CodePudding user response:
The elasticsearch-xpack gem was deprecated and its endpoints (like those under the transform namespace) were merged into elasticsearch-api, but only for main and the 8.x version. In 7.x versions of the client, you still need to install and require the elasticsearch-xpack gem. You can see the code here for 7.15.
So you need to do something like:
require 'elasticsearch'
require 'elasticsearch/xpack'
client = Elasticsearch::Client.new
client.transform.stop_transform(transform_id: 'my_transform' )