diff --git a/pygeoapi/provider/elasticsearch_.py b/pygeoapi/provider/elasticsearch_.py index 67f9816..fc5fe0a 100644 --- a/pygeoapi/provider/elasticsearch_.py +++ b/pygeoapi/provider/elasticsearch_.py @@ -366,7 +366,7 @@ class ElasticsearchProvider(BaseProvider): 'query': { 'bool': { 'filter': [{ - 'match': { + 'match_phrase': { self.mask_prop(self.id_field): identifier } }] @@ -374,12 +374,16 @@ class ElasticsearchProvider(BaseProvider): } } - result = self.es.search(index=self.index_name, body=query) - if len(result['hits']['hits']) == 0: - LOGGER.error(err) - raise ProviderItemNotFoundError(err) - LOGGER.debug('Serializing feature') - feature_ = self.esdoc2geojson(result['hits']['hits'][0]) + try: + result = self.es.search(index=self.index_name, body=query) + if len(result['hits']['hits']) == 0: + LOGGER.error(err) + raise ProviderItemNotFoundError(err) + LOGGER.debug('Serializing feature') + feature_ = self.esdoc2geojson(result['hits']['hits'][0]) + except exceptions.RequestError as err2: + LOGGER.error(err2) + raise ProviderItemNotFoundError(err2) except Exception as err: LOGGER.error(err) return None