Skip to content

add CirrusSearch/ElasticSearch support #22

@WolfgangFahl

Description

@WolfgangFahl

To enable CirrusSearch, we need an Elasticsearch container compatible with the MediaWiki version (typically ES 7.10.x for modern MW) and specific configuration in LocalSettings.php.

1. docker-compose.yml

Add the elasticsearch service. We define a single-node cluster and limit memory usage to prevent it from overwhelming the host.

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.10.2
    environment:
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ports:
      - "9200:9200"
      - "9300:9300"
    volumes:
      # Ensure this volume is added to the top-level volumes section as well
      - elasticsearch-data:/usr/share/elasticsearch/data

2. LocalSettings.php

Elastica and CirrusSearch must be loaded and configured to point to the elasticsearch container.

# Load extensions
wfLoadExtension( 'Elastica' );
wfLoadExtension( 'CirrusSearch' );

# Configure CirrusSearch 
$wgCirrusSearchServers = [ 'elasticsearch' ]; 
$wgSearchType = 'CirrusSearch'; 

# Ensure updates are processed
$wgDisableSearchUpdate = false;

3. Post-Install Actions

After the containers are up, the search index must be initialized via the container:

php extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php
php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkip
php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipParse

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions