ngageoint / elasticgeo

ElasticGeo provides a GeoTools data store that allows geospatial features from an Elasticsearch index to be published via OGC services using GeoServer.
GNU General Public License v3.0
168 stars 85 forks source link

WFS FeatureID query values #120

Open StephenBMarwick opened 3 years ago

StephenBMarwick commented 3 years ago

When querying using WFS with GetFeature, responses are returned with the elastic id prefixed with layer id as the id (aka featureid). Attempting to obtain a specific feature using the returned featureid results in no results being returned.

Looking at the query being sent to ElasticSearch, it seems that ElasticGeo is not stripping the layer id prefix before forwarding the query. ElasticSearch has no concept of the layer name that ElasticGeo provides, so it does not match anything.

I'm using the following versions:

Is there some configuration setting that I might be missing?

albertwgchu commented 3 years ago

We've encountered the same issue as you describe. We use javascript to strip out the layer id prefix as a work around.

I'm not sure if the layer id prefix is needed? Maybe for collisions when there's multiple layers? If not it would be preferable to just use the elastic id.

StephenBMarwick commented 3 years ago

Thanks for the sanity check @albertwgchu. A little reading I did suggested it was something to do with the GML identifier gml:id needing to start with an alpha (not numeric) character. As this can't be guaranteed with Elasticsearch, which does allow identifiers to start with numerics, another identifier is added. Unfortunately, I can't find the reference to put here. I don't think this is a particularly strong reason to use the layer id, so I suspect there are other reasons behind the decision. I'm looking to modify the code to strip the layer id on inbound queries. I'll probably feed the change back here as a PR when I'm ready.