當前位置: 首頁>>代碼示例>>Python>>正文


Python ES.bulk_index_relations方法代碼示例

本文整理匯總了Python中nefertari.elasticsearch.ES.bulk_index_relations方法的典型用法代碼示例。如果您正苦於以下問題:Python ES.bulk_index_relations方法的具體用法?Python ES.bulk_index_relations怎麽用?Python ES.bulk_index_relations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nefertari.elasticsearch.ES的用法示例。


在下文中一共展示了ES.bulk_index_relations方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: on_bulk_delete

# 需要導入模塊: from nefertari.elasticsearch import ES [as 別名]
# 或者: from nefertari.elasticsearch.ES import bulk_index_relations [as 別名]
def on_bulk_delete(model_cls, objects, request):
    if not getattr(model_cls, '_index_enabled', False):
        return

    pk_field = model_cls.pk_field()
    ids = [getattr(obj, pk_field) for obj in objects]

    from nefertari.elasticsearch import ES
    es = ES(source=model_cls.__name__)
    es.delete(ids, request=request)

    # Reindex relationships
    es.bulk_index_relations(objects, request=request)
開發者ID:numb3r3,項目名稱:nefertari-sqla,代碼行數:15,代碼來源:signals.py

示例2: on_bulk_update

# 需要導入模塊: from nefertari.elasticsearch import ES [as 別名]
# 或者: from nefertari.elasticsearch.ES import bulk_index_relations [as 別名]
def on_bulk_update(model_cls, objects, request):
    if not getattr(model_cls, '_index_enabled', False):
        return

    if not objects:
        return

    from nefertari.elasticsearch import ES
    es = ES(source=model_cls.__name__)
    documents = to_dicts(objects)
    es.index(documents, request=request)

    # Reindex relationships
    es.bulk_index_relations(objects, request=request, nested_only=True)
開發者ID:oleduc,項目名稱:nefertari-mongodb,代碼行數:16,代碼來源:signals.py

示例3: on_bulk_update

# 需要導入模塊: from nefertari.elasticsearch import ES [as 別名]
# 或者: from nefertari.elasticsearch.ES import bulk_index_relations [as 別名]
def on_bulk_update(update_context):
    request = getattr(
        update_context.query, '_request', None)
    model_cls = update_context.mapper.entity
    if not getattr(model_cls, '_index_enabled', False):
        return

    objects = update_context.query.all()
    if not objects:
        return

    from nefertari.elasticsearch import ES
    es = ES(source=model_cls.__name__)
    es.index(objects, request=request)

    # Reindex relationships
    es.bulk_index_relations(objects, request=request, nested_only=True)
開發者ID:geniusproject,項目名稱:nefertari-sqla,代碼行數:19,代碼來源:signals.py


注:本文中的nefertari.elasticsearch.ES.bulk_index_relations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。