def get_es_conn(): """Return an Elasticsearch ConnectionContext.""" cm = ConfigurationManager( ConnectionContext.get_required_config(), values_source_list=[environment] ) config = cm.get_config() return ConnectionContext(config)
def get_conn(): # Create a configuration manager that will only check the environment for # configuration and not command line parameters cm = ConfigurationManager(ConnectionContext.get_required_config(), values_source_list=[environment]) config = cm.get_config() return ConnectionContext(config)
def es_conn(): """Create an Elasticsearch ConnectionContext and clean up indices afterwards.""" cm = ConfigurationManager(ConnectionContext.get_required_config(), values_source_list=[environment]) config = cm.get_config() conn = ConnectionContext(config) yield conn for index in conn.get_indices(): conn.delete_index(index)
def get_conn(): # Create a configuration manager that will only check the environment for # configuration and not command line parameters cm = ConfigurationManager( ConnectionContext.get_required_config(), values_source_list=[environment] ) config = cm.get_config() return ConnectionContext(config)
def es_conn(): """Create an Elasticsearch ConnectionContext and clean up indices afterwards.""" cm = ConfigurationManager( ConnectionContext.get_required_config(), values_source_list=[environment] ) config = cm.get_config() conn = ConnectionContext(config) yield conn for index in conn.get_indices(): conn.delete_index(index)
def es_conn(): """Create an Elasticsearch ConnectionContext and clean up indices afterwards. This uses defaults and configuration from the environment. """ manager = ConfigurationManager(ESConnectionContext.get_required_config(), values_source_list=[environment]) conn = ESConnectionContext(manager.get_config()) # Create two indexes--this week and last week template = conn.config.elasticsearch_index conn.create_index(utc_now().strftime(template)) conn.create_index( (utc_now() - datetime.timedelta(weeks=1)).strftime(template)) conn.health_check() yield conn for index in conn.get_indices(): conn.delete_index(index)