Amazon OpenSearch - Hands On Demo

Create an Amazon OpenSearch Service domain - Part 1

 

  1. Under Analytics, choose Amazon OpenSearch Service.

  2. Choose Create domain.

  3. Provide a name for the domain.

  4. Choose Standard create.

  5. For templates, choose Dev/test.

  6. For the deployment option, choose Domain with standby.

  7. For Version, choose the latest version.

  8. Ignore the Data nodes, Warm and cold data storage, Dedicated master nodes, Snapshot configuration, and Custom endpoint sections.

Create an Amazon OpenSearch Service domain - Part 2

 

  1. Use a public access domain. Under Network, choose Public access.

  2. In the fine-grained access control settings, keep the Enable fine-grained access control check box selected. Select Create master user and provide a username and password.

  3. Ignore the SAML authentication and Amazon Cognito authentication sections.

  4. For Access policy, choose Only use fine-grained access control. In this tutorial, fine-grained access control handles authentication, not the domain access policy.

  5. Keep rest all as defaults.

  6. Click Create.

  7. New domains typically take 15 to  30 minutes to initialize.

  8. Copy the domain endpoint under General information.

Create/Upload a Single Document

 

  1. Launch AWS Cloud Shell in us-east-1 (North Virginia) Region.
  2. Copy paste the following code. Make sure to change the domain endpoint as per your environment.
USERNAME=master
PASSWORD=Master@123
DOMAINENDPOINT=https://search-movies-afndo3wvhhypa2f4abi7cidgqi.us-east-1.es.amazonaws.com
curl -XPUT -u "$USERNAME:$PASSWORD" \
     "${DOMAINENDPOINT}/movies/_doc/1" \
     -d '{"director": "Burton, Tim", "genre": ["Comedy","Sci-Fi"], "year": 1996, "actor": ["Jack Nicholson","Pierce Brosnan","Sarah Jessica Parker"], "title": "Mars Attacks!"}' \
     -H 'Content-Type: application/json'

Upload multiple documents

 

  1. Copy paste the following code.
cat > data.json << EOF
{ "index" : { "_index": "movies", "_id" : "2" } }
{"director": "Frankenheimer, John", "genre": ["Drama", "Mystery", "Thriller", "Crime"], "year": 1962, "actor": ["Lansbury, Angela", "Sinatra, Frank", "Leigh, Janet", "Harvey, Laurence", "Silva, Henry", "Frees, Paul", "Gregory, James", "Bissell, Whit", "McGiver, John", "Parrish, Leslie", "Edwards, James", "Flowers, Bess", "Dhiegh, Khigh", "Payne, Julie", "Kleeb, Helen", "Gray, Joe", "Nalder, Reggie", "Stevens, Bert", "Masters, Michael", "Lowell, Tom"], "title": "The Manchurian Candidate"}
{ "index" : { "_index": "movies", "_id" : "3" } }
{"director": "Baird, Stuart", "genre": ["Action", "Crime", "Thriller"], "year": 1998, "actor": ["Downey Jr., Robert", "Jones, Tommy Lee", "Snipes, Wesley", "Pantoliano, Joe", "Jacob, Ir\u00e8ne", "Nelligan, Kate", "Roebuck, Daniel", "Malahide, Patrick", "Richardson, LaTanya", "Wood, Tom", "Kosik, Thomas", "Stellate, Nick", "Minkoff, Robert", "Brown, Spitfire", "Foster, Reese", "Spielbauer, Bruce", "Mukherji, Kevin", "Cray, Ed", "Fordham, David", "Jett, Charlie"], "title": "U.S. Marshals"}
{ "index" : { "_index": "movies", "_id" : "4" } }
{"director": "Ray, Nicholas", "genre": ["Drama", "Romance"], "year": 1955, "actor": ["Hopper, Dennis", "Wood, Natalie", "Dean, James", "Mineo, Sal", "Backus, Jim", "Platt, Edward", "Ray, Nicholas", "Hopper, William", "Allen, Corey", "Birch, Paul", "Hudson, Rochelle", "Doran, Ann", "Hicks, Chuck", "Leigh, Nelson", "Williams, Robert", "Wessel, Dick", "Bryar, Paul", "Sessions, Almira", "McMahon, David", "Peters Jr., House"], "title": "Rebel Without a Cause"}
EOF
curl -XPOST -u "$USERNAME:$PASSWORD" \
     "${DOMAINENDPOINT}/_bulk" \
     --data-binary @data.json \
     -H 'Content-Type: application/json'

Search Documents

 

  1. Copy paste the following code.
curl -XGET -u "$USERNAME:$PASSWORD" "${DOMAINENDPOINT}/movies/_search?q=mars&pretty=true"

Explore Dashboards

https://search-movies-afndo3wvhhypa2f4abi7cidgqi.us-east-1.es.amazonaws.com/_dashboards/

Delete an Amazon OpenSearch Service domain

 

 

  1. Under Domains, select the movies domain.

  2. Choose Delete and confirm deletion.

 

Thanks

For

Watching