Elasticsearch :: Transport :: Transport :: Errors :: NotAcceptable:[406] {" error":" Content-Type header []不受支持"," status&# 34;:406}

时间:2018-04-11 06:06:37

标签: ruby-on-rails elasticsearch

我试图让项目运行,但使用弹性搜索的任何内容都会因此错误而崩溃:

Elasticsearch::Transport::Transport::Errors::NotAcceptable: [406] {"error":"Content-Type header [] is not supported","status":406}
/Users/bob/.rvm/gems/ruby-2.4.3/gems/elasticsearch-transport-2.0.0/lib/elasticsearch/transport/transport/base.rb:201:in `__raise_transport_error'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/elasticsearch-transport-2.0.0/lib/elasticsearch/transport/transport/base.rb:312:in `perform_request'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/elasticsearch-transport-2.0.0/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/elasticsearch-transport-2.0.0/lib/elasticsearch/transport/client.rb:128:in `perform_request'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/elasticsearch-api-2.0.0/lib/elasticsearch/api/namespace/common.rb:21:in `perform_request'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/elasticsearch-api-2.0.0/lib/elasticsearch/api/actions/indices/create.rb:84:in `create'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/searchkick-1.4.0/lib/searchkick/index.rb:13:in `create'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/searchkick-1.4.0/lib/searchkick/index.rb:147:in `create_index'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/searchkick-1.4.0/lib/searchkick/index.rb:198:in `reindex_scope'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/searchkick-1.4.0/lib/searchkick/model.rb:53:in `searchkick_reindex'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/searchkick-1.4.0/lib/searchkick/tasks.rb:26:in `block (4 levels) in <top (required)>'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/searchkick-1.4.0/lib/searchkick/tasks.rb:24:in `each'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/searchkick-1.4.0/lib/searchkick/tasks.rb:24:in `block (3 levels) in <top (required)>'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/bugsnag-6.2.0/lib/bugsnag/integrations/rake.rb:16:in `execute_with_bugsnag'
/Users/bob/.rvm/gems/ruby-2.4.3/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/Users/bob/.rvm/gems/ruby-2.4.3/bin/ruby_executable_hooks:15:in `eval'
/Users/bob/.rvm/gems/ruby-2.4.3/bin/ruby_executable_hooks:15:in `<main>'

我不知道发生了什么。我已通过brew install elasticsearch@2.4安装并由brew services start elasticsearch@2.4

运行

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我最终到了那里。对于有此问题的其他人:

您可能需要特定版本的elasticsearch(我需要2.4):

  • key = b'Sixteen byte key' data = 'Jeevan B Manoj'.encode("UTF-8") data = pad(data,16) cipher = AES.new(key, AES.MODE_CBC) print("data before encryption") print(data) ciphertext = cipher.encrypt(data) cipher = AES.new(key, AES.MODE_CBC) plaintext = cipher.decrypt(ciphertext) print(plaintext)
  • brew uninstall elasticsearch
  • brew install elasticsearch@2.4 #OSX specific
  • pkill -f elasticsearch#你可能需要等几分钟
  • brew services start elasticsearch@2.4 #this测试弹性搜索是否正常运行