elastic-enterprise-search 7.13.0.pre → 7.13.0

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: 8036e7cf6cee2aa2a4bd8ebe43e8ebd81e46de9849dd785c1185e865cd197a6d
4
- data.tar.gz: 0dc716523605727f80cf992537ace657ba4152db79e8b7df08a077d77c40f623
3
+ metadata.gz: 5f34ee86d14a96362e791a8f5542bf4a4da9ff48df0ee92b35996f08c56219ce
4
+ data.tar.gz: 11be1147329f5adafc17769b825c7262a9d3d4309a705233ceebe24b36c3dc05
5
5
  SHA512:
6
- metadata.gz: 2a46a41e600dbae30c4f24ff5a76b766ce68ae54d4c322e94c5eb312a1e0ee4bbf55df7bbea572656285078cc3a177b35bd4d8619d3cd706db7500f91ac71c72
7
- data.tar.gz: d825c1dccff5af252f2eaba9dd2f84ef47594fbe8e3992a1255433179f44e32d4318a91dc495871d889a273456ef7cf6663184fc2a8f03f32658e560d253a159
6
+ metadata.gz: c867f7c2c897cade800f5e6c6c415eece5c939f53996246378021cb584a39a5b768b02459525741fa3d59654a44893ce8d0c02084a22daf3d7c352230fcf3895
7
+ data.tar.gz: 368a0e0137e5315ca34c5b661cca686eff108a2ee31a7951bc1043e57558bc3d48b403dc3d5c03967da7c7fdf6b24cd03018889f6651760e22a6db6d5da17f0e
@@ -0,0 +1,21 @@
1
+ [[release_notes_713]]
2
+ === 7.13.0 Release notes
3
+
4
+ [discrete]
5
+ ==== General
6
+
7
+ - Tested with Elastic Enterprise Search API version 7.13.0.
8
+ - Improved meta header implementation for Elastic Cloud.
9
+
10
+ [discrete]
11
+ ==== Workplace Search
12
+
13
+ * The client now supports Basic Authentication and Elasticsearch tokens. All Workplace Search APIs support Basic Authentication, Elasticsearch tokens and Workplace Search admin user access tokens as an authentication method. You still need to set up user access tokens generated by the Workplace Search OAuth Service for the Search API and the Analytics Events API.
14
+ * New APIs:
15
+ ** `document`: Retrieve a document by ID from a specified content source.
16
+ ** `delete_all_documents`: Delete all documents for a given content source
17
+ ** `content_source`: Retrieves a content source by ID
18
+ ** `create_content_source`: Creates a custom content source
19
+ ** `delete_content_source`: Deletes a content source by ID
20
+ ** `list_content_sources`: Retrieves all content sources
21
+ ** `put_content_source`: Updates a custom content source
@@ -5,10 +5,12 @@
5
5
  [discrete]
6
6
  === 7.x
7
7
 
8
+ * <<release_notes_713, 7.13.0 Release Notes>>
8
9
  * <<release_notes_712, 7.12.0 Release Notes>>
9
10
  * <<release_notes_711, 7.11.0 Release Notes>>
10
11
  * <<release_notes_710, 7.10.0.beta.1 Release Notes>>
11
12
 
13
+ include::713.asciidoc[]
12
14
  include::712.asciidoc[]
13
15
  include::711.asciidoc[]
14
16
  include::710.asciidoc[]
@@ -1,6 +1,33 @@
1
1
  [[workplace-search-api]]
2
2
  == Workplace Search API
3
3
 
4
+ === Content Sources
5
+
6
+ [source,rb]
7
+ ----------------------------
8
+ # Create a custom content source
9
+ client.create_content_source(name: 'test')
10
+
11
+ # Retrieve a content source by ID
12
+ content_source_id = client.create_content_source(name: 'books').body['id']
13
+ client.content_source(content_source_id)
14
+
15
+ # Delete a content source by ID
16
+ client.delete_content_source(content_source_id)
17
+
18
+ # Retrieve all content sources
19
+ client.list_content_sources
20
+
21
+ # Update a custom content source
22
+ body = {
23
+ name: new_name,
24
+ schema: { title: 'text', body: 'text', url: 'text' },
25
+ display: { title_field: 'title', url_field: 'url', color: '#f00f00' },
26
+ is_searchable: true
27
+ }
28
+ client.put_content_source(id, body: body)
29
+ ----------------------------
30
+
4
31
  === Documents
5
32
 
6
33
  [source,rb]
@@ -47,7 +47,7 @@ Gem::Specification.new do |s|
47
47
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
48
48
  s.require_paths = ['lib']
49
49
 
50
- s.add_dependency 'elasticsearch-transport', '7.13.0.pre'
50
+ s.add_dependency 'elasticsearch-transport', '~> 7.13.0'
51
51
  s.add_runtime_dependency 'jwt', '>= 1.5', '< 3.0'
52
52
  s.add_development_dependency 'awesome_print'
53
53
  s.add_development_dependency 'byebug' unless defined?(JRUBY_VERSION)
@@ -83,10 +83,6 @@ module Elastic
83
83
  @options[:open_timeout] || DEFAULT_TIMEOUT
84
84
  end
85
85
 
86
- def proxy
87
- @options[:proxy]
88
- end
89
-
90
86
  def overall_timeout
91
87
  (@options[:overall_timeout] || DEFAULT_TIMEOUT).to_f
92
88
  end
@@ -46,11 +46,9 @@ module Elastic
46
46
  end
47
47
 
48
48
  # Construct and send a request to the API.
