Rails4 production elasticsearch error - failed to find geo_point, but works in Development Rails4 production elasticsearch error - failed to find geo_point, but works in Development elasticsearch elasticsearch

Rails4 production elasticsearch error - failed to find geo_point, but works in Development


i solved the above error and let me share how.

i think there was some reason because of the versions of Elasticsearch on my dev and prod.

========on dev==========Loading development environment (Rails 4.2.6)2.2.4 :001 > Elasticsearch::Model.client.info => {"name"=>"Sunpyre", "cluster_name"=>"elasticsearch", "version"=>{"number"=>"2.3.5", "build_hash"=>"90f433701e64ccd01edbb4", "build_timestamp"=>"2016-07-27T10:36:52Z", "build_snapshot"=>false, "lucene_version"=>"5.5.0"}, "tagline"=>"You Know, for Search"} 2.2.4 :002 > =======on prod=========Loading production environment (Rails 4.2.6)2.2.0 :001 > Elasticsearch::Model.client.info => {"name"=>"Production Node", "cluster_name"=>"elasticsearch", "cluster_uuid"=>"NCPUn7V084cpIA", "version"=>{"number"=>"2.4.6", "build_hash"=>"5376dca9f70f3abe0ace8240fd", "build_timestamp"=>"2017-07-18T12:17:44Z", "build_snapshot"=>false, "lucene_version"=>"5.5.4"}, "tagline"=>"You Know, for Search"} 2.2.0 :002 > 

So the mappings like the below worked in dev but not on prod.

====working on dev but not on prod=====

searchkick word_start: [:name, :slug],             word_middle: [:name, :slug],             text_start: [:name, :slug],             locations: ["location"]

But when i added explicit mappings, it worked on prod..also on dev(needless to say)

searchkick merge_mappings: true,   mappings: {hall:       {properties:         {          locations:           {            type:"geo_point"          }        }      }  },  locations: ["location"],  word_start: [:name, :slug],  word_middle: [:name, :slug],  text_start: [:name, :slug]  mapping do    indexes :location, type: 'geo_point'  end

I think all the custom mappings was the thing needed on the 2.4 version which is not visible on ChangeLog.

Hope this helps someone.