ElasticSearch by jonathan-dart

An ElasticSearch module for ProcessWire

ElasticSearch for ProcessWire 0.4.4

About ElasticSearch for ProcessWire

The ElasticSearch module for ProcessWire CMS/CMF will add your page content to an ElasticSearch index per site, and give you a convenient way to search it.


  • Make sure the PHP cURL library is installed. (apt-get install php5-curl)
  • Install ElasticSearch.
  • Install this module, the usual methods apply.
  • In the module settings configure your ElasticSearch IP and port, and click save.
  • In the module settings click "Index All Pages".


Synchonizing Page Data with ElasticSearch

When pages are saved, deleted, trashed, and restored ElasticSearch will be notified accordingly, so after you've clicked "Index All Pages" you shouldn't need to think about it again.

What gets searched?

Most content from a page should be seachable: text fields, translated fields, repeaters and filenames.


This module has a function search() that returns a PageArray.

$search_results = $modules->get('ElasticSearch')->search('foo bar'); 


The MarkupPagerNav module should work out of the box.

$search_results = $modules->get('ElasticSearch')->search('foo bar', $results_per_page); 

echo "Total results: " . $search_results->getTotal();

echo $search_results->renderPagination();

Minimum Scores

The search function also takes a 3rd parameter to configure the minimum score required for a page to match.

$search_results = $modules->get('ElasticSearch')->search('foo bar', $results_per_page, 0.05);

Custom Queries

By default this module uses a fuzzy_like_this query to match pages. To change that use an array for the 1st parameter when calling search.

$search_results = $modules->get('ElasticSearch')->search(array(
    'query' => array(
        'match' => array(
            '_all' => 'foo bar',



This plugin will create an index based on the http host, so if you have many sites one one server they can all safely use the same ElasticSearch server, no special configuration is required to support multiple sites.

Configuring ElasticSearch can be very simple, if running ElasticSearch on a single server you really only need the below configuration in /etc/elasticsearch/elasticsearch.yml:

index.number_of_shards: 1
index.number_of_replicas: 0
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: []

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • ProcessWire 3.0.185 (dev) core updates, plus new Session Allow module— More
    17 September 2021
  • Three new ProcessWire Textformatter modules: Find/Replace, Markdown in Markup, and Emoji— More
    3 September 2021
  • This week we have a new master version released after a year in the making. With nearly 40 pull requests, hundreds of new additions and more than 100 issue reports resolved, this new version has a ton of great new stuff— More
    27 August 2021

Latest news

  • ProcessWire Weekly #388
    In the 388th issue of ProcessWire Weekly we'll check out the latest core update, introduce two new third party modules, and more. Read on!
    Weekly.pw / 16 October 2021
  • ProcessWire 3.0.184 new master/main version
    This week we have a new master/main version released after a full year in the making. As you might imagine, this new version has a ton of great new stuff and we’ll try to cover much of it here.
    Blog / 27 August 2021
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani