Running a geospatial query


(Gerson Galang) #1

Hi,

I've been trying to get this simple example of running spatial query with
the data I added into ES but couldn't get anything back.Both the intersects
and within return zero hits. Is there anything I am missing?

curl -XDELETE 'http://localhost:9200/_all/'

curl -XPUT 'localhost:9200/locations_index'

curl -XPUT 'http://localhost:9200/locations_index/dataset/_mapping' -d '
{
"dataset":{
"properties":{
"longId":{
"type":"long",
"store":"yes"
},
"id":{
"include_in_all":"false",
"index":"not_analyzed",
"type":"string",
"store":"yes"
},
"location":{
"type":"geo_shape",
"tree":"quadtree",
"precision":"1m",
"store":"yes"
}
}
}
}'

curl -XPUT 'http://localhost:9200/locations_index/dataset/rd_1700' -d '
{
"longId": 1700,
"id": "id_1700",
"location": {
"type":"envelope",
"coordinates":[[96.8, -43.7],[159.1, -9.1]]
}
}'

curl -XGET '
http://localhost:9200/locations_index/dataset/_search?pretty=true' -d '{
"query": {
"geo_shape" : {
"location" : {
"shape":{
"type":"envelope",
"coordinates" : [[96.8, -43.7],[159.1, -9.1]]
},
"relation":"intersects"
}
}
}
}
'

curl -XGET '
http://localhost:9200/locations_index/dataset/_search?pretty=true' -d '{
"query": {
"geo_shape" : {
"location" : {
"shape":{
"type":"envelope",
"coordinates" : [[95.0, -45.7],[160.1, -8.1]]
},
"relation":"within"
}
}
}
}
'

Thanks,
Gerson

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2