2

I am following this article to implement full text search using Elasticsearch in my Rails application but I am getting this error

/.rvm/gems/ruby-2.1.5/gems/rack-1.6.1/lib/rack/builder.rb:49: stack level too deep (SystemStackError)

app/models/article.rb: 
   require 'elasticsearch/model' 
     class Article < ActiveRecord::Base 
      include Elasticsearch::Model 
      include Elasticsearch::Model::Callbacks 
     end 
    Article.import # for auto sync model with elastic search

Whenever, I write Article.import in my article.rb model.

halfer
  • 19,824
  • 17
  • 99
  • 186
awsm sid
  • 81
  • 1
  • 10
  • 1
    replace your link with minimal reproducable example so that we can actually see what's going on. – Abhinav Gauniyal Jun 09 '15 at 05:43
  • app/models/article.rb: require 'elasticsearch/model' class Article < ActiveRecord::Base include Elasticsearch::Model include Elasticsearch::Model::Callbacks end Article.import # for auto sync model with elastic search – awsm sid Jun 09 '15 at 06:01
  • @awsmsid please update your question with the information you provided in the comments – usmanali Jun 09 '15 at 06:42
  • Also the error you are getting is probably due to infinite recursion, please paste your indexes in the question as well – usmanali Jun 09 '15 at 06:43

1 Answers1

0

Try define method to_indexed_json, which tell ES how your JSON serialisation model is.

take a look at this question, elasticsearch mapping and to_indexed_json , of which the answer clarify what mapping and indexed_json are.

Community
  • 1
  • 1
fengd
  • 7,551
  • 3
  • 41
  • 44
  • can anyone tell me how to implement autocomplete word suggestion in my rails app. i am using 'tire' gem as in railscasts episode 307. – awsm sid Jun 09 '15 at 12:21