示例#1
0
 def __init__(self, domain):
     auth = self._get_auth()
     host = self._get_host(auth)
     es_header = [{
         'host': host,
         'port': 443,
         'use_ssl': True,
         'http_auth': (auth[0], auth[1])
     }]
     Elasticsearch.__init__(self, es_header)
示例#2
0
    def __init__(self, *args, **kwargs):

        if "index" not in kwargs:
            raise Exception("Please set index!")

        kwargs["timeout"] = 120

        self._index = kwargs["index"]
        del kwargs["index"]

        Elasticsearch.__init__(self, *args, **kwargs)
示例#3
0
 def __init__(self):  # adapted for flexible indexnames
     Elasticsearch.__init__(self, host='elasticsearch')
     #self.indices.refresh()
     self.host = 'elasticsearch'
     self.data = {}
     self.entities = True
     self.n_expand = 5
     self.n_results = 100
     #self.w2vmodelnl	   = "../data/dutch_word2vec_model.bin"
     self.w2vmodelnl = None
     self.w2vmodelen = "../data/gist_word2vec_model.bin"
     self.load_w2vmodel(self.w2vmodelnl, self.w2vmodelen)
示例#4
0
    def __init__(self, hosts=None, transport_class=Transport, **kwargs):
        """
            :arg hosts: list of nodes we should connect to. Node should be a
                dictionary ({"host": "localhost", "port": 9200}), the entire dictionary
                will be passed to the :class:`~elasticsearch.Connection` class as
                kwargs, or a string in the format of ``host[:port]`` which will be
                translated to a dictionary automatically.  If no value is given the
                :class:`~elasticsearch.Urllib3HttpConnection` class defaults will be used.

            :arg transport_class: :class:`~elasticsearch.Transport` subclass to use.

            :arg kwargs: any additional arguments will be passed on to the
                :class:`~elasticsearch.Transport` class and, subsequently, to the
                :class:`~elasticsearch.Connection` instances.


        """
        Elasticsearch.__init__(self, hosts=hosts, transport_class=transport_class, **kwargs)

        self.features = FeaturesClient(self)
        self.models = ModelsClient(self)
示例#5
0
 def __init__(self):
     Elasticsearch.__init__(self, [{'host': 'localhost', 'port': 9200}])
示例#6
0
 def __init__(self, hosts=None, transport_class=Transport, **kwargs):
     self.producer = Producer()
     self.topic = _.get(settings.SYNC, 'rts.queue.key')
     Elasticsearch.__init__(hosts=hosts,
                            transport_class=transport_class,
                            **kwargs)