TypeError: _doc.index is not a function
File "/app/node_modules/mongoosastic/lib/mongoosastic.js", line 260, col 14, in model.Query.postSave
_doc.index(onIndex)
File "/app/node_modules/kareem/index.js", line 186, col 14, in next
post.apply(context, newArgs);
File "/app/node_modules/kareem/index.js", line 197, col 3, in Kareem.execPost
next();
File "/app/node_modules/kareem/index.js", line 265, col 15, in null.<anonymous>
_this.execPost(name, context, argsWithoutError, function() {
File "/app/node_modules/mongoose/lib/query.js", line 2269, col 10, in _completeOneLean
return callback(null, doc);
File "/app/node_modules/mongoose/lib/query.js", line 2222, col 16, in null.<anonymous>
return _completeOneLean(doc, res, opts, callback);
File "/app/node_modules/mongoose/lib/model.js", line 3835, col 16, in null.<anonymous>
callback.apply(null, arguments);
File "/app/node_modules/mongoose/lib/model.js", line 3007, col 5, in next
callback(null, docs);
File "/app/node_modules/mongoose/lib/model.js", line 3112, col 12, in populate
return callback();
File "/app/node_modules/mongoose/lib/model.js", line 2997, col 5, in _populate
populate(model, docs, path, next);
File "/app/node_modules/mongoose/lib/model.js", line 2957, col 5, in Function.Model.populate
_populate(this, docs, paths, cache, callback);
File "/app/node_modules/mongoose/lib/query.js", line 2216, col 17, in cb
_this.model.populate(doc, pop, function(err, doc) {
File "/app/node_modules/mongoose/lib/query.js", line 2237, col 16, in null.<anonymous>
return cb(error, res ? res.value : res, res);
File "/app/node_modules/mongoose/lib/utils.js", line 526, col 16, in null.<anonymous>
callback.apply(this, arguments);
File "/app/node_modules/mongodb/lib/utils.js", line 120, col 56, in handleCallback
return value2 ? callback(err, value1, value2) : callback(err, value1);
File "/app/node_modules/mongodb/lib/collection.js", line 2494, col 14, in null.<anonymous>
return handleCallback(callback, null, result);
File "/app/node_modules/mongodb/lib/utils.js", line 120, col 56, in handleCallback
return value2 ? callback(err, value1, value2) : callback(err, value1);
File "/app/node_modules/mongodb/lib/db.js", line 315, col 5, in null.<anonymous>
handleCallback(callback, null, result.result);
File "/app/node_modules/mongodb-core/lib/connection/pool.js", line 469, col 18, in null.<anonymous>
return cb(err, result);
File "/app/node_modules/opbeat/lib/instrumentation/index.js", line 105, col 27, in opbeatCallbackWrapper
var result = original.apply(this, arguments)
File "internal/process/next_tick.js", line 131, col 7, in _combinedTickCallback
File "internal/process/next_tick.js", line 218, col 9, in process._tickDomainCallback [as _tickCallback]
We export our models which already have the mongoosastic plugin mounted but for some reason the index
method is undefined in the postSave