Below is my Index (tz_geo) and mapping details:
Index setting:
{
"index.blocks.read_only_allow_delete": "false",
"index.priority": "1",
"index.query.default_field": [
"*"
],
"index.write.wait_for_active_shards": "1",
"index.refresh_interval": "30s",
"index.number_of_replicas": "7"
}
Mapping:
{
"mapping": {
"properties": {
"geo": {
"type": "geo_point"
},
"gnameid": {
"type": "long",
"index": false
},
"iso": {
"type": "keyword",
"index": false
},
"locid": {
"type": "long",
"index": false
},
"tz": {
"type": "keyword",
"index": false
}
}
}
}
ElasticSearch details:
{
"name" : "node-1",
"cluster_name" : "test-cluster",
"cluster_uuid" : "ET-Gwb-iR4mCmzZUppuOKw",
"version" : {
"number" : "7.2.0",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "508c38a",
"build_date" : "2019-06-20T15:54:18.811730Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
Number of nodes in cluster: 11
Index data size: 9.6 GB
Total documents in Index: 12025944
My Geo Search using C# ElasticSearch NEST
var result = await ES_Client.SearchAsync<ES_TZGeo>(s => s
.Index("tz_geo")
.Query(query => query.Bool(b => b.Filter(filter => filter
.GeoDistance(geo => geo
.Field(f => f.geo)
.Distance("500km").Location(lat, lon)
.DistanceType(GeoDistanceType.Arc)
)
)
)
)
.Sort(sort => sort
.GeoDistance(g => g
.Field(f => f.geo)
.Order(SortOrder.Ascending)
.Unit(DistanceUnit.Kilometers)
.Points(new GeoLocation(lat, lon))
.DistanceType(GeoDistanceType.Arc)))
.Size(1)
);
The above search will find the nearest document based on lat,lon provided.
We are seeing that sometimes the response is more than 1 sec for the above query. Is there any recommendation on how to improve on this search either in terms of NEST or maybe change the replicas, etc?
Thank you for your time.