Restore MediaWiki ElasticSearch functionality

A couple months ago, had a mediawiki server with 3 wikis running on it dumped in my lap to support. The search box was using CirrusSearch and Elasticsearch / Elastica to generate results, but that was recently broken when the security team did some sort of log4j remediation. All searches would return "An error has occurred while searching: We could not complete your search due to a temporary problem. Please try again later."

So, I removed most traces of CirrusSearch / Elasticsearch and then had the bare-bones MediaWiki search working and of course no longer received the above error. Our server was running back-level MediaWiki (1.30), so I just brought the software up to nearly the latest versions.

Centos 7.3.1611

Versions
MediaWiki - 1.37.2
PHP - 7.4.28 (apache2handler)
MySQL - 5.7.20

CirrusSearch - 6.5.4 (70b9a7e) 05:55, 16 March 2022
Elastica - 6.1.3 (c2b259b) 05:46, 19 January 2022

# yum list installed|grep elastic
elasticsearch.noarch 6.8.23-1 @elasticsearch6
elasticsearch-curator.x86_64 5.4.1-1 installed

I reenabled CirrusSearch and Elastica in LocalSettings.php, and my Version page shows them as loaded, but while I'm still not getting errors, the search results don't seem like they are enhanced in any way. How can I confirm whether or not I'm actually getting results from Elasticsearch instead of the default built-in search?

I suspect I already have my answer in that my attempt to regenerate my Elasticsearch index fails with the response below. So I guess the real question is how do I fix Elasticsearch for my wikis?

# php /data/www/html/wiki/extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php
Updating cluster ...
indexing namespaces...
Elastica\Exception\Connection\HttpException from line 190 of /data/www/html/wiki/extensions/Elastica/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php: Couldn't connect to host, Elasticsearch down?
#0 /data/www/html/wiki/extensions/Elastica/vendor/ruflin/elastica/lib/Elastica/Request.php(194): Elastica\Transport\Http->exec()
#1 /data/www/html/wiki/extensions/Elastica/vendor/ruflin/elastica/lib/Elastica/Client.php(689): Elastica\Request->send()
#2 /data/www/html/wiki/extensions/Elastica/vendor/ruflin/elastica/lib/Elastica/Client.php(721): Elastica\Client->request()
#3 /data/www/html/wiki/extensions/Elastica/vendor/ruflin/elastica/lib/Elastica/Index.php(586): Elastica\Client->requestEndpoint()
#4 /data/www/html/wiki/extensions/Elastica/vendor/ruflin/elastica/lib/Elastica/Index.php(330): Elastica\Index->requestEndpoint()
#5 /data/www/html/wiki/extensions/CirrusSearch/includes/MetaStore/MetaStoreIndex.php(501): Elastica\Index->exists()
#6 /data/www/html/wiki/extensions/CirrusSearch/includes/MetaStore/MetaStoreIndex.php(165): CirrusSearch\MetaStore\MetaStoreIndex::cirrusReady()
#7 /data/www/html/wiki/extensions/CirrusSearch/includes/Maintenance/Maintenance.php(221): CirrusSearch\MetaStore\MetaStoreIndex->createIfNecessary()
#8 /data/www/html/wiki/extensions/CirrusSearch/maintenance/IndexNamespaces.php(36): CirrusSearch\Maintenance\Maintenance->maybeCreateMetastore()
#9 /data/www/html/wiki/extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php(65): CirrusSearch\Maintenance\IndexNamespaces->execute()
#10 /data/www/html/wiki/maintenance/doMaintenance.php(108): CirrusSearch\Maintenance\UpdateSearchIndexConfig->execute()
#11 /data/www/html/wiki/extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php(103): require_once('/data/www/html/...')
#12 {main}

What does your Elasticsearch config look like?
Can you curl host:9200 and get a response?

Thank you Warkolm.

Since I took over supporting this server, I've never been able to get that curl test to work. Sadly today is no exception:

# curl -X GET "localhost:9200"
curl: (7) Failed connect to localhost:9200; Connection refused

There are a few elasticsearch.yml files on the server. They're all either completely commented out or reflect the settings in the file located at /etc/elasticsearch/elasticsearch.yml

Here are all the lines that are not commented out of that version:

path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0

What's in /var/log/elasticsearch/elasticsearch.log?

The log doesn't seem to exist. Perhaps I'm looking at the wrong Elasticsearch.yml file? Searching the server turns up some others, but they are either commented fully out or have the same settings as this one.

cat /var/log/elasticsearch/elasticsearch.log

cat: /var/log/elasticsearch/elasticsearch.log: No such file or directory

ls -al /var/log/elasticsearch/

total 8
drwxr-s--- 2 elasticsearch elasticsearch 6 Jan 6 14:43 .
drwxr-xr-x. 19 root root 4096 Apr 7 03:15 ..

Following all the documentation for Elasticsearch, and for some reason I can't seem to get the service to start, and of course the logs aren't appearing where the configuration is saying they should. Does anybody have some suggestions?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.