# HG changeset patch
# User Arthur Lutz <arthur.lutz@logilab.fr>
# Date 1472142087 -7200
#      Thu Aug 25 18:21:27 2016 +0200
# Node ID 848960dc68c1797b393a229937caf3ca33b5294a
# Parent  e16e7cb9d87dc1266cb8fde75e33b3db81f3573f
[views] use registry to get indexer

diff --git a/views.py b/views.py
--- a/views.py
+++ b/views.py
@@ -25,7 +25,7 @@
 import cwtags.tag as t
 from cubicweb.view import StartupView
 
-from cubes.elasticsearch.es import indexable_types, get_connection
+from cubes.elasticsearch.es import indexable_types
 from cubes.elasticsearch.search_helpers import compose_search
 
 
@@ -78,7 +78,8 @@
         self.w(u'<h1>%s</h1>' % self._cw._('Recherche'))
         query_string = xml_escape(self._cw.form.get('search', ''))
         self.w(u'<h2>Resultats pour : <em>%s</em></h2>' % query_string)
-        get_connection(self._cw.vreg.config)
+        indexer = self._cw.vreg['es'].select('indexer', self._cw)
+        indexer.get_connection()
         facet_selections = {}
         start, stop = 0, 10
         for key, value in self._cw.form.items():