def recreate_index_mapping():
    """
    Recreate Index Mapping
    """
    index_mapping = elasticsearch_util.get_mapping_setting_obj()
    elasticsearch_factory.recreate_index_mapping(settings.ES_INDEX_NAME,
                                                 index_mapping)
    def initiate(self):
        """
        Make sure the Elasticsearch is up and running
        Making profiles for Elasticsearch Recommendations
        """
        elasticsearch_factory.check_elasticsearch()
        is_data_old = ElasticsearchRecommender.is_data_old()

        if is_data_old:
            elasticsearch_factory.recreate_index_mapping(ElasticsearchRecommender.RECOMMEND_INDEX, ElasticsearchRecommender.get_index_mapping())
            ElasticsearchRecommender.load_data_into_es_table()
    def initiate(self):
        """
        Make sure the Elasticsearch is up and running
        Making profiles for Elasticsearch Recommendations
        """
        elasticsearch_factory.check_elasticsearch()

        if ElasticsearchRecommender.is_data_old():
            elasticsearch_factory.recreate_index_mapping(
                settings.ES_RECOMMEND_USER,
                ElasticsearchRecommender.get_index_mapping())
            ElasticsearchRecommender.load_data_into_es_table()
def recreate_index_mapping():
    """
    Recreate Index Mapping
    """
    index_mapping = elasticsearch_util.get_mapping_setting_obj()
    elasticsearch_factory.recreate_index_mapping(settings.ES_INDEX_NAME, index_mapping)