elastic/app-search-ruby

Need an example of using a signed search key

Closed this issue · 0 comments

https://github.com/elastic/app-search-python#create-a-signed-search-key

https://swiftype.com/documentation/app-search/authentication#signed

This is the example used in the documentation. It needs to be updated:

require 'swiftype-app-search'

read_only_api_key = 'private-xxxxxxxxxxxxxxxxxxxx'
api_key_name = 'private-key'
enforced_options = {
  result_fields: { title: { raw: {} } },
  filters: { world_heritage_site: 'true' }
}

signed_search_key = SwiftypeAppSearch::Client.create_signed_search_key(read_only_api_key, api_key_name, enforced_options)

client = SwiftypeAppSearch::Client.new(host_identifier: 'host-2376rb', api_key: signed_search_key)
client.search('national-parks-demo', 'everglade')