I am using Nest 6.2.0 to connect to elastic search.
I am trying to map a class containing DBGeography objects and I have tried adding the [GeoShape] tag and I get the following error.
ServerError = {ServerError: 400Type: mapper_parsing_exception Reason: "failed to parse" CausedBy: "Type: not_x_content_exception Reason: "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes""}
The code I am using to Create the index and document are:
// Create an index
response = Connection.CreateIndex(indexName, c => c
.Mappings(ms => ms
.Map<RACE.DataModels.EventModels.Event.Route>(m => m
.AutoMap<RACE.DataModels.EventModels.Event.Route>()
)
)
);
// Add document to index
result = Connection.Index(obj, i => i
.Index(indexName));
Also, here is the code for the Route object which I am trying to add to the index.
public partial class Route : BaseClass
{
[Key]
public Guid ID { get; set; }
[Required]
[Display(Name = "Event")]
public Guid EventID { get; set; }
[Required]
[Display(Name = "Route Name")]
public string Name { get; set; }
[Display(Name = "Description")]
public string Description { get; set; }
[Required]
[Display(Name = "Path Type")]
public int PathType { get; set; }
[GeoShape]
[Required]
[Display(Name = "Route Path")]
public DbGeography Path { get; set; }
//[GeoShape]
[Ignore]
public string PathWKT { get { return Path.WellKnownValue.WellKnownText; } }
[GeoShape]
[Display(Name = "Start")]
public DbGeography Start { get; set; }
[GeoShape]
[Display(Name = "End")]
public DbGeography End { get; set; }
[Display(Name = "Laps")]
public int Laps { get; set; }
[Display(Name = "Status")]
public int Status { get; set; }
[Ignore]
[ForeignKey("EventID")]
public virtual Event Event { get; set; }
[Ignore]
[ForeignKey("RouteID")]
public virtual List<Gateway> Gateways { get; set; }
}
Is DBGeography stopping the object from being correctly mapped, and how can I correctly map a DBGeography object to GeoShape?