Skip to content

Commit

Permalink
Changes required to communicate with OpenSearch serverless.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed Jan 20, 2023
1 parent 245de23 commit e8104c9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

source 'https://rubygems.org'

gem 'opensearch-aws-sigv4', '~> 1.0.0'
gem 'opensearch-aws-sigv4', github: 'opensearch-project/opensearch-ruby'
29 changes: 17 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
GEM
remote: https://rubygems.org/
GIT
remote: https://github.com/opensearch-project/opensearch-ruby.git
revision: 76f5308e74aa22e1cd9fbd0954c84eb6171e116d
specs:
aws-eventstream (1.2.0)
aws-sigv4 (1.5.2)
aws-eventstream (~> 1, >= 1.0.2)
faraday (2.7.2)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
multi_json (1.15.0)
opensearch-api (2.1.0)
multi_json
opensearch-aws-sigv4 (1.0.0)
opensearch-aws-sigv4 (1.1.0)
aws-sigv4 (~> 1)
opensearch-ruby (>= 1.0.1)
opensearch-ruby (2.1.0)
Expand All @@ -20,13 +13,25 @@ GEM
opensearch-transport (2.1.0)
faraday (>= 1.0, < 3)
multi_json

GEM
remote: https://rubygems.org/
specs:
aws-eventstream (1.2.0)
aws-sigv4 (1.5.2)
aws-eventstream (~> 1, >= 1.0.2)
faraday (2.7.4)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
multi_json (1.15.0)
ruby2_keywords (0.0.5)

PLATFORMS
arm64-darwin-21

DEPENDENCIES
opensearch-aws-sigv4 (~> 1.0.0)
opensearch-aws-sigv4!

BUNDLED WITH
2.3.24
10 changes: 5 additions & 5 deletions example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
require 'aws-sigv4'

signer = Aws::Sigv4::Signer.new(
service: 'es',
service: 'aoss',
region: ENV['AWS_REGION'] || 'us-east-1',
access_key_id: ENV['AWS_ACCESS_KEY_ID'] || raise('Missing AWS_ACCESS_KEY_ID.'),
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'] || raise('Missing AWS_SECRET_ACCESS_KEY.'),
Expand All @@ -22,11 +22,11 @@

client = OpenSearch::Aws::Sigv4Client.new({
host: ENV['OPENSEARCH_ENDPOINT'] || raise('Missing OPENSEARCH_ENDPOINT.'),
log: false
log: true
}, signer)

info = client.info
puts info['version']['distribution'] + ': ' + info['version']['number']
# info = client.info
# puts info['version']['distribution'] + ': ' + info['version']['number']

# create an index
index = 'movies'
Expand All @@ -35,7 +35,7 @@
begin
# index data
document = { title: 'Moneyball', director: 'Bennett Miller', year: 2011 }
client.index(index: index, body: document, id: '1', refresh: true)
client.index(index: index, body: document, id: '1')

# wait for the document to index
sleep(3)
Expand Down

0 comments on commit e8104c9

Please sign in to comment.