Amazon Cloudsearch Wordpress Integration

Amazon Cloudsearch Wordpress Integration
Page content

Improve Wordpress Search Capabilities using Amazon CloudSearch

Wordpress has its own built-in search features. However, the built in search feature has limited capabilities that are sufficient for small blogs but not for larger websites or ecommerce websites.

You will need to improve the basic search in Wordpress using a dedicated search plugin or another external search service to provide your customers the best experience.

Improving the existing wordpress search can have several benefits. It helps reduce bounce rate when customers can easily find more accurate search responses. Rather than skipping through several results and then reaching the right one, they can see more accurate search results when they search on your website for a specific query.

As your website grows and its number of users as well as the content on your website, you cannot manage with the existing Wordpress search but need to provide your users with a considerably better search experience. The wordpress search feature is very basic.

Amazon Cloudsearch and its benefits

You have several options to improve Wordpress search and one of them is Amazon CloudSearch which is a cost effective solution for improving the search experience manifold on your Wordpress website. It is not just cost effective, it is also easy to set up.

Amazon CloudSearch is a managed search service provided by AWS Cloud. It is a simple and cost effective solution to set up, manage and scale a search solution for your website or application. It supports 34 languages as well as all the important search features such as autocomplete, highlighting and geospatial search.

Amazon Cloudsearch offers several benefits including ease of set up, simplicity, scalability, cost effectiveness, security, reliability and high performance.

  • Amazon Cloudsearch allows you to quickly add rich search capabilities to your website or application without the need to be a search expert or being concerned regarding hardware, setup and management. You can create a search domain with just a few clicks and upload the data that you want searchable. In a few minutes Amazon Cloudsearch will have automatically provisioned the required resources and deployed a fully tuned search index. Easily change search parameters or fine tune search relevance whenever you need. Amazon Cloudsearch will also scale seamlessly with changes in volume of data and traffic levels.

  • Managing search indexing options is simple with Amazon Cloudsearch. You can configure and manage your search domain using the console, AWS CLI or AWS SDKs. To get automatic recommendations regarding the configuration of your search indexing options, just point to a sample of data. It is easy to add and delete the index fields as well as configure search options like highlighting, faceting etc. each time you make configuration changes, you will not need to upload data again.

  • Amazon Cloudsearch offers powerful autoscaling for search domains. It can scale your search domain’s resources up or domain with changes in data or query volume. However, you can control scaling if you are expecting a surge in traffic or growth in data volumes.

  • Amazon Cloudsearch is a high performance search. It ensures low latency and high throughput performance, even at large scale through automatic sharding (sharding involves breaking data into smaller chunks and storing them across several database servers for processing large volumes of data simultaneously; helps improve performance by overcoming bottlenecks that come with large volumes of data) and horizontal and vertical autoscaling.

  • Amazon Cloudsearch is a fully managed custom search service which means that software and hardware provisioning, setup and configuration, software patching, data partitioning, node monitoring, scaling, and data durability are managed for you.

  • Amazon Cloudsearch is cost effective since you pay low hourly rates and only for the resources you use.

  • Amazon Cloudsearch is secure since it uses strong cryptographic methods for user authentication and to prevent unauthorized access to search domains. AWS IAM provides an additional security level.

Must Read - Amazon Cloudfront Distribution with Custom Domain Name

What are the search features supported by Amazon Cloudsearch?

Amazon Cloudsearch offers several rich features including the following:

  • Free text, Boolean, and Faceted search
  • Autocomplete suggestions
  • Customizable relevance ranking and query-time rank expressions
  • Field weighting
  • Geospatial search
  • Highlighting
  • Support for 34 languages

How to setup Amazon Cloudsearch with Wordpress?

Setting up Amazon Cloudsearch with Wordpress is easy. The integration of Amazon Cloudsearch with Wordpress can be made possible easily with the help of a plugin. However, before you can integrate Amazon C;loudsearch into your Wordpress site, you will need to create a search domain.

Create search domain using AWS Console

The first step to integrating AWS Cloudsearch in Wordpress is to create a search domain. You need access to your AWS account, Login to your AWS account, and if you have not signed up yet create an account and login. Now, search for Cloudsearch.

Once you are on the Amazon Cloudsearch dashboard, you can click on create a new search domain.

Amazon Cloudsearch for Wordpress

Now, enter a unique name for your search domain. Here, we are naming it mysite-search. For the desired instance type, select search.small and replication count 1 (default count).

The default partition count is 1 and if you want to change you need to use at least search.2xlarge for the instance type.

Once you have filled the information, move on to the next step by clicking continue.

