Please help me with indexing geolocation in nest elastic search 7, this is my code
Model
public class ElasticSearchModel : Model<Building>
{
public ElasticSearchModel()
{
BuildingRooms = new List<BuildingRoomViewModel>();
BuildingPhotos = new List<BuildingPhotoViewModel>();
}
public GeoLocation Location { get; set;}
public int Id { get; set; }
public string BuildTitle { get; set; }
public DateTime CreatedDate { get; set; }
public int TotalRooms { get; set; }
public string Description { get; set; }
public decimal? OwnerPrice { get; set; }
public double? Size { get; set; }
public string SizeName { get; set; }
public string MoneyType { get; set; }
public string BuildAction { get; set; }
}
and creating index like this
_elasticClient.CreateIndex("honadona", c => c
.Map<ElasticSearchModel>(mm => mm
.AutoMap()
)
);
but i get response structure like this for location field:
"location": {
"properties": {
"lon": {
"type": "float"
},
"lat": {
"type": "float"
}
}
I cant search with Geodistance, it give me error "all_shard":
var Buildingpoints= _elasticClient.Search<ElasticSearchModel>(
s => s.RequestConfiguration(r => r
.DisableDirectStreaming()
).From(0).Size(600).Query(query => query.Bool(b => b
.Filter(filter => filter
.GeoDistance(geo => geo
.Field(f => f.Location)
.Distance(4.0, Nest.DistanceUnit.Kilometers)
.Location(41.23, 69.32)
)