Monday 12 June 2017

How to define a schema while using Elastic search with geo_near

I am new in Elastic search.I define a mongoose schema in node.js where I add a field 'location' to store the longitude and latitude value like-

location: { "type": "geo_point" }

and Mongoosastic plugin

schema.plugin(mongoosastic, {
  hosts: [
    'localhost:9200'
  ]
});

While I adding location: { "type": "geo_point" } this line i get an error

throw new TypeError('Undefined type ' + name + ' at `' + path + ^

TypeError: Undefined type Geo_point at location Did you try nesting Schemas? You can only nest using refs or arrays.

How to fix the error and solve the problem.



via Santu Nandi

No comments:

Post a Comment