<commit_before><?php

use diskover\Constants;
use Elasticsearch\ClientBuilder;

error_reporting(E_ALL ^ E_NOTICE);

function connectES() {
  // Connect to Elasticsearch node
  $esPort = getenv('APP_ES_PORT') ?: 9200;
  $hosts = [
      [
    'host' => Constants::ES_HOST,
    'port' => $esPort,
    'user' => Constants::ES_USER,
    'pass' => Constants::ES_PASS
      ]
  ];
  $client = ClientBuilder::create()->setHosts($hosts)->build();

  // Check connection to Elasticsearch
  try {
    $params = [
      'index' => Constants::ES_INDEX,
      'type' => Constants::ES_TYPE,
      'id' => 1,
      'client' => [ 'ignore' => [400, 404, 500] ]
    ];
    $client->get($params);
  } catch(Exception $e) {
    echo 'Error connecting to Elasticsearch: ',  $e->getMessage(), "\n";
  }

  return $client;<commit_msg>Update Diskover.php<commit_after><?php

use diskover\Constants;
use Elasticsearch\ClientBuilder;

error_reporting(E_ALL ^ E_NOTICE);

function connectES() {
  // Connect to Elasticsearch node
  $esPort = getenv('APP_ES_PORT') ?: 9200;
  $esIndex = getenv('APP_ES_INDEX') ?: Constants::ES_INDEX;
  $hosts = [
      [
    'host' => Constants::ES_HOST,
    'port' => $esPort,
    'user' => Constants::ES_USER,
    'pass' => Constants::ES_PASS
      ]
  ];
  $client = ClientBuilder::create()->setHosts($hosts)->build();

  // Check connection to Elasticsearch
  try {
    $params = [
      'index' => $esIndex,
      'type' => Constants::ES_TYPE,
      'id' => 1,
      'client' => [ 'ignore' => [400, 404, 500] ]
    ];
    $client->get($params);
  } catch(Exception $e) {
    echo 'Error connecting to Elasticsearch: ',  $e->getMessage(), "\n";
  }

  return $client;
{'fraction_non_alphanumeric': 0.1806797853309481, 'fraction_numerical': 0.016696481812760882, 'mean_word_length': 3.2806122448979593, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '3483925', 'n_tokens_mistral': 617, 'n_tokens_neox': 592, 'n_words': 115}