2016-05-05 12 views
3

を使用したElasticSearch 2.x GeoPointマッピングNEST C#Clientを使用してelasticsearchに "Geo Point"マッピングに問題があります。インデックスの作成にNEST C#

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

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

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

マイマッピングプロパティ:ここ

は私のクラス定義です

.Mappings(map => map 
    .Map<Crime>(m => m.AutoMap() 
    .TimestampField(ts => ts.Enabled(true).Path("timeStamp"))             
    .Properties(pro => pro 
     .GeoPoint(geo => geo 
     .Name(n => n.Coordinates) 
     .LatLon(true) 
)))) 

そして、私のマッピングは、いくつかの文書がインデックス化された右一度見てdoesntの....

... 
"coordinates": { 
        "properties": { 
        "lat": { 
         "type": "double" 
        }, 
        "lng": { 
         "type": "double" 
        } 
        } 
       }, 
... 

(SENSEを使用して)クエリを実行しようとすると、次のエラーが表示されます。

"reason": { 
       "type": "query_parsing_exception", 
       "reason": "failed to parse [geo_bbox] query. could not find [geo_point] field [coordinates]", 
       "index": "someindexname", 
       "line": 16, 
       "col": 9 
      } 

私の意見では、問題はマッピングにありますが、ジオポイントを正しくマップする方法がわからないことは、2.xのアップデート(1.xと比較して)が大幅に変化しています。何か案は ?解決

+0

これをES 2.xに対してテストしていますか? – Rob

+0

@Robええ...私は2番目の最後の文でこれを言いましたが、それはもっと明示する必要があります。待ってください - タイトルに2.xと書かれています:) –

+0

ああ、 ) – Rob

答えて

1

- 最新のリリースにNESTライブラリを更新 -

もロンに自分の座標クラスのメンバーLNGと改名:

[Number(NumberType.Double, Name = "lon")] 
public double Lon { get; set; } 

私はC#の宣言はそのわずか注釈が重要なthatsのは問題does notのだと思います。

ありがとうございました