def pre_load_hook(self): if not self.in_place and self.own_index_exists: # delete the existing index. self.log("Deleting index") self.indexing_pillow.get_es_new().indices.delete(self.indexing_pillow.es_index) self.log("Recreating index") create_index_for_pillow(self.indexing_pillow) initialize_mapping_if_necessary(self.indexing_pillow)
def test_index_operations(self): pillow = TestElasticPillow() self.assertTrue(self.es.indices.exists(self.index)) self.assertTrue(pillow_index_exists(pillow)) # delete and check pillow.get_es_new().indices.delete(self.index) self.assertFalse(self.es.indices.exists(self.index)) self.assertFalse(pillow_index_exists(pillow)) # create and check create_index_for_pillow(pillow) self.assertTrue(self.es.indices.exists(self.index)) self.assertTrue(pillow_index_exists(pillow))