The current code does ES initialization in several places (::Search, ::Indexer and ::QueryBuilder), and in different ways (different parameters on each place). The best place would probably be Koha::SearchEngine::Elasticsearch, from which the rest inherit from.