NoMethodError (undefined method `highlight' for #<Elasticsearch::Model::Response::Result> NoMethodError (undefined method `highlight' for #<Elasticsearch::Model::Response::Result> elasticsearch elasticsearch

NoMethodError (undefined method `highlight' for #<Elasticsearch::Model::Response::Result>


Maybe is a silly observation, but did you tried to change the value

:highlight to :_highlight ?

class ElasticsearchResultsSerializer < ActiveModel::Serializer  attributes :_id, :_highlight, :_score, :_source  def _source    @article = object._index.singularize.capitalize.constantize.find(object._id)    @serializer = "#{object._index.singularize.capitalize}Serializer".constantize    @serializer.new(@article)  endend


I would try switching fields to:

fields: {  :"*" => {}}

Just to see if that gets rid of the error. See the following: https://github.com/elastic/elasticsearch-rails/issues/446