0

My Model:

class Package < ActiveRecord::Base
  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks
end

When I ask if the index exists, I get true:

Package.__elasticsearch__.client.indices.exists(index: "packages")
=> true

But when I do:

Package.__elasticsearch__.client.indices.get(index: "packages")

I get this error:

Elasticsearch::Transport::Transport::Errors::BadRequest: [400] No handler found for uri [/packages] and method [GET]

I already have some documents indexed, and I can do a search, so what's wrong with the line above?

ps: here's the doc: http://www.rubydoc.info/gems/elasticsearch-api/Elasticsearch/API/Indices/Actions

BMW
  • 42,880
  • 12
  • 99
  • 116
Robin
  • 21,667
  • 10
  • 62
  • 85

1 Answers1

1

It might be the way you've configured your elasticsearch client in your initializer. If you're using the typhoeus adapter, see this discussion: https://github.com/elasticsearch/elasticsearch-rails/issues/316

Something that might also be helpful is debugging how things are actually indexed / mapped via their marvel plugin http://localhost:9200/_plugin/marvel/sense/index.html?

GET _cat/indices GET packages/_mapping

daino3
  • 4,386
  • 37
  • 48
  • I got it... just checked the client: `Mission.__elasticsearch__.client`. And I see hosts like `...4238643.us-east-1.bonsai.io`! So it means by default it uses their remove service bonsai.io! Thanks – Robin Mar 09 '15 at 13:11
  • It's not actually by default btw, I had an initializer that was setting the new host... – Robin Mar 09 '15 at 14:54