def delete_collection(collection_id, wait=True): """Delete all documents from a particular collection.""" query_delete({'term': {'collection_id': collection_id}}, wait=wait) es.delete(index=es_index, doc_type=TYPE_COLLECTION, id=collection_id, ignore=[404])
def delete_collection(collection_id): """Delete all documents from a particular collection.""" es.delete(index=collections_index(), doc_type='doc', refresh=True, id=collection_id, ignore=[404])
def delete_collection(collection_id, sync=False): """Delete all documents from a particular collection.""" es.delete(collections_index(), doc_type='doc', id=str(collection_id), refresh=sync, ignore=[404])
def delete_collection(collection_id, sync=False): """Delete all documents from a particular collection.""" es.delete( collections_index(), id=str(collection_id), refresh=refresh_sync(sync), ignore=[404], )
def delete_collection(collection_id, wait=True): """Delete all documents from a particular collection.""" delete_entities(collection_id, wait=wait) delete_documents(collection_id, wait=wait) es.delete(index=collections_index(), doc_type='doc', id=collection_id, ignore=[404])
def delete_collection(collection_id, wait=True): """Delete all documents from a particular collection.""" query = {'term': {'collection_id': collection_id}} query_delete(records_index(), query, wait=wait) query_delete(entities_index(), query, wait=wait) es.delete(index=collections_index(), doc_type=collection_type(), id=collection_id, ignore=[404])
def delete_entity(entity_id, exclude=None, sync=False): """Delete an entity from the index.""" if exclude is not None: exclude = entities_write_index(exclude) for entity in entities_by_ids(entity_id, excludes='*'): index = entity.get('_index') if index == exclude: continue es.delete(index=index, id=entity_id, refresh=refresh_sync(sync))
def delete_entity(entity_id, exclude=None, sync=False): """Delete an entity from the index.""" if exclude is not None: exclude = entities_write_index(exclude) for entity in entities_by_ids(entity_id, excludes='*'): index = entity.get('_index') if index == exclude: continue try: es.delete(index=index, id=entity_id, refresh=refresh_sync(sync)) q = {'term': {'entities': entity_id}} query_delete(entities_read_index(), q, sync=sync) except NotFoundError: # This is expected in some cases. For example, when 2 Things are # connected by an Interval and all the 3 entities get deleted # simultaneously, Aleph tries to delete the Interval thrice due to # recursive deletion of adjacent entities. ElasticSearch throws a # 404 in that case. # In those cases, we want to skip both the `es.delete` step and # the `query_delete` step. log.warning("Delete failed for entity %s - not found", entity_id) continue
def delete_document(document_id): clear_records(document_id) try: es.delete(index=es_index, doc_type=TYPE_DOCUMENT, id=document_id) except NotFoundError: pass
def delete_collection(collection_id, sync=False): """Delete all documents from a particular collection.""" es.delete(collections_index(), id=str(collection_id), refresh=refresh_sync(sync), ignore=[404])
def delete_collection_entities(): q = {'query': {'exists': {'field': 'collection_id'}}} for ent in scan(es, query=q, index=es_index, doc_type=[TYPE_ENTITY]): es.delete(index=es_index, doc_type=TYPE_ENTITY, id=ent.get('_id'))
def delete_entity(entity_id): """Delete an entity from the index.""" es.delete(index=es_index, doc_type=TYPE_ENTITY, id=entity_id, ignore=[404])
def delete_document(document_id): clear_records(document_id) es.delete(index=es_index, doc_type=TYPE_DOCUMENT, id=document_id, ignore=[404])
def delete_document(document_id): clear_records(document_id) try: es.delete(index=es_index, doc_type=TYPE_DOCUMENT, id=document_id) except NotFoundError: log.info("Delete non-existent document from index: %s", document_id)
def delete_safe(index, id, sync=False): es.delete(index=index, id=str(id), ignore=[404], refresh=refresh_sync(sync))
def delete_entity(entity_id, sync=False): """Delete an entity from the index.""" refresh = 'wait_for' if sync else False for index in entities_index_list(): es.delete(index=index, doc_type='doc', id=str(entity_id), refresh=refresh, ignore=[404])
def delete_entity(entity_id): """Delete an entity from the index.""" es.delete(index=entities_index(), doc_type=entity_type(), id=entity_id, ignore=[404])
def delete_document(document_id): clear_records(document_id) es.delete(index=entities_index(), doc_type=entity_type(), id=document_id, ignore=[404])
def delete_entity(entity_id): """Delete an entity from the index.""" for index in entities_index_list(): es.delete(index=index, doc_type='doc', id=entity_id, ignore=[404])