I'm having an issue while trying to index a document stored in a DocumentDb collection.
The datasource of the indexer was defined with a custom SQL to retrieve the changed documents. The document I want to index has a property called LocationGP
which is a Microsoft.Spatial.GeographyPoint, and is mapped to a field of the index with the same name and defined as DataType.GeographyPoint
The error I get when trying to create the indexer is:
Column 'LocationGP' is of type JObject that is not compatible with the field of type Edm.GeographyPoint in the index
Any ideas?
This is the definition of the DataSource:
return new DataSource()
{
Name = "opportunities-datasource",
Container = new DataContainer()
{
Name = "Companies",
Query = @"SELECT o.id,
o.CompanyName,
o.LocationGP,
o.Location.CityName AS LocationCity,
o.Location.StateName AS LocationState,
o.Location.CountryName AS LocationCountry,
o._ts
FROM Companies o WHERE o.DocType = 1 AND o._ts > @HighWaterMark"
},
Type = "documentdb",
Credentials = new DataSourceCredentials()
{
ConnectionString = String.Format("AccountEndpoint={0};AccountKey={1};Database=CompaniesDb", DocumentDbEndpointUri, DocumentDbPrimaryKey)
},
DataChangeDetectionPolicy = new HighWaterMarkChangeDetectionPolicy("_ts"),
DataDeletionDetectionPolicy = new SoftDeleteColumnDeletionDetectionPolicy("Status", "2")
};
This is the document:
[{
"id": "088e1e97-6d59-40ad-a9be-620fdc7938c7",
"CompanyName": "Neptune",
"LocationGP": {
"Latitude": 39.8010482788086,
"Longitude": -89.6436004638672,
"IsEmpty": false,
"Z": null,
"M": null,
"CoordinateSystem": {
"EpsgId": 4326,
"Id": "4326",
"Name": "WGS84"
}
},
"Location": {
"CityName": "Springfield",
"CountryName": "US",
"StateName": "IL"
},
"Status": 1,
"DocType": 1,
"Timestamp": "2016-08-19T16:08:46.0481948Z",
"_ts": 1471622922
}]
Here are two more documents on Azure Search that explains what type of geography instances are accepted:
Basically it needs to be in GeoJSON "Point" type format.