ElasticSearch:将MultiLineString映射到.Net中的嵌套对象

时间:2018-09-24 12:04:34

标签: c# elasticsearch nest

我正在尝试从我们的ElasticSearch数据库中获取.Net中的某些对象。通常,属性映射可以很好地工作,但是我无法获得几何图形,因为它们是MultiLineStrings。

这是ES映射的一部分:

      (...)
      "geometry" : {
        "type" : "geo_shape",
        "tree" : "quadtree"
      }
      (...)

这是此文档的结果:

"geometry" : {
  "type" : "MultiLineString",
  "coordinates" : [
    [
      [
        -0.3024731508,
        39.6154086637
      ],
      [
        -0.3024750709,
        39.6154090056
      ]
    ]
  ]
},

和.Net中的

    [PropertyName("geometry")]
    public MultiLineStringGeoShape Geometry { get; set; } //Where MultiLineStringGeoShape is in Nest namespace

但是,当我尝试获取此对象时,Geometry始终为null。我尝试将Geometry的类型修改为对象,并且将对象正确映射为不能转换或反序列化为MultiLineStringGeoShape的Nest的JObject。 所有其他属性均正确映射。

我们正在使用ElasticSearch 6.2.4和Nest 6.2.0。

我错过了什么吗? 谢谢。

0 个答案:

没有答案