Elasticsearch-返回给定点中的多边形(“关系”:“相交会返回并集”)

时间:2018-07-26 00:38:12

标签: elasticsearch kibana

索引中有多个多边形,我试图返回给定点中的所有多边形。

但是我的查询返回了索引中的所有文档,即使它不属于多边形1。

它给了我结合而不是相交。

查询在下面

地图参考。 http://geojson.io/#map=7/-31.775/144.382

PUT /example3
{

 "mappings": {
      "_doc": {
        "properties": {
          "features": {
            "properties": {
              "geometry": {
                "type": "geo_shape"

              }
            }
          }
        }
      }
    }
}

样本数据:

{
      "type": "Feature",
      "geometry": {
        "name": "Poly - 04",
        "type": "Polygon",
        "coordinates": [
        [
            [
              144.91670608520508,
              -37.82524314302977
            ],
            [
              144.96846199035645,
              -37.82524314302977
            ],
            [
              144.96846199035645,
              -37.78787789236923
            ],
            [
              144.91670608520508,
              -37.78787789236923
            ],
            [
              144.91670608520508,
              -37.82524314302977
            ]
          ]

        ]
      }
    }

查询:

    GET /example3/_search
    {
        "query":{
            "bool": {
                "must": {
                    "match_all": {}
                },
                "filter": {
                    "geo_shape": {
                        "features.geometry": {
                          "relation": "intersects",
                            "shape": {
                                "type": "point",
                                "coordinates" : 
                                   [
                                      146.0138,
                                      -37.1734

                                    ]

                            }
                        }
                    }
                }
            }
        }
    }

0 个答案:

没有答案