Release status: stable | |
|---|---|
| Implementation | Search,API,Hook |
| Description | Implements searching for MediaWiki using Elasticsearch |
| Author(s) | Nik Everett, Chad Horohoe, Erik Bernhardson |
| Latest version | continuous updates |
| Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. |
| Composer | mediawiki/cirrussearch |
| License | GNU General Public License 2.0 or later |
| Download | README |
| Help | Help:Extension:CirrusSearch |
| |
| |
| |
| Translate the CirrusSearch extension if it is available at translatewiki.net | |
| Vagrant role | cirrussearch |
| Issues | Open tasks ·Report a bug |
TheCirrusSearch extension implements searching for MediaWiki usingElasticsearch.
CirrusSearch will be migrated to use OpenSearch as its backend. Please seeWikimedia Search Platform/Decision Records/Search backend replacement technology for more information. |
Elasticsearch is a standalone third-party software you must install as a requirement for this extension.It is a database system that provides search and indexing functionality, where the current text of your wiki pages gets indexed for faster and improved search results.The communication between MediaWiki and Elasticsearch is done through web services.
See also thehelp page on using this extension.
In addition to thestandard MediaWiki requirements for PHP, CirrusSearch requires PHP to be compiled withcURL support.
You mustinstall Elasticsearch orOpensearch.
Every version of Elasticsearch changes how web services work and causes compatibility problems.You must install the version of Elasticsearch compatible with the version of MediaWiki you are currently using:
MediaWiki 1.39+ require Elasticsearch 7.10.2 (6.8.23+ is possible using acompatibility layer). Seethis revision for compatibility information with earlier versions of MediaWiki.
MediaWiki 1.44+ is compatible with OpenSearch 1.3.
Take note that a Java installation likeOpenJDK is needed in addition.It's best to use the official Elasticsearch Docker image or a self-hosted version.A managed product like Amazon OpenSearch (formerly Amazon Elasticsearch) can work but may require additional configuration depending on its specifics.For example, Amazon OpenSearch only listens for Elasticsearch API requests over HTTPS on port 443 (i.e., it does not expose the default Elasticsearch port 9200), so a TLS-enabled proxy (e.g., Nginx) can enable CirrusSearch to communicate with an Amazon OpenSearch cluster.
Even though the instructions below tell you only to run Composer when installing from git, it may be necessary to issue it anyway to install all PHP dependencies.
Elastica folder to yourextensions/ directory.cdextensions/gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/Elasticacomposer install --no-dev in the extension directory.(SeeT173141 for potential complications.)wfLoadExtension('Elastica');
CirrusSearch folder to yourextensions/ directory.cdextensions/gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/CirrusSearchcomposer install --no-dev in the extension directory.(SeeT173141 for potential complications.)wfLoadExtension('CirrusSearch');
$IP/extensions/CirrusSearch/README. Note that all info in it might not apply to your version of the extension, especially the version ofElasticsearch supported.This is an optional step.You will need to install thesearch-extra plugin for this.Do so by following these steps:
/usr/share/elasticsearch/bin/elasticsearch-plugin/elasticsearch-plugininstallorg.wikimedia.search:extra:7.10.2-wmf12
LocalSettings.php file:$wgCirrusSearchWikimediaExtraPlugin['regex']=['build','use','max_inspect'=>10000];
systemctlrestartelasticsearch
phppath/to/extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php--startOver
phppath/to/extensions/CirrusSearch/maintenance/ForceSearchIndex.php
Please follow the upgrade instructions in the CirrusSearchUPGRADE file.
The configuration parameters of CirrusSearch are documented at the"settings.txt" file.See also documentation onCirrusSearch configuration profiles.
$wgCirrusSearchIndexBaseName configuration parameter, which one needs to set, e.g.,$wgCirrusSearchIndexBaseName='mywikidatabasename';.CirrusSearch extension defines a number of hooks that other extensions can make use of to extend the core schema and modify documents.The following hooks are available:
CirrusSearch features can be used in API queries.Searching happens via the normalsearch API,action=query&list=search; you can use CirrusSearch-specific features, such as themorelike: special prefix to find pages related toMarie Curie andradium:
api.php?action=query&list=search&srsearch=morelike:Marie_Curie%7Cradium&srlimit=10&srprop=size&formatversion=2
Custom APIs and parameters are provided for querying CirrusSearch configuration and debug information:
action=cirrusdump module:2014?action=cirrusdumpcirrusDumpQuery parameter toSpecial:Search or search API queries:https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpQuerycirrusDumpResult parameter toSpecial:Search or search API queries:https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpResultcirrusExplain, can be passed withcirrusDumpResult to have the Lucene explanation of the score included with the result dump:https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpResult&cirrusExplain It can also be used to get the explanation in a human-readable format, by giving it one of the valuesverbose,pretty orhot, such as:https://en.wikipedia.org/wiki/Special:Search/cat%20dog%20chicken?cirrusDumpResult&cirrusExplain=prettycirrus-config-dump,cirrus-settings-dump,cirrus-mapping-dump,cirrus-profiles-dump modules to obtain dump from the CirrusSearch setup:api.php?action=cirrus-config-dump&formatversion=2Elasticsearch service can be run with the Vagrant role (cirrussearch) and MediaWiki Vagrant.
For Docker, you can use a command likedocker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:6.8.2.Then follow the installation and configuration directions.If your web host is in a container, you'll want to make sure the above container is on the same network, and in theLocalSettings.php file, you will want to reference theelasticsearch as the hostname.This will not have the WMF plugins but can be sufficient for basic testing.
| This extension is being used on one or moreWikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia'sCommonSettings.php andInitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki'sSpecial:Version page. |
| This extension is included in the following wiki farms/hosts and/or packages:This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |