Open danielbachhuber opened 6 years ago
Yes, Elasticsearch 5.0+ instituted a schema field cap and an accompanying index setting, ultimately for performance. We haven't decided how exactly SearchPress should address that in the long-term, but here's a fix in the interim:
/**
* Bump up field limit.
*
* @param array $mapping ES mapping.
* @return array Updated mapping.
*/
add_filter( 'sp_config_mapping', function( $mapping ) {
$mapping['settings']['index']['mapping']['total_fields']['limit'] = 5000;
return $mapping;
} );
Ultimately, this happens because of the way SearchPress indexes post meta. For each unique meta key, the Elasticsearch schema gets upwards of 8 fields added. We do this to allow us to maintain parity with WP_Query
, since ES doesn't (natively) do runtime type casting. The only time we've ever seen performance issues from this is in a case where a site was setting dynamic meta keys (e.g. related-post-{$post_id}
) and not filtering them out prior to indexing -- that led to the ES schema inflating to hundreds of thousands of fields before it caused issues.
We have a few ideas for long-term fixes, but we need to do some benchmarking first. I'll leave this open until we do merge in a long-term fix.
We haven't decided how exactly SearchPress should address that in the long-term, but here's a fix in the interim:
Thanks! The filter works for my needs.
When I run:
I eventually see this error:
The stats end up as:
Any ideas why there's a cap?