def __init__(self, host='es', port=14900):
    self.host = host
    self.port = port
    self.return_hits = []
    self.search = mock.Mock()
    self.deprecated_search = mock.Mock()
    self.create = mock.Mock()
    self.index = mock.Mock()
    self.delete = mock.Mock()
    self.info = mock.Mock(return_value={'status': 200, 'name': 'foo', 'version': {'number': '2.0'}})
    self.ping = mock.Mock(return_value=True)
    self.indices = mock_es_indices_client()
    self.es_version = mock.Mock(return_value='2.0')
    self.is_atleastfive = mock.Mock(return_value=False)
    self.is_atleastsix = mock.Mock(return_value=False)
    self.is_atleastsixtwo = mock.Mock(return_value=False)
    self.is_atleastsixsix = mock.Mock(return_value=False)
    self.is_atleastseven = mock.Mock(return_value=False)

    def writeback_index_side_effect(index, doc_type):
        if (doc_type == 'silence'):
            return (index + '_silence')
        elif (doc_type == 'past_elastalert'):
            return (index + '_past')
        elif (doc_type == 'elastalert_status'):
            return (index + '_status')
        elif (doc_type == 'elastalert_error'):
            return (index + '_error')
        return index
    self.resolve_writeback_index = mock.Mock(side_effect=writeback_index_side_effect)
def __init__(self, host='es', port=14900):
    self.host = host
    self.port = port
    self.return_hits = []
    self.search = mock.Mock()
    self.deprecated_search = mock.Mock()
    self.create = mock.Mock()
    self.index = mock.Mock()
    self.delete = mock.Mock()
    self.info = mock.Mock(return_value={'status': 200, 'name': 'foo', 'version': {'number': '2.0'}})
    self.ping = mock.Mock(return_value=True)
    self.indices = mock_es_indices_client()
    self.es_version = mock.Mock(return_value='2.0')
    self.is_atleastfive = mock.Mock(return_value=False)
    self.is_atleastsix = mock.Mock(return_value=False)
    self.is_atleastsixtwo = mock.Mock(return_value=False)
    self.is_atleastsixsix = mock.Mock(return_value=False)
    self.is_atleastseven = mock.Mock(return_value=False)

    def writeback_index_side_effect(index, doc_type):
        if (doc_type == 'silence'):
            return (index + '_silence')
        elif (doc_type == 'past_elastalert'):
            return (index + '_past')
        elif (doc_type == 'elastalert_status'):
            return (index + '_status')
        elif (doc_type == 'elastalert_error'):
            return (index + '_error')
        return index
    self.resolve_writeback_index = mock.Mock(side_effect=writeback_index_side_effect)