Example #1
0
    def setUp(self):
        """ If you're reading this. I am gone and dead, presumably.
            Elasticsearch's logging is quite loud and lets us know
            about anticipated errors, so I set the level to ERROR only.
            If elasticsearch is giving you trouble in tests and you
            aren't seeing any info, get rid of this. God bless you.
        """
        self.elasticsearchLogger.setLevel(logging.ERROR)
        self.es = connections.get_connection("default")
        self.indexes = get_indexes()

        for index in list(self.indexes):
            self.es.indices.delete_alias("{}*".format(index), "_all", ignore=[404])
            self.es.indices.delete("{}*".format(index), ignore=[404])

        for index, body in self.indexes.items():
            sync_index(index, body)
Example #2
0
def es_client(request):
    es = connections.get_connection("default")
    indexes = get_indexes()

    for index in list(indexes):
        es.indices.delete_alias("{}_*".format(index), "_all", ignore=[404])
        es.indices.delete("{}_*".format(index), ignore=[404])

    for index, body in indexes.items():
        sync_index(index, body)

    def fin():
        for index in list(indexes):
            es.indices.delete_alias("{}_*".format(index), "_all", ignore=[404])
            es.indices.delete("{}_*".format(index), ignore=[404])

    request.addfinalizer(fin)
    return es  # provide the fixture value
Example #3
0
    def setUp(self):
        """ If you're reading this. I am gone and dead, presumably.
            Elasticsearch's logging is quite loud and lets us know
            about anticipated errors, so I set the level to ERROR only.
            If elasticsearch is giving you trouble in tests and you
            aren't seeing any info, get rid of this. God bless you.
        """
        self.elasticsearchLogger.setLevel(logging.ERROR)
        self.es = connections.get_connection("default")
        self.indexes = get_indexes()

        for index in list(self.indexes):
            self.es.indices.delete_alias("{}*".format(index),
                                         "_all",
                                         ignore=[404])
            self.es.indices.delete("{}*".format(index), ignore=[404])

        for index, body in self.indexes.items():
            sync_index(index, body)
Example #4
0
def test_index_settings():
    indexes = get_indexes()
    assert indexes["djes-example"]["settings"]["index"]["number_of_replicas"] == 1
Example #5
0
def test_index_settings():
    indexes = get_indexes()
    assert indexes["djes-example"]["settings"]["index"][
        "number_of_replicas"] == 1