【发布时间】:2015-03-29 23:57:45
【问题描述】:
我正在使用 ElasticProperty 属性来定义我的索引类型映射。这有效:
[ElasticProperty(Boost = 2)]
public string Title { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string ActivityType { get; set; }
我创建了我的索引,一切看起来都很好(我只是在复制受影响的道具):
"properties": {
"activityType": {
"type": "string",
"index": "not_analyzed"
},
"title": {
"type": "string",
"boost": 2
}
}
但是,当我删除映射时,更改分析器并重新索引看看会发生什么:
[ElasticProperty(Boost = 2, Analyzer = "keyword")]
public string Title { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string ActivityType { get; set; }
结果:
"properties": {
"activityType": {
"type": "string"
},
"title": {
"type": "string"
}
}
有人能解释一下这里发生了什么吗?似乎添加 Analyzer 参数会强制动态生成映射。为什么?
【问题讨论】:
标签: c# elasticsearch mapping nest