Skip to content

Commit

Permalink
Passes no mapping test for find and find_one; but string contains is …
Browse files Browse the repository at this point in the history
…a fragile solution
  • Loading branch information
Nicholas Iaquinto committed May 19, 2015
1 parent d375c3e commit 452fe73
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion eve_elastic/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,13 @@ def find(self, resource, req, sub_resource_lookup):
query['aggs'] = source_config['aggregations']

args = self._es_args(resource)
hits = self.es.search(body=query, **args)
try:
hits = self.es.search(body=query, **args)
except elasticsearch.exceptions.RequestError as e:
if e.status_code == 400 and "No mapping found for" in e.error:
hits = {}
else:
raise
return self._parse_hits(hits, resource)

def find_one(self, resource, req, **lookup):
Expand Down

0 comments on commit 452fe73

Please sign in to comment.