elastic-enterprise-search 7.10.0.beta.1 → 7.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ci/jobs/elastic+enterprise-search-ruby+7.10.0.beta.1.yml +12 -0
- data/.ci/test-matrix.yml +2 -1
- data/.github/workflows/testing.yml +1 -1
- data/.gitignore +1 -0
- data/CONTRIBUTING.md +43 -0
- data/Gemfile +1 -0
- data/README.md +7 -225
- data/Rakefile +1 -24
- data/docs/guide/app-search-api.asciidoc +172 -0
- data/docs/guide/connecting.asciidoc +125 -0
- data/docs/guide/development.asciidoc +42 -0
- data/docs/guide/enterprise-search-api.asciidoc +46 -0
- data/docs/guide/index.asciidoc +17 -0
- data/docs/guide/installation.asciidoc +18 -0
- data/docs/guide/overview.asciidoc +59 -0
- data/docs/guide/workplace-search-api.asciidoc +121 -0
- data/elastic-enterprise-search.gemspec +5 -4
- data/lib/elastic/app-search/api/add_meta_engine_source.rb +7 -4
- data/lib/elastic/app-search/api/api_logs.rb +15 -16
- data/lib/elastic/app-search/api/count_analytics.rb +7 -5
- data/lib/elastic/app-search/api/create_curation.rb +8 -6
- data/lib/elastic/app-search/api/create_engine.rb +9 -7
- data/lib/elastic/app-search/api/create_synonym_set.rb +6 -5
- data/lib/elastic/app-search/api/curation.rb +6 -5
- data/lib/elastic/app-search/api/delete_curation.rb +6 -5
- data/lib/elastic/app-search/api/delete_documents.rb +7 -4
- data/lib/elastic/app-search/api/delete_engine.rb +5 -3
- data/lib/elastic/app-search/api/delete_meta_engine_source.rb +7 -4
- data/lib/elastic/app-search/api/delete_synonym_set.rb +6 -5
- data/lib/elastic/app-search/api/documents.rb +7 -4
- data/lib/elastic/app-search/api/engine.rb +5 -3
- data/lib/elastic/app-search/api/index_documents.rb +7 -4
- data/lib/elastic/app-search/api/list_curations.rb +7 -5
- data/lib/elastic/app-search/api/list_documents.rb +7 -5
- data/lib/elastic/app-search/api/list_engines.rb +7 -5
- data/lib/elastic/app-search/api/list_synonym_sets.rb +7 -5
- data/lib/elastic/app-search/api/log_clickthrough.rb +10 -7
- data/lib/elastic/app-search/api/multi_search.rb +8 -7
- data/lib/elastic/app-search/api/put_curation.rb +9 -8
- data/lib/elastic/app-search/api/put_documents.rb +7 -4
- data/lib/elastic/app-search/api/put_schema.rb +7 -4
- data/lib/elastic/app-search/api/put_search_settings.rb +6 -3
- data/lib/elastic/app-search/api/put_synonym_set.rb +7 -7
- data/lib/elastic/app-search/api/query_suggestion.rb +8 -6
- data/lib/elastic/app-search/api/reset_search_settings.rb +5 -3
- data/lib/elastic/app-search/api/schema.rb +6 -4
- data/lib/elastic/app-search/api/search.rb +5 -3
- data/lib/elastic/app-search/api/search_settings.rb +6 -4
- data/lib/elastic/app-search/api/synonym_set.rb +6 -5
- data/lib/elastic/app-search/api/top_clicks_analytics.rb +9 -7
- data/lib/elastic/app-search/api/top_queries_analytics.rb +8 -6
- data/lib/elastic/app-search/app_search.rb +19 -2
- data/lib/elastic/enterprise-search/api/health.rb +6 -1
- data/lib/elastic/enterprise-search/api/put_read_only.rb +5 -1
- data/lib/elastic/enterprise-search/api/read_only.rb +6 -1
- data/lib/elastic/enterprise-search/api/stats.rb +6 -2
- data/lib/elastic/enterprise-search/api/version.rb +6 -1
- data/lib/elastic/enterprise-search/client.rb +15 -2
- data/lib/elastic/enterprise-search/request.rb +25 -13
- data/lib/elastic/enterprise-search/utils.rb +5 -6
- data/lib/elastic/enterprise-search/version.rb +1 -1
- data/lib/elastic/enterprise_search.rb +1 -1
- data/lib/elastic/workplace-search/api/add_user_permissions.rb +10 -9
- data/lib/elastic/workplace-search/api/create_analytics_event.rb +59 -0
- data/lib/elastic/workplace-search/api/create_external_identity.rb +9 -7
- data/lib/elastic/workplace-search/api/delete_documents.rb +9 -7
- data/lib/elastic/workplace-search/api/delete_external_identity.rb +10 -6
- data/lib/elastic/workplace-search/api/external_identity.rb +10 -6
- data/lib/elastic/workplace-search/api/index_documents.rb +11 -8
- data/lib/elastic/workplace-search/api/list_external_identities.rb +11 -7
- data/lib/elastic/workplace-search/api/list_permissions.rb +11 -7
- data/lib/elastic/workplace-search/api/put_external_identity.rb +10 -9
- data/lib/elastic/workplace-search/api/put_user_permissions.rb +10 -9
- data/lib/elastic/workplace-search/api/remove_user_permissions.rb +10 -9
- data/lib/elastic/workplace-search/api/search.rb +19 -1
- data/lib/elastic/workplace-search/api/user_permissions.rb +10 -6
- data/lib/elastic/workplace-search/workplace_search.rb +26 -1
- data/spec/app-search/api_curations_spec.rb +97 -0
- data/spec/app-search/api_documents_spec.rb +20 -6
- data/spec/app-search/api_engines_spec.rb +4 -4
- data/{lib/generator/templates/_license.erb → spec/app-search/api_log_clickthrough_spec.rb} +18 -0
- data/spec/app-search/api_meta_engines_spec.rb +72 -0
- data/spec/app-search/api_query_suggestion_spec.rb +39 -0
- data/spec/app-search/api_schema_spec.rb +17 -3
- data/spec/app-search/api_search_settings_spec.rb +76 -0
- data/spec/app-search/api_synonyms_spec.rb +79 -0
- data/spec/app-search/client_spec.rb +20 -0
- data/spec/enterprise-search/client_spec.rb +11 -0
- data/spec/enterprise-search/request_spec.rb +22 -0
- data/spec/enterprise-search/utils_spec.rb +46 -0
- data/spec/fixtures/vcr/app_search/add_meta_engine_source.yml +109 -0
- data/spec/fixtures/vcr/app_search/api_documents.yml +56 -0
- data/spec/fixtures/vcr/app_search/{index_documents.yml → api_index_documents.yml} +11 -10
- data/spec/fixtures/vcr/app_search/api_log_clickthrough.yml +54 -0
- data/spec/fixtures/vcr/app_search/api_put_schema.yml +109 -0
- data/spec/fixtures/vcr/app_search/api_put_search_settings.yml +56 -0
- data/spec/fixtures/vcr/app_search/api_query_suggestion.yml +59 -0
- data/spec/fixtures/vcr/app_search/api_reset_search_settings.yml +56 -0
- data/spec/fixtures/vcr/app_search/{schema.yml → api_schema.yml} +12 -11
- data/spec/fixtures/vcr/app_search/api_search_settings.yml +56 -0
- data/spec/fixtures/vcr/app_search/create_curation.yml +113 -0
- data/spec/fixtures/vcr/{create_engine.yml → app_search/create_engine.yml} +0 -0
- data/spec/fixtures/vcr/app_search/create_meta_engine.yml +56 -0
- data/spec/fixtures/vcr/app_search/create_synonym_set.yml +56 -0
- data/spec/fixtures/vcr/app_search/delete_curation.yml +56 -0
- data/spec/fixtures/vcr/{delete_engine.yml → app_search/delete_engine.yml} +0 -0
- data/spec/fixtures/vcr/app_search/delete_meta_engine_source.yml +56 -0
- data/spec/fixtures/vcr/app_search/delete_synonym_set.yml +56 -0
- data/spec/fixtures/vcr/app_search/get_curation.yml +56 -0
- data/spec/fixtures/vcr/{get_engine.yml → app_search/get_engine.yml} +0 -0
- data/spec/fixtures/vcr/app_search/list_curations.yml +56 -0
- data/spec/fixtures/vcr/{list_engines.yml → app_search/list_engines.yml} +0 -0
- data/spec/fixtures/vcr/app_search/list_synonym_sets.yml +56 -0
- data/spec/fixtures/vcr/app_search/multi_query_search.yml +2 -2
- data/spec/fixtures/vcr/app_search/put_curation.yml +113 -0
- data/spec/fixtures/vcr/app_search/put_synonym_set.yml +56 -0
- data/spec/fixtures/vcr/app_search/synonym_set.yml +56 -0
- data/spec/fixtures/vcr/{add_user_permissions.yml → workplace_search/add_user_permissions.yml} +11 -9
- data/spec/fixtures/vcr/{clear_user_permissions.yml → workplace_search/clear_user_permissions.yml} +11 -9
- data/spec/fixtures/vcr/workplace_search/create_analytics_event.yml +55 -0
- data/spec/fixtures/vcr/workplace_search/create_external_identity.yml +53 -0
- data/spec/fixtures/vcr/{delete_documents.yml → workplace_search/delete_documents.yml} +11 -9
- data/spec/fixtures/vcr/workplace_search/delete_external_identity.yml +53 -0
- data/spec/fixtures/vcr/{index_documents.yml → workplace_search/index_documents.yml} +11 -9
- data/spec/fixtures/vcr/workplace_search/list_external_identities.yml +53 -0
- data/spec/fixtures/vcr/{list_permissions.yml → workplace_search/list_permissions.yml} +11 -9
- data/spec/fixtures/vcr/workplace_search/oauth_request_token.yml +57 -0
- data/spec/fixtures/vcr/workplace_search/put_external_identity.yml +53 -0
- data/spec/fixtures/vcr/{put_user_permissions.yml → workplace_search/put_user_permissions.yml} +22 -18
- data/spec/fixtures/vcr/{remove_user_permissions.yml → workplace_search/remove_user_permissions.yml} +11 -9
- data/spec/fixtures/vcr/workplace_search/retrieve_external_identity.yml +53 -0
- data/spec/fixtures/vcr/workplace_search/search_request.yml +60 -0
- data/spec/fixtures/vcr/{user_permissions_empty.yml → workplace_search/user_permissions_empty.yml} +11 -9
- data/spec/integration/enterprise_search_api_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -0
- data/spec/workplace-search/client_spec.rb +10 -2
- data/spec/workplace-search/create_analytics_event_spec.rb +59 -0
- data/spec/workplace-search/documents_spec.rb +80 -0
- data/spec/workplace-search/external_identities_spec.rb +84 -0
- data/spec/workplace-search/{api_spec.rb → permissions_spec.rb} +14 -66
- data/spec/workplace-search/search_spec.rb +53 -0
- metadata +96 -36
- data/lib/generator/documentation_helper.rb +0 -94
- data/lib/generator/endpoint_generator.rb +0 -119
- data/lib/generator/parameters_exceptions.rb +0 -40
- data/lib/generator/parameters_helper.rb +0 -144
- data/lib/generator/templates/endpoint_template.erb +0 -29
- data/lib/generator/templates/spec_template.erb +0 -1
- data/lib/generator/utils.rb +0 -70
- data/spec/fixtures/vcr/create_document.yml +0 -54
@@ -0,0 +1,84 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
# frozen_string_literal: true
|
19
|
+
|
20
|
+
require 'spec_helper'
|
21
|
+
|
22
|
+
describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
23
|
+
let(:host) { ENV['ELASTIC_ENTERPRISE_HOST'] || 'http://localhost:3002' }
|
24
|
+
let(:access_token) { ENV['ELASTIC_WORKPLACE_TOKEN'] || 'access_token' }
|
25
|
+
let(:content_source_id) { ENV['ELASTIC_WORKPLACE_SOURCE_ID'] || 'content_source_id' }
|
26
|
+
let(:client) do
|
27
|
+
Elastic::EnterpriseSearch::WorkplaceSearch::Client.new(
|
28
|
+
host: host,
|
29
|
+
http_auth: access_token
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'external identities' do
|
34
|
+
let(:user) { 'elastic_user' }
|
35
|
+
let(:source_user_id) { 'example@elastic.co' }
|
36
|
+
|
37
|
+
it 'creates an external identity' do
|
38
|
+
VCR.use_cassette('workplace_search/create_external_identity') do
|
39
|
+
body = { user: user, source_user_id: source_user_id }
|
40
|
+
response = client.create_external_identity(content_source_id, body: body)
|
41
|
+
|
42
|
+
expect(response.status).to eq 200
|
43
|
+
expect(response.body).to eq({ 'source_user_id' => source_user_id, 'user' => user })
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'retrieves an external identity' do
|
48
|
+
VCR.use_cassette('workplace_search/retrieve_external_identity') do
|
49
|
+
response = client.external_identity(content_source_id, user: user)
|
50
|
+
|
51
|
+
expect(response.status).to eq 200
|
52
|
+
expect(response.body).to eq({ 'source_user_id' => source_user_id, 'user' => user })
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'lists external identities' do
|
57
|
+
VCR.use_cassette('workplace_search/list_external_identities') do
|
58
|
+
response = client.list_external_identities(content_source_id)
|
59
|
+
|
60
|
+
expect(response.status).to eq 200
|
61
|
+
expect(response.body['results']).to eq([{ 'source_user_id' => source_user_id, 'user' => user }])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'updates an external identity' do
|
66
|
+
VCR.use_cassette('workplace_search/put_external_identity') do
|
67
|
+
body = { source_user_id: 'example2@elastic.co' }
|
68
|
+
response = client.put_external_identity(content_source_id, user: user, body: body)
|
69
|
+
|
70
|
+
expect(response.status).to eq 200
|
71
|
+
expect(response.body).to eq({ 'source_user_id' => 'example2@elastic.co', 'user' => user })
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'deletes an external identity' do
|
76
|
+
VCR.use_cassette('workplace_search/delete_external_identity') do
|
77
|
+
response = client.delete_external_identity(content_source_id, user: user)
|
78
|
+
|
79
|
+
expect(response.status).to eq 200
|
80
|
+
expect(response.body).to eq 'ok'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -22,7 +22,7 @@ require 'spec_helper'
|
|
22
22
|
describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
23
23
|
let(:host) { ENV['ELASTIC_ENTERPRISE_HOST'] || 'http://localhost:3002' }
|
24
24
|
let(:access_token) { ENV['ELASTIC_WORKPLACE_TOKEN'] || 'access_token' }
|
25
|
-
let(:
|
25
|
+
let(:content_source_id) { ENV['ELASTIC_WORKPLACE_SOURCE_ID'] || 'content_source_id' }
|
26
26
|
let(:client) do
|
27
27
|
Elastic::EnterpriseSearch::WorkplaceSearch::Client.new(
|
28
28
|
host: host,
|
@@ -30,64 +30,12 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
30
30
|
)
|
31
31
|
end
|
32
32
|
|
33
|
-
context 'documents' do
|
34
|
-
let(:documents) do
|
35
|
-
[
|
36
|
-
{ 'id' => '4e696e74656e646f203634',
|
37
|
-
'url' => 'https://www.elastic.co/blog/introducing-quick-start-guides-getting-started-with-elastic-enterprise-search-for-free',
|
38
|
-
'title' => 'Getting started with Elastic Enterprise Search for free',
|
39
|
-
'body' => 'this is a test' },
|
40
|
-
{
|
41
|
-
'id' => '47616d6520426f7920436f6c6f72',
|
42
|
-
'url' => 'https://www.elastic.co/workplace-search',
|
43
|
-
'title' => 'One-stop answer shop for the virtual workplace',
|
44
|
-
'body' => 'this is also a test'
|
45
|
-
}
|
46
|
-
]
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'indexes' do
|
50
|
-
VCR.use_cassette(:index_documents) do
|
51
|
-
response = client.index_documents(content_source_key, body: documents)
|
52
|
-
|
53
|
-
expect(response.status).to eq 200
|
54
|
-
expect(response.body)
|
55
|
-
.to eq(
|
56
|
-
{ 'results' =>
|
57
|
-
[
|
58
|
-
{ 'id' => '4e696e74656e646f203634', 'errors' => [] },
|
59
|
-
{ 'id' => '47616d6520426f7920436f6c6f72', 'errors' => [] }
|
60
|
-
] }
|
61
|
-
)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'deletes' do
|
66
|
-
VCR.use_cassette(:index_documents) do
|
67
|
-
client.index_documents(content_source_key, body: documents)
|
68
|
-
end
|
69
|
-
|
70
|
-
VCR.use_cassette(:delete_documents) do
|
71
|
-
response = client.delete_documents(content_source_key, body: documents.map { |doc| doc['id'] })
|
72
|
-
expect(response.status).to eq 200
|
73
|
-
expect(response.body)
|
74
|
-
.to eq(
|
75
|
-
{ 'results' =>
|
76
|
-
[
|
77
|
-
{ 'id' => '4e696e74656e646f203634', 'success' => true },
|
78
|
-
{ 'id' => '47616d6520426f7920436f6c6f72', 'success' => true }
|
79
|
-
] }
|
80
|
-
)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
33
|
context 'permissions' do
|
86
34
|
let(:user) { 'enterprise_search' }
|
87
35
|
|
88
36
|
it 'lists permissions' do
|
89
|
-
VCR.use_cassette(
|
90
|
-
response = client.list_permissions(
|
37
|
+
VCR.use_cassette('workplace_search/list_permissions') do
|
38
|
+
response = client.list_permissions(content_source_id)
|
91
39
|
|
92
40
|
expect(response.status).to eq 200
|
93
41
|
|
@@ -104,8 +52,8 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
104
52
|
it 'gets user permissions' do
|
105
53
|
clear_user_permissions
|
106
54
|
|
107
|
-
VCR.use_cassette(
|
108
|
-
response = client.user_permissions(
|
55
|
+
VCR.use_cassette('workplace_search/user_permissions_empty') do
|
56
|
+
response = client.user_permissions(content_source_id, { user: user })
|
109
57
|
|
110
58
|
expect(response.status).to eq 200
|
111
59
|
|
@@ -117,18 +65,18 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
117
65
|
end
|
118
66
|
|
119
67
|
def clear_user_permissions
|
120
|
-
VCR.use_cassette(
|
68
|
+
VCR.use_cassette('workplace_search/clear_user_permissions') do
|
121
69
|
client.put_user_permissions(
|
122
|
-
|
70
|
+
content_source_id,
|
123
71
|
{ permissions: [], user: user }
|
124
72
|
)
|
125
73
|
end
|
126
74
|
end
|
127
75
|
|
128
76
|
it 'updates user permissions' do
|
129
|
-
VCR.use_cassette(
|
77
|
+
VCR.use_cassette('workplace_search/put_user_permissions') do
|
130
78
|
response = client.add_user_permissions(
|
131
|
-
|
79
|
+
content_source_id,
|
132
80
|
{ permissions: ['testing', 'more', 'permissions'], user: user }
|
133
81
|
)
|
134
82
|
|
@@ -140,7 +88,7 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
140
88
|
)
|
141
89
|
|
142
90
|
response = client.put_user_permissions(
|
143
|
-
|
91
|
+
content_source_id,
|
144
92
|
{ permissions: [], user: user }
|
145
93
|
)
|
146
94
|
|
@@ -154,10 +102,10 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
154
102
|
end
|
155
103
|
|
156
104
|
it 'adds and removes permissions from a user' do
|
157
|
-
VCR.use_cassette(
|
105
|
+
VCR.use_cassette('workplace_search/add_user_permissions') do
|
158
106
|
permissions = ['permission1', 'permission2']
|
159
107
|
response = client.add_user_permissions(
|
160
|
-
|
108
|
+
content_source_id,
|
161
109
|
{ permissions: permissions, user: user }
|
162
110
|
)
|
163
111
|
|
@@ -169,10 +117,10 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
169
117
|
)
|
170
118
|
end
|
171
119
|
|
172
|
-
VCR.use_cassette(
|
120
|
+
VCR.use_cassette('workplace_search/remove_user_permissions') do
|
173
121
|
permissions = ['permission1', 'permission2']
|
174
122
|
response = client.remove_user_permissions(
|
175
|
-
|
123
|
+
content_source_id,
|
176
124
|
{ permissions: permissions, user: user }
|
177
125
|
)
|
178
126
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
# frozen_string_literal: true
|
19
|
+
|
20
|
+
require 'spec_helper'
|
21
|
+
|
22
|
+
describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
23
|
+
let(:host) { ENV['ELASTIC_ENTERPRISE_HOST'] || 'http://localhost:3002' }
|
24
|
+
let(:access_token) { ENV['ELASTIC_WORKPLACE_TOKEN'] || 'access_token' }
|
25
|
+
let(:content_source_id) { ENV['ELASTIC_WORKPLACE_SOURCE_ID'] || 'content_source_id' }
|
26
|
+
let(:client) do
|
27
|
+
Elastic::EnterpriseSearch::WorkplaceSearch::Client.new(
|
28
|
+
host: host,
|
29
|
+
http_auth: access_token
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'goes through the search OAuth ' do
|
34
|
+
VCR.use_cassette('workplace_search/oauth_request_token') do
|
35
|
+
client_id = 'client_id'
|
36
|
+
client_secret = 'client_secret'
|
37
|
+
redirect_uri = 'http://localhost:9393'
|
38
|
+
|
39
|
+
# gets authorization code via client.authorization_url(client_id, redirect_uri)
|
40
|
+
authorization_code = 'authorization_code'
|
41
|
+
@oauth_access_token = client.request_access_token(client_id, client_secret, authorization_code, redirect_uri)
|
42
|
+
end
|
43
|
+
|
44
|
+
VCR.use_cassette('workplace_search/search_request') do
|
45
|
+
response = client.search(body: { query: '1984' }, access_token: @oauth_access_token)
|
46
|
+
|
47
|
+
expect(response.status).to eq 200
|
48
|
+
expect(response.body['results'].count).to be > 1
|
49
|
+
expect(response.body['results'][0]['title']['raw']).to eq '1984'
|
50
|
+
expect(response.body['results'][0]['author']['raw']).to eq 'George Orwell'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-enterprise-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.11.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:
|
11
|
+
date: 2021-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch-transport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '7.11'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '7.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jwt
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
33
|
+
version: '1.5'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '3.0'
|
20
37
|
type: :runtime
|
21
38
|
prerelease: false
|
22
39
|
version_requirements: !ruby/object:Gem::Requirement
|
23
40
|
requirements:
|
24
41
|
- - ">="
|
25
42
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
43
|
+
version: '1.5'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.0'
|
27
47
|
- !ruby/object:Gem::Dependency
|
28
48
|
name: awesome_print
|
29
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,10 +142,9 @@ dependencies:
|
|
122
142
|
- - ">="
|
123
143
|
- !ruby/object:Gem::Version
|
124
144
|
version: '0'
|
125
|
-
description: 'API client for
|
126
|
-
a beta state.
|
145
|
+
description: 'Official API client for Elastic Enterprise Search APIs.
|
127
146
|
|
128
|
-
'
|
147
|
+
'
|
129
148
|
email:
|
130
149
|
- support@elastic.co
|
131
150
|
executables: []
|
@@ -145,6 +164,7 @@ files:
|
|
145
164
|
- ".ci/functions/imports.sh"
|
146
165
|
- ".ci/functions/wait-for-container.sh"
|
147
166
|
- ".ci/jobs/defaults.yml"
|
167
|
+
- ".ci/jobs/elastic+enterprise-search-ruby+7.10.0.beta.1.yml"
|
148
168
|
- ".ci/jobs/elastic+enterprise-search-ruby+master.yml"
|
149
169
|
- ".ci/jobs/elastic+enterprise-search-ruby+pull-request.yml"
|
150
170
|
- ".ci/run-elasticsearch.sh"
|
@@ -157,10 +177,19 @@ files:
|
|
157
177
|
- ".github/workflows/testing.yml"
|
158
178
|
- ".gitignore"
|
159
179
|
- ".rubocop.yml"
|
180
|
+
- CONTRIBUTING.md
|
160
181
|
- Gemfile
|
161
182
|
- LICENSE
|
162
183
|
- README.md
|
163
184
|
- Rakefile
|
185
|
+
- docs/guide/app-search-api.asciidoc
|
186
|
+
- docs/guide/connecting.asciidoc
|
187
|
+
- docs/guide/development.asciidoc
|
188
|
+
- docs/guide/enterprise-search-api.asciidoc
|
189
|
+
- docs/guide/index.asciidoc
|
190
|
+
- docs/guide/installation.asciidoc
|
191
|
+
- docs/guide/overview.asciidoc
|
192
|
+
- docs/guide/workplace-search-api.asciidoc
|
164
193
|
- elastic-enterprise-search.gemspec
|
165
194
|
- lib/data/ca-bundle.crt
|
166
195
|
- lib/elastic-enterprise-search.rb
|
@@ -213,6 +242,7 @@ files:
|
|
213
242
|
- lib/elastic/enterprise-search/version.rb
|
214
243
|
- lib/elastic/enterprise_search.rb
|
215
244
|
- lib/elastic/workplace-search/api/add_user_permissions.rb
|
245
|
+
- lib/elastic/workplace-search/api/create_analytics_event.rb
|
216
246
|
- lib/elastic/workplace-search/api/create_external_identity.rb
|
217
247
|
- lib/elastic/workplace-search/api/delete_documents.rb
|
218
248
|
- lib/elastic/workplace-search/api/delete_external_identity.rb
|
@@ -226,63 +256,93 @@ files:
|
|
226
256
|
- lib/elastic/workplace-search/api/search.rb
|
227
257
|
- lib/elastic/workplace-search/api/user_permissions.rb
|
228
258
|
- lib/elastic/workplace-search/workplace_search.rb
|
229
|
-
- lib/generator/documentation_helper.rb
|
230
|
-
- lib/generator/endpoint_generator.rb
|
231
|
-
- lib/generator/parameters_exceptions.rb
|
232
|
-
- lib/generator/parameters_helper.rb
|
233
|
-
- lib/generator/templates/_license.erb
|
234
|
-
- lib/generator/templates/endpoint_template.erb
|
235
|
-
- lib/generator/templates/spec_template.erb
|
236
|
-
- lib/generator/utils.rb
|
237
259
|
- spec/app-search/api_count_analytics_spec.rb
|
260
|
+
- spec/app-search/api_curations_spec.rb
|
238
261
|
- spec/app-search/api_documents_spec.rb
|
239
262
|
- spec/app-search/api_engines_spec.rb
|
263
|
+
- spec/app-search/api_log_clickthrough_spec.rb
|
240
264
|
- spec/app-search/api_logs_spec.rb
|
265
|
+
- spec/app-search/api_meta_engines_spec.rb
|
266
|
+
- spec/app-search/api_query_suggestion_spec.rb
|
241
267
|
- spec/app-search/api_schema_spec.rb
|
242
268
|
- spec/app-search/api_search_and_multi_search_spec.rb
|
269
|
+
- spec/app-search/api_search_settings_spec.rb
|
243
270
|
- spec/app-search/api_spec_helper.rb
|
271
|
+
- spec/app-search/api_synonyms_spec.rb
|
244
272
|
- spec/app-search/api_top_clicks_analytics_spec.rb
|
245
273
|
- spec/app-search/api_top_queries_analytics_spec.rb
|
246
274
|
- spec/app-search/client_spec.rb
|
247
275
|
- spec/enterprise-search/client_spec.rb
|
248
276
|
- spec/enterprise-search/request_spec.rb
|
249
|
-
- spec/
|
277
|
+
- spec/enterprise-search/utils_spec.rb
|
278
|
+
- spec/fixtures/vcr/app_search/add_meta_engine_source.yml
|
279
|
+
- spec/fixtures/vcr/app_search/api_documents.yml
|
280
|
+
- spec/fixtures/vcr/app_search/api_index_documents.yml
|
281
|
+
- spec/fixtures/vcr/app_search/api_log_clickthrough.yml
|
250
282
|
- spec/fixtures/vcr/app_search/api_logs.yml
|
283
|
+
- spec/fixtures/vcr/app_search/api_put_schema.yml
|
284
|
+
- spec/fixtures/vcr/app_search/api_put_search_settings.yml
|
285
|
+
- spec/fixtures/vcr/app_search/api_query_suggestion.yml
|
286
|
+
- spec/fixtures/vcr/app_search/api_reset_search_settings.yml
|
287
|
+
- spec/fixtures/vcr/app_search/api_schema.yml
|
288
|
+
- spec/fixtures/vcr/app_search/api_search_settings.yml
|
251
289
|
- spec/fixtures/vcr/app_search/api_top_clicks_analytics.yml
|
252
290
|
- spec/fixtures/vcr/app_search/api_top_clicks_analytics_query.yml
|
253
291
|
- spec/fixtures/vcr/app_search/api_top_queries_analytics.yml
|
254
292
|
- spec/fixtures/vcr/app_search/count_analytics.yml
|
255
293
|
- spec/fixtures/vcr/app_search/create_and_update_document.yml
|
294
|
+
- spec/fixtures/vcr/app_search/create_curation.yml
|
295
|
+
- spec/fixtures/vcr/app_search/create_engine.yml
|
296
|
+
- spec/fixtures/vcr/app_search/create_meta_engine.yml
|
297
|
+
- spec/fixtures/vcr/app_search/create_synonym_set.yml
|
298
|
+
- spec/fixtures/vcr/app_search/delete_curation.yml
|
299
|
+
- spec/fixtures/vcr/app_search/delete_engine.yml
|
300
|
+
- spec/fixtures/vcr/app_search/delete_meta_engine_source.yml
|
301
|
+
- spec/fixtures/vcr/app_search/delete_synonym_set.yml
|
302
|
+
- spec/fixtures/vcr/app_search/get_curation.yml
|
303
|
+
- spec/fixtures/vcr/app_search/get_engine.yml
|
256
304
|
- spec/fixtures/vcr/app_search/index_and_delete_document.yml
|
257
|
-
- spec/fixtures/vcr/app_search/
|
305
|
+
- spec/fixtures/vcr/app_search/list_curations.yml
|
258
306
|
- spec/fixtures/vcr/app_search/list_documents.yml
|
307
|
+
- spec/fixtures/vcr/app_search/list_engines.yml
|
308
|
+
- spec/fixtures/vcr/app_search/list_synonym_sets.yml
|
259
309
|
- spec/fixtures/vcr/app_search/multi_query_search.yml
|
260
|
-
- spec/fixtures/vcr/app_search/
|
310
|
+
- spec/fixtures/vcr/app_search/put_curation.yml
|
311
|
+
- spec/fixtures/vcr/app_search/put_synonym_set.yml
|
261
312
|
- spec/fixtures/vcr/app_search/search.yml
|
262
313
|
- spec/fixtures/vcr/app_search/single_query_search.yml
|
263
|
-
- spec/fixtures/vcr/
|
264
|
-
- spec/fixtures/vcr/
|
265
|
-
- spec/fixtures/vcr/
|
266
|
-
- spec/fixtures/vcr/
|
267
|
-
- spec/fixtures/vcr/
|
268
|
-
- spec/fixtures/vcr/
|
269
|
-
- spec/fixtures/vcr/
|
270
|
-
- spec/fixtures/vcr/
|
271
|
-
- spec/fixtures/vcr/
|
272
|
-
- spec/fixtures/vcr/
|
273
|
-
- spec/fixtures/vcr/
|
274
|
-
- spec/fixtures/vcr/
|
314
|
+
- spec/fixtures/vcr/app_search/synonym_set.yml
|
315
|
+
- spec/fixtures/vcr/workplace_search/add_user_permissions.yml
|
316
|
+
- spec/fixtures/vcr/workplace_search/clear_user_permissions.yml
|
317
|
+
- spec/fixtures/vcr/workplace_search/create_analytics_event.yml
|
318
|
+
- spec/fixtures/vcr/workplace_search/create_external_identity.yml
|
319
|
+
- spec/fixtures/vcr/workplace_search/delete_documents.yml
|
320
|
+
- spec/fixtures/vcr/workplace_search/delete_external_identity.yml
|
321
|
+
- spec/fixtures/vcr/workplace_search/index_documents.yml
|
322
|
+
- spec/fixtures/vcr/workplace_search/list_external_identities.yml
|
323
|
+
- spec/fixtures/vcr/workplace_search/list_permissions.yml
|
324
|
+
- spec/fixtures/vcr/workplace_search/oauth_request_token.yml
|
325
|
+
- spec/fixtures/vcr/workplace_search/put_external_identity.yml
|
326
|
+
- spec/fixtures/vcr/workplace_search/put_user_permissions.yml
|
327
|
+
- spec/fixtures/vcr/workplace_search/remove_user_permissions.yml
|
328
|
+
- spec/fixtures/vcr/workplace_search/retrieve_external_identity.yml
|
329
|
+
- spec/fixtures/vcr/workplace_search/search_request.yml
|
330
|
+
- spec/fixtures/vcr/workplace_search/user_permissions_empty.yml
|
275
331
|
- spec/integration/enterprise_search_api_spec.rb
|
276
332
|
- spec/spec_helper.rb
|
277
333
|
- spec/webmock_requires.rb
|
278
|
-
- spec/workplace-search/api_spec.rb
|
279
334
|
- spec/workplace-search/client_spec.rb
|
335
|
+
- spec/workplace-search/create_analytics_event_spec.rb
|
336
|
+
- spec/workplace-search/documents_spec.rb
|
337
|
+
- spec/workplace-search/external_identities_spec.rb
|
338
|
+
- spec/workplace-search/permissions_spec.rb
|
339
|
+
- spec/workplace-search/search_spec.rb
|
280
340
|
homepage: https://github.com/elastic/enterprise-search-ruby
|
281
341
|
licenses:
|
282
342
|
- Apache-2.0
|
283
343
|
metadata:
|
284
344
|
bug_tracker_uri: https://github.com/elastic/enterprise-search-ruby/issues
|
285
|
-
documentation_uri: https://
|
345
|
+
documentation_uri: https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/index.html
|
286
346
|
homepage_uri: https://www.elastic.co/enterprise-search
|
287
347
|
source_code_uri: https://github.com/elastic/enterprise-search-ruby
|
288
348
|
post_install_message:
|
@@ -296,12 +356,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
296
356
|
version: '2.5'
|
297
357
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
298
358
|
requirements:
|
299
|
-
- - "
|
359
|
+
- - ">="
|
300
360
|
- !ruby/object:Gem::Version
|
301
|
-
version:
|
361
|
+
version: '0'
|
302
362
|
requirements: []
|
303
|
-
rubygems_version: 3.1.
|
363
|
+
rubygems_version: 3.1.4
|
304
364
|
signing_key:
|
305
365
|
specification_version: 4
|
306
|
-
summary: Official
|
366
|
+
summary: Official API client for Elastic Enterprise Search
|
307
367
|
test_files: []
|