ネストされた場所でフィルタリングするときに、geo_shape フィルターが結果を返すのに問題があります。
次のものがあるとします。
PUT test/test/_mapping
{
"properties": {
"name": {
"type": "string"
},
"gatheringEvent": {
"properties": {
"siteCoordinates": {
"type": "nested",
"properties": {
"point": {
"type": "geo_shape"
}
}
}
}
},
"point": {
"type": "geo_shape"
}
}
}
次のドキュメントにインデックスを付けると、次のようになります。
POST test/test/1
{
"name": "Bird",
"gatheringEvent.siteCoordinates.point": {
"type": "point",
"coordinates": [
5,
5
]
},
"point": {
"type": "point",
"coordinates": [
5,
5
]
}
}
次のクエリの実行: (ネストされていない場所で geo_shape フィルターを使用)
GET test/test/_search
{
"query": {
"filtered": {
"query": {
"match": {
"name": "Bird"
}
},
"filter": {
"geo_shape": {
"point": {
"shape": {
"type": "polygon",
"coordinates": [
[
[0 ,0 ],
[10 ,0],
[10,10],
[0,10 ],
[0 ,0 ]
]
]
},
"relation": "within"
}
}
}
}
}
}
期待どおりにドキュメントを返してくれます。
しかし、ネストされた場所で geo_shape フィルターを実行すると、次のようになります。
GET test/test/_search
{
"query": {
"filtered": {
"query": {
"match": {
"name": "Bird"
}
},
"filter": {
"nested": {
"path": "gatheringEvent.siteCoordinates",
"filter": {
"geo_shape": {
"gatheringEvent.siteCoordinates.point": {
"shape": {
"type": "polygon",
"coordinates": [
[
[0 ,0 ],
[10 ,0],
[10,10],
[0,10 ],
[0 ,0 ]
]
]
},
"relation": "within"
}
}
}
}
}
}
}
}
結果が出ない..
ネストされたマッピングも削除しましたが、それが問題かもしれないと思ったのですが、「ポイント」フィールドがオブジェクトタイプフィールド内にあるとすぐに、結果が得られません..
私がここで間違っていることについて何か考えはありますか??
ありがとう。