# self._doc_type = 'gene'
self._index = ES_INDEX_NAME_ALL
self._doc_type = ES_INDEX_TYPE
self._total_scroll_size = 1000
return [self._get_genedoc(hit, dotfield=dotfield) for hit in hits['hits']]
- def _clean_res2(self, res):
- ''' res is the dictionary returned from a query.
- do some reformating of raw ES results before returning.
- This method is used for self.query method.
- for attr in ['took', 'facets', 'aggregations', '_scroll_id']:
- _res['hits'] = [self._get_genedoc(hit) for hit in _res['hits']]
def _cleaned_res_2(self, res, empty=[], error={'error': True},
single_hit=False, dotfield=True, fields=None):
dotfield=dotfield, fields=fields)
+ def _cleaned_res_3(self, res):
+ ''' res is the dictionary returned from a query.
+ do some reformating of raw ES results before returning.
+ This method is used for self.query method.
+ for attr in ['took', 'facets', 'aggregations', '_scroll_id']:
+ _res['hits'] = [self._get_genedoc_2(hit) for hit in _res['hits']]
def _cleaned_scopes(self, scopes):
'''return a cleaned scopes parameter.
should be either a string or a list of scope fields.
return {'success': False, 'error': msg}
- res = self._clean_res2(res)
+ res = self._cleaned_res_3(res)
#_res['took'] = res['took']
return {'success': False, 'error': 'No results to return.'}
- res = self._clean_res2(r)
+ res = self._cleaned_res_3(r)
#res.update({'_scroll_id': scroll_id})
if r['_shards']['failed']:
res.update({'_warning': 'Scroll request has failed on {} shards out of {}.'.format(r['_shards']['failed'], r['_shards']['total'])})