I have two indices, both have > 2 million documents containing localId
s (mapped to keyword
) and geospatial data. Both indices use geo_shape
as the mapping), so the mappings look like this:
{
"properties": {
"localId": {
"type": "keyword"
},
"geometry": {
"type": "geo_shape"
}
}
}
I've successfully run bounding box queries against the data, but I'm struggling to run the distance from point queries. The docs give explicit examples of the query running against geo_shape data, but I get an error of:
{
"error" : {
"root_cause" : [
{
"type" : "query_shard_exception",
"reason" : "field [geometry] is not a geo_point field",
"index_uuid" : "e7-HPZmUR4Wpu96W6K_YXw",
"index" : "test1"
}
],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "query",
"grouped" : true,
"failed_shards" : [
{
"shard" : 0,
"index" : "test1",
"node" : "FAu7pbAtQti7e9aRaX4-bg",
"reason" : {
"type" : "query_shard_exception",
"reason" : "field [geometry] is not a geo_point field",
"index_uuid" : "e7-HPZmUR4Wpu96W6K_YXw",
"index" : "test1"
}
}
]
},
"status" : 400
}
Any idea what I've missed to be able to get distance working against geo_shape data?
elasticsearch details:
{
"name" : "server-name",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "1SqVbKmGR5qxG6bcpjxasg",
"version" : {
"number" : "7.10.2",
"build_flavor" : "oss",
"build_type" : "deb",
"build_hash" : "747e1cc71def077253878a59143c1f785afa92b9",
"build_date" : "2021-01-13T00:42:12.435326Z",
"build_snapshot" : false,
"lucene_version" : "8.7.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
CodePudding user response:
The geo_distance
query in 7.10 only supported geo_point
fields.
The support for geo_shape
started in 7.11