NEST - problem with AutoMap() and geo_point


#1

Hi everyone. I'll get to the point:

First class: AddressPoint.cs

public GeoLocation Loc { get; set; }

Form1.cs

var settings = new ConnectionSettings(pool).DefaultIndex("testindex");

            var client = new ElasticClient(settings);

            if (client.IndexExists("testindex").Exists)
                client.DeleteIndex("testindex");

            var createIndexResponse = client.CreateIndex("testindex", c => c
                .Mappings(ms => ms
                    .Map<AddressPoint>(m => m
                        .AutoMap()
                    )
                )
            );

then later in the code generating object and filling it with properties:

row.Loc = new GeoLocation((double) row.WGS84Lat, (double) row.WGS84Lon);

All that I have already done should map row.Loc to geo_point but the result is:

"loc": {
            "properties": {
              "lat": {
                "type": "float"
              },
              "lon": {
                "type": "float"
              }
            }
          },

Could someone enlighten me what I'm doing wrong?

Elasticsearch version: 6.2.1
NEST version: 6.0.0.0

Thanks.


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.