NEST的PolygonShape错误

时间:2018-08-10 02:10:28

标签: elasticsearch nest

美好的一天:

我正在尝试保存形状为Polygon的对象。每当我尝试保存它时,都会出现错误failed to parse [serviceAreas]。此属性位于定义为

的POCO上
/// <summary>
///  Used for Service Locations 
/// </summary>
[GeoShape]
public PolygonGeoShape ServiceAreas { get; set; } 

这是保存属性时生成的:

"serviceAreas":{  
          "coordinates":[  
             [  
                {  
                   "lat":34.070222,
                   "lon":-118.286448
                },
                {  
                   "lat":34.070649,
                   "lon":-118.203192
                },
                {  
                   "lat":34.022147,
                   "lon":-118.203878
                },
                {  
                   "lat":34.019016,
                   "lon":-118.277349
                },
                {  
                   "lat":34.070222,
                   "lon":-118.286448
                }
             ]
          ],
          "type":"polygon",
          "ignoreUnmapped":null
       },

详细错误是这样的:

failed to parse [serviceAreas]","caused_by":{"type":"json_parse_exception","reason":"Current token (START_OBJECT) not numeric, can not use numeric value accessors\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@1ea7ae53

问题是,当我像这样在JSON输出中删除latlon时,

"serviceAreas":{  
      "coordinates":[  
         [  
            [  
              34.070222,
              -118.286448
            ],
            [  
               34.070649,
               -118.203192
            ],
            [  
               34.022147,
               -118.203878
            ],
            [  
             34.019016,
             -118.277349
            ],
            [  
             34.070222,
             -118.286448
            ]
         ]
      ],

有效。有什么想法吗?我正在使用带有NEST 6.1.0的ElasticSearch版本6.3.2。

0 个答案:

没有答案