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


Python ElasticSettings.indices_str方法代码示例

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


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

示例1: search

# 需要导入模块: from elastic.elastic_settings import ElasticSettings [as 别名]
# 或者: from elastic.elastic_settings.ElasticSettings import indices_str [as 别名]
def search(request, query, search_idx=ElasticSettings.indices_str()):
    ''' Renders a elastic results page based on the query '''

    aggs = Aggs(Agg("categories", "terms", {"field": "_type", "size": 0}))
    elastic = Search.field_search_query(query, aggs=aggs, fields=fields,
                                        search_from=0, size=20, idx=search_idx)
    result = elastic.search()
    context = {}
    context['diseases'] = _add_diseases()
    context['total'] = result.hits_total
    context['db'] = result.idx
    context['size'] = result.size
    context['query'] = result.query
    context["idxs"] = _categories(result.idx)
    return render(request, 'search/searchresults.html', context,
                  content_type='text/html')
开发者ID:D-I-L,项目名称:django_template,代码行数:18,代码来源:views.py

示例2: range_overlap_search

# 需要导入模块: from elastic.elastic_settings import ElasticSettings [as 别名]
# 或者: from elastic.elastic_settings.ElasticSettings import indices_str [as 别名]
def range_overlap_search(request, src, start, stop, search_idx=ElasticSettings.indices_str()):
    ''' Renders a elastic result page based on the src, start and stop '''
    elastic = Search.range_overlap_query(src, start, stop, idx=search_idx)

    result = elastic.search()
    context = {}
    context['diseases'] = _add_diseases()
    context['total'] = result.hits_total
    context['db'] = result.idx
    context['size'] = result.size
    context['query'] = result.query
    context["idxs"] = _categories(result.idx)
    context["chromosome"] = src
    context["start"] = start
    context["stop"] = stop
    return render(request, 'search/searchresults.html', context,
                  content_type='text/html')
开发者ID:D-I-L,项目名称:django_template,代码行数:19,代码来源:views.py


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