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
169 stars 85 forks source link

Unable to retrieve Elastic data by using GeoServer CQL Filters #95

Closed Dp024 closed 5 years ago

Dp024 commented 5 years ago

I am using this elasticgeo plugin in GeoServer. I stored GeoJSON data in elastic search. The GeoJSON data would be like { "type":"Feature","properties":{"ABBREV":"Italy","NAME":"Italy",......}, "geometry":{"type":"MultiPolygon","coordinates":[values...]}}. I inserted multiple countries GeoJSON documents of same sturcture. I published the layer in GeoServer. I am able to retrieve this data by using WMS and WFS service. But, When I am trying to retrieve the data based on fields using cql filter, I am unable to retrieve WMS(Map) and WFS (GeoJSON format) data. I am using in CQL filters -> "properties.ABBREV"='Italy' and also try with properties.ABBREV='Italy' . I am not got the GeoJSON data of Italy( wfs url) and map of Italy (WMS url). and also I am checking with Match query in elastic search like "properties.ABBREV":"Italy" then it showing the matched documents. But, when i apply CQL Filters, it didn't work. I am searching multiple references but I am unable to get the solution for this problem. could you please help on this.

sjudeng commented 5 years ago

If you have access to configure GeoServer, try turning up logging to see the actual Elasticsearch queries that are being executed with your filters.

https://github.com/ngageoint/elasticgeo/blob/master/gs-web-elasticsearch/doc/index.rst#configuring-logging

I think a CQL filter of the form "properties.ABBREV"='Italy' is going to result in an Elasticsearch term filter: {"term": {"ABBREV": "Italy"}}. If the field is analyzed then the search values need to be consistent with the analyzer used. For example, values may need to be lowercase when querying fields analyzed with the default analyzer. https://github.com/ngageoint/elasticgeo/blob/master/gs-web-elasticsearch/doc/index.rst#faq