The next steps are as follows:

  • Configure Index
  • Review Index Configuration
  • Setup Access Policies

You can skip the next three steps and click on continue for each since we can do this after we install the plugin. In the final step, give your confirmation and then wait for the resources to deploy and your search domain to become active.

Amazon cloudsearch wordpress

It will take around ten minutes following which you will see the status of the search domain you created as active.

Amazon cloudsearch active

Create AWS Cloudsearch domain using AWS CLI

If you can use the aws CLI or have it installed locally, the CLI method is much easier for creating a Cloudsearch domain. You will only need to run the following command:

aws cloudsearch create-domain --domain-name <domain-name> 

For example, if I want to create a search domain for my movie website and want to name the search domain movies, I will movies at the end of the above command.

aws cloudsearch create-domain --domain-name movies

It will output a response like the following:

{
    "DomainStatus": {
        "DomainId": "329878988866/movies",
        "DomainName": "movies",
        "ARN": "arn:aws:cloudsearch:us-east-1:329878988866:domain/movies",
        "Created": true,
        "Deleted": false,
        "DocService": {},
        "SearchService": {},
        "RequiresIndexDocuments": false,
        "Processing": false,
        "SearchPartitionCount": 0,
        "SearchInstanceCount": 0
    }
}

You can use the ‘aws cloudsearch delete-domain –domain-name’ command to delete a search domain. When you delete a search domain, you will receive a response like the following:

aws cloudsearch delete-domain --domain-name movies


{
    "DomainStatus": {
        "DomainId": "329878988866/movies",
        "DomainName": "movies",
        "ARN": "arn:aws:cloudsearch:us-east-1:329878988866:domain/movies",
        "Created": true,
        "Deleted": true,
        "DocService": {
            "Endpoint": "doc-movies-abcdef5km644wi6jqx26l4vlq.us-east-1.cloudsearch.amazonaws.com"
        },
        "SearchService": {
            "Endpoint": "search-movies-abcdef5km644wi6jqx26l4vlq.us-east-1.cloudsearch.amazonaws.com"
        },
        "RequiresIndexDocuments": false,
        "Processing": false,
        "SearchPartitionCount": 0,
        "SearchInstanceCount": 0
    }
}

Must Read - Learn About Amazon EC2 Instance Families

Setup the Cloudsearch Plugin

Now that you are ready with a search domain, the next step would be to set up the Cloudsearch plugin from the Wordpress plugin repository. Install and activate the plugin.

Go to the plugin repository to add the new plugin and search for Cloudsearch. Install and activate it and then from the left sidebar click on cloudsearch and go to settings.

You will see some empty boxes asking for AWS Access key id, secret key and session id.

You will also need to fill the search-domain end point as well as the name of the search domain you have created.

Cloudsearch plugin

Go back to your AWS account and click on your name in the top right corner. From the drop down menu, click on security credentials. We will need to create access keys before we can use the plugin to integrate cloudsearch into our Wordpress website.

Click on create access key and then give your confirmation when asked for. In the next step, copy the access key and the secret key and paste them inside their respective fields in the plugin settings.

Copy the cloudsearch domain end point from cloudsearch dashboard inside your aws account and paste it there. Enter the name of your search domain. For example, we had selected mysite-search as the domain name.

You can make changes to the schema settings below these settings. If you want only posts and pages to appear in the searches, you must select only these two. If you want the categories to be searched, you can include them by ticking the box for taxonomies.

For the front page and the results settings of the plugin, you can continue with the default settings. If you want to change the highlighting style, you can make changes inside the highlighting settings. You can enable suggestions if you want through the suggestions settings.

Now, you are finished setting up the plugin. Click on save to save all the settings.

Run Indexing in Cloudsearch plugin

If you try to search for something right away using your Wordpress search, you will get no results. It is because your default Wordpress search has been replaced by Cloudsearch but you have got nothing indexed or your search index does not have any data.

We will need to get our site data indexed so that users can search and find it. Go back to the Cloudsearch plugin settings on the left sidebar inside your Wordpress dashboard and click on manage.

Click on the ‘create index’, ‘aync all index documents’ and then ‘run indexing’ buttons to get your site data indexed by Amazon Cloudsearch.

Wait for the indexing operation to complete. It will take just a little time. The process can be faster if you use a larger instance than the default search.small instance.

Every time you make changes or update the schema settings, click on ‘create/update index’.

Following that, you will be required to run indexing again. Once you have run indexing for the first time, you can test the search and you will have a much better search experience than the default Wordpress search. Amazon Cloudsearch will return search results a lot faster and the results will be more relevat to the search query.

Suggested Reading