<commit_before>import lila.search._

import akka.actor._
import com.sksamuel.elastic4s.ElasticDsl._
import com.sksamuel.elastic4s.http.JavaClient
import com.sksamuel.elastic4s.{ ElasticClient, ElasticProperties }
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext

object ESConnect {

  def apply(
      system: ActorSystem,
      lifecycle: play.api.inject.ApplicationLifecycle,
      config: play.api.Configuration
  )(implicit ec: ExecutionContext): ESClient = {

    val IndexesToOptimize = List("game", "forum", "team", "study")

    val underlyingClient: ElasticClient = {

      val c = ElasticClient(JavaClient(ElasticProperties(config.get[String]("elasticsearch.uri"))))

      lifecycle.addStopHook(() =>
        scala.concurrent.Future {
          play.api.Logger("search").info("closing now!")
          c.close()
          Thread sleep 1000
        }
      )

      c
    }

    system.scheduler.scheduleWithFixedDelay(1 hour, 1 hour) { () =>
      underlyingClient execute {
        forceMerge(IndexesToOptimize)
      }
    }

    new ESClient(underlyingClient)
  }
}<commit_msg>remove periodic call to force merge<commit_after>import lila.search._

import akka.actor._
import com.sksamuel.elastic4s.ElasticDsl._
import com.sksamuel.elastic4s.http.JavaClient
import com.sksamuel.elastic4s.{ ElasticClient, ElasticProperties }
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext

object ESConnect {

  def apply(
      system: ActorSystem,
      lifecycle: play.api.inject.ApplicationLifecycle,
      config: play.api.Configuration
  )(implicit ec: ExecutionContext): ESClient = {

    val IndexesToOptimize = List("game", "forum", "team", "study")

    val underlyingClient: ElasticClient = {

      val c = ElasticClient(JavaClient(ElasticProperties(config.get[String]("elasticsearch.uri"))))

      lifecycle.addStopHook(() =>
        scala.concurrent.Future {
          play.api.Logger("search").info("closing now!")
          c.close()
          Thread sleep 1000
        }
      )

      c
    }

    new ESClient(underlyingClient)
  }
}
{'fraction_non_alphanumeric': 0.10968660968660969, 'fraction_numerical': 0.007597340930674264, 'mean_word_length': 3.3, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '466655', 'n_tokens_mistral': 661, 'n_tokens_neox': 625, 'n_words': 118}