Skip to content

dblock/opensearch-ruby-client-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenSearch Ruby Client Demo

Makes requests to Amazon OpenSearch using the OpenSearch Ruby Client, specifically opensearch-aws-sigv4 released as part of (opensearch-project/opensearch-ruby#71). Version 1.1.0 added support for OpenSearch Serverless.

Running

Create an OpenSearch domain or an OpenSearch Serverless collection in (AWS) which support IAM based AuthN/AuthZ.

export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export AWS_SESSION_TOKEN=
export AWS_REGION=

export SERVICE=es # use aoss for OpenSearch Serverless
export ENDPOINT=https://....us-west-2.es.amazonaws.com

bundle exec ruby example.rb

This will output the version of OpenSearch and a search result.

opensearch: 1.2.4
{"_index"=>"sample-index", "_type"=>"_doc", "_id"=>"1", "_score"=>0.2876821, "_source"=>{"first_name"=>"Bruce"}}

The code will create an index, add a document, then cleanup.

Use bundle exec ruby json.rb to run the raw JSON sample.

License

This project is licensed under the Apache v2.0 License.

Copyright

Copyright OpenSearch Contributors. See NOTICE for details.

About

OpenSearch Ruby Client Demo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages