Open main menu
This page is a translated version of the page Extension:CirrusSearch and the translation is 62% complete.

Other languages:
English • ‎русский • ‎中文 • ‎日本語
OOjs UI icon advanced.svg
发布状态: 稳定版
实现 搜索, API , 钩子
描述 使用Elasticsearch实现搜索MediaWiki
作者 Nik Everett, Chad Horohoe, Erik Bernhardson
最新版本 持续更新
兼容性方针 主线(master)
MediaWiki 1.23+
PHP 5.4+
许可协议 GNU通用公眾授權條款2.0或更新版本
  • $wgCirrusSearchServers
  • $wgCirrusSearchMaxRetries
  • $wgCirrusSearchSoftCommitTimeout
  • $wgCirrusSearchHardCommitTimeout
  • $wgCirrusSearchHardCommitMaxPendingDocs
  • $wgCirrusSearchCacheResultTime
  • $wgCirrusSearchCacheCleanupThread
  • $wgCirrusSearchFilterCacheSize
  • $wgCirrusSearchFilterCacheAutowarmCount
  • $wgCirrusSearchQueryResultCacheSize
  • $wgCirrusSearchQueryResultCacheAutowarmCount
  • $wgCirrusSearchDocumentCacheSize
  • many others
Vagrant角色 cirrussearch
问题 开放的工作 · 报告错误


This page is for installation. After the install is working, see 幫助:捲雲檢索 for usage.


  • 去除使该扩展难以安装的复杂依赖关系
    • 唯一的依赖项应该是纯PHP MediaWiki扩展和Elasticsearch本身
  • 为其他MediaWiki扩展可扩展的Wiki页面提供近实时搜索索引

提供MWSearch 为用户提供的所有查询选项等


PHP and cURL
* MediaWiki 1.28.x requires ElasticSearch 2.x.
  • MediaWiki 1.29.x and 1.30.x require ElasticSearch 5.3.x or 5.4.x.
  • MediaWiki 1.31.x and 1.32.x require ElasticSearch 5.5.x or 5.6.x.
  • MediaWiki 1.33.x requires ElasticSearch 6.5.x.

Take note that a Java installation like OpenJDK is needed in addition.

  • Elastica is a PHP library to talk to Elasticsearch. Install Elastica per the instructions below.
  • Due to the actual handling of jobs by the CirrusSearch extension, it's advisable to set up jobs in redis to prevent messages like Notice: unserialize(): Error at offset 64870 of 65535 bytes in JobQueueDB.php and subsequent errors like Unsupported operand types. See 任务T157759.



Even though the instructions below tell you to only run Composer when installing from git, it may be necessary to issue it anyway in order to install all PHP dependencies.

  • 下载文件,并将其放置在您extensions/文件夹中的Elastica目录内。
  • 只有從git安裝才运行Composer来安装PHP依赖,通过发行composer install --no-dev至扩展目录。 (参见T173141了解潜在问题。)
  • 将下列代码放置在您的LocalSettings.php的底部:
    wfLoadExtension( 'Elastica' );
  •   完成 – 在您的wiki上导航至Special:Version,以验证扩展已成功安装。

致使用MediaWiki 1.24或更早版本的用户:

上面的说明介绍的是安装此扩展的新方法,它使用wfLoadExtension()。 如果您需要在早期版本(MediaWiki 1.24和更早版本)中安装此扩展,而不是wfLoadExtension( 'Elastica' );,您需要使用:

require_once "$IP/extensions/Elastica/Elastica.php";


  • 下载文件,并将其放置在您extensions/文件夹中的CirrusSearch目录内。
  • 将下列代码放置在您的LocalSettings.php的底部:
    wfLoadExtension( 'CirrusSearch' );
  • Now follow the setup instructions in the CirrusSearch README delivered with your extension i.e. $IP/extensions/CirrusSearch/README. Note that all info in it might not apply to your version of the extension, especially the version of Elasticsearch supported.
  • Configure as required.
  •   完成 – 在您的wiki上导航至Special:Version,以验证扩展已成功安装。

致使用MediaWiki 1.24或更早版本的用户:

上面的说明介绍的是安装此扩展的新方法,它使用wfLoadExtension()。 如果您需要在早期版本(MediaWiki 1.24和更早版本)中安装此扩展,而不是wfLoadExtension( 'CirrusSearch' );,您需要使用:

require_once "$IP/extensions/CirrusSearch/CirrusSearch.php";


Please follow the upgrade instructions in the CirrusSearch UPGRADE file.


The configuration options of CirrusSearch are documented at the docs/settings.txt file, and also in the CirrusSearch.php file.

See also documentation on CirrusSearch configuration profiles.


CirrusSearch extension defines a number of hooks that other extensions can make use of to extend the core schema and modify documents. 以下钩子可用:


CirrusSearch features can be used in API queries. 一些示例和查询:


Local development

Elastic Search service can be run with the Vagrant role (cirrussearch) and MediaWiki Vagrant.

For Docker, you can use a command like docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:6.8.2. The 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 LocalSettings.php you will want to reference elasticsearch as the host name. This will not have the WMF plugins but can be sufficient for basic testing.