hibiken / stories

Medium clone built with Ruby on Rails
https://my-medium-clone.herokuapp.com/
MIT License
826 stars 270 forks source link

Search not working #53

Closed yogeshmanjhi1993 closed 6 years ago

yogeshmanjhi1993 commented 7 years ago

Hi Kenny, I followed all the installarion instructions and got the project working every thing works fine except the search when i tried searching for post description I am getting this error Elasticsearch::Transport::Transport::Errors::BadRequest at /search [400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"no [query] registered for [filtered]","line":1,"col":22}],"type":"parsing_exception","reason":"no [query] registered for [filtered]","line":1,"col":22},"status":400}

Any idea how can i resolve this.Tried to solve it the entire day but could not solve it.Please help me to get the search functionality working.

yogeshmanjhi1993 commented 7 years ago

@AjayBarot Can you please help me out i am not able to get the search functionality working.Any suggestions or ideas will be great help.Thanks

dacochan commented 7 years ago

Plese check your version elasticsearch, this app using ElasticSearch 1.7.3, if u are using version 5.6.2, update your gem to

gem 'elasticsearch', '~> 5.0', '>= 5.0.4'
gem 'elasticsearch-rails', '~> 5.0', '>= 5.0.1'
gem 'elasticsearch-model', '~> 5.0', '>= 5.0.1'

and your model/concerns/searchable_user.rb change filtered: to bool:and query: to must: and then rake elasticsearch:reindex

yogeshmanjhi1993 commented 6 years ago

@dacochan thanks that helped :+1: