How to search the records with locations all in a polygon or multiPolygon?


(阙裕斌) #1

I add the mappings and insert a record with 2 locations ([13, 13], [52,
52]),
and I want to search the results with it's locations all in the polygon,not
one of the locations in the polygon. would you please tell me how to search
the reslut?

curl -XPOST localhost:9200/test5 -d '{
"mappings" : {
"gistype" : {
"properties" : {
"address":{
"properties":{
"location":{"type" : "geo_point"}
}
}
}
}
}
}'

curl -XPUT 'http://localhost:9200/test5/gistype/1' -d '{
"name": "Wind & Wetter, Berlin, Germany",
"address": [
{
"name":1,
"location": [13, 13]
},
{
"name":2,
"location": [52, 52]
}
]
}'

I searched like this , but I want to search the record locations all in the
polygon. So it's wrong .

curl -XGET 'http://localhost:9200/test5/gistype/_search?pretty=true' -d '{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"geo_polygon" : {
"location" : {
"points" : [
{"lat" : 0, "lon" : 0},
{"lat" : 14, "lon" : 0},
{"lat" : 14, "lon" : 14},
{"lat" : 0, "lon" : 14}
]
}
}
}
}
}
}'

@kimchy

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5d156505-9695-4315-8826-884d8e4f1f8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2