本文整理汇总了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')
示例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')