Note: You are currently viewing documentation for Moodle 3.4. Up-to-date documentation for the latest stable version of Moodle is likely available here: Azuresearch.


From MoodleDocs
Type Search engines, Elasticsearch
Set N/A
Maintainer(s) Matt Porritt

Moodle Global Search - Azure Search Backend

This plugin allows Moodle to use Microsoft Azure Search as the search engine for Moodle's Global Search.

The following features are provided by this plugin:

  • File indexing
  • Respects Moodle Proxy settings

Supported Moodle Versions

This plugin currently supports Moodle:

  • 3.1
  • 3.2
  • 3.3
  • 3.4

Azure Search Service Setup

Service Setup

To setup an Azure Search Service (and optionally a Microsoft Azure account), follow the instructions at:

Get API Credentials

Calls to the Azure Search service require the service URL and an access key on every request. A search service is created with both, so if you added Azure Search to your subscription, follow these steps to get the necessary information:

  1. In the Azure portal, open the search service page from the dashboard or find your service in the service list.
  2. Get the endpoint at Overview > Essentials > Url. An example endpoint might look like
  3. Get the api-key in Settings > Keys. There are two admin keys for redundancy in case you want to roll over keys. Admin keys grant the write permissions on your service, necessary for creating and loading indexes. You can use either the primary or secondary key for write operations.

Moodle Plugin Installation

Once you have setup an Azure Search service you can now install the Moodle plugin.

Command Line Installation

To install the plugin in Moodle via the command line:

  1. Get the code from GitHub or the Moodle Plugin Directory.
  2. Copy or clone code into: <moodledir>/search/engine/azure
  3. Run the upgrade: sudo -u www-data php admin/cli/upgrade Note: the user may be different to www-data on your system.
User Interface Installation

To install the plugin in Moodle via the Moodle User Interface:

  1. Log into your Moodle as an Administrator.
  2. Navigate to: Site administration > Plugins > Install Plugins
  3. Install plugin from Moodle Plugin directory or via zip upload.

Moodle Plugin Setup

Once you have setup an Azure Search service you can now configure the Moodle plugin.

  1. Log into Moodle as an administrator
  2. Set up the plugin in Site administration > Plugins > Search > Manage global search by selecting azure as the search engine.
  3. Configure the Azure Search plugin at: Site administration > Plugins > Search > Azure
  4. Set URL, API Key and API version of your Elasticsearch server
  5. Set the Index name you want to use for your Azure Search service.
  6. To create the index and populate Azure Searcg with your site's data, run this CLI script. sudo -u www-data php search/cli/indexer.php --force --reindex
  7. Enable Global search in Site administration > Advanced features

File Indexing Support

This plugin provides optional file indexing support.

This plugin uses Apache Tika for file indexing support. This is a separate service to this plugin and core Moodle. Tika parses files, extracts the text, and return it via a REST API.

If you wish to use file indexing you will need access to a Tika service. An example setup can be found below.

Tika Setup

Seting up a Tika test service is straight forward. In most cases on a Linux environment, you can simply download the Java JAR then run the service. wget java -jar tika-server-1.16.jar

This will start Tika on the host. By default the Tika service is available on: http://localhost:9998

Enabling File indexing support in Moodle

Once a Tika service is available the Azure Search plugin in Moodle needs to be configured for file indexing support.
Assuming you have already followed the basic installation steps, to enable file indexing support:

  1. Configure the Azure Search plugin at: Site administration > Plugins > Search > Azure
  2. Select the Enable file indexing checkbox.
  3. Set Tika hostname and Tika port of your Tika service. If you followed the basic Tika setup instructions the defaults should not need changing.
  4. Click the Save Changes button.

What is Tika

From the Apache Tika website:

The Apache Tika™ toolkit detects and extracts metadata and text from over a thousand different file types (such as PPT, XLS, and PDF). All of these file types can be parsed through a single interface, making Tika useful for search engine indexing, content analysis, translation, and much more. You can find the latest release on the download page. Please see the Getting Started page for more information on how to start using Tika.