Ask A Question


You’re not receiving notifications from this thread.

ElasticSearch 400 error.

Sillico asked in Rails


I am pretty new to Rails and recently signed up to try to get some more exposure. I have been playing around with Elastic Search, but am having a hard time implementing some of the more advanced features. I watched the episode on GoRails, but when I try to boot up the server from the GoRails repo, I constantly get 400 errors. I tried searching my project directory for "fields" an found one result that I replace with stored_fields. Then I tried commenting out that function. However, nothing changes. What am I missing / doing wrong?

Searchkick::InvalidQueryError in QuestionsController#index
[400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":127}],"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":127},"status":400}

 def index
    query = params[:q].presence || "*"
    @questions =, suggest: true) # The highlighted line from the error page on rails server

  # GET /questions/1

I believe this is an error is relating to a version of elasticsearch and Searchkick.

Can you check what version of elasticsearch you're running and what version of the searchkick gem you have in you Gemfile/Gemfile.lock?


I actually ended up watching the video and using parts of the video with what I had already built out to get the desired result. Great tutorial though!


I'm actually seeing the same error in a controller spec. Searchkick v. 1.3.2, elasticsearch v. 2.0.0. Rails 4.2.6 & Ruby 2.2.2. I didn't set up this searchkick so I've been googling around for suggestions on the issue and this is one of few instances of the same error.

Edit: Figured it out! Elasticsearch 5+ (not the gem) renames fields to stored_fields, and searchkick doesn't support that in 1.3.2. I updated searchkick and it's all fine.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,969+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.