ElasticPress limits the number of WooCommerce products in category

Created on 7 Feb 2020  路  4Comments  路  Source: 10up/ElasticPress

Describe the bug
When I enable ElasticPress in my WooCommerce store, the number of products listed are limited to 10000.
With the ElasticPress plugin disabled, I get the correct number of products from the category (313851).
I'm not sure if it's a problem from ElasticPress or maybe ElasticSearch?

Steps to Reproduce

  1. Click on any category with more than 10000 products.
  2. See error

Screenshots
EP

Additional context
Tried tweaking search.max_buckets: 100000 or even 1000000 but with no success.

What could be the problem?

bug

Most helpful comment

What is your ElasticSearch version? From version 7.0 is track_total_hits set to 10000 by default: https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.html#track-total-hits-10000-default

You can force it like this:

add_filter( 'ep_formatted_args', function ( $formatted_args ) {
   $formatted_args['track_total_hits'] = true;
   return $formatted_args;
} );

All 4 comments

@roditi3811 you can increase the value of https://github.com/10up/ElasticPress/blob/7f5debeff99ea61c104d443f16b1ac61d0104bce/includes/classes/Indexable/Post/Post.php#L635 up to 1,000,000 (that's the index.max_result_window set by the plugin) and you'll get the updated total of results. It's just another default setting we build in to handle performance. You might check out the scroll API referenced in the code comment above that filter, but based on your previous ticket your Elasticsearch instance might just be large enough to handle the window change 馃槃

Thank for the reply, but it doesn't seem to change anything, I'm still getting 10000 results :(
image

Also I've tried
curl -XPUT "http://XXX:9200/XXX-post-1/_settings" -H 'Content-Type: application/json' -d '{ "index" : { "max_result_window" : 10000000 } }'
And the results of http://XXX:9200/XXX-post-1/_settings
image

I'm not sure if it means something, but the first time when I am accessing the category, I see the correct number of products.
If I make a search for a general term and I hit the 10000 limit, when I go back and access that category again, I see the limit of 10000 there also, as if it applies the search limit to the categories also.

What is your ElasticSearch version? From version 7.0 is track_total_hits set to 10000 by default: https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.html#track-total-hits-10000-default

You can force it like this:

add_filter( 'ep_formatted_args', function ( $formatted_args ) {
   $formatted_args['track_total_hits'] = true;
   return $formatted_args;
} );

add_filter( 'ep_formatted_args', function ( $formatted_args ) {
$formatted_args['track_total_hits'] = true;
return $formatted_args;
} );

PERFECT! That did the job indeed, thanks very much, works like a charm now.
Elasticsearch version is 7.5.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

j3j5 picture j3j5  路  5Comments

mbanusic picture mbanusic  路  3Comments

jakejackson1 picture jakejackson1  路  8Comments

psorensen picture psorensen  路  7Comments

keg picture keg  路  4Comments