Elasticsearch:搜索包含点的geo_shape

时间:2016-03-17 11:14:40

标签: elasticsearch geospatial geojson elastic-stack geotagging

我正在尝试正确格式化一个返回多边形geo_shape的查询,给定一个点geo_shape。

elasticsearch版本是2.2.1

我的映射是

"outputarea-index" : {
    "aliases" : { },
    "mappings" : {
      "outputarea" : {
        "properties" : {
          "location" : {
            "type" : "geo_shape",
            "tree" : "quadtree",
            "precision" : "10.0m"
          },
          "oa_id" : {
            "type" : "string"
          }
        }
      }
    },

我的文件是

"type": "Feature", "properties": { "OA11CD": "E00000001", "LAD11CD": "E09000001" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -0.094486180992449, 51.520329824877336 ], [ -0.094515616052987, 51.52023932543856 ], [ -0.094539915144025, 51.520164470526943 ], [ -0.094544324018805, 51.52015070261556 ], [ -0.094573093007717, 51.520060614990577 ], [ -0.094615644263065, 51.519921085391069 ], [ -0.094621105045769, 51.519903180006096 ], [ -0.094632294581515, 51.519882705887319 ], [ -0.094643015216892, 51.519863105420363 ], [ -0.094647432986907, 51.519854993963698 ], [ -0.09453051769114, 51.519828787812926 ], [ -0.09447184960877, 51.519809849605494 ], [ -0.094504707419636, 51.519759242770952 ], [ -0.094536816899835, 51.519766967440994 ], [ -0.094713504727674, 51.519809476840926 ], [ -0.095790721630945, 51.520068626885028 ], [ -0.096121025721161, 51.520148096396902 ], [ -0.096088566098825, 51.520210274553293 ], [ -0.09599411910667, 51.520223857913599 ], [ -0.096014162391047, 51.520262734328782 ], [ -0.096046381877994, 51.520325207001612 ], [ -0.096220261861897, 51.520293417056905 ], [ -0.0965101097006, 51.520240425029648 ], [ -0.096510142797268, 51.520240668365567 ], [ -0.096515641941531, 51.520274371752606 ], [ -0.096329725955979, 51.520308934330373 ], [ -0.096313949525538, 51.520311870631495 ], [ -0.095956238129518, 51.520377995755709 ], [ -0.095800108757507, 51.520406161727557 ], [ -0.09567888031131, 51.520428014835232 ], [ -0.095613131457773, 51.520439878630029 ], [ -0.095440650073645, 51.520470944007648 ], [ -0.095356224874306, 51.520486146380406 ], [ -0.095269034239812, 51.520501987218282 ], [ -0.095266187305836, 51.520502507517243 ], [ -0.095234378645064, 51.520508285753003 ], [ -0.095079358314049, 51.520536450794644 ], [ -0.09477056340925, 51.520594347219664 ], [ -0.094752475812971, 51.520597740360863 ], [ -0.094389398782176, 51.520662802375568 ], [ -0.094396489284427, 51.520638664664645 ], [ -0.094400152058549, 51.520626197549888 ], [ -0.094414604769778, 51.520576937359905 ], [ -0.094452530601296, 51.520445336047963 ], [ -0.094486180992449, 51.520329824877336 ] ] ] } },

,查询是

'query': {'bool': {'filter': {'geo_shape': {'location': {'shape': {'type': 'point', 'coordinates': [-0.096786, 51.517569]}, 'relation': 'contains'}}}, 'must': {'match_all': {}}}}, 'size': 10}

结果:

  

TransportError(400,u'search_phase_execution_exception',u'')

任何想法?

完整错误是

2016-03-17 17:00:43,729][INFO ][rest.suppressed ] /outputarea-index/_search Params: {index=outputarea-index} Failed to execute phase [query], all shards failed; shardFailures {[zu3E6F7kQRWnDPY5L9zF-w][outputarea-index][0]: RemoteTransportException[[ec2-1][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: SearchParseException[failed to parse search source [{"query" : {"bool": {"filter": {"geo_shape": {"location": {"shape": {"type": "point", "coordinates": [-0.097519, 51.522401]}, "relation": "contains"}}}, "must": {"match_all": {}}}}, "size": 10}]]; nested: IllegalArgumentException[]; }{[zu3E6F7kQRWnDPY5L9zF-w][outputarea-index][1]: RemoteTransportException[[ec2-1][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: SearchParseException[failed to parse search source [{"query": {"bool": {"filter": {"geo_shape": {"location": {"shape": {"type": "point", "coordinates": [-0.097519, 51.522401 ]}, "relation": "contains"}}}, "must": {"match_all": {}}}}, "size": 10}]]; nested: IllegalArgumentException[]; }{[zu3E6F7kQRWnDPY5L9zF-w][outputarea-index][2]: RemoteTransportException[[ec2-1][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: SearchParseExc eption[failed to parse search source [{"query": {"bool": {"filter": {"geo_shape": {"location": {"shape": {"type": "point", "coordinates": [-0.097519, 51.522401]}, "relation": "contains"}}}, "must": {"match_all": {}}}}, "size": 10}]]; nested: IllegalArgumentException[]; }{ [zu3E6F7kQRWnDPY5L9zF-w][outputarea-index][3]: RemoteTransportException[[ec2-1][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: SearchParseException[failed to parse search source [{"query": {"bool": {"filter": {"geo_shape": {"location": {"shape": {"type": "point", "coordinates": [-0.097519, 51.522401]}, "relation": "contains"}}}, "must": {"match_all": {}}}}, "size": 10}]]; nested: IllegalArgumentException[]; }{[zu3E6F7kQRWnDPY5L9zF-w][outputarea-index][4]: RemoteTransportException[[ec2-1][127.0.0.1:9300][indices:data/read /search[phase/query]]]; nested: SearchParseException[failed to parse search source [{"query": {"bool": {"filter": {"geo_shape": {"location": {"shape": {"type": "point", "coordinates": [-0.097519, 51.522401]}, "relation": "contains"}}}, "must": {"match_all": {}}}}, "size": 10}]]; nested: IllegalArgumentException[]; }

0 个答案:

没有答案