Unable to search indexed-shape if excluding source


(Peter Neubauer) #1

Hi there,
I indexed shapes in an ELS 1.7.3 index that have the mapping

{"wof":
  {"_source":
    {"excludes":["shape"]},
    "properties":{ 
       "shape":{
          "type":"geo_shape",
          "tree":"quadtree",
         "tree_levels":20}...

Because the shape-fields are quite big in certain cases and slow down source retrieval (they come from https://github.com/whosonfirst/whosonfirst-data)
Now, normal searches like this are working correctly:

{
  "query": {
    "filtered": {
  "query": {
    "match_all": {}
  },
  "filter": {
    "geo_shape": {
      "shape": {
        "shape": {
          "type": "Point",
          "coordinates": [
            12.96,
            55.59
          ]
        }
      }
    }
  }
}
}
}

But something like an indexed shape in another index (mapimages/mapimage) query fails:

{
"query": {
"filtered": {
  "query": {
    "match_all": {}
  },
  "filter": {
    "geo_shape": {
      "l_shape": {
        "indexed_shape": {
          "id": "101752283",
          "index": "wofs",
          "type": "wof",
          "path": "shape"
        }
      }
    }
  }
}
} 
}

with an exception:

ElasticsearchIllegalStateException[Shape with name [101752283] found but missing shape field];

That field is there but only indexed, and it should not be needed, since the query is going against the mapimages/mapimage documents and never needing the wof.shape field?

Why is the first query working but no the second?

Thanks for any help!

/peter


(Colin Goodheart-Smithe) #2

The indexed shapes feature in the geo_shape query works by retrieving (by using the GET document API) the specified shape document from the index (in this case /wofs/wof/101752283) and reading the field in the source of the document specified in the path (in this case the shape field). If you exclude the shape field from the source ES wont be able to access the shape definition and therefore won't be able to execute the query.


(Peter Neubauer) #3

Ahh,
ok - I thought there would be some reuse of the already indexed shape more than just getting the source.

Thanks a lot for the fast answer @colings86 !

/peter


(system) #4