Geo_shape query return empty set

Hello,
I'm using a fresh install of ES 2.0 with this mapping

{
"mappings": {
"poi": {
"properties": {
"id": {
"type": "string",
"index": "not_analyzed"
},
"type": {
"type": "string",
"index": "not_analyzed"
},
"name": {
"type": "string",
"analyzer": "whitespace"
},
"location": {
"type": "geo_shape",
"tree": "quadtree",
"precision": "1m"
},
"tags": {
"type": "object"
}
}
}
}

A sample record

       {
        "id": 418867116,
        "location": {
          "type": "point",
          "coordinates": [
            11.6653751,
            46.7330048
          ]
        },
        "extras": {},
        "name": "Elvas",
        "type": "poi"
      }

The query

{
"query": {
"geo_shape": {
"location": {
"shape": {
"type": "envelope",
"coordinates": [

[10.347760040313005, 45.325425681936885],
[12.082201447337866, 47.05641195871056]

]
}
}
}
}
}

I've tried wih circle, polygon, envelope and I always get an empty result. Data is indexed but no results for geo_shape queries.. Any hint?

Thanks, regards

Hi,
Seems to work for me. What kind of client are you using to issue the search query? I copied your mapping and indexing code to a little script using curl to send the requests, and first I didn't see an empty result set as well. Make sure to wait a tiny bit (~1 sec) after indexing before the document is searchable. This is determined by the index.refresh_interval settings you can read more about here. In this case I get the document back like expected.

Thank you Christoph,
actually with a shell script and single record.. it works!

I've used node.js elasticsearch client to build the create index and to push records with the bulk api.
Maybe the bulk api is the source of my issue? Or an indexing issue?

I'm going to try to insert the records one by one just to see if it works

UPDATE: I've used the bulk api in node.js so that requests are not spawned in parallel. Now I can query point types but I'm unable to search in polylines. A step forward :smile:

UPDATE2: Ok, after inserting records one by one, I can query the data as expected. Need to check if my usage of node.js bulk implementation is faulty.

Best
Luca