Skip to content

Instantly share code, notes, and snippets.

@vitaliel
Last active December 18, 2023 20:06
Show Gist options
  • Save vitaliel/196d3bda81d5831a35a91fa678d50d48 to your computer and use it in GitHub Desktop.
Save vitaliel/196d3bda81d5831a35a91fa678d50d48 to your computer and use it in GitHub Desktop.
SearchFlip: Opensearch, skip ssl verification
# Skip ssl verification for local opensearch service
class CustomerIndex
include SearchFlip::Index
# Tested on OpenSearch 1.3 and 2.5
def self.connection
ctx = OpenSSL::SSL::SSLContext.new
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
http_client = SearchFlip::HTTPClient.new(plugins: [
proc {|res, method, uri, opts| opts[:ssl_context] = ctx; res }
]).basic_auth(user: "admin", pass: "admin")
mimic_es SearchFlip::Connection.new http_client: http_client
end
def self.mimic_es connection
connection.instance_variable_set :@version, '8.1.1'
connection
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment