richardwilly98 / elasticsearch-river-mongodb

MongoDB River Plugin for ElasticSearch
1.12k stars 215 forks source link

_parent mapping #567

Open scne opened 8 years ago

scne commented 8 years ago

Hi everybody,

I've 3 collections in my database under mongo: shows - venues - dropdowns

shows are mapped like below {"shows": { "properties" : { "description": { "type": "string" }, "image": { "type": "string" }, "site": { "type": "string" }, "title" : { "type" : "multi_field", "fields" : { "title" : {"type" : "string", "index" : "analyzed"}, "raw_title" : {"type" : "string", "index" : "not_analyzed", "store": "no"} } } } }

venues like this

{ "venues": { "properties" : { "name" : { "type" : "multi_field", "fields" : { "name" : {"type" : "string", "index" : "analyzed"}, "raw_name" : {"type" : "string", "index" : "not_analyzed", "store": "no"} } }, "city" : { "type" : "multi_field", "fields" : { "city" : {"type" : "string", "index" : "analyzed"}, "raw_city" : {"type" : "string", "index" : "not_analyzed", "store": "no"} } }, "region" : { "type" : "multi_field", "fields" : { "region" : {"type" : "string", "index" : "analyzed"}, "raw_region" : {"type" : "string", "index" : "not_analyzed", "store": "no"} } }, "state" : { "type": "boolean" } } } }

and I've this model in mongo for dropdowns:

{ created: { type: Date, default: Date.now }, analytics: { type: String, default: '', trim: true }, state: { type: Boolean, default: false, index: true }, show: [{ type: Schema.ObjectId, ref: 'Show' }], venues:[{ venue:{ type: Schema.ObjectId, ref: 'Venue', index: true }, site: { type: String, trim: true, index: true } }] }

I'd map dropdowns with parent/child schema into my index, but I can't understand if is possibile with ObjectId because I've tried with this mapping:

"dropdowns": { "properties" : { "state": { "type": "boolean" }, "analytics": { "type": "string" }, "show": { "_parent":{ "type" : "shows" } }, "venues" : { "properties" : { "venue" : { "_parent": { "type" : "venues" } } }, "site" : {"type" : "string"} } } }

but I received this error "MapperParsingException[No type specified for property [show]]"

There is anyway to setting up correctly my index?