PHP code example of alleyinteractive / elasticsearch-extensions
1. Go to this page and download the library: Download alleyinteractive/elasticsearch-extensions library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alleyinteractive / elasticsearch-extensions example snippets
add_action(
'elasticsearch_extensions_config',
function( $es_config ) {
$es_config
->restrict_post_statuses( [ 'publish', 'my-custom-status' ] )
->restrict_post_types( [ 'post', 'page' ] )
->enable_empty_search()
->enable_post_type_aggregation()
->enable_taxonomy_aggregation( 'category' )
->enable_taxonomy_aggregation( 'post_tag' );
}
);