def get_entity(entity_id): """Fetch an entity from the index.""" result = es.get(index=entities_index(), doc_type='doc', id=entity_id, ignore=[404], _source_exclude=['text']) return unpack_result(result)
def load_entity(entity_id): """Load a single entity by ID.""" result = es.get(index=es_index, doc_type=TYPE_ENTITY, id=entity_id, ignore=[404]) if result.get('found') is False: return entity = result.get('_source') entity.pop('text', None) entity['id'] = result.get('_id') return entity
def get_entity(entity_id): """Fetch an entity from the index.""" result = es.get(index=es_index, doc_type=TYPE_ENTITY, id=entity_id, ignore=[404]) entity = unpack_result(result) if entity is not None: entity.pop('text', None) return entity
def get_entity(entity_id): """Fetch an entity from the index.""" if entity_id is None: return None for index in entities_index_list(): result = es.get(index=index, doc_type='doc', id=entity_id, ignore=[404], _source_exclude=['text']) result = unpack_result(result) if result is not None: return result