add filter to ElasticPress track total hits

This commit is contained in:
Rafael Chaves Freitas 2020-05-24 14:21:39 -03:00
parent 0d6573038b
commit fa2739ea72
1 changed files with 5 additions and 0 deletions

View File

@ -48,6 +48,11 @@ class Elastic_Press {
add_filter( 'ep_config_mapping', [$this, 'elasticpress_config_mapping'], 10, 1 ); add_filter( 'ep_config_mapping', [$this, 'elasticpress_config_mapping'], 10, 1 );
add_filter( 'ep_post_sync_args', [$this, 'ep_post_sync_args'], 10, 2 ); add_filter( 'ep_post_sync_args', [$this, 'ep_post_sync_args'], 10, 2 );
add_filter( 'ep_formatted_args', function ( $formatted_args ) {
$formatted_args['track_total_hits'] = true;
return $formatted_args;
} );
// add_action('ep_add_query_log', function($query) { //using to DEBUG // add_action('ep_add_query_log', function($query) { //using to DEBUG
// error_log("DEGUG:"); // error_log("DEGUG:");
// error_log($query["args"]["body"]); // error_log($query["args"]["body"]);