【发布时间】:2015-06-29 06:59:10
【问题描述】:
我正在使用 mongoosastic 将猫鼬模型索引到 Elasticsearch 中,并使用 es_indexed: true 指定字段,效果很好。
现在我希望不使用 index: 'not_analyzed' 选项分析其中一些字段,但它不起作用。
我在 Elasticsearch 中运行GET /actions/_mapping 来检查映射,但没有显示该选项。因此我猜想 mongoosastic 没有通过它。
我还尝试从 Elasticsearch 中删除索引以确保它考虑到我的编辑,但它也没有改变。
如果我使用PUT /actions 手动输入索引,那么它可以工作,但目标是将它包含在架构声明中,如下所示。
var actionSchema = exports.Schema = mongoose.Schema({
published: {
type: Date,
default: Date.now,
es_indexed: true
},
actorUser: {
type: ObjectId,
ref: 'User',
es_indexed: true
},
actor: {
type: activityObject,
es_indexed: true
},
pictureUrl: String,
verb: {
type: String,
es_indexed: true,
index: 'not_analyzed'
},
object: {
type: activityObject,
es_indexed: true
},
target: {
id: {
type: String,
es_indexed: true
},
displayName: {
type: String,
es_indexed: true,
index: 'not_analyzed'
},
objectType: {
type: String,
es_indexed: true
},
image: String,
url: String
},
path: {
type: String,
es_indexed: true
},
recipients: [{
type: ObjectId,
ref: 'User'
}]
});
知道我应该怎么做才能让它工作吗?
[编辑] 我在 mongoosastic GitHub 存储库上问了这个问题,该问题目前被标记为可能的错误:https://github.com/mongoosastic/mongoosastic/issues/76
【问题讨论】:
-
naah es_index: 'not_analyzed' 和 es_indexed:'not_analyzed' 在 mongoosastic 中也不起作用,在哪里指定类型名称,因为默认情况下它从索引名称中获取类型名称??
标签: elasticsearch mongoosastic