2017-02-21 52 views
1

在ElasticSearch 5我正在做一个属性:GeoShape不存储纬度/经度

var prop = new Property 
     { 
      Id = page.Id, 
      GeoLocation = 
       new PointGeoShape(
        new GeoCoordinate((double) geoPoint.Latitude, (double) geoPoint.Longitude)) 
     }; 

有了新的定义:

public class Property 
    { 
     [Number] 
     public int Id { get; set; } 

     [GeoShape] 
     public PointGeoShape GeoLocation { get; set; } 
    } 

当它被送往弹性它有一个类型的点,lat和lng都是双打的。

然而,当它插入弹性和我拿回来,它看起来像:

"GeoLocation": { 
    "coordinates": [ 
     { 
     "s": -1, 
     "e": -2, 
     "c": [ 
      7, 
      9, 
      0, 
      2, 
      8, 
      9, 
      9, 
      0, 
      2, 
      1, 
      3, 
      0, 
      3, 
      2, 
      5, 
      5, 
      7 
     ] 
     }, 
     { 
     "s": 1, 
     "e": 1, 
     "c": [ 
      5, 
      1, 
      5, 
      2, 
      6, 
      5, 
      2, 
      0, 
      3, 
      7, 
      4, 
      7, 
      1, 
      9, 
      8, 
      3 
     ] 
     } 
    ], 
    "type": "point" 
+0

您是否明确地在索引中映射了“Property”POCO,例如:在创建索引时或之后使用自动映射来映射POCO? –

回答

0

这是由于邮递员“涂脂抹粉”,当我检查的原始响应它是正确的。