Apparently none of this will work with Elasticsearch versions greater than 8.0. See elastic/homebrew-tap#126 (comment). The alternative seems to be to use Docker, or since it's a big system either way might as well switch to VVV.
These are basic instructions, and I'm sure could be tightened up.
- install
elasticsearch-full
(via homebrew):brew install elasticsearch-full
- create new index by running a
PUT
request tohttp://localhost:9200/vip-local-post-1
- add the following configuration values to either
/wp-config.php
or/wp-content/vip-config/vip-config.php
(if you usevip-config.php
, make sure to include the check for the local environment):
if ( 'local' === VIP_GO_ENV ) {
/**
* Enable Search Dev Tools
*
*/
define( 'VIP_SEARCH_DEV_TOOLS', true ); // this should match the value you have for `WP_DEBUG` and other similar settings
/**
* Values for your local Elasticsearch instance
*
*/
if ( ! defined( 'VIP_ELASTICSEARCH_ENDPOINTS' ) ) {
define(
'VIP_ELASTICSEARCH_ENDPOINTS',
array(
'http://localhost:9200/', // unless you install Elasticsearch elsewhere. The trailing slash does matter.
)
);
}
if ( ! defined( 'VIP_ELASTICSEARCH_USERNAME' ) ) {
define( 'VIP_ELASTICSEARCH_USERNAME', 'test_user' );
}
if ( ! defined( 'VIP_ELASTICSEARCH_PASSWORD' ) ) {
define( 'VIP_ELASTICSEARCH_PASSWORD', 'test_password' );
}
/**
* This is a value to generate the correct name for the local Elasticsearch index.
*
*/
if ( ! defined( 'FILES_CLIENT_SITE_ID' ) ) {
define( 'FILES_CLIENT_SITE_ID', 'local' );
}
/**
* Errors will show in the logs without this
*
*/
if ( ! defined( 'Automattic\WP\Cron_Control\JOB_CONCURRENCY_LIMIT' ) ) {
define( 'Automattic\WP\Cron_Control\JOB_CONCURRENCY_LIMIT', 10 );
}
}
- run
wp elasticpress index --setup
. The--setup
flag deletes and rebuilds the index. - Run
wp vip-search index --indexables=term --setup
to index term data. - Run
wp vip-search activate-feature related_posts
to enable related posts. - run
brew info elasticsearch-full
and find the config directory, ex:/usr/local/etc/elasticsearch/
- open
elasticsearch.yml
and addxpack.security.enabled: false
to the end - run
brew services restart elastic/tap/elasticsearch-full
Note: to run the index commands remotely, any wp
command gets prefixed with vip @mytestsite.environmentname --