File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,26 @@ use the `transport_options` option:
128
128
Elasticsearch::Client.new url: 'https://username:[email protected] :9200',
129
129
transport_options: { ssl: { ca_file: '/path/to/cacert.pem' } }
130
130
131
+ You can also use [ ** API Key authentication** ] ( https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html ) :
132
+
133
+ ``` ruby
134
+ Elasticsearch ::Client .new (
135
+ host: host,
136
+ transport_options: transport_options,
137
+ api_key: credentials
138
+ )
139
+ ```
140
+
141
+ Where credentials is either the base64 encoding of ` id ` and ` api_key ` joined by a colon or a hash with the ` id ` and ` api_key ` :
142
+
143
+ ``` ruby
144
+ Elasticsearch ::Client .new (
145
+ host: host,
146
+ transport_options: transport_options,
147
+ api_key: {id: ' my_id' , api_key: ' my_api_key' }
148
+ )
149
+ ```
150
+
131
151
### Logging
132
152
133
153
To log requests and responses to standard output with the default logger (an instance of Ruby's {::Logger} class),
You can’t perform that action at this time.
0 commit comments