epomatti / aws-cloudsearch

AWS CloudSearch sandbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS CloudSearch

Infrastructure

Create the infrastructure:

terraform init
terraform apply -auto-approve

Terraform will also create the search indexes.

Search

Upload documents

Upload the file batch:

aws cloudsearchdomain upload-documents \
  --endpoint-url $documentEndpoint \
  --content-type 'application/json' \
  --documents 'movies-batch.json' \
  --region 'us-east-1'

Send a search

Search with a query:

aws cloudsearchdomain search \
  --endpoint-url $searchEndpoint \
  --search-query 'Matrix' \
  --region 'us-east-1'

Get suggestions

Create a suggester:

aws cloudsearch define-suggester \
  --domain-name 'movies-domain' \
  --suggester 'SuggesterName=movie_suggester,DocumentSuggesterOptions={SourceField=title,FuzzyMatching=none}' \
  --region 'us-east-1'

Index the documents again (this can take a while):

aws cloudsearch index-documents \
  --domain-name 'movies-domain' \
  --region 'us-east-1'

Retrieves autocomplete suggestions for a partial query string:

aws cloudsearchdomain suggest \
  --endpoint-url $searchEndpoint \
  --suggester 'movie_suggester' \
  --suggest-query 'Matrix' \
  --region 'us-east-1' \
  --size 3

About

AWS CloudSearch sandbox

License:MIT License


Languages

Language:HCL 100.0%