我设置了mongoosastic来将我的文档编入索引以进行弹性搜索。问题是,尽管设置了模式,但所有字段都被编入索引。
我的架构:
id: { type: String, index: true },
title: String,
title_lower: { type: String, es_indexed: true, es_boost: 2.0 },
slug: String,
city: { type: String, es_indexed: true },
country: { type: String, es_indexed: true },
genre: [{ type: String, es_indexed: true }],
description: { type: String, es_indexed: true },
gallery: [{ title: String, images: { thumbnail: String, medium: String, full: String }}],
date: { start: String, end: String },
price: { min: Number, max: Number },
temperature: Number,
weather: String,
comments: [CommentSchema],
lineup: { type: [LineupSchema], es_indexed: true }
这里我只想要title_lower,city,genre,description和阵容索引。但检查弹性如:http://localhost:9200/events/_search我可以看到所有字段都添加在_source。