简体   繁体   中英

ElasticSearch 5.0 + Rails

Installed a fresh ElasticSearch 5.0 today and changed my Rails configuration to point to ES 5.

My elasticsearch.rb configuration file looks like:

require "faraday"
require "typhoeus/adapters/faraday"

config = {
  host: "http://xxx.xxx.xxx.yyyy:9200/",
  transport_options: {
    request: { timeout: 5 }
  },
}

if File.exists?("config/elasticsearch.yml")
  config.merge!(YAML.load_file("config/elasticsearch.yml").symbolize_keys)
end

I have the following related gems installed on the application:

gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'elasticsearch-persistence', require: 'elasticsearch/persistence/model'

When I go to start my application, I receive the message:

[400] No handler found for uri [//****] and method [DELETE] (Elasticsearch::Transport::Transport::Errors::BadRequest)

Has anyone encountered this issue before?

I looked around for a bit and it looks like ElasticSearch 5.0 has a new API for deleting, but I'm not sure if this is the root cause of my issues:

https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-delete-by-query.html

Thanks in advance!

According this discussion The problem is the proxy_options configuration. Just ignore the transport_options . If you change the configuration as following it should work.

config = {
  hosts: default_host,
  adapter: :typhoeus
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM