elasticsearch-ruby: The client noticed that the server is not a supported distribution of Elasticsearch.

Here is the version of our ElasticSearch server. We are using AWS Elasticsearch Service.

#<Elasticsearch::Transport::Transport::Response:0x00007ff8a437a880
 @body=
  {"name"=>"69ada12c4d38682ccca6b0ed1bc1985a",
   "cluster_name"=>"492823447739:affluentkb",
   "cluster_uuid"=>"fh03uiS9QyC1XxyA8wgtIQ",
   "version"=>
    {"number"=>"7.9.1",
     "build_flavor"=>"oss",
     "build_type"=>"tar",
     "build_hash"=>"unknown",
     "build_date"=>"2021-05-21T20:16:39.863972Z",
     "build_snapshot"=>false,
     "lucene_version"=>"8.6.2",
     "minimum_wire_compatibility_version"=>"6.8.0",
     "minimum_index_compatibility_version"=>"6.0.0-beta1"},
   "tagline"=>"You Know, for Search"},
 @headers=
  {"date"=>"Thu, 12 Aug 2021 08:48:46 GMT",
   "content-type"=>"application/json; charset=UTF-8",
   "transfer-encoding"=>"chunked",
   "connection"=>"keep-alive",
   "access-control-allow-origin"=>"*",
   "vary"=>"Accept-Encoding, User-Agent"},
 @status=200>

When upgrading to elasticsearch v7.14, we are having this issue: /usr/local/bundle/gems/elasticsearch-7.14.0/lib/elasticsearch.rb:85:in verify_with_version_or_header’: The client noticed that the server is not a supported distribution of Elasticsearch. (Elasticsearch::UnsupportedProductError)`

Everything is working well with these version of gems:

elasticsearch (7.13.1)
elasticsearch-api (= 7.13.1)
elasticsearch-transport (= 7.13.1)
elasticsearch-dsl (0.1.10)
elasticsearch-model (7.1.1)
elasticsearch (> 1)
elasticsearch-rails (7.1.1)

But with the new version, we got the exception above:

elasticsearch (7.14.0)
elasticsearch-api (= 7.14.0)
elasticsearch-transport (= 7.14.0)
elasticsearch-dsl (0.1.10)
elasticsearch-model (7.2.0)
elasticsearch (~> 7)
elasticsearch-rails (7.2.0)

Is this something on our side?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

With the 7.11 release of Elasticsearch, we will no longer be releasing oss-only distributions, as stated in the FAQ on license change. The recommendation is to upgrade to the latest default distribution of Elasticsearch, which is free to use under Elastic License v2. Otherwise, you can pin the client version to <7.14.

I would definitely recommend abiding by the terms of the elastic license. However, if you are abiding by the terms of the license and the client is being grumpy with you, you can do this after loading the gem but before connecting to your client (say, in an initializer in Rails):

module Elasticsearch
  class Client
    def verify_with_version_or_header(body, version, headers)
      @verified = true
    end
  end
end

Basically, you’re just patching out this check.

We get the same error.

We’re using Bonsai to host our Elasticsearch, and they seem to have the oss as build_flavor.

OK. I see. Those changes makes sense from a business perspective. 👍

We’re hosting on Heroku, and I would actually love to switch to the “real” Elastic-hosted version (https://elements.heroku.com/addons/foundelasticsearch).

I guess this would fix it for us.

But I’m really missing a “free tier” that we could run on our staging environment. Do you know if this would be possible? @picandocodigo

Thank you; yes, I’m aware of the advantages of using a supported server, and don’t expect any support whatsoever for this configuration, or talking to unsupported servers. I would be surprised if anyone expects that.

FWIW, this came up for me because I’ve installed Elasticsearch via homebrew on my development computer. Yes, I know from this thread that I can pin the client to > 7.14. It is a little bit 🙃 that I needed to find a thread on github to learn that, or any way to get the Elasticsearch client to connect to my development Elasticsearch server.

It would be a very nice feature if the client would replace this error with a loud warning that it’s connecting to an unsupported server and that very bad things may happen and not to expect any support, or provide a connection flag to let it communicate with servers that may or may not be API-compatible with the official Elasticsearch distributions. I also suspect that these suggestions have been raised internally and rejected for various reasons, and that any PRs to do similar things would be rejected. Let me know if that is incorrect.

A better patch than the one above would be more like (this is untested) — it does warn you about connecting in an unsupported configuration. (Yes, if I were doing this for real I would refactor @verified to not be called that, and probably also tell you why it thinks the connection is unsupported.)

module Elasticsearch
  class Client    
    # Turn connecting to an unsupported server from an error to a warning
    def method_missing(name, *args, &block)
      if name == :perform_request
        begin
          verify_elasticsearch unless @verified
        rescue Elasticsearch::NotElasticsearchError => e
          Warning.warn e.message
          Warning.warn "Use at your own risk!"
          Warning.warn "For a supported configuration, connect to an official Elasticsearch distribution."
          @verified = true  # Suppress future warnings
        end
        @transport.perform_request(*args, &block)
      else
        super
      end
    end
  end
end

is there any fix for this? I’m using the latest version available on aws 7.10, also using latest ruby gem version and still getting this error.

Still waiting for fix as well…

@anderslemke Bonsai has a whole warning page for that Here