Podcast Episode

291 – Search Your WordPress Site with Elastic Search

Announcements

  • WordCamp Europe was a success
  • Q&A with Matt
  • Next year WordCamp Europe is in Paris

Is there a plugin for that?

With more than 50,000 plugins in the WordPress repository, it’s hard to find the perfect one. Each week, I will highlight an interesting plugin form the repository.

For more great plugins, download my 50 Most Useful Plugins eBook.

Remove Admin Bar is a simple plugin that removes the admin bar from a user’s front end.

Search Your WordPress Site with Elastic Search

Doesn’t WordPress have search built in?

Yes, it does, but the default search is very basic.

  • It only searches post title, content, and excerpt.
  • It relies on MySQL, so it’s slow
  • It’s not able to handle any advanced filtering

Elastic Search is an open-source search server written in Java based on a technology called Lucene (open- source search software by Apache).

It uses a standalone database server that provides a RESTful interface to accept and store data in a way that is optimized for search.

It’s extremely scalable, performant, and reliable.

Some of the things that Elastic Search can search are:
– Relevant results
– Autosuggest
– Fuzzy matching
– Geographic searches
– Filterable searches
– Data weighting
– Much more

Elastic Search SaaS companies:
found.no
qbox.io
– [heroku.com](http://heroku.com]

ElasticPress is a free 10up WordPress plugin that powers WordPress search with Elasticsearch.

In your wp-config.php file, add the following where the URL is the domain or IP of your Elasticsearch instance:

define( 'EP_HOST', 'http://192.168.50.4:9200' );

Thank You!

Thank you to those who use my affiliate links. As you know I make a small commission when someone uses my link and I want to say thank you to the following people. For all my recommended resources, go to my Resources Page

Full Transcript

Business Transcription is provided by GMR Transcription.

On today's episode we are going to talk about how to improve your WordPress site search with Elastic Search right here on Your Website Engineer podcast episode number 291. Hello everybody. Welcome back to another episode of Your Website Engineer podcast. My name is Dustin. Today will be the last episode I'm recording from Spain. It's hard to believe but my European excursion for six weeks has finally come to a close. I was just in Word Camp here – or I was in Word Camp – I went to Word Camp here this weekend. I was in Austria and the WordPress was a – or the Word Camp was a phenomenal success.

There was, I think, 100 – or 1,900 plus people out of the 2200 people that had registered. So it was still one of the biggest Word Camps ever. And it was just an overall very, very smooth event. I'll probably do a recap at some point and just kinda take my key takeaways that I've learned from Europe and just some of the things I'm gonna take back to our local Dayton community.

But they did a great job with the opening and the closing presentations. It was really well done. It was well executed. There were more than 150 volunteers doing things, and so everybody knew where they were supposed to go at what time. It was just really, really laid out very, very nicely.

A lot of the presentations are on WordCamp.org or they're getting uploaded to WordPress.TV. But if you go to 2016.Europe.WordCamp.org you can find the live stream and some of the replays that are there. I also have a link in the show notes of the Q and A with Matt that was one of the first things that got uploaded to WordPress.TV and that was Brian Crozgard from Post Status. Did a 30-minutes Q and A with Matt and then it was audience questions for 30 minutes all recorded and up on WordPress TV [inaudible] [00:01:46], so that's nice.

And they made an announcement at the end that the Word Camp 2017 is going to be in Paris. They found a venue that's just a little bit bigger and they're going to be able to hold World Camp Paris there. So you can actually purchase tickets, if you want to, if you go to 2017.Europe.WordCamp.org. And that's gonna be all there is in the way of announcements.

In the – is there a plug-in for that section? I wanna tell you about remove admin bar and this is a simple plug-in that removes the admin bar from the user's front end. And so this would be really, really useful when you have a membership site or you have some sorta site where people are logging in, they have an account online but you don't want them to see that admin bar across the top. So that's the plug-in that I recommend for that. It's called remove admin bar and it is in the WordPress repository, also in the show notes for episode number 291.

All right. Today I am going to do a very high-level overview of what Elastic Search is. And mainly I've had this on my schedule to do for a very, very long time but I was doing volunteering in one of the rooms when somebody from Ten Up did an entire presentation on Elastic Search. And said, oh, well, this is what it is. Like it makes more sense now. And so I'm able to tell you a little bit about it. It's not to implement Elastic Search. It's not gonna be a very beginner thing because it – well, let's just go ahead and dive right in.

So you may be thinking, doesn't WordPress have search built in? And indeed it does. It has a very default search or a very basic search and it only searches the post titles, the content and the excerpt. That's the only thing it looks for. So if you search for a category type, those aren't gonna appear in your search results. They're just kind of – if you have any custom fields or anything like that, those won't be found in the normal WordPress search.

It relies on My Sequel, which it's slow so My Sequel is what runs your – it's the database but just going in and looking for results, it has to scan through every line and performance-wise it's not a very fast search. And it's not able to handle advanced filtering. There's a lot of things that it can't do. It's very, very basic. I mean, it does a really good job if you just turn on search on your website or most deems, you know, implement the Word Press normal way of searching.

So there's a new thing out there, it's called Elastic Search, and you can find out more at ElasticSearch.org. It's an open source server – or search server written in Java based on technology called Lucine. And this is open source search software by Apache. And it uses a standalone database that provides a restful interface to acceptance for data in a way that's optimized for search. So essentially it's scalable. It's a very performance – great way to search and it's very, very reliable.

Some of the things that you can do with Elastic Search are you can find relevant results, and that makes it easier. The auto suggest feature, so that's kind of like when you go to Google and you start typing it automatically will start suggesting things as you type. It does fuzzy matching so maybe if you are searching for the word podcast, it'll pull in results that have the word podcast [inaudible] [00:04:53]. So that's pretty nice.

You can do geographic searches if you'd like. You can do filterable searches, you can do data way. There's so much more that you can do with this. So essentially what you have to do to get everything set up is you have to go in and you have to set up an additional server, if you will. There's two options to do this. You could actually pay somebody to manager host it and [inaudible] softwares and service or you can post your own cluster.

There's a few out there called Found.no or Qbox.oi or Heroku.com. There's a lot of these out there that you can actually just go ahead and use and get set up and just pay a monthly service fee to have that done. And what it does is when you start with Elastic Search, basically it will go in -- you tell it where your database is and it goes in and it looks at and pulls in all the records from your database. The speaker mentioned that if there's 100,000 articles, that may take like 30 minutes on a development server to get those two in sync.

So you can actually run Elastic Search on your local install, your local environment to give it a test. And it costs nothing to do that obviously because it's just – you're just setting up another sequel database. And so then those two run in parallel and then when you add a new post you update a tag, whatever you do. Like your WordPress site talks to your Elastic Search site or your database over there and then you can – it will automatically just update that. So it's very little data that's updated regularly. It's just that very first time it takes a while for everything to get set up.

So I'm not gonna go into how to set this up because it is kind of time consuming. And basically I would recommend if you're interested in this then sign up for one of those services and get set up that way. But once you have the Elastic Search all set up, that's when you have to connect it to WordPress. And then there's a plug-in created by the folks over at Ten Up that's called Elastic Press. And it is a free WordPress program that powers the WordPress search within Elastic Search. So essentially there's nothing you have to do on the WordPress side of things. You install this plug-in and then when somebody starts to use the native search built into your website it's gonna go ahead and use Elastic Search instead of the default.

So we talked a little bit about some of the things. You could search across multiple blogs and multisite which is nice. You can return results by relevancy and so you can customize the relevancy calculation so it's built into the plug-in. You can do performance queries so you can filter by taxonomies or post medi key or things like that. The fuzzy search will do post title, content, excerpts, taxonomy, germs, post medi and authors. So that's really nice as well.

Elastic Press is also compliant with WP-CLI. So if you wanted to turn on and turn off things or customize it through the command line interface, you can do that as well. So you can get it from Get Hub or you can download it from the WordPress repository. And then inside your WP-config file you put one line of code that will define what your Elastic Press host is, and that's usually an IP address. And then you activate the plug-in. And you need to run a WP-CLI command that will force the indexing across all of the sites in your network.

And then once it's activated and all the posts are integrated – or once all the posts are indexed it will integrate with WP_Query and run queries against Elastic Search instead of My Sequel. So WP_Query will only work when the search query or when you put a parameter EP underscore integrate as past. And so you have to do a little customization if you want to use Elastic Search and things outside of the normal search parameter.

So that's, in a nutshell, very, very basic what Elastic Search is and Elastic Press. This is something that's still, I think, a little bit over my head and I'm not super interested – I'm interested in doing it but I don't know if I have time to kinda implement this new search solution on my website. But I thought it was something that I at least should bring and share because it is a way, especially if you have a very, very large site or a multi-network site or you just want your search results to be better because you're using a lot of custom attributes and things like that. So Elastic Press is – or Elastic Search with Elastic Press plug-in is something you'll definitely want to look at.

So that's all I wanna share with you today. I wanna say thank you so much for putting up with the less quality in the audio over the last six weeks or so. I promise next week I'll be back in my home office. I'm excited to be home. I'm excited to have my own studio back again and get things set up and not have to worry about when I can record based on when recording space is open, when the bells aren't going off and things like that.

And so the next time you hear from me will be in a week but I'll be getting ready to travel to Podcast Movement. And so Podcast Movement is in Chicago. I'll be there just on the Wednesday, the first day of Podcast Movement. I'm only going on Wednesday because I have another trip coming back to Europe in a few days once I get home. So that's what I wanna share with you today. Take care and thank you so much for tuning in and listening to me during these crazy weeks of my European adventure. So with that, we'll talk to you again next week. Take care. Bye-bye.

Leave a Reply