Elasticsearch、MongoDb、Mongoostic查询对象数组
我试图使用Mongoostic将boqEntry的“细节”字段索引到Elasticsearch实例中,然后再查询它们boqList的内部工程量清单由工程量清单组成。我已经按照下面的代码定义了我的模式。在通过FilePond上传工程量清单文档后,我正在为其编制索引。每当我对Elasticsearch执行查询()时 我得到的回应如下: 但是,我希望能够从boqList数组中仅检索那些特定的“细节”,这些细节与我在基于React的前端实现的搜索框中的搜索词相匹配,比如全文搜索。我对MERN stack、Mongoose和Elasticsearch比较陌生。我真的很感激任何帮助。谢谢 以下是猫鼬模式:Elasticsearch、MongoDb、Mongoostic查询对象数组,mongodb,
elasticsearch,mongoose,mongoose-schema,mongoosastic,Mongodb,
elasticsearch,Mongoose,Mongoose Schema,Mongoosastic,我试图使用Mongoostic将boqEntry的“细节”字段索引到Elasticsearch实例中,然后再查询它们boqList的内部工程量清单由工程量清单组成。我已经按照下面的代码定义了我的模式。在通过FilePond上传工程量清单文档后,我正在为其编制索引。每当我对Elasticsearch执行查询()时 我得到的回应如下: 但是,我希望能够从boqList数组中仅检索那些特定的“细节”,这些细节与我在基于React的前端实现的搜索框中的搜索词相匹配,比如全文搜索。我对MERN stack
你还在寻找解决方案吗?你好,是的,我是!
"hits": [
{
"_index": "boqss",
"_type": "boqs",
"_id": "5d9730d83f756d04a8d6dbfe",
"_score": 1.0,
"_source": {
"projectId": "5d860711cf3b052a34a84f6c",
"boqList": [
{
"particulars": "Excavation "
},
{
"particulars": "Providing & laying Rubble Soling"
},
{
"particulars": "Providing & laying PCC M10"
},
{
"particulars": "Providing & Laying Reinforcement With Cutting, Bending & Binding With Binding Wire Etc Complete."
},
{
"particulars": "Providing & Making Double Scaffolding"
},
{
"particulars": "Providing & Casting R.C.C M25"
},
{
"particulars": "Providing & Applying Cement Plaster"
},
...
const mongoose = require('mongoose')
const Schema = mongoose.Schema
var mongoosastic = require('mongoosastic')
const boqEntry = new Schema({
particulars : {type : String, es_indexed : true},
quantity : {type : Number},
unit : {type : String},
rate : {type : Number},
amount : {type : Number},
});
const BOQ = new Schema(
{
projectId : { type : String},
boqList : {type : [boqEntry], es_type : 'nested'}
},
{ timestamps: true },
);
BOQ.plugin(mongoosastic)
module.exports = mongoose.model('boqs', BOQ)