简体   繁体   English

ElasticSearch 5.0 + Rails

[英]ElasticSearch 5.0 + Rails

Installed a fresh ElasticSearch 5.0 today and changed my Rails configuration to point to ES 5. 今天安装了新的ElasticSearch 5.0,并将我的Rails配置更改为指向ES 5。

My elasticsearch.rb configuration file looks like: 我的elasticsearch.rb配置文件如下所示:

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:

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: 我四处张望,看起来ElasticSearch 5.0具有要删除的新API,但是我不确定这是否是导致我的问题的根本原因:

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

Thanks in advance! 提前致谢!

According this discussion The problem is the proxy_options configuration. 根据此讨论 ,问题在于proxy_options配置。 Just ignore the transport_options . 只需忽略transport_options If you change the configuration as following it should work. 如果按照以下方式更改配置,则它应该可以工作。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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