0

ElasticSearch でインデックスを作成したいモデル スキーマがあります。docsによると、設定:

es_indexed: true

必要なスキーマ フィールドとともに、ElasticSearch に関連する操作でそのキーのみをインデックス化します。約 20 のフィールドからなる大規模なスキーマがあり、そのうち 5 つだけをインデックス化する必要があります。

問題は、これらのフラグが無視され、文書全体が索引付けされていることです。

var PersonSchema = new Mongoose.Schema({
    name: {type: String, es_indexed: true},
    address: address: {
        street_address: {type: String},
        locality: {type: String},
        region: {type: String},
        zip: {type: String},
        landmark: {type: String},
        neighbourhood : {type: [String]}
    },
    ...
    tags: {type:[String], index:true, es_indexed: true},
    ...
})

PersonSchema.plugin(mongoosastic);

var Person = Mongoose.model("Merchant", PersonSchema);

電話したら

var stream = Merchant.synchronize()
        , count = 0;

    stream.on('data', function(err, doc){
        count++;
        console.log('indexing: '+ count+ ' done');
    });
    stream.on('close', function(){
        console.log('indexed ' + count + ' documents!');
    });

    stream.on('error', function(err){
        console.log(err);
    });

住所やその他の不要なフィールドを含め、ドキュメント全体が保存されます。es_indexed: trueフラグが機能しないのはなぜですか?

4

1 に答える 1