MediaWiki-Docker/Configuration recipes/ElasticSearch

From mediawiki.org
Jump to navigation Jump to search

ElasticSearch[edit]

docker-compose.override.yml
version: '3.7'
services:
  elasticsearch:
    image: docker-registry.wikimedia.org/dev/stretch-elasticsearch:0.0.1
    volumes:
      - esdata:/usr/share/elasticsearch/data
    environment:
      - discovery.type=single-node
    ports:
      - 9200:9200
      - 9300:9300
volumes:
  esdata:
    driver: local


After installing MediaWiki, download and install Elastica and CirrusSearch.

LocalSettings.php
wfLoadExtension( 'CirrusSearch' );
require_once "$IP/extensions/CirrusSearch/tests/jenkins/FullyFeaturedConfig.php";
$wgCirrusSearchServers = [ 'elasticsearch' ];
Setup commands
# Installs the dependencies for Elastica
docker-compose exec mediawiki composer --working-dir=/var/www/html/w/extensions/Elastica install 
# Configure the search index and populate it with content
docker-compose exec mediawiki php extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php
docker-compose exec mediawiki php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkip
docker-compose exec mediawiki php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipParse
# Process the job queue. You need to do this any time you add/update content and want it updated in ElasticSearch
docker-compose exec mediawiki php maintenance/runJobs.php