<commit_before>var elasticSearch = require('elasticsearch');
var url = require('url');

module.exports = {
  initialize: function (api, next) {

    api.elasticsearch = {
      createClient: function () {
        return new elasticSearch.Client({
          host: url.format({
            hostname: api.config.elasticsearch.hostname,
            protocol: api.config.elasticsearch.protocol,
            port: api.config.elasticsearch.port
          }),
          apiVersion: api.config.elasticsearch.apiVersion
        })
      },
      elasticsearch: elasticSearch
    };

    next();

  },
  startPriority: 1001,
  start: function (api, next) {
    api.elasticsearch.client = api.elasticsearch.createClient();
    api.elasticsearch.client.ping({
      requestTimeout: 30000
    })
      .then(function (response) {
        api.elasticsearch.client = client;
        next();
      })
      .catch(function (err) {
        if (api.config.elasticsearch.terminateOnError === false) {
          api.logger.warning('Could not reach elasticsearch cluster');
          return next();
        }
        return next(err);
      });
  }
};<commit_msg>revert changes<commit_after>var elasticSearch = require('elasticsearch');
var url = require('url');

module.exports = {
  initialize: function (api, next) {

    api.elasticsearch = {
      createClient: function () {
        return new elasticSearch.Client({
          host: url.format({
            hostname: api.config.elasticsearch.hostname,
            protocol: api.config.elasticsearch.protocol,
            port: api.config.elasticsearch.port
          }),
          apiVersion: api.config.elasticsearch.apiVersion
        })
      },
      elasticsearch: elasticSearch
    };

    next();

  },
  startPriority: 1001,
  start: function (api, next) {
    var client = api.elasticsearch.createClient();
    client.ping({
      requestTimeout: 30000
    })
      .then(function (response) {
        api.elasticsearch.client = client;
        next();
      })
      .catch(function (err) {
        if (api.config.elasticsearch.terminateOnError === false) {
          api.logger.warning('Could not reach elasticsearch cluster');
          return next();
        }
        return next(err);
      });
  }
};
{'fraction_non_alphanumeric': 0.123500666370502, 'fraction_numerical': 0.007996446023989337, 'mean_word_length': 2.2590448625180897, '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': '6412089', 'n_tokens_mistral': 614, 'n_tokens_neox': 609, 'n_words': 122}