【问题标题】:How to create mapping for geopoint properties using fluent api and attributes in Nest?如何使用 fluent api 和 Nest 中的属性为地理点属性创建映射?
【发布时间】:2018-04-10 02:29:32
【问题描述】:

我正在尝试使用 Nest v5.5.0 为地理点属性配置映射

我有这个模型(类型)地址,它有这个属性:

 [GeoPoint(Name = "coordinates")]
 public Coordinates Coordinates { get; set; }

坐标类:

    public class Coordinates
{
    [Number(NumberType.Float, Name = "lat")]
    public float Lat { get; set; }

    [Number(NumberType.Float, Name = "lng")]
    public float Lng { get; set; }
}

并使用流畅的 api:

.Mappings(m => m
      .Map<AdvertiserType>(map => map
                 .AutoMap()
                 .Properties(p => p
                      .GeoPoint(geo => geo
                             .Name(n => n.Coordinates)
                                )
                            )
                      )
     )

但是当我尝试索引数据时出现解析异常。请告诉我如何使用 Nest5.5.0 映射地理点属性?

【问题讨论】:

    标签: elasticsearch mapping nest


    【解决方案1】:

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-25
    • 1970-01-01
    • 1970-01-01
    • 2013-06-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多