简体   繁体   中英

Mongoosastic - indexing ObjectId into elastic search

I would like to index my mongoDB objectID when indexing to Elastic Search

Like this :

_id : {type: mongoose.Schema.Types.ObjectId, es_indexed:true},
parentItem : {type: mongoose.Schema.Types.ObjectId, Ref:'SystemItem', es_indexed:true }

This produce undefined when mongoosastic is importing my db into elastic search

There is a way to do this? Or should I go other way?

The _id is not within _source object with all other fields returned by Elasticsearch , but inside the parent hit object. There is no need to specify _id in the model definition, as it's included in the model by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM