Hi All, I would like to be able to search against documents using a geo_shape filter where the geojson is a nested subdocument and only retrieve the 1 sub document that matched the geographical filter (not the whole document). I think the docs (specifically nested object type and nested query/filter docs) state this is possible using join:false. For some reason I can't get it to work though and I'm convinced its a user error or lack of understanding.
On ES 90.5 and below is a worked example. Can someone point me in the right direction please? Thanks # Clear the deck and create a new index > curl -XDELETE http://localhost:9200/test {"ok":true,"acknowledged":true} > curl -XPUT http://localhost:9200/test {"ok":true,"acknowledged":true} # Set a new mapping for the testtype > curl -XPUT http://localhost:9200/test/testtype/_mapping -d '{"testtype": {"properties": {"entities": {"type": "nested", "properties": {"geometry": {"tree": "quadtree", "type": "geo_shape","precision": "10m"}}}}}}' {"ok":true,"acknowledged":true} # Index a new document curl -XPUT http://localhost:9200/test/testtype/doc1 -d '{"id" : "doc1", "entities": [{"geometry": {"type" : "Point", "coordinates": [0.0, 0.0]}}, {"geometry": {"type" : "Point", "coordinates": [180.0, 90.0]}}]}' # Query WITH join:false > curl -XGET http://localhost:9200/test/testtype/_search -d '{"query": {"filtered": {"filter": {"nested" : {"path" : "entities", *"join":false*, "filter" : {"geo_shape": {"entities.geometry": {"shape": {"type": "envelope","coordinates": [[-10.0, 10.0],[10.0, -10.0]]}}}}}},"query": {"match_all": {}}}}}' {"took":0,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}} # Query WITHour join:false > curl -XGET http://localhost:9200/test/testtype/_search -d '{"query": {"filtered": {"filter": {"nested" : {"path" : "entities", "filter" : {"geo_shape": {"entities.geometry": {"shape": {"type": "envelope","coordinates": [[-10.0, 10.0],[10.0, -10.0]]}}}}}},"query": {"match_all": {}}}}}' {"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"test","_type":"testtype","_id":"doc1","_score":1.0, "_source" : {"id" : "doc1", "entities": [{"geometry": {"type" : "Point", "coordinates": [0.0, 0.0]}}, {"geometry": {"type" : "Point", "coordinates": [180.0, 90.0]}}]}}]}} -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/87ea2d52-66e1-4418-917a-b9b8d720cb0a%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
