elastic-enterprise-search 7.17.0 → 7.17.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b57d38a9d4bae9ccd2217e1bd94a06b886a394aafef47a15ba645694404f3183
4
- data.tar.gz: 3f122a3a3400a56afa448de6d3047df37e897867a2a23be1f24026d76fb31e00
3
+ metadata.gz: 20d5dc58d956de95e2aa7d0723236fddf174fdbf17bb59685609a3cbeb3115cf
4
+ data.tar.gz: f343bdbeb2448f5a77750a1bf1f28e54152e56662ce490633e5bd49232695230
5
5
  SHA512:
6
- metadata.gz: 941c3d7645c1126a267662abaf62993581224ef333ad1c6552b52dbeb24508837362afc6f0c6d030e3043567eaebe2b5caa2972571d2610461f15d7f1cf1c88e
7
- data.tar.gz: e85bab13059c21cdade084f4eb6e676be6d091db4b5d8e44326bfa8256b19e76af630ee41d28ecc5ec0a0c52febec826d8fc628d1205d598703b5a2167102363
6
+ metadata.gz: b7dc1bce350ac51b2061bd1d85037b51d884a31b558aa8d4164a98d4eb18d7d403558029719037f824358788466ad14a050d2c799532fc7505f2d64dc681fb4c
7
+ data.tar.gz: d5c0604ace9a80dd05c3ec1f0b04d6ef0f48aebda33727632ce01d1a3ce7b217cec72d044b9dd3344ba7f160d4350991f4c61b29b875c0c6c3feff0394bc5048
data/CHANGELOG ADDED
@@ -0,0 +1 @@
1
+ See https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/release_notes.html
data/CODE_OF_CONDUCT ADDED
@@ -0,0 +1 @@
1
+ See: https://www.elastic.co/community/codeofconduct
data/CONTRIBUTING.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Contributing to enterprise-search-ruby
2
2
 
3
+ ## Run Stack locally
4
+
5
+ A rake task is included to run the Elastic Enterprise Search stack locally via Docker:
6
+
7
+ ```
8
+ $ rake stack[7.10.0]
9
+ ```
10
+
11
+ This will run Elastic Enterprise Search in http://localhost:3002
12
+ - Username: `enterprise_search`
13
+ - Password: `changeme`
14
+
15
+ The version of the Elastic Enterprise Search Stack to use should be the same as tags of `https://www.docker.elastic.co/r/enterprise-search`. You can also use SNAPSHOT builds such as `8.0.0-SNAPSHOT`, `7.11-SNAPSHOT`, etc.
16
+
17
+ ## Running Tests
18
+
19
+ Unit tests for the clients:
20
+
21
+ ```
22
+ $ rake spec:client
23
+ ```
24
+
25
+ Integration tests: you need to have an instance of Enterprise Search running either locally or remotely, and specify the host and credentials in environment variables (see below for a complete dockerized setup). If you're using the included rake task `rake stack[:version]`, you can run the integration tests with the following command:
26
+
27
+ ```
28
+ $ ELASTIC_ENTERPRISE_HOST='http://localhost:3002' \
29
+ ELASTIC_ENTERPRISE_USER='elastic' \
30
+ ELASTIC_ENTERPRISE_PASSWORD='changeme' \
31
+ rake spec:integration
32
+ ```
33
+
34
+ Run integration tests completely within containers, the way we run them on our CI:
35
+ ```
36
+ RUNSCRIPTS=enterprise-search STACK_VERSION=7.10.0 ./.ci/run-tests
37
+ ```
38
+
39
+
3
40
  ## Contributing Code Changes
4
41
 
