当前位置: 首页>>代码示例>>Python>>正文


Python ES.get_indices方法代码示例

本文整理汇总了Python中pyes.ES.get_indices方法的典型用法代码示例。如果您正苦于以下问题:Python ES.get_indices方法的具体用法?Python ES.get_indices怎么用?Python ES.get_indices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyes.ES的用法示例。


在下文中一共展示了ES.get_indices方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

# 需要导入模块: from pyes import ES [as 别名]
# 或者: from pyes.ES import get_indices [as 别名]
    def handle(self, *args, **kwargs):
        elastic = ES(settings.SEARCH_HOSTS)

        pp = pprint.PrettyPrinter(indent=4)
        pp.pprint(elastic.get_indices())

        elastic.connection.close()
开发者ID:mkramb,项目名称:zaposlim.se,代码行数:9,代码来源:search_info.py

示例2: handle

# 需要导入模块: from pyes import ES [as 别名]
# 或者: from pyes.ES import get_indices [as 别名]
    def handle(self, *args, **kwargs):
        delete_all = kwargs.get('all')
        elastic = ES(settings.SEARCH_HOSTS)
        indices = []

        if delete_all:
            indices.extend(elastic.get_indices(True))
            indices.extend(elastic.get_closed_indices())

            for index in indices:
                elastic.delete_index_if_exists(index)
        else:
            for source_name in args:
                indices_aliased = [index for index in elastic.get_alias(source_name) if index == source_name]
                elastic.delete_index_if_exists(source_name)

                if indices_aliased:
                    elastic.delete_alias(source_name, indices_aliased)

                    for index in indices_aliased:
                        elastic.delete_index_if_exists(index)

        if len(indices) and len(args):
            elastic.connection.close()
            self.stdout.write("Successfully deleted indicies & aliases.\n")

        elastic.connection.close()
开发者ID:mkramb,项目名称:zaposlim.se,代码行数:29,代码来源:search_delete.py

示例3: count_documents

# 需要导入模块: from pyes import ES [as 别名]
# 或者: from pyes.ES import get_indices [as 别名]
def count_documents():
    num_docs = cache.get('website.documents_count')

    if not num_docs:
        elastic = ES(settings.SEARCH_HOSTS)
        indices = elastic.get_indices()
        elastic.connection.close()

        indices = indices.values()
        num_docs = 0

        for item in indices:
            num_docs += item['num_docs']

        cache.set('website.documents_count', num_docs)

    return num_docs
开发者ID:mkramb,项目名称:zaposlim.se,代码行数:19,代码来源:models.py


注:本文中的pyes.ES.get_indices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。