10up/ElasticPress

Name: ElasticPress

Owner: 10up

Description: A fast and flexible search and query engine for WordPress.

Created: 2014-06-10 04:29:30.0

Updated: 2018-01-13 12:34:30.0

Pushed: 2018-01-11 15:20:20.0

Homepage: https://elasticpress.io

Size: 3023

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ElasticPress Build Status

A fast and flexible search and query engine for WordPress.

Please note: master is the stable branch

Upgrade Notice: Versions 1.6.1, 1.6.2, 1.7, 1.8, 2.1, 2.1.2, 2.2 require re-syncing.

ElasticPress, a fast and flexible search and query engine for WordPress, enables WordPress to find or ?query? relevant content extremely fast through a variety of highly customizable features. WordPress out-of-the-box struggles to analyze content relevancy and can be very slow. ElasticPress supercharges your WordPress website making for happier users and administrators. The plugin even contains features for popular plugins.

How Does it Work

ElasticPress integrates with the WP_Query object returning results from Elasticsearch instead of MySQL.

Requirements
Installation
  1. First, you will need to properly install and configure Elasticsearch.
  2. Install the plugin in WordPress. You can download a zip via Github and upload it using the WordPress plugin uploader.
  3. Activate the plugin (network activate for multisite). Navigate to the settings page. You should see an ElasticPress icon in your admin menu.
  4. Input your Elasticsearch host. Your host must begin with a protocol specifier (http or https). URLs without a protocol prefix will not be parsed correctly and will cause ElasticPress to error out.
  5. Sync your content by clicking the sync icon.

Once syncing finishes, your site is officially supercharged. You also have access to ElasticPress's powerful WP_Query integration API.

Features
Search

Instantly find the content you?re looking for. The first time.

WooCommerce

?I want a cotton, woman?s t-shirt, for under $15 that?s in stock.? Faceted product browsing strains servers and increases load times. Your buyers can find the perfect product quickly, and buy it quickly.

Related Posts

ElasticPress understands data in real time, so it can instantly deliver engaging and precise related content with no impact on site performance.

Available API functions:

Protected Content

Optionally index all of your content, including private and unpublished content, to speed up searches and queries in places like the administrative dashboard.

Documents (requires Ingest Attachment plugin)

Indexes text inside of popular file types, and adds those files types to search results.

Autosuggest

Suggest relevant content as text is entered into the search field.

WP_Query and the ElasticPress Query Integration

ElasticPress integrates with WP_Query if the ep_integrate parameter is passed (see below) to the query object. If the search feature is activated (which it is by default), all queries with the s parameter will be integrated with as well. ElasticPress converts WP_Query arguments to Elasticsearch readable queries. Supported WP_Query parameters are listed and explained below. ElasticPress also adds some extra WP_query arguments for extra functionality.

Supported WP_Query Parameters

The following are special parameters that are only supported by ElasticPress.

WP-CLI Commands

The following commands are supported by ElasticPress:

Security
ne( 'ES_SHIELD', 'username:password' );
Disable Dashboard Sync

Dashboard sync can be disabled by defining the constant EP_DASHBOARD_SYNC as false in your wp-config.php file.

ne( 'EP_DASHBOARD_SYNC', false );

This can be helpful for managed sites where users initiating a sync from the dashboard could potentially cause issues such as deleting the index and limiting this control to WP-CLI is preferred. When disabled, features that would require reindexing are also prevented from being enabled/disabled from the dashboard.

Custom Features

ElasticPress has a robust API for registering your own features. Refer to the code within each feature for detailed examples. To register a feature, you will need to call the ep_register_feature() function like so:

action( 'plugins_loaded', function() {
ep_register_feature( 'slug', array(
    'title' => 'Pretty Title',
    'setup_cb' => 'setup_callback_function',
    'feature_box_summary_cb' => 'summary_callback_function',
    'feature_box_long_cb' => 'long_summary_callback_function',
    'requires_install_reindex' => true,
    'requirements_status_cb' => 'requirements_status_callback_function',
    'post_activation_cb' => 'post_activation_callback_function',
) );

The only arguments that are really required are the slug and title of the associative arguments array. Here are descriptions of each of the associative arguments:

If you build an open source custom feature, let us know! We'd be happy to list the feature within ElasticPress documentation.

Development
Setup

Follow the configuration instructions above to setup the plugin.

Testing

Within the terminal change directories to the plugin folder. Initialize your testing environment by running the following command:

For VVV users:

 bin/install-wp-tests.sh wordpress_test root root localhost latest

For VIP Quickstart users:

 bin/install-wp-tests.sh wordpress_test root '' localhost latest

where:

Our test suite depends on a running Elasticsearch server. You can supply a host to PHPUnit as an environmental variable like so:

OST="http://192.168.50.4:9200" phpunit
Debugging

We have a Debug Bar Plugin available for ElasticPress. This tool allows you to examine all the ElasticPress queries on each page load.

Issues

If you identify any errors or have an idea for improving the plugin, please open an issue. We're excited to see what the community thinks of this project, and we would love your input!

License

ElasticPress is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.