Elasticsearch - 在巨大的地理形状内找到点

Use*_*age 5 elasticsearch elasticsearch-geo-shape

我有'形状'索引,存储了许多巨大的地理形状(一个地理形状的原始shapefile大小为6MB).

我正在使用这个映射:

"shape": {
    "type": "geo_shape",
    "tree": "quadtree",
    "tree_levels": "20"
},
"_all": {
   "enabled": false
},
"dynamic": "true"
Run Code Online (Sandbox Code Playgroud)

我也有'照片'索引.每张照片的纬度和经度都显示为带有Point类型的地理位置.例如

"location": {
  "type": "Point",
  "coordinates": [
    -103.262600,
    43.685315
  ]
}
Run Code Online (Sandbox Code Playgroud)

映射:

"location": {
 "type": "geo_shape",
 "tree": "quadtree",
 "tree_levels": 20
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用以下查询查找位于所选形状内的所有照片:

GET photos/_search
{
  "query": {
    "filtered": {
      "filter": {
        "geo_shape": {
          "location": { 
            "relation": "intersects",
            "indexed_shape": {
              "id": "huge_region_shape_id",
              "type": "country",
              "index": "shapes",
              "path": "shape"
            }
          }
        }
      },
      "query": {
        "match_all": {}
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

问题:

1)在巨大的形状上,这个查询会执行几分钟或永久.

2)只是通过某些参数搜索形状需要花费大量时间,如果"形状"包含在源中,但如果我将其排除 - geo_shape过滤器将抛出异常 - "找到的形状但缺少字段"

在映射中:

_source: {
  excludes : ['shape']
}
Run Code Online (Sandbox Code Playgroud)

有没有办法解决这个问题?