Friday, January 8, 2016

Integrating ElasticSearch with WordPress

High traffic sites that heavily depend on search can run into server resource issues and cause a sluggish experience for users. A good solution for this is to allow a third-party service to handle search for your site. We recently had a client that needed just that and ElasticSearch was a good fit. 10up’s ElasticPress plugin was used for integration with WordPress. ElasticSearch provides a wide variety of filters and tokenizers that will fit nearly every project. The ones mentioned below highlight some that were helpful in resolving search issues during the project. Searching with special characters ElasticSearch uses tokenizers in custom analyzers for search. The problem is that the standard tokenizer doesn’t generate tokens for punctuation like ampersands. The whitespace tokenizer needs to be used to split tokens by whitespace and preserve punctuation. This can be done by updating ElasticSearch mapping by using ElasticPress filters and WP CLI command. The default mapping can be found includes/mappings.php and using the ElasticPress ep_config_mapping_file filter to return an updated mapping file location. This will fix some special characters, but others such as hyphens and periods #wordpress #smallbusiness #entrepreneur

https://managewp.org/articles/11488/integrating-elasticsearch-with-wordpress

No comments:

Post a Comment