How to use the elasticmock.fake_elasticsearch.FakeElasticsearch function in ElasticMock

To help you get started, we’ve selected a few ElasticMock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vrcmarcos / elasticmock / tests / fake_elasticsearch / test_instance.py View on Github external
def test_should_create_fake_elasticsearch_instance(self):
        self.assertIsInstance(self.es, FakeElasticsearch)
github vrcmarcos / elasticmock / tests / test_elasticmock.py View on Github external
def test_should_create_fake_elasticsearch_instance(self):
        self.assertIsInstance(self.es, FakeElasticsearch)
github vrcmarcos / elasticmock / elasticmock / __init__.py View on Github external
def _get_elasticmock(hosts=None, *args, **kwargs):
    host = _normalize_hosts(hosts)[0]
    elastic_key = '{0}:{1}'.format(
        host.get('host', 'localhost'), host.get('port', 9200)
    )

    if elastic_key in ELASTIC_INSTANCES:
        connection = ELASTIC_INSTANCES.get(elastic_key)
    else:
        connection = FakeElasticsearch()
        ELASTIC_INSTANCES[elastic_key] = connection
    return connection