mongoosastic

How to stop duplication on instant search? jquery + AJAX + mongoosastic

流过昼夜 提交于 2020-01-25 11:52:14
问题 Currently The instant search that I'm using is working perfectly but , there is only one problem. Whenever I type "Chemical", it will show the query for Chemical Engineer Chemical Entrepreneur Checmical People But let say I decided to add "Engineer" after "Chemical", then the result will be Chemical Engineer Chemical Entrepreneur Checmical People Chemical Engineer Chemical Entrepreneur Checmical People Here's the code router.js router.post('/api/search/', function(req, res, next) { Product

Mongoosastic - { [Error: No Living connections] message: 'No Living connections' }

隐身守侯 提交于 2020-01-13 03:50:17
问题 Im trying to use mongoosastic for searching purposes, but I keep getting 'No Living connections' error and mapping problem Here's the code var mongoose = require('mongoose'); var mongoosastic = require('mongoosastic'); var Schema = mongoose.Schema; var JobSchema = Schema({ category: { type: Schema.Types.ObjectId, ref: 'Category', es_indexed:true}, title: { type: String, es_indexed:true }, }); JobSchema.plugin(mongoosastic); module.exports = mongoose.model('Job', JobSchema); routes.js var Job

Elasticsearch full-text query issue from inner array

拜拜、爱过 提交于 2020-01-07 06:56:48
问题 This is my object. and I want find text inside of task i.e task.name. { "_id" : ObjectId("55e2acd77e5e4ddc037b3ef5"), "userId" : "123", "username" : "user12", "address" : "abc", "number" : 928228828282.0, "task" : [{ "name" : "metac", "productCode" : "1234", "_id" : ObjectId("55e2acd77e5e4ddc037b3ef7") }, { "name" : "alfa33", "productCode" : "1234", "_id" : ObjectId("55e2acd77e5e4ddc037b3ef6") }], "__v" : 0 } so when I query for that it will return all task. curl -XPOST 'localhost:9200

GeoCode filter in mongoose elasticsearch

旧时模样 提交于 2020-01-05 08:32:30
问题 I am trying to do geo point filter in mongodb in meanjs. i have used mongoosastic modules but i am not able to perform geo point filter. here below are the mongoose schema and controller code for filter. Mongoose schema 'use strict'; /** * Module dependencies. */ var mongoose = require('mongoose'), Schema = mongoose.Schema, mongoosastic = require('mongoosastic'); var BusinessSchema = new Schema({ name: {type: String, unique: 'Name already exists', trim: true, required: 'Name is required.', es

How to do instant search with mongoosastic + AJAX?

不想你离开。 提交于 2019-12-19 08:05:50
问题 I have configured mongoosastic successfully, I tried searching and it is working fine, but when it comes to front-end I'm not really sure on how to achieve this, I experimented with a lot of ways but couldn't come up with a good solution. Here's the code. // For the Search API router.post('/api/search/', function(req, res, next) { Job.search( { query_string: { query: req.body.search } } , function(err, results) { if (err) return next(err); res.json(results); }); }); So whenever I search

Inserting large amounts of data to Mongoose & ElasticSearch via Mongoosastic

杀马特。学长 韩版系。学妹 提交于 2019-12-13 20:21:38
问题 I am following these instructions: https://www.compose.com/articles/mongoosastic-the-power-of-mongodb-and-elasticsearch-together/ I have a TSV file (17MB) that I am iterating through. I am watching my Indexed results with the following code: Entry.on('es-indexed',(e,r)=>{ console.log(`Indexed Result: ${r} Indexed Error: ${e}`); }) Some of my data is getting indexed properly, but I get many error messages too: Indexed Result: undefined Indexed Error: Error: Request Timeout after 30000ms Here

mongoosastic findOneAndUpdate not indexing in elasticsearch

允我心安 提交于 2019-12-13 02:12:18
问题 Problem : In my example if i user schema.save then it will indexed in elastic search but problem starts when i use findOneAndUpdate so it will not index in elastic even if i insert (i.e save) MovieSchema.findOneAndUpdate(query, reqObject, { upsert: true }, function(err, results) { if (err) { if (!update) { var filePath = path.join(__dirname, "../../movie/images/uploads/") + reqObject.imageUrl; fs.unlinkSync(filePath); } console.log(err) callback({ RESULT_CODE: '-1', MESSAGE: 'System error.

And operator mongoosastic (filter)

这一生的挚爱 提交于 2019-12-12 05:15:34
问题 How can I add filter to my query to get for example just users where role admin ? Here is my query: userModel.search({ "multi_match": { "fields": ["firstName", 'lastName', 'specialities', 'profession', 'country', 'state', 'city'], "query": req.query.q, "fuzziness": "AUTO" } }, { from: (pageNum - 1) * perPage, size: perPage }, function (err, results) { ... I need to do something like this just with mognoosastic: ElasticSearch - multi-match with filter - returns no result 回答1: Try Below Query

elasticsearch search text return full array issue

二次信任 提交于 2019-12-12 03:39:21
问题 I am using mongoosastic for elasticsearch . and i done all setup and its working fine. but problem is result are not getting properly. FILE:- mongoose and mongoosastic. var mongoose = require('mongoose'); var Schema = mongoose.Schema; var medicineSchema = require('./search') var mongoosastic = require("mongoosastic"); var UserProfileSchema = new Schema({ userId: String, username: String, address: String, number: Number, task: [{ name: { type: String, es_boost: 2.0 // or es_indexed:true },

include_type_name parameter is set to true in node.js

半城伤御伤魂 提交于 2019-12-08 12:26:59
问题 I'm trying to create a mapping between MongoDB and elasticsearch. I'm using mongoosastic for it. When I'm trying to create new mapping it gives me following error. For solution, i have add ?Finclude_type_name=true on https://github.com/mongoosastic/mongoosastic/blob/master/lib/mongoosastic.js function createMappingIfNotPresent (options, cb) { const client = options.client; const indexName = options.indexName; const typeName = options.typeName+"?Finclude_type_name=true"; const schema = options