【发布时间】:2018-10-18 10:24:45
【问题描述】:
我使用的是 NEST v6.3.1、ElasticSearch v6.4.2
我无法将我的字段作为关键字编入索引。
这两个属性我都试过了:
[Keyword]
public string Suburb { get; set; }
流利:
client.CreateIndex(indexName, i => i
.Mappings(ms => ms
.Map<Listing>(m => m
.Properties(ps => ps
.Keyword(k => k
.Name(n => n.Suburb)))
.AutoMap())
.Map<Agent>(m => m
.AutoMap())
.Map<BuildingDetails>(m => m
.AutoMap())
.Map<LandDetails>(m => m
.AutoMap())
)
);
两者的结果相同:
{
"listings": {
"mappings": {
"listing": {
"properties": {
"suburb": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
例如与我在这里看到的不匹配: https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/attribute-mapping.html
当我尝试使用[GeoPoint] 时,也会发生同样的事情。应该是 geopoint 类型,但它映射到浮点数:
"latLong": {
"properties": {
"lat": {
"type": "float"
},
"lon": {
"type": "float"
}
}
}
所以我错过了一些东西,只是不确定是什么。
有什么帮助吗?
谢谢
【问题讨论】:
标签: elasticsearch nest