If you ever thought about creating an app that will be used for thousands of people you have probably faced the question “How can I increase the searching performance in my app?”. An Amazon cloudsearch domain might be a good option, since this service is “pay-as-you-go” and was created specially to handle searches. A search domain encapsulates the data you want to search, indexing options that control how you can search data and what information you can retrieve from your search domain, and the search instances that index your data and process search requests.
The first step is to search the service you need on the search tab, in this case, cloudsearch, and then click the service:
Once you’re in the service, click the button to create a new search domain:
A pop-up containing the needed steps will open on the screen, the first step is to name the search domain. You may name it as you want, although there are some constraints, only hyphen and numbers are allowed, capital letters or any other special character are forbidden:
The second step is to configure the indexes, these indexes are responsible for making data searchable inside the cloudsearch and they must be in one of these 4 formats: JSON, XML, CSV or TXT, otherwise it won’t work. There are 5 ways to configure your index, in this case, we’re going to select the Analyze sample file(s) from my local machine option and attach a json file to it:
The third step consists of verifying the fields that were indexed, if they match the fields that you want to use on your searches. It’s also possible to modify these configurations later through the consoleObs: fields with text or text-array type are incapable of generate facetsExample of json used as index:Index generated:
The fourth step is to set the access policies. The platform provides some useful examples of policies and you can use them as your own
Search and Suggester: Allows access to the search functionalities except uploading documents to the search domain, upload documents will be available for the account owner only;
Allow open access to all services: Allows access to all functionalities;
Allow access to all services from specific IP(s): Allows access to all functionalities, but only for the specified IP's
Deny access to all services: All services are unavailable, no one is allowed to use your endpoints
The fifth step consists on verifying the previous configurations made and assuring that all the informations are correct, after that, you just have to click the Confirm button
To make changes or to verify the settings of your search domain, just select the topic on the side menu:
Testing or monitoring the search requests, just select the topic on the side menu:
How to upload the database that will be used for searching through the console?
Go to the Dashboard and hit the Upload Documents button
A pop-up with the needed steps will apper on the screen, and in this pop-up, the first step is to select which source your database comes from. You must consider that cloudsearch only allows 4 types of files: JSON, XML, CSV or TXT. Therefore, if your database is in a different type, you’ll need to convert to one of these 4 before uploading it.Obs: For this example the ‘File(s) on my local disk’ option was selected
The second step is to review documents, where the tool makes the matching between the index fields from your previous index configuration to your documents fields.
If the fields from your database don’t match with your index fields, a warning message will be displayed on your screen.
Ex:
The last step is the Document Summary, in it you can see the process summary, such as the amount of records that were sent to the search domain, the status of the process and if any record failed.
Open the module where you want to make the integration with the cloudsearch and right click on REST method inside the Integrations folder in the Logic tab
Select the Consume REST API, then click ADD SINGLE METHOD
Go to Dashboard in the cloudsearch console and copy the Search endpoint
Inside the method URL, paste the endpoint you copied from the cloudsearch and hit the Finish button
The rest method is now created, but it will need a few adjustments
To retrieve the data from the cloudsearch you need to pass the parameters through the URL. (Here is a link where you can find more of information about the URL composition Search API Reference for Amazon CloudSearch - Amazon CloudSearch)
URL Path in the action ‘Get’ you place the parameters that you want to pass in order to retrieve information
Retrieving information
Double click on the Get action to open the pop-up
Go to the Test tab and fill the inputs, then click on Test button
If the response is correct, then hit the Finish button and the accept the use of Response of the test
The last step is to check if the structures are correct and it’s done, you’re now able to use this endpoint inside an action or service action
Currently, the necessary amount of time to create a search domain is 10 minutes, and any changes of the configurations you made during the creation, will demand a new rerun index, which may take more time depending on how much data you have in your domain.
The upload of documents does not generate any index. So, in order to make things searchable, you will need to configure your indexes and your indexes must be in compliance with the fields in the database.
When using the endpoint inside the outsystems, remember to check your domain access policies, if it’s not properly configured an error might occur
To download a sample database or check out the document used to search reference, go to https://drive.google.com/drive/u/0/folders/1DoMj4dFHdrEaxp9tcywVL-7L4QVV01zb
Creating and Managing Amazon CloudSearch Domains - Amazon CloudSearch
Creating an Amazon CloudSearch Domain - Amazon CloudSearch
Search API Reference