<commit_before>from pyshelf.search.metadata import Metadata
from pyshelf.search import utils
import yaml
import os


class ElasticInitializer(object):
    def __init__(self, config_path):
        self.config_path = config_path

    def initialize(self):
        config = self.read_config()
        connection, index = utils.configure_es_connection(config["connectionString"],
                config.get("accessKey"), config.get("secretKey"), config.get("region"))
        Metadata.init(using=connection, index=index)
        self.es.indices.refresh(index=index)

    def read_config(self):
        with open(self.config_path) as cf:
            config = yaml.load(cf.read())

            return config.get("elasticsearch")<commit_msg>Fix setup_elastic<commit_after>from pyshelf.search.metadata import Metadata
from pyshelf.search import utils
import yaml
import os


class ElasticInitializer(object):
    def __init__(self, config_path):
        self.config_path = config_path

    def initialize(self):
        config = self.read_config()
        wrapper = utils.configure_es_connection(config["connectionString"],
                config.get("accessKey"), config.get("secretKey"), config.get("region"))
        Metadata.init(using=wrapper.connection, index=wrapper.index)
        self.es.indices.refresh(index=index)

    def read_config(self):
        with open(self.config_path) as cf:
            config = yaml.load(cf.read())

            return config.get("elasticsearch")
{'fraction_non_alphanumeric': 0.10893098782138025, 'fraction_numerical': 0.0, 'mean_word_length': 3.3887240356083086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '72338', 'n_tokens_mistral': 421, 'n_tokens_neox': 405, 'n_words': 83}