'Init a es object.
Servers can be defined in different forms:
- host:port with protocol guess (i.e. 127.0.0.1:9200 protocol -> http
127.0.0.1:9500  protocol -> thrift )
- type://host:port (i.e. http://127.0.0.1:9200  https://127.0.0.1:9200 thrift://127.0.0.1:9500)
- (type, host, port) (i.e. tuple ("http", "127.0.0.1", "9200") ("https", "127.0.0.1", "9200")
("thrift", "127.0.0.1", "9500")). This is the prefered form.
:param server: the server name, it can be a list of servers.
:param timeout: timeout for a call
:param bulk_size: size of bulk operation
:param encoder: tojson encoder
:param max_retries: number of max retries for server if a server is down
:param retry_time: number of seconds between retries
:param basic_auth: Dictionary with \'username\' and \'password\' keys for HTTP Basic Auth.
:param model: used to objectify the dictinary. If None, the raw dict is returned.
:param dump_curl: If truthy, this will dump every query to a curl file.  If
this is set to a string value, it names the file that output is sent
to.  Otherwise, it should be set to an object with a write() method,
which output will be written to.
:param raise_on_bulk_item_failure: raises an exception if an item in a
bulk operation fails
:param document_object_field: a class to use as base document field in mapper'

def __init__(self, server='localhost:9200', timeout=30.0, bulk_size=400, encoder=None, decoder=None, max_retries=3, retry_time=60, default_indices=None, default_types=None, log_curl=False, dump_curl=False, model=ElasticSearchModel, basic_auth=None, raise_on_bulk_item_failure=False, document_object_field=None, bulker_class=ListBulker, cert_reqs='CERT_OPTIONAL'):

    if (default_indices is None):
        default_indices = ['_all']
    self.timeout = timeout
    self.default_indices = default_indices
    self.max_retries = max_retries
    self.retry_time = retry_time
    self.cluster = None
    self.debug_dump = False
    self.cluster_name = 'undefined'
    self.basic_auth = basic_auth
    self.connection = None
    self._mappings = None
    self.document_object_field = document_object_field
    if (model is None):
        model = (lambda connection, model: model)
    self.model = model
    self.log_curl = log_curl
    if dump_curl:
        if isinstance(dump_curl, six.string_types):
            self.dump_curl = codecs.open(dump_curl, 'wb', 'utf8')
        elif hasattr(dump_curl, 'write'):
            self.dump_curl = dump_curl
        else:
            raise TypeError('dump_curl    parameter    must    be    supplied    with    a    string    or    an    object    with    a    write()    method')
    else:
        self.dump_curl = None
    self._bulk_size = bulk_size
    self.bulker = bulker_class(weakref.proxy(self), bulk_size=bulk_size, raise_on_bulk_item_failure=raise_on_bulk_item_failure)
    self.bulker_class = bulker_class
    self._raise_on_bulk_item_failure = raise_on_bulk_item_failure
    connection_http.CERT_REQS = cert_reqs
    self.info = {}
    if encoder:
        self.encoder = encoder
    if decoder:
        self.decoder = decoder
    if isinstance(server, six.string_types):
        self.servers = [server]
    elif isinstance(server, tuple):
        self.servers = [server]
    else:
        self.servers = server
    self.indices = Indices(weakref.proxy(self))
    self.cluster = Cluster(weakref.proxy(self))
    self.default_types = (default_types or [])
    self._check_servers()
    self._init_connection()
