0

I'm trying to get a list of record intersecting a circle.

the mappings: I have a geo_point and a geo_shape but I'm referring at geo_shape exclusively

{
   "mappings": {
      "poi": {
         "properties": {
            "id": {
               "type": "string",
               "index": "not_analyzed"
            },
            "type": {
               "type": "string",
               "index": "not_analyzed"
            },
            "name": {
               "type": "string",
               "analyzer": "whitespace"
            },
            "pin": {
               "type": "geo_point"
            },
            "geometry": {
               "type": "geo_shape",
               "tree": "quadtree",
               "precision": "1m"
            },
            "extras": {
               "type": "object"
            }
         }
      }
   }
}

a record (first of list, not necessarily matching)

{
   "id": 416824728,
   "pin": [
      11.2418666,
      46.4718564
   ],
   "geometry": {
      "type": "Point",
      "coordinates": [
         11.2418666,
         46.4718564
      ]
   },
   "extras": {
      "capacity": "5",
      "amenity": "parking",
      "fee": "no"
   },
   "name": "",
   "type": "poi"
}

the query:

{
   "query": {
      "filtered": {
         "query": {
            "match_all": {}
         },
         "filter": {
            "geo_shape": {
               "geometry": {
                  "shape": {
                     "type": "circle",
                     "radius": "100km",
                     "coordinates": [
                        11,
                        46
                     ]
                  }
               }
            }
         }
      }
   }
}

Any suggestion?

Thanks

Val
  • 207,596
  • 13
  • 358
  • 360
lcapra
  • 1,420
  • 16
  • 18
  • I've created the index/mapping and added the sample document you shared and your search query does return that document perfectly. Can you tell how you're doing the query (what client, which HTTP method, which URL, ...)? – Val Nov 06 '15 at 05:21
  • Yes I had the same results trying by my self.. see my response (Actually I've cross posted from here https://discuss.elastic.co/t/geo-shape-query-return-empty-set/33860) Thanks – lcapra Nov 06 '15 at 10:11

1 Answers1

0

I was using the node.js bulk api implementation in parallel and the records where not searchable.

Leveraging on promises I've used the bulk api in series, but only Point types where searchable then.

After switching to an insertion of records one-by-one, all the records (comprising Polygon and LineString) where correctly indexed(?) and thus search-able.

lcapra
  • 1,420
  • 16
  • 18