49
- #
50
- # @raise [Timeout::Error] when the timeout expires
51
49
  def request(method, path, params = {}, body = {}, headers = {})
52
50
  meta_headers = { authorization: decide_authorization(params), user_agent: request_user_agent }
53
- headers = if headers.nil? || !headers.is_a?(Hash)
51
+ headers = if !headers.is_a?(Hash)
54
52
  meta_headers
55
53
  else
56
54
  headers.merge(meta_headers)
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Elastic
21
21
  module EnterpriseSearch
22
- VERSION = '7.13.0.pre'
22
+ VERSION = '7.13.0'
23
23
  end
24
24
  end
@@ -18,7 +18,6 @@
18
18
  # frozen_string_literal: true
19
19
 
20
20
  require 'spec_helper'
21
- require_relative './../webmock_requires'
22
21
 
23
22
  describe Elastic::EnterpriseSearch::Client do
24
23
  let(:host) { 'https://localhost:8080' }
@@ -112,6 +112,32 @@ describe Elastic::EnterpriseSearch::Client do
112
112
  expect(client.put('test', {}, { 'params' => 'test' }, custom_header).status).to eq(200)
113
113
  end
114
114
  end
115
+
116
+ context 'Test headers' do
117
+ context 'when using an empty header' do
118
+ let(:custom_header) { {} }
119
+ it 'builds the right request' do
120
+ stub_request(:get, "#{host}/test")
121
+ .with(body: { 'params' => 'test' })
122
+ .with(headers: headers)
123
+ .to_return(stub_response)
124
+
125
+ expect(client.request(:get, 'test', {}, { 'params' => 'test' }, custom_header).status).to eq(200)
126
+ end
127
+ end
128
+
129
+ context 'when using invalid header' do
130
+ let(:custom_header) { 'Test' }
131
+ it 'builds the right request' do
132
+ stub_request(:get, "#{host}/test")
133
+ .with(body: { 'params' => 'test' })
134
+ .with(headers: headers)
135
+ .to_return(stub_response)
136
+
137
+ expect(client.request(:get, 'test', {}, { 'params' => 'test' }, custom_header).status).to eq(200)
138
+ end
139
+ end
140
+ end
115
141
  end
116
142
 
117
143
  context 'with ssl' do
@@ -20,7 +20,7 @@
20
20
  require 'spec_helper'
21
21
 
22
22
  describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
23
- let(:host) { 'https://localhost:8080' }
23
+ let(:host) { 'http://localhost:3002' }
24
24
  let(:access_token) { 'access_token' }
25
25
 
26
26
  context 'dependant on EnterpriseSearch' do
@@ -66,11 +66,33 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
66
66
  end
67
67
  end
68
68
 
69
+ context 'Authentication' do
70
+ let(:client) { Elastic::EnterpriseSearch::WorkplaceSearch::Client.new(http_auth: http_auth) }
71
+
72
+ context 'when using an API token' do
73
+ let(:http_auth) { 'api_token' }
74
+
75
+ it 'initializes a workplace search client' do
76
+ expect(client.http_auth).to eq http_auth
77
+ expect(client.setup_authentication_header).to eq "Bearer #{http_auth}"
78
+ end
79
+ end
80
+
81
+ context 'when using basic auth' do
82
+ let(:http_auth) { { user: 'elastic', password: 'password' } }
83
+
84
+ it 'initializes a workplace search client' do
85
+ expect(client.http_auth).to eq http_auth
86
+ expect(client.setup_authentication_header).to eq 'Basic ZWxhc3RpYzpwYXNzd29yZA=='
87
+ end
88
+ end
89
+ end
90
+
69
91
  context 'OAuth' do
70
92
  let(:client) { Elastic::EnterpriseSearch::WorkplaceSearch::Client.new(host: host) }
71
93
 
72
94
  it 'generates an authorization url' do
73
- authorization_url = 'https://localhost:8080/ws/oauth/authorize?response_type=code&client_id=client_id&redirect_uri=https%3A%2F%2Flocalhost%3A3002'
95
+ authorization_url = 'http://localhost:3002/ws/oauth/authorize?response_type=code&client_id=client_id&redirect_uri=https%3A%2F%2Flocalhost%3A3002'
74
96
  expect(client.authorization_url('client_id', 'https://localhost:3002')).to eq authorization_url
75
97
  end
76
98
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic-enterprise-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.13.0.pre
4
+ version: 7.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Briano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-11 00:00:00.000000000 Z
11
+ date: 2021-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch-transport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 7.13.0.pre
19
+ version: 7.13.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 7.13.0.pre
26
+ version: 7.13.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jwt
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -192,6 +192,7 @@ files:
192
192
  - docs/guide/release_notes/710.asciidoc
193
193
  - docs/guide/release_notes/711.asciidoc
194
194
  - docs/guide/release_notes/712.asciidoc
195
+ - docs/guide/release_notes/713.asciidoc
195
196
  - docs/guide/release_notes/index.asciidoc
196
197
  - docs/guide/workplace-search-api.asciidoc
197
198
  - elastic-enterprise-search.gemspec
@@ -354,9 +355,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
354
355
  version: '2.5'
355
356
  required_rubygems_version: !ruby/object:Gem::Requirement
356
357
  requirements:
357
- - - ">"
358
+ - - ">="
358
359
  - !ruby/object:Gem::Version
359
- version: 1.3.1
360
+ version: '0'
360
361
  requirements: []
361
362
  rubygems_version: 3.2.16
362
363
  signing_key: