コード例 #1
0
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])
コード例 #2
0
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])
コード例 #3
0
ファイル: collections.py プロジェクト: jbaehne/aleph
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])
コード例 #4
0
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],
    )
コード例 #5
0
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])
コード例 #6
0
ファイル: collections.py プロジェクト: GelLiNN/aleph
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])
コード例 #7
0
ファイル: entities.py プロジェクト: vishalbelsare/aleph
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))
コード例 #8
0
ファイル: entities.py プロジェクト: pudo/aleph
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))
コード例 #9
0
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
コード例 #10
0
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
コード例 #11
0
ファイル: collections.py プロジェクト: pudo/aleph
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])
コード例 #12
0
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'))
コード例 #13
0
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])
コード例 #14
0
ファイル: documents.py プロジェクト: kaue-cauin/aleph
def delete_document(document_id):
    clear_records(document_id)
    es.delete(index=es_index,
              doc_type=TYPE_DOCUMENT,
              id=document_id,
              ignore=[404])
コード例 #15
0
ファイル: documents.py プロジェクト: fin/aleph
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)
コード例 #16
0
def delete_safe(index, id, sync=False):
    es.delete(index=index,
              id=str(id),
              ignore=[404],
              refresh=refresh_sync(sync))
コード例 #17
0
ファイル: entities.py プロジェクト: mustafaascha/aleph
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])
コード例 #18
0
ファイル: entities.py プロジェクト: GelLiNN/aleph
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])
コード例 #19
0
ファイル: documents.py プロジェクト: GelLiNN/aleph
def delete_document(document_id):
    clear_records(document_id)
    es.delete(index=entities_index(),
              doc_type=entity_type(),
              id=document_id,
              ignore=[404])
コード例 #20
0
ファイル: entities.py プロジェクト: roukdanus/aleph
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])