Input geo locations with Elasticsearch.net

I am using the Elasticesearch.net library instead of the NEST library and am able to input my data except my latitude and longitude are not able to be mapped to a geo_point in Kibana. All of the examples I can find seem to be talking about NEST though.

Here is a bit of my code...

var settings = new ConnectionConfiguration(new Uri("http://" + ipAddress));
var lowlevelClient = new ElasticLowLevelClient(settings);

// Fill out the pieces here...

foreach (Piece piece in pieces)
{
var asyncIndexResponse = await lowlevelClient.IndexAsync(
"pieces", "piece", piece.PieceID, PostData.Serializable(piece));
}

My piece class looks like this:
public class Piece
{
public string PieceID { get; set; }
public DateTime TimeStamp { get; set; }
public int MachineSerial { get; set; }
public string Location { get; set; }
public string RoutingCategory { get; set; }
public string RoutingString { get; set; }
public int DestinationBin { get; set; }
}

I have tried many of the options this page appears to suggest, but I think I'm missing something:
https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html

Can someone tell me what to do to allow me to input location data using Elasticsearch.net?

What do the lat and lon look like on a Piece instance? Could you provide a succinct example?

With what you have tried so far, what does DebugInformation show on the response? You can get to this through response.ApiCall.DebugInformation, and if you set .DisableDirectStreaming() on the request (or globally on ConnectionConfiguration), you'll also get the request and response bytes in the debug information.

Russ,

I have tried a few different formats for the piece.
This is what I tried last:
{
"PieceID": "110180403-143925247",
"TimeStamp": "2018-04-03T18: 39: 25.2475097Z",
"MachineSerial": 110,
"City": "Lafayette",
"Location": "40.451587,-86.878911",
"RoutingCategory": "Resolved",
"RoutingString": "01666850339",
"DestinationBin": 11
}

I have tried the location with and without a space.

I have also tried this:
{
"PieceID": "110180403-143925247",
"TimeStamp": "2018-04-03T18: 39: 25.2475097Z",
"MachineSerial": 110,
"City": "Lafayette",
"Location": {
"lat": 40.451587,
"lon": -86.878911
},
"RoutingCategory": "Resolved",
"RoutingString": "01666850339",
"DestinationBin": 11
}

No matter what I have tried, I get this error message in Kibana when trying to make a Coordinate Map:
No Compatible Fields: The "pieces*" index pattern does not contain any of the following field types: geo_point

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