diff --git a/es.py b/es.py index 9575714a94be82bb55fe29b2356b7376b7fd8dbc_ZXMucHk=..62fe7cbe262dac10d822745169eceb5815f20261_ZXMucHk= 100644 --- a/es.py +++ b/es.py @@ -103,7 +103,6 @@ if locations and index_name: # TODO sanitize locations es = connections.create_connection(hosts=locations.split(','), - index=index_name, timeout=20) try: if not es.indices.exists(index=index_name): diff --git a/views.py b/views.py index 9575714a94be82bb55fe29b2356b7376b7fd8dbc_dmlld3MucHk=..62fe7cbe262dac10d822745169eceb5815f20261_dmlld3MucHk= 100644 --- a/views.py +++ b/views.py @@ -39,7 +39,9 @@ 'creation_date': DateHistogramFacet(field='creation_date', interval='month'), } - def __init__(self, query=None, filters={}, doc_types=None): + def __init__(self, query=None, filters={}, doc_types=None, index=None): + if index: + self.index = index if doc_types: self.doc_types = doc_types super(CWFacetedSearch, self).__init__(query, filters) @@ -115,6 +117,7 @@ indexable = indexable_types(self._cw.vreg.schema) return CWFacetedSearch(query_string, facet_selections, + index=self._cw.vreg.config.get('index-name'), doc_types=indexable)[start:stop] def display_results(self, response):