多くの巨大なジオシェイプを格納する「シェイプ」インデックスがあります (1 つのジオシェイプの元のシェイプファイルのサイズは 6MB でした)。
私はこのマッピングを使用しています:
"shape": {
"type": "geo_shape",
"tree": "quadtree",
"tree_levels": "20"
},
"_all": {
"enabled": false
},
"dynamic": "true"
「写真」インデックスもあります。各写真には緯度と経度が Point タイプの geoshape として表示されます。例えば
"location": {
"type": "Point",
"coordinates": [
-103.262600,
43.685315
]
}
そのためのマッピング:
"location": {
"type": "geo_shape",
"tree": "quadtree",
"tree_levels": 20
}
次のクエリを使用して、選択した形状内にあるすべての写真を見つけようとしています:
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": {}
}
}
}
}
問題:
1) 巨大な形状では、このクエリは数分間または永遠に実行されます。
2)「形状」がソースに含まれていると、いくつかのパラメーターで形状を検索するだけで時間がかかりますが、それを除外すると、geo_shape フィルターが例外をスローします - 「形状が見つかりましたが、フィールドがありません」
マッピング:
_source: {
excludes : ['shape']
}
この問題を解決する方法はありますか?