5
42
  1. Please make sure you have signed the [Contributor License
data/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ Elastic Enterprise Search Ruby Client
2
+ Copyright 2021 Elasticsearch B.V.
data/README.md CHANGED
@@ -6,48 +6,44 @@
6
6
 
7
7
  Official Ruby API client for [Elastic Enterprise Search](https://www.elastic.co/enterprise-search). Use this gem to integrate App Search and Workplace Search into your Ruby code.
8
8
 
9
- ## Documentation
10
-
11
- [See the documentation](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/index.html) for compatibility info, configuring, and an API reference.
12
-
13
- ## Development
14
-
15
- ### Run Stack locally
9
+ ## Installation
16
10
 
17
- A rake task is included to run the Elastic Enterprise Search stack locally via Docker:
11
+ Install the `elastic-enterprise-search` gem from [Rubygems](https://rubygems.org/gems/elastic-enterprise-search):
18
12
 
19
13
  ```
20
- $ rake stack[7.10.0]
14
+ $ gem install elastic-enterprise-search
21
15
  ```
22
16
 
23
- This will run Elastic Enterprise Search in http://localhost:3002
24
- - Username: `enterprise_search`
25
- - Password: `changeme`
17
+ Or add it to your project's Gemfile:
26
18
 
27
- The version of the Elastic Enterprise Search Stack to use should be the same as tags of `https://www.docker.elastic.co/r/enterprise-search`. You can also use SNAPSHOT builds such as `8.0.0-SNAPSHOT`, `7.11-SNAPSHOT`, etc.
19
+ ```ruby
20
+ gem 'elastic-enterprise-search', 'VERSION'
21
+ ```
28
22
 
29
- ### Running Tests
23
+ The Enterprise Search client is implemented with [`elastic-transport`](https://github.com/elastic/elastic-transport-ruby/) as the HTTP layer, which uses [Faraday](https://rubygems.org/gems/faraday). Faraday supports several [adapters](https://lostisland.github.io/faraday/adapters/) and will use `Net::HTTP` by default. For optimal performance with the Enterprise Search API, we suggest using an HTTP library which supports persistent ("keep-alive") connections. For the standard Ruby implementation, this could be https://github.com/drbrain/net-http-persistent[Net::HTTP::Persistent], [patron](https://github.com/toland/patron) or [Typhoeus](https://github.com/typhoeus/typhoeus). For JRuby, [Manticore](https://github.com/cheald/manticore) is a great option as well. Require the library for the adapter in your code and then pass in the `:adapter` parameter to the client when you initialize it:
30
24
 
31
- Unit tests for the clients:
25
+ ```ruby
26
+ require 'elastic-enterprise-search'
27
+ require 'faraday/net_http_persistent'
32
28
 
29
+ client = Elastic::EnterpriseSearch::Client.new(adapter: :net_http_persistent)
33
30
  ```
34
- $ rake spec:client
35
- ```
31
+ If an adapter is not specified, the client will try to auto-detect available libraries and use the best available HTTP client.
36
32
 
37
- Integration tests: you need to have an instance of Enterprise Search running either locally or remotely, and specify the host and credentials in environment variables (see below for a complete dockerized setup). If you're using the included rake task `rake stack[:version]`, you can run the integration tests with the following command:
33
+ ## Documentation
38
34
 
39
- ```
40
- $ ELASTIC_ENTERPRISE_HOST='http://localhost:3002' \
41
- ELASTIC_ENTERPRISE_USER='elastic' \
42
- ELASTIC_ENTERPRISE_PASSWORD='changeme' \
43
- rake spec:integration
44
- ```
35
+ [See the documentation](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/index.html) for usage, code examples, configuring the client, and an API reference.
45
36
 
46
- Run integration tests completely within containers, the way we run them on our CI:
47
- ```
48
- RUNSCRIPTS=enterprise-search STACK_VERSION=7.10.0 ./.ci/run-tests
49
- ```
37
+ See code examples of usage for the [Enterprise Search](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/enterprise-search-api.html), [App Search](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/app-search-api.html) and [Workplace Search](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/workplace-search-api.html) APIs.
38
+
39
+ ## Compatibility
40
+
41
+ We follow Ruby’s own maintenance policy and officially support all currently maintained versions per [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/).
42
+
43
+ ## Development
44
+
45
+ See [CONTRIBUTING](https://github.com/elastic/enterprise-search-ruby/blob/main/CONTRIBUTING.md).
50
46
 
51
47
  ## License
52
48
 
53
- Apache-2.0
49
+ This software is licensed under the [Apache 2 license](./LICENSE). See [NOTICE](./NOTICE).
@@ -14,7 +14,15 @@ For **Elastic Enterprise Search 7.0** and later, use the major version 7 (`7.x.y
14
14
 
15
15
  [discrete]
16
16
  === HTTP Library
17
- This library uses https://github.com/elastic/elasticsearch-ruby/tree/main/elasticsearch-transport[elasticsearch-transport], the low-level Ruby client for connecting to an Elasticsearch cluster - also used in the official https://github.com/elastic/elasticsearch-ruby[Elasticsearch Ruby Client].
17
+ This library uses https://github.com/elastic/elastic-transport-ruby[elastic-transport], the low-level Ruby client for connecting to an Elastic clusters - also used in the official https://github.com/elastic/elasticsearch-ruby[Elasticsearch Ruby Client]. It uses https://rubygems.org/gems/faraday[Faraday], which supports several https://lostisland.github.io/faraday/adapters/[adapters] and will use `Net::HTTP` by default. For optimal performance with the Enterprise Search API, we suggest using an HTTP library which supports persistent ("keep-alive") connections. For the standard Ruby implementation, this could be https://github.com/drbrain/net-http-persistent[Net::HTTP::Persistent], https://github.com/toland/patron[patron] or https://github.com/typhoeus/typhoeus[Typhoeus]. For JRuby, https://github.com/cheald/manticore[Manticore] is a great option as well. Require the library for the adapter in your code and then pass in the `:adapter` parameter to the client when you initialize it:
18
+
19
+ [source,ruby]
20
+ ---------------------------------------------------
21
+ require 'elastic-enterprise-search'
22
+ require 'faraday/net_http_persistent'
23
+
24
+ client = Elastic::EnterpriseSearch::Client.new(adapter: :net_http_persistent)
25
+ ---------------------------------------------------
18
26
 
19
27
  All requests, if successful, will return an `Elasticsearch::Transport::Transport::Response` instance. You can access the response `body`, `headers` and `status`.
20
28
 
@@ -1,6 +1,18 @@
1
1
  [[release_notes_717]]
2
2
  === 7.17 Release notes
3
3
 
4
+ [discrete]
5
+ [[release_notes_7171]]
6
+ === 7.17.1 Release notes
7
+
8
+ - Updates in Documentation: CHANGELOG, CODE_OF_CONDUCT, CONTRIBUTING, NOTICE, README
9
+ - Adds the option to specify an adapter for Faraday when initializing a client. See https://github.com/elastic/enterprise-search-ruby/blob/main/README.md#elastic-enterprise-search-client[README]
10
+ - Fixes typo in meta data for CLIENT_NAME.
11
+
12
+ [discrete]
13
+ [[release_notes_7170]]
14
+ === 7.17.0 Release notes
15
+
4
16
  [discrete]
5
17
  ==== General
6
18
 
@@ -58,6 +58,7 @@ module Elastic
58
58
  # @option options [String] :proxy url of proxy to use, ex: "http://localhost:8888"
59
59
  # @option options [Boolean] :log Use the default logger (disabled by default)
60
60
  # @option arguments [Object] :logger An instance of a Logger-compatible object
61
+ # @option arguments [Symbol] :adapter A specific adapter for Faraday (e.g. `:patron`)
61
62
  # @option enable_meta_header [Boolean] :enable_meta_header Enable sending the meta data header to Cloud.
62
63
  # (Default: true)
63
64
  def initialize(options = {})
@@ -72,6 +73,7 @@ module Elastic
72
73
  log: log,
73
74
  logger: logger,
74
75
  request_timeout: overall_timeout,
76
+ adapter: adapter,
75
77
  transport_options: {
76
78
  request: { open_timeout: open_timeout }
77
79
  },
@@ -103,6 +105,10 @@ module Elastic
103
105
  @options[:logger]
104
106
  end
105
107
 
108
+ def adapter
109
+ @options[:adapter]
110
+ end
111
+
106
112
  def host
107
113
  return DEFAULT_HOST unless @options[:host]
108
114
 
@@ -24,7 +24,7 @@ require 'base64'
24
24
 
25
25
  module Elastic
26
26
  module EnterpriseSearch
27
- CLIENT_NAME = 'elastic-enteprise-search-ruby'
27
+ CLIENT_NAME = 'elastic-enterprise-search-ruby'
28
28
  CLIENT_VERSION = Elastic::EnterpriseSearch::VERSION
29
29
 
30
30
  # Module included in Elastic::Enterprise::Client for http requests.
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Elastic
21
21
  module EnterpriseSearch
22
- VERSION = '7.17.0'
22
+ VERSION = '7.17.1'
23
23
  end
24
24
  end
@@ -85,4 +85,33 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
85
85
  expect(decoded_token[0]['query']).to(eq('cat'))
86
86
  end
87
87
  end
88
+
89
+ context 'adapters' do
90
+ let(:client) { described_class.new }
91
+ let(:adapter) { client.transport.transport.connections.all.first.connection.builder.adapter }
92
+
93
+ context 'when no adapter is specified' do
94
+ it 'uses Faraday NetHttp' do
95
+ expect(adapter).to eq Faraday::Adapter::NetHttp
96
+ end
97
+ end
98
+
99
+ context 'when the adapter is patron' do
100
+ let(:client) { described_class.new(adapter: :patron) }
101
+
102
+ it 'uses Faraday with the adapter' do
103
+ expect(adapter).to eq Faraday::Adapter::Patron
104
+ end
105
+ end
106
+
107
+ unless defined?(JRUBY_VERSION)
108
+ context 'when the adapter is typhoeus' do
109
+ let(:client) { described_class.new(adapter: :patron) }
110
+
111
+ it 'uses Faraday with the adapter' do
112
+ expect(adapter).to eq Faraday::Adapter::Patron
113
+ end
114
+ end
115
+ end
116
+ end
88
117
  end
@@ -103,4 +103,33 @@ describe Elastic::EnterpriseSearch::Client do
103
103
  expect(subject['x-elastic-client-meta']).to match(/^ent=[0-9]+\.[0-9]+\.[0-9]+(p)?,/)
104
104
  end
105
105
  end
106
+
107
+ context 'adapters' do
108
+ let(:client) { described_class.new }
109
+ let(:adapter) { client.transport.transport.connections.all.first.connection.builder.adapter }
110
+
111
+ context 'when no adapter is specified' do
112
+ it 'uses Faraday NetHttp' do
113
+ expect(adapter).to eq Faraday::Adapter::NetHttp
114
+ end
115
+ end
116
+
117
+ context 'when the adapter is patron' do
118
+ let(:client) { described_class.new(adapter: :patron) }
119
+
120
+ it 'uses Faraday with the adapter' do
121
+ expect(adapter).to eq Faraday::Adapter::Patron
122
+ end
123
+ end
124
+
125
+ unless defined?(JRUBY_VERSION)
126
+ context 'when the adapter is typhoeus' do
127
+ let(:client) { described_class.new(adapter: :patron) }
128
+
129
+ it 'uses Faraday with the adapter' do
130
+ expect(adapter).to eq Faraday::Adapter::Patron
131
+ end
132
+ end
133
+ end
134
+ end
106
135
  end
@@ -10,7 +10,7 @@ http_interactions:
10
10
  X-Elastic-Client-Meta:
11
11
  - es=7.11.0.pre.1,rb=2.7.2,t=7.11.0.pre.1,fd=1.3.0,nh=1.1
12
12
  User-Agent:
13
- - 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
13
+ - 'elastic-enterprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
14
14
  elasticsearch-transport: 7.11.0.pre.1)'
15
15
  Content-Type:
16
16
  - application/json
@@ -10,7 +10,7 @@ http_interactions:
10
10
  X-Elastic-Client-Meta:
11
11
  - es=7.11.0.pre.1,rb=2.7.2,t=7.11.0.pre.1,fd=1.3.0,nh=1.1
12
12
  User-Agent:
13
- - 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
13
+ - 'elastic-enterprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
14
14
  elasticsearch-transport: 7.11.0.pre.1)'
15
15
  Content-Type:
16
16
  - application/json
@@ -10,7 +10,7 @@ http_interactions:
10
10
  X-Elastic-Client-Meta:
11
11
  - es=7.11.0.pre.1,rb=2.7.2,t=7.11.0.pre.1,fd=1.3.0,nh=1.1
12
12
  User-Agent:
13
- - 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
13
+ - 'elastic-enterprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
14
14
  elasticsearch-transport: 7.11.0.pre.1)'
15
15
  Content-Type:
16
16
  - application/json
@@ -96,4 +96,33 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
96
96
  expect(client.authorization_url('client_id', 'https://localhost:3002')).to eq authorization_url
97
97
  end
98
98
  end
99
+
100
+ context 'adapters' do
101
+ let(:client) { described_class.new }
102
+ let(:adapter) { client.transport.transport.connections.all.first.connection.builder.adapter }
103
+
104
+ context 'when no adapter is specified' do
105
+ it 'uses Faraday NetHttp' do
106
+ expect(adapter).to eq Faraday::Adapter::NetHttp
107
+ end
108
+ end
109
+
110
+ context 'when the adapter is patron' do
111
+ let(:client) { described_class.new(adapter: :patron) }
112
+
113
+ it 'uses Faraday with the adapter' do
114
+ expect(adapter).to eq Faraday::Adapter::Patron
115
+ end
116
+ end
117
+
118
+ unless defined?(JRUBY_VERSION)
119
+ context 'when the adapter is typhoeus' do
120
+ let(:client) { described_class.new(adapter: :patron) }
121
+
122
+ it 'uses Faraday with the adapter' do
123
+ expect(adapter).to eq Faraday::Adapter::Patron
124
+ end
125
+ end
126
+ end
127
+ end
99
128
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic-enterprise-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.17.0
4
+ version: 7.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Briano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-07 00:00:00.000000000 Z
11
+ date: 2022-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch-transport
@@ -183,9 +183,12 @@ files:
183
183
  - ".github/workflows/testing.yml"
184
184
  - ".gitignore"
185
185
  - ".rubocop.yml"
186
+ - CHANGELOG
187
+ - CODE_OF_CONDUCT
186
188
  - CONTRIBUTING.md
187
189
  - Gemfile
188
190
  - LICENSE
191
+ - NOTICE
189
192
  - README.md
190
193
  - Rakefile
191
194
  - docs/guide/app-search-api.asciidoc
@@ -406,7 +409,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
406
409
  - !ruby/object:Gem::Version
407
410
  version: '0'
408
411
  requirements: []
409
- rubygems_version: 3.3.3
412
+ rubygems_version: 3.3.7
410
413
  signing_key:
411
414
  specification_version: 4
412
415
  summary: Official API client for Elastic Enterprise Search