Open In App

How to Configure AWS Elasticsearch For Full-Text Search?

Last Updated : 16 Oct, 2024
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report

The Elasticsearch built on Apache Lucene is a search and analytics engine . Since from its release in (2010), Elasticsearch has become one of the most popular search engine and a compulsion used for log analytics, full-text search, security intelligence and operational intelligence cases. To ensure that the open source community and our customers continue to have a secure, high-quality, fully open source search and analytics suite AWS has introduced the OpenSearch project. The data can be in the form of JSON documents to Elasticsearch using the API like the Logstash and Amazon Kinesis Firehose.

Primary Terminologies

As we are going deep inside the topic let us understand some of the basic terminologies first,

  • Query: Query is a search request to fetch the information from the documents.
  • Elastic Search: The Elastic Search is a free and open search for all the types of data present in the textual, numerical or structured manner.
  • Mapping: It defines the different types that may reside in an index for example , properties, names, type, mytype.
  • Index: It is the largest unit of data and store the documents of any number and the type.
  • Analyzers: They are used to breakdown a phrase into its simple or the constituent term.
  • Cluster: A cluster in an Elasticsearch consists of elastic nodes which can be more than one in the quantity there are enormous number of API's which are used to query the status to cluster.
  • Highly Secure - Virtual private cloud (VPC) can be set up with the help of amazon elastic search which is safe and simple, also the network isolation and management of authentication can be secured.
  • Cost Effective - It is a cost effective and a scalable tool, it provides users with the storage capacity of 3PB , tremendous amount of data.
  • Easily Usable - All the services provided by the amazon elastic search are extremely easy to use and very simple to utilize. It takes a few second with a strong internet connectivity to and the customers may post the elastic clusters.
  • Full-text-search - The Elastic search provides a rich and diverse experience over a huge variety of documents with some very useful features such as the fuzzy search, faceting, auto-complete and many more.
  • Supports a huge varieties of API'S.

Step 1: Sign up with your AWS account or create a new AWS account on it the button will be present on the top right corner.

Create Aws Account

Step 2: While creating the account provide all the essential details asked and after filling each one correctly Click on the CONTINUE Button.

Configuring Aws Account

After setting up everything and Now Create a new domain.

Create a new domain
  • Enter a Domain Name
Enter a Domain Name
  • Network Configuration : Decide if you want to make your domain public or private
Network Configuration

After setting up everything and Configuring your Domain we will proceed towards Step number 3

Step 3: Is to Upload the data for the Indexing Purpose By the help of command line interface Upload data to Amazon EC2 domain service On your Windows operating System CURL can be Installed to use as cmd (command promt) but the best and the most recommended operating system is the LINUX OS.

Apply and execute the code command mentioned below as the the first document

Code:

C++
curl -XPUT -u master-user:master-user-password domain-endpoint/books/_doc/1 -H 'Content-Type: application/json' -d '{
   "book_name": "Know your Worth",
   "author": ["NK Sondhi", "Vibha Malhotra"],
   "publisher": "General Press",
   "publishing_date": "February 2017",
   "ISBN": "8180320235",
   "length": "224 pages"
}'
Json
#include <iostream>
using namespace std;

int main() {

    cout << "GFG!";
    return 0;
}
Seeting-up-Indexes

Now multiple documents of json file Just user has to copy and paste these commands.

C++
{ "index": { "_index": "books", "_id": "2" } }  
{ "book_name": "The End of Imagination", "author":
 "Arundhati Roy", "publisher": "Haymarket Books", 
 "publishing_date": "December 1998", "ISBN": 
 "9781608466191", "length": "408 pages" }  
{ "index": { "_index": "books", "_id": "3" } }  
{ "book_name": "Power of Positive Thinking", 
 "author": "Norman Vincent Peale", "publisher": 
 "Prentice Hall", "publishing_date": "October 1952",
 "ISBN": "9780671635305", "length": "240 pages" }
Screenshot-2024-10-14-171614

Step 4: Search document through the command line and execute the below code mentioned

C++
curl XGET -u master-user:master-user-password 
'domain-endpoint/books/_search?q=technical&pretty=true'  


Alternative Python code for the same are mentioned below:

Screenshot-2023-05-21-130812.png

Conclusion

Configuring AWS Elasticsearch for full-text search is a powerful way to enhance your data retrieval capabilities. With its robust architecture and seamless integration with other AWS services, it provides a scalable solution for managing large datasets. By following the proper configuration steps and utilizing best practices, you can harness the full potential of AWS Elasticsearch, ensuring efficient and effective data searching and analysis. Whether you are working with logs, user-generated content, or any other text data, AWS Elasticsearch offers the tools you need to implement a sophisticated full-text search solution that meets your needs


Next Article
Article Tags :

Similar Reads