【发布时间】:2017-01-13 23:32:11
【问题描述】:
我有以下弹性索引项:
{
"_index": "areas",
"_type": "area",
"_id": "AVb_MPXHCPQmPhMEnjGo",
"_score": 1,
"_source": {
"name": "Chorlton somewhere",
"location": {
"type": "Point",
"coordinates": [
-2.2852634,
53.4417472
]
}
}
}
现在在 NEST 中,我的班级看起来像:
[String]
public string Name { get; set; }
[GeoPoint]
public GeoLocation Location{ get; set; }
我希望能够在 C# 中使用类型和坐标来表示位置。
我知道这是错误的,但是我不知道如何在C#的类结构中实现上述JSON的结构
【问题讨论】:
-
您应该尝试
GeoShape而不是GeoLocation,因为您的location点不是geo_point,而是geo_shape。 -
@Val 如果我将属性的属性设置为 GeoShape,在这种情况下我需要为属性使用什么类型?
-
在你的情况下,
PointGeoShape我猜 -
啊,我在寻找 Geo... 一开始。看起来很有效!
-
酷,很高兴它正在工作!
标签: elasticsearch nest