elastic-enterprise-search 7.15.1 → 8.0.0.pre
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.13.yml +12 -0
- data/.ci/jobs/elastic+enterprise-search-ruby+7.14.yml +12 -0
- data/.ci/jobs/elastic+enterprise-search-ruby+7.15.yml +12 -0
- data/.ci/jobs/elastic+enterprise-search-ruby+7.16.yml +12 -0
- data/.ci/test-matrix.yml +2 -3
- data/.github/workflows/testing.yml +3 -3
- data/.rubocop.yml +1 -1
- data/CHANGELOG +1 -0
- data/CODE_OF_CONDUCT +1 -0
- data/CONTRIBUTING.md +37 -0
- data/NOTICE +2 -0
- data/README.md +25 -29
- data/docs/guide/app-search-api.asciidoc +15 -9
- data/docs/guide/overview.asciidoc +11 -3
- data/docs/guide/release_notes/712.asciidoc +10 -0
- data/docs/guide/release_notes/714.asciidoc +0 -12
- data/docs/guide/release_notes/715.asciidoc +0 -12
- data/docs/guide/release_notes/716.asciidoc +16 -0
- data/docs/guide/release_notes/717.asciidoc +9 -0
- data/docs/guide/release_notes/80.asciidoc +14 -0
- data/docs/guide/release_notes/index.asciidoc +11 -0
- data/elastic-enterprise-search.gemspec +3 -3
- data/lib/elastic/api/response.rb +52 -0
- data/lib/elastic/{workplace-search/api/user_permissions.rb → app-search/api/adaptive_relevance_settings.rb} +10 -15
- data/lib/elastic/app-search/api/adaptive_relevance_suggestions.rb +60 -0
- data/lib/elastic/app-search/api/add_meta_engine_source.rb +4 -5
- data/lib/elastic/app-search/api/api_key.rb +4 -6
- data/lib/elastic/app-search/api/api_logs.rb +8 -15
- data/lib/elastic/app-search/api/count_analytics.rb +5 -5
- data/lib/elastic/app-search/api/crawler_active_crawl_request.rb +4 -7
- data/lib/elastic/app-search/api/crawler_crawl_request.rb +6 -8
- data/lib/elastic/app-search/api/crawler_crawl_schedule.rb +4 -7
- data/lib/elastic/app-search/api/crawler_domain.rb +6 -8
- data/lib/elastic/app-search/api/crawler_domain_validation_result.rb +6 -5
- data/lib/elastic/app-search/api/crawler_metrics.rb +3 -6
- data/lib/elastic/app-search/api/crawler_overview.rb +4 -7
- data/lib/elastic/app-search/api/crawler_process_crawl.rb +6 -8
- data/lib/elastic/app-search/api/crawler_process_crawl_denied_urls.rb +6 -8
- data/lib/elastic/app-search/api/crawler_url_extraction_result.rb +6 -6
- data/lib/elastic/app-search/api/crawler_url_tracing_result.rb +7 -7
- data/lib/elastic/app-search/api/crawler_url_validation_result.rb +7 -7
- data/lib/elastic/app-search/api/crawler_user_agent.rb +3 -6
- data/lib/elastic/app-search/api/create_api_key.rb +10 -10
- data/lib/elastic/app-search/api/create_crawler_crawl_request.rb +9 -5
- data/lib/elastic/app-search/api/create_crawler_crawl_rule.rb +13 -11
- data/lib/elastic/app-search/api/create_crawler_domain.rb +8 -8
- data/lib/elastic/app-search/api/create_crawler_entry_point.rb +10 -8
- data/lib/elastic/app-search/api/create_crawler_process_crawl.rb +6 -6
- data/lib/elastic/app-search/api/create_crawler_sitemap.rb +10 -8
- data/lib/elastic/app-search/api/create_curation.rb +10 -8
- data/lib/elastic/app-search/api/create_engine.rb +8 -7
- data/lib/elastic/app-search/api/create_synonym_set.rb +6 -6
- data/lib/elastic/app-search/api/curation.rb +5 -7
- data/lib/elastic/app-search/api/delete_api_key.rb +4 -6
- data/lib/elastic/app-search/api/delete_crawler_active_crawl_request.rb +4 -7
- data/lib/elastic/app-search/api/delete_crawler_crawl_rule.rb +7 -9
- data/lib/elastic/app-search/api/delete_crawler_crawl_schedule.rb +4 -7
- data/lib/elastic/app-search/api/delete_crawler_domain.rb +6 -8
- data/lib/elastic/app-search/api/delete_crawler_entry_point.rb +7 -9
- data/lib/elastic/app-search/api/delete_crawler_sitemap.rb +7 -9
- data/lib/elastic/app-search/api/delete_curation.rb +5 -7
- data/lib/elastic/app-search/api/delete_documents.rb +4 -5
- data/lib/elastic/app-search/api/delete_engine.rb +3 -6
- data/lib/elastic/app-search/api/delete_meta_engine_source.rb +4 -4
- data/lib/elastic/app-search/api/delete_synonym_set.rb +5 -7
- data/lib/elastic/app-search/api/documents.rb +5 -5
- data/lib/elastic/app-search/api/engine.rb +3 -6
- data/lib/elastic/app-search/api/index_documents.rb +4 -5
- data/lib/elastic/{workplace-search/api/add_user_permissions.rb → app-search/api/list_adaptive_relevance_suggestions.rb} +13 -14
- data/lib/elastic/app-search/api/list_api_keys.rb +2 -5
- data/lib/elastic/app-search/api/list_crawler_crawl_requests.rb +6 -8
- data/lib/elastic/{workplace-search/api/list_permissions.rb → app-search/api/list_crawler_domains.rb} +12 -13
- data/lib/elastic/app-search/api/list_crawler_process_crawls.rb +6 -7
- data/lib/elastic/app-search/api/list_curations.rb +3 -6
- data/lib/elastic/app-search/api/list_documents.rb +3 -6
- data/lib/elastic/app-search/api/list_engines.rb +2 -5
- data/lib/elastic/app-search/api/list_synonym_sets.rb +3 -6
- data/lib/elastic/app-search/api/log_clickthrough.rb +9 -8
- data/lib/elastic/{workplace-search/api/put_user_permissions.rb → app-search/api/put_adaptive_relevance_settings.rb} +13 -14
- data/lib/elastic/app-search/api/put_adaptive_relevance_suggestions.rb +51 -0
- data/lib/elastic/app-search/api/put_api_key.rb +11 -10
- data/lib/elastic/app-search/api/put_crawler_crawl_rule.rb +14 -12
- data/lib/elastic/app-search/api/put_crawler_crawl_schedule.rb +8 -7
- data/lib/elastic/app-search/api/put_crawler_domain.rb +9 -9
- data/lib/elastic/app-search/api/put_crawler_entry_point.rb +11 -9
- data/lib/elastic/app-search/api/put_crawler_sitemap.rb +11 -9
- data/lib/elastic/app-search/api/put_curation.rb +11 -9
- data/lib/elastic/app-search/api/put_documents.rb +4 -4
- data/lib/elastic/app-search/api/put_schema.rb +4 -4
- data/lib/elastic/app-search/api/put_search_settings.rb +6 -6
- data/lib/elastic/app-search/api/put_synonym_set.rb +8 -8
- data/lib/elastic/app-search/api/query_suggestion.rb +5 -5
- data/lib/elastic/app-search/api/refresh_adaptive_relevance_update_process.rb +56 -0
- data/lib/elastic/app-search/api/reset_search_settings.rb +3 -6
- data/lib/elastic/app-search/api/schema.rb +3 -6
- data/lib/elastic/app-search/api/search.rb +6 -5
- data/lib/elastic/app-search/api/search_settings.rb +3 -6
- data/lib/elastic/app-search/api/synonym_set.rb +5 -7
- data/lib/elastic/app-search/api/top_clicks_analytics.rb +5 -5
- data/lib/elastic/app-search/api/top_queries_analytics.rb +4 -4
- data/lib/elastic/enterprise-search/api/health.rb +2 -3
- data/lib/elastic/enterprise-search/api/put_read_only.rb +6 -4
- data/lib/elastic/enterprise-search/api/read_only.rb +2 -3
- data/lib/elastic/enterprise-search/api/stats.rb +2 -3
- data/lib/elastic/enterprise-search/api/version.rb +2 -3
- data/lib/elastic/enterprise-search/client.rb +8 -13
- data/lib/elastic/enterprise-search/request.rb +5 -3
- data/lib/elastic/enterprise-search/version.rb +1 -1
- data/lib/elastic/workplace-search/api/auto_query_refinement_details.rb +3 -4
- data/lib/elastic/workplace-search/api/command_sync_jobs.rb +4 -5
- data/lib/elastic/workplace-search/api/content_source.rb +3 -4
- data/lib/elastic/workplace-search/api/create_analytics_event.rb +16 -12
- data/lib/elastic/workplace-search/api/create_batch_synonym_sets.rb +4 -3
- data/lib/elastic/workplace-search/api/create_content_source.rb +6 -5
- data/lib/elastic/workplace-search/api/create_external_identity.rb +11 -6
- data/lib/elastic/workplace-search/api/current_user.rb +3 -5
- data/lib/elastic/workplace-search/api/delete_content_source.rb +3 -4
- data/lib/elastic/workplace-search/api/delete_documents.rb +4 -4
- data/lib/elastic/workplace-search/api/delete_documents_by_query.rb +4 -3
- data/lib/elastic/workplace-search/api/delete_external_identity.rb +7 -9
- data/lib/elastic/workplace-search/api/delete_synonym_set.rb +3 -5
- data/lib/elastic/workplace-search/api/document.rb +4 -6
- data/lib/elastic/workplace-search/api/external_identity.rb +7 -9
- data/lib/elastic/workplace-search/api/index_documents.rb +3 -4
- data/lib/elastic/workplace-search/api/list_content_sources.rb +2 -3
- data/lib/elastic/workplace-search/api/{remove_user_permissions.rb → list_documents.rb} +12 -12
- data/lib/elastic/workplace-search/api/list_external_identities.rb +3 -4
- data/lib/elastic/workplace-search/api/list_synonym_sets.rb +1 -2
- data/lib/elastic/workplace-search/api/put_content_source.rb +6 -6
- data/lib/elastic/workplace-search/api/put_content_source_icons.rb +6 -6
- data/lib/elastic/workplace-search/api/put_external_identity.rb +11 -10
- data/lib/elastic/workplace-search/api/put_synonym_set.rb +4 -4
- data/lib/elastic/workplace-search/api/put_triggers_blocklist.rb +3 -5
- data/lib/elastic/workplace-search/api/search.rb +13 -13
- data/lib/elastic/workplace-search/api/synonym_set.rb +3 -5
- data/lib/elastic/workplace-search/api/triggers_blocklist.rb +3 -3
- data/spec/app-search/client_spec.rb +29 -0
- data/spec/enterprise-search/client_spec.rb +29 -0
- data/spec/enterprise-search/request_spec.rb +1 -1
- data/spec/integration/app-search/adaptive_relevance_settings_spec.rb +60 -0
- data/spec/integration/app-search/adaptive_relevance_suggestions_spec.rb +54 -0
- data/spec/integration/app-search/api_logs_spec.rb +12 -4
- data/spec/integration/app-search/app_search_helper.rb +2 -2
- data/spec/integration/app-search/count_analytics_spec.rb +3 -2
- data/spec/integration/app-search/crawler_domain_spec.rb +16 -0
- data/spec/integration/app-search/curations_spec.rb +15 -9
- data/spec/integration/app-search/engines_spec.rb +24 -26
- data/spec/integration/app-search/log_clickthrough_spec.rb +1 -1
- data/spec/integration/app-search/meta_engines_spec.rb +5 -5
- data/spec/integration/app-search/search_and_multiple_search_spec.rb +1 -1
- data/spec/integration/workplace-search/content_sources_spec.rb +6 -6
- data/spec/integration/workplace-search/documents_spec.rb +20 -3
- data/spec/integration/workplace-search/external_identities_spec.rb +26 -16
- data/spec/integration/workplace-search/triggers_spec.rb +2 -2
- data/spec/integration/workplace-search/users_spec.rb +0 -6
- data/spec/workplace-search/client_spec.rb +29 -0
- metadata +34 -22
- data/.ci/jobs/elastic+enterprise-search-ruby+7.10.0.beta.1.yml +0 -12
- data/.github/compatibility/Gemfile +0 -23
- data/.github/workflows/compatibility.yml +0 -20
- data/spec/integration/workplace-search/permissions_spec.rb +0 -77
@@ -44,7 +44,7 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
|
|
44
44
|
expect(response.status).to eq 200
|
45
45
|
expect(response.body['id']).to match(/cur-[0-9a-f]+/)
|
46
46
|
|
47
|
-
response = client.search(engine_name, query: 'jungle')
|
47
|
+
response = client.search(engine_name, body: { query: 'jungle' })
|
48
48
|
expect(response.status).to eq 200
|
49
49
|
expect(response.body['results'].count).to eq 1
|
50
50
|
expect(response.body['results'].first['title']['raw']).to eq 'Jungle Tales'
|
@@ -65,9 +65,11 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
|
|
65
65
|
def create_curation(name, query, promoted_id, hidden_id)
|
66
66
|
response = client.create_curation(
|
67
67
|
name,
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
body: {
|
69
|
+
queries: [query],
|
70
|
+
promoted: [promoted_id],
|
71
|
+
hidden: [hidden_id]
|
72
|
+
}
|
71
73
|
)
|
72
74
|
# Give the server a second
|
73
75
|
sleep 1
|
@@ -79,16 +81,20 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
|
|
79
81
|
|
80
82
|
response = client.put_curation(
|
81
83
|
engine_name,
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
84
|
+
{
|
85
|
+
curation_id: id,
|
86
|
+
body: {
|
87
|
+
queries: ['jungle'],
|
88
|
+
promoted: [@hidden['id']],
|
89
|
+
hidden: [@promoted['id']]
|
90
|
+
}
|
91
|
+
}
|
86
92
|
)
|
87
93
|
|
88
94
|
expect(response.status).to eq 200
|
89
95
|
expect(response.body['id']).to match(/cur-[0-9a-f]+/)
|
90
96
|
|
91
|
-
response = @client.search(engine_name, query: 'jungle')
|
97
|
+
response = @client.search(engine_name, body: { query: 'jungle' })
|
92
98
|
expect(response.status).to eq 200
|
93
99
|
expect(response.body['results'].count).to eq 1
|
94
100
|
expect(response.body['results'].first['title']['raw']).to eq 'The Jungle Book'
|
@@ -22,54 +22,52 @@ require_relative "#{__dir__}/app_search_helper.rb"
|
|
22
22
|
describe Elastic::EnterpriseSearch::AppSearch::Client do
|
23
23
|
context 'Engines' do
|
24
24
|
let(:engine_name) { 'test-create-engines' }
|
25
|
+
let(:engine_response) do
|
26
|
+
{
|
27
|
+
'type' => 'default',
|
28
|
+
'language' => nil,
|
29
|
+
'document_count' => 0,
|
30
|
+
'index_create_settings_override' => {}
|
31
|
+
}
|
32
|
+
end
|
25
33
|
|
26
34
|
after do
|
27
35
|
delete_engines
|
28
36
|
end
|
29
37
|
|
30
38
|
it 'creates a new engine' do
|
31
|
-
response = client.create_engine(name: engine_name)
|
39
|
+
response = client.create_engine({ body: { name: engine_name } })
|
32
40
|
|
33
41
|
expect(response.status).to eq 200
|
34
|
-
expect(response.body).to eq(
|
35
|
-
{
|
36
|
-
'name' => engine_name,
|
37
|
-
'type' => 'default',
|
38
|
-
'language' => nil,
|
39
|
-
'document_count' => 0
|
40
|
-
}
|
41
|
-
)
|
42
|
+
expect(response.body).to eq(engine_response.merge({ 'name' => engine_name }))
|
42
43
|
end
|
43
44
|
|
44
45
|
it 'lists engines' do
|
45
|
-
client.create_engine(name: 'engine1')
|
46
|
-
client.create_engine(name: 'engine2')
|
46
|
+
client.create_engine({ body: { name: 'engine1' } })
|
47
|
+
client.create_engine({ body: { name: 'engine2' } })
|
47
48
|
|
48
49
|
response = client.list_engines
|
49
50
|
expect(response.status).to eq 200
|
50
51
|
|
51
52
|
expect(response.body.dig('meta', 'page', 'total_results')).to eq 2
|
52
|
-
expect(response.body['results']).to include(
|
53
|
-
|
54
|
-
)
|
55
|
-
expect(response.body['results']).to include(
|
56
|
-
{ 'name' => 'engine2', 'type' => 'default', 'language' => nil, 'document_count' => 0 }
|
57
|
-
)
|
53
|
+
expect(response.body['results']).to include(engine_response.merge({ 'name' => 'engine1' }))
|
54
|
+
expect(response.body['results']).to include(engine_response.merge({ 'name' => 'engine2' }))
|
58
55
|
end
|
59
56
|
|
60
|
-
|
61
|
-
engine_name
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
57
|
+
context 'get engines' do
|
58
|
+
let(:engine_name) { 'retrieve-engine' }
|
59
|
+
it 'retrieves an engine by name' do
|
60
|
+
engine_name = 'retrieve-engine'
|
61
|
+
client.create_engine({ body: { name: engine_name } })
|
62
|
+
response = client.engine(engine_name)
|
63
|
+
expect(response.status).to eq 200
|
64
|
+
expect(response.body).to eq(engine_response.merge({ 'name' => engine_name }))
|
65
|
+
end
|
68
66
|
end
|
69
67
|
|
70
68
|
it 'deletes an engine' do
|
71
69
|
engine_name = 'delete-engine'
|
72
|
-
client.create_engine(name: engine_name)
|
70
|
+
client.create_engine({ body: { name: engine_name } })
|
73
71
|
response = client.delete_engine(engine_name)
|
74
72
|
expect(response.status).to eq 200
|
75
73
|
expect(response.body).to eq({ 'deleted' => true })
|
@@ -21,7 +21,7 @@ require_relative "#{__dir__}/app_search_helper.rb"
|
|
21
21
|
|
22
22
|
describe Elastic::EnterpriseSearch::AppSearch::Client do
|
23
23
|
context 'Log Click through' do
|
24
|
-
let(:engine_name) { '
|
24
|
+
let(:engine_name) { 'log-click-through' }
|
25
25
|
|
26
26
|
before do
|
27
27
|
create_engine(engine_name)
|
@@ -28,12 +28,12 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
|
|
28
28
|
type: 'meta',
|
29
29
|
source_engines: ['books', 'videogames']
|
30
30
|
}
|
31
|
-
client.create_engine(
|
31
|
+
client.create_engine(body: body)
|
32
32
|
end
|
33
33
|
|
34
34
|
before do
|
35
|
-
client.create_engine(name: 'books')
|
36
|
-
client.create_engine(name: 'videogames')
|
35
|
+
client.create_engine({ body: { name: 'books' } })
|
36
|
+
client.create_engine({ body: { name: 'videogames' } })
|
37
37
|
end
|
38
38
|
|
39
39
|
after do
|
@@ -51,7 +51,7 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
|
|
51
51
|
it 'adds a new source engine to a meta engine' do
|
52
52
|
create_meta_engine
|
53
53
|
# Create new source engine to add:
|
54
|
-
client.create_engine(name: 'add-source')
|
54
|
+
client.create_engine({ body: { name: 'add-source' } })
|
55
55
|
response = client.add_meta_engine_source(engine_name, source_engines: ['add-source'])
|
56
56
|
|
57
57
|
expect(response.status).to eq 200
|
@@ -62,7 +62,7 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
|
|
62
62
|
|
63
63
|
it 'removes a source engine from a meta engine' do
|
64
64
|
create_meta_engine
|
65
|
-
client.create_engine(name: 'remove-source')
|
65
|
+
client.create_engine({ body: { name: 'remove-source' } })
|
66
66
|
client.add_meta_engine_source(engine_name, source_engines: ['remove-source'])
|
67
67
|
response = client.delete_meta_engine_source(engine_name, source_engines: ['remove-source'])
|
68
68
|
|
@@ -44,7 +44,7 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
|
|
44
44
|
|
45
45
|
context 'search' do
|
46
46
|
it 'performs a single query search' do
|
47
|
-
response = client.search(engine_name, query: 'Ibarbourou')
|
47
|
+
response = client.search(engine_name, body: { query: 'Ibarbourou' })
|
48
48
|
expect(response.status).to eq 200
|
49
49
|
expect(response.body).not_to be nil
|
50
50
|
expect(response.body['results'].count).to be 1
|
@@ -27,7 +27,7 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
27
27
|
|
28
28
|
it 'creates, retrieves and deletes authenticated with basic auth' do
|
29
29
|
# Create a content source and get its id
|
30
|
-
response = client.create_content_source(name: 'test')
|
30
|
+
response = client.create_content_source(body: { name: 'test' })
|
31
31
|
expect(response.status).to eq 200
|
32
32
|
expect(response.body['id'])
|
33
33
|
id = response.body['id']
|
@@ -47,7 +47,7 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'creates and updates' do
|
50
|
-
response = client.create_content_source(name: 'ruby_client_app')
|
50
|
+
response = client.create_content_source(body: { name: 'ruby_client_app' })
|
51
51
|
expect(response.status).to eq 200
|
52
52
|
id = response.body['id']
|
53
53
|
|
@@ -71,7 +71,7 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'syncs jobs' do
|
74
|
-
response = client.create_content_source(name: 'sync_jobs_test')
|
74
|
+
response = client.create_content_source(body: { name: 'sync_jobs_test' })
|
75
75
|
expect(response.status).to eq 200
|
76
76
|
id = response.body['id']
|
77
77
|
|
@@ -81,19 +81,19 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
context 'icons' do
|
84
|
-
let(:content_source_id) { client.create_content_source(name: 'with-icon').body['id'] }
|
84
|
+
let(:content_source_id) { client.create_content_source(body: { name: 'with-icon' }).body['id'] }
|
85
85
|
|
86
86
|
it 'puts an icon' do
|
87
87
|
path = File.expand_path("#{File.dirname(__FILE__)}/icon.png")
|
88
88
|
icon = Base64.strict_encode64(File.read(path))
|
89
|
-
response = client.put_content_source_icons(content_source_id, main_icon: icon, alt_icon: icon)
|
89
|
+
response = client.put_content_source_icons(content_source_id, body: { main_icon: icon, alt_icon: icon })
|
90
90
|
expect(response.status).to eq 200
|
91
91
|
expect(response.body['results']).to eq({ 'main_icon' => 'success', 'alt_icon' => 'success' })
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
95
|
context 'auto query refinements details' do
|
96
|
-
let(:content_source_id) { client.create_content_source(name: 'refinements').body['id'] }
|
96
|
+
let(:content_source_id) { client.create_content_source(body: { name: 'refinements' }).body['id'] }
|
97
97
|
|
98
98
|
it 'retrieves details' do
|
99
99
|
response = client.auto_query_refinement_details(content_source_id)
|
@@ -43,7 +43,7 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
43
43
|
|
44
44
|
context 'Documents' do
|
45
45
|
let(:content_source_id) do
|
46
|
-
client.create_content_source(name: 'test').body['id']
|
46
|
+
client.create_content_source(body: { name: 'test' }).body['id']
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'indexes' do
|
@@ -58,7 +58,7 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
context 'Documents in Content Sources' do
|
61
|
-
let(:content_source_id) { client.create_content_source(name: 'books').body['id'] }
|
61
|
+
let(:content_source_id) { client.create_content_source(body: { name: 'books' }).body['id'] }
|
62
62
|
let(:document_id) { client.index_documents(content_source_id, documents: documents).body['results'].first['id'] }
|
63
63
|
|
64
64
|
it 'Gets a document in a content source' do
|
@@ -73,7 +73,7 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'Deletes documents by query' do
|
76
|
-
content_source_id = client.create_content_source(name: 'asimov').body['id']
|
76
|
+
content_source_id = client.create_content_source(body: { name: 'asimov' }).body['id']
|
77
77
|
documents = [
|
78
78
|
{ title: 'Foundation', year: 1951 },
|
79
79
|
{ title: 'Foundation and Empire', year: 1952 },
|
@@ -91,5 +91,22 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
91
91
|
expect(response.status).to eq 200
|
92
92
|
expect(response.body).to eq({ 'total' => 3, 'deleted' => 3, 'failures' => [] })
|
93
93
|
end
|
94
|
+
|
95
|
+
it 'Lists documents' do
|
96
|
+
content_source_id = client.create_content_source(body: { name: 'quiroga' }).body['id']
|
97
|
+
documents = [
|
98
|
+
{ title: 'Stories of Love, Madness and Death', year: 1917 },
|
99
|
+
{ title: 'Drifting', year: 1937 },
|
100
|
+
{ title: 'The Beheaded Hen', year: 1925 }
|
101
|
+
]
|
102
|
+
client.index_documents(content_source_id, documents: documents)
|
103
|
+
# Give time to index the documents
|
104
|
+
sleep 2
|
105
|
+
|
106
|
+
response = client.list_documents(content_source_id)
|
107
|
+
expect(response.status).to eq 200
|
108
|
+
expect(response.body['results'].count).to eq 3
|
109
|
+
expect(response.body['results'].map { |a| a['year'] }).to eq ['1917', '1937', '1925']
|
110
|
+
end
|
94
111
|
end
|
95
112
|
end
|
@@ -25,33 +25,42 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
25
25
|
delete_content_sources
|
26
26
|
end
|
27
27
|
|
28
|
-
let(:content_source_id) { client.create_content_source(name: 'my_content').body['id'] }
|
29
|
-
let(:
|
30
|
-
let(:
|
28
|
+
let(:content_source_id) { client.create_content_source(body: { name: 'my_content' }).body['id'] }
|
29
|
+
let(:external_user_id) { 'elastic_user' }
|
30
|
+
let(:user_properties) { ['attribute_name' => '_elasticsearch_username', 'attribute_value' => 'fernando'] }
|
31
31
|
let(:body) do
|
32
|
-
{
|
32
|
+
{ external_user_id: external_user_id, permissions: [], external_user_properties: user_properties }
|
33
|
+
end
|
34
|
+
let(:expected_response) do
|
35
|
+
{
|
36
|
+
'content_source_id' => content_source_id,
|
37
|
+
'external_user_id' => external_user_id,
|
38
|
+
'external_user_properties' => user_properties,
|
39
|
+
'permissions' => []
|
40
|
+
}
|
33
41
|
end
|
34
42
|
|
35
43
|
context 'Creates' do
|
36
|
-
let(:source_user_id) { 'test@elastic.co' }
|
44
|
+
# let(:source_user_id) { 'test@elastic.co' }
|
37
45
|
let(:user) { 'test' }
|
38
46
|
|
39
47
|
it 'creates an external identity' do
|
40
48
|
response = client.create_external_identity(content_source_id, body: body)
|
41
49
|
|
42
50
|
expect(response.status).to eq 200
|
43
|
-
expect(response.body).to eq(
|
51
|
+
expect(response.body).to eq(expected_response)
|
44
52
|
|
45
|
-
client.delete_external_identity(content_source_id,
|
53
|
+
client.delete_external_identity(content_source_id, external_user_id: external_user_id)
|
46
54
|
end
|
47
55
|
|
48
56
|
it 'creates and retrieves' do
|
49
57
|
client.create_external_identity(content_source_id, body: body)
|
50
|
-
response = client.external_identity(content_source_id,
|
58
|
+
response = client.external_identity(content_source_id, external_user_id: external_user_id)
|
51
59
|
|
52
60
|
expect(response.status).to eq 200
|
53
|
-
|
54
|
-
|
61
|
+
|
62
|
+
expect(response.body).to eq(expected_response)
|
63
|
+
client.delete_external_identity(content_source_id, external_user_id: external_user_id)
|
55
64
|
end
|
56
65
|
end
|
57
66
|
|
@@ -63,8 +72,9 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
63
72
|
response = client.list_external_identities(content_source_id)
|
64
73
|
|
65
74
|
expect(response.status).to eq 200
|
66
|
-
|
67
|
-
|
75
|
+
|
76
|
+
expect(response.body['results']).to eq([expected_response])
|
77
|
+
client.delete_external_identity(content_source_id, external_user_id: external_user_id)
|
68
78
|
end
|
69
79
|
end
|
70
80
|
|
@@ -74,11 +84,11 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
74
84
|
end
|
75
85
|
|
76
86
|
it 'updates an external identity' do
|
77
|
-
body = {
|
78
|
-
response = client.put_external_identity(content_source_id,
|
87
|
+
body = { external_user_id: external_user_id, permissions: ['permission1'] }
|
88
|
+
response = client.put_external_identity(content_source_id, external_user_id: external_user_id, body: body)
|
79
89
|
|
80
90
|
expect(response.status).to eq 200
|
81
|
-
expect(response.body).to eq({ '
|
91
|
+
expect(response.body).to eq expected_response.merge({ 'permissions' => ['permission1'] })
|
82
92
|
end
|
83
93
|
end
|
84
94
|
|
@@ -88,7 +98,7 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
88
98
|
end
|
89
99
|
|
90
100
|
it 'deletes an external identity' do
|
91
|
-
response = client.delete_external_identity(content_source_id,
|
101
|
+
response = client.delete_external_identity(content_source_id, external_user_id: external_user_id)
|
92
102
|
expect(response.status).to eq 200
|
93
103
|
expect(response.body).to eq 'ok'
|
94
104
|
end
|
@@ -28,14 +28,14 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
28
28
|
original_list = response.body['blocklist']
|
29
29
|
|
30
30
|
# Add a term to the block list and check it's been changed
|
31
|
-
response = client.put_triggers_blocklist(
|
31
|
+
response = client.put_triggers_blocklist(blocklist: original_list + ['tests'])
|
32
32
|
expect(response.status).to eq 200
|
33
33
|
expect(response.body['blocklist']).to eq(original_list + ['tests'])
|
34
34
|
response = client.triggers_blocklist
|
35
35
|
expect(response.body['blocklist']).to eq(original_list + ['tests'])
|
36
36
|
|
37
37
|
# Restored original list
|
38
|
-
response = client.put_triggers_blocklist(
|
38
|
+
response = client.put_triggers_blocklist(blocklist: original_list)
|
39
39
|
expect(response.status).to eq 200
|
40
40
|
expect(response.body['blocklist']).to eq(original_list)
|
41
41
|
end
|
@@ -26,11 +26,5 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
26
26
|
expect(response.status).to eq 200
|
27
27
|
expect(response.body.keys).to eq ['email', 'username']
|
28
28
|
end
|
29
|
-
|
30
|
-
it 'gets the current user with an access token' do
|
31
|
-
response = client.current_user(get_token: true)
|
32
|
-
expect(response.status).to eq 200
|
33
|
-
expect(response.body.keys).to eq ['email', 'username', 'access_token']
|
34
|
-
end
|
35
29
|
end
|
36
30
|
end
|
@@ -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,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-enterprise-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0.pre
|
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: 2022-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: elastic-transport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 8.0.0.pre.1
|
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:
|
26
|
+
version: 8.0.0.pre.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jwt
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1
|
109
|
+
version: '1'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 1
|
116
|
+
version: '1'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: vcr
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,7 +164,10 @@ files:
|
|
164
164
|
- ".ci/functions/imports.sh"
|
165
165
|
- ".ci/functions/wait-for-container.sh"
|
166
166
|
- ".ci/jobs/defaults.yml"
|
167
|
-
- ".ci/jobs/elastic+enterprise-search-ruby+7.
|
167
|
+
- ".ci/jobs/elastic+enterprise-search-ruby+7.13.yml"
|
168
|
+
- ".ci/jobs/elastic+enterprise-search-ruby+7.14.yml"
|
169
|
+
- ".ci/jobs/elastic+enterprise-search-ruby+7.15.yml"
|
170
|
+
- ".ci/jobs/elastic+enterprise-search-ruby+7.16.yml"
|
168
171
|
- ".ci/jobs/elastic+enterprise-search-ruby+main.yml"
|
169
172
|
- ".ci/jobs/elastic+enterprise-search-ruby+pull-request.yml"
|
170
173
|
- ".ci/make.sh"
|
@@ -175,17 +178,18 @@ files:
|
|
175
178
|
- ".ci/run-tests"
|
176
179
|
- ".ci/test-matrix.yml"
|
177
180
|
- ".github/check_license_headers.rb"
|
178
|
-
- ".github/compatibility/Gemfile"
|
179
181
|
- ".github/license-header.txt"
|
180
|
-
- ".github/workflows/compatibility.yml"
|
181
182
|
- ".github/workflows/license.yml"
|
182
183
|
- ".github/workflows/rubocop.yml"
|
183
184
|
- ".github/workflows/testing.yml"
|
184
185
|
- ".gitignore"
|
185
186
|
- ".rubocop.yml"
|
187
|
+
- CHANGELOG
|
188
|
+
- CODE_OF_CONDUCT
|
186
189
|
- CONTRIBUTING.md
|
187
190
|
- Gemfile
|
188
191
|
- LICENSE
|
192
|
+
- NOTICE
|
189
193
|
- README.md
|
190
194
|
- Rakefile
|
191
195
|
- docs/guide/app-search-api.asciidoc
|
@@ -201,12 +205,18 @@ files:
|
|
201
205
|
- docs/guide/release_notes/713.asciidoc
|
202
206
|
- docs/guide/release_notes/714.asciidoc
|
203
207
|
- docs/guide/release_notes/715.asciidoc
|
208
|
+
- docs/guide/release_notes/716.asciidoc
|
209
|
+
- docs/guide/release_notes/717.asciidoc
|
210
|
+
- docs/guide/release_notes/80.asciidoc
|
204
211
|
- docs/guide/release_notes/index.asciidoc
|
205
212
|
- docs/guide/workplace-search-api.asciidoc
|
206
213
|
- elastic-enterprise-search.gemspec
|
207
214
|
- lib/data/ca-bundle.crt
|
208
215
|
- lib/elastic-enterprise-search.rb
|
209
216
|
- lib/elastic/.rubocop.yml
|
217
|
+
- lib/elastic/api/response.rb
|
218
|
+
- lib/elastic/app-search/api/adaptive_relevance_settings.rb
|
219
|
+
- lib/elastic/app-search/api/adaptive_relevance_suggestions.rb
|
210
220
|
- lib/elastic/app-search/api/add_meta_engine_source.rb
|
211
221
|
- lib/elastic/app-search/api/api_key.rb
|
212
222
|
- lib/elastic/app-search/api/api_logs.rb
|
@@ -252,8 +262,10 @@ files:
|
|
252
262
|
- lib/elastic/app-search/api/documents.rb
|
253
263
|
- lib/elastic/app-search/api/engine.rb
|
254
264
|
- lib/elastic/app-search/api/index_documents.rb
|
265
|
+
- lib/elastic/app-search/api/list_adaptive_relevance_suggestions.rb
|
255
266
|
- lib/elastic/app-search/api/list_api_keys.rb
|
256
267
|
- lib/elastic/app-search/api/list_crawler_crawl_requests.rb
|
268
|
+
- lib/elastic/app-search/api/list_crawler_domains.rb
|
257
269
|
- lib/elastic/app-search/api/list_crawler_process_crawls.rb
|
258
270
|
- lib/elastic/app-search/api/list_curations.rb
|
259
271
|
- lib/elastic/app-search/api/list_documents.rb
|
@@ -261,6 +273,8 @@ files:
|
|
261
273
|
- lib/elastic/app-search/api/list_synonym_sets.rb
|
262
274
|
- lib/elastic/app-search/api/log_clickthrough.rb
|
263
275
|
- lib/elastic/app-search/api/multi_search.rb
|
276
|
+
- lib/elastic/app-search/api/put_adaptive_relevance_settings.rb
|
277
|
+
- lib/elastic/app-search/api/put_adaptive_relevance_suggestions.rb
|
264
278
|
- lib/elastic/app-search/api/put_api_key.rb
|
265
279
|
- lib/elastic/app-search/api/put_crawler_crawl_rule.rb
|
266
280
|
- lib/elastic/app-search/api/put_crawler_crawl_schedule.rb
|
@@ -273,6 +287,7 @@ files:
|
|
273
287
|
- lib/elastic/app-search/api/put_search_settings.rb
|
274
288
|
- lib/elastic/app-search/api/put_synonym_set.rb
|
275
289
|
- lib/elastic/app-search/api/query_suggestion.rb
|
290
|
+
- lib/elastic/app-search/api/refresh_adaptive_relevance_update_process.rb
|
276
291
|
- lib/elastic/app-search/api/reset_search_settings.rb
|
277
292
|
- lib/elastic/app-search/api/schema.rb
|
278
293
|
- lib/elastic/app-search/api/search.rb
|
@@ -293,7 +308,6 @@ files:
|
|
293
308
|
- lib/elastic/enterprise-search/utils.rb
|
294
309
|
- lib/elastic/enterprise-search/version.rb
|
295
310
|
- lib/elastic/enterprise_search.rb
|
296
|
-
- lib/elastic/workplace-search/api/add_user_permissions.rb
|
297
311
|
- lib/elastic/workplace-search/api/auto_query_refinement_details.rb
|
298
312
|
- lib/elastic/workplace-search/api/command_sync_jobs.rb
|
299
313
|
- lib/elastic/workplace-search/api/content_source.rb
|
@@ -312,20 +326,17 @@ files:
|
|
312
326
|
- lib/elastic/workplace-search/api/external_identity.rb
|
313
327
|
- lib/elastic/workplace-search/api/index_documents.rb
|
314
328
|
- lib/elastic/workplace-search/api/list_content_sources.rb
|
329
|
+
- lib/elastic/workplace-search/api/list_documents.rb
|
315
330
|
- lib/elastic/workplace-search/api/list_external_identities.rb
|
316
|
-
- lib/elastic/workplace-search/api/list_permissions.rb
|
317
331
|
- lib/elastic/workplace-search/api/list_synonym_sets.rb
|
318
332
|
- lib/elastic/workplace-search/api/put_content_source.rb
|
319
333
|
- lib/elastic/workplace-search/api/put_content_source_icons.rb
|
320
334
|
- lib/elastic/workplace-search/api/put_external_identity.rb
|
321
335
|
- lib/elastic/workplace-search/api/put_synonym_set.rb
|
322
336
|
- lib/elastic/workplace-search/api/put_triggers_blocklist.rb
|
323
|
-
- lib/elastic/workplace-search/api/put_user_permissions.rb
|
324
|
-
- lib/elastic/workplace-search/api/remove_user_permissions.rb
|
325
337
|
- lib/elastic/workplace-search/api/search.rb
|
326
338
|
- lib/elastic/workplace-search/api/synonym_set.rb
|
327
339
|
- lib/elastic/workplace-search/api/triggers_blocklist.rb
|
328
|
-
- lib/elastic/workplace-search/api/user_permissions.rb
|
329
340
|
- lib/elastic/workplace-search/workplace_search.rb
|
330
341
|
- rake_tasks/unified_release_tasks.rake
|
331
342
|
- spec/app-search/client_spec.rb
|
@@ -336,6 +347,8 @@ files:
|
|
336
347
|
- spec/fixtures/vcr/workplace_search/create_analytics_event.yml
|
337
348
|
- spec/fixtures/vcr/workplace_search/oauth_request_token.yml
|
338
349
|
- spec/fixtures/vcr/workplace_search/search_request.yml
|
350
|
+
- spec/integration/app-search/adaptive_relevance_settings_spec.rb
|
351
|
+
- spec/integration/app-search/adaptive_relevance_suggestions_spec.rb
|
339
352
|
- spec/integration/app-search/api_key_spec.rb
|
340
353
|
- spec/integration/app-search/api_logs_spec.rb
|
341
354
|
- spec/integration/app-search/app_search_helper.rb
|
@@ -369,7 +382,6 @@ files:
|
|
369
382
|
- spec/integration/workplace-search/documents_spec.rb
|
370
383
|
- spec/integration/workplace-search/external_identities_spec.rb
|
371
384
|
- spec/integration/workplace-search/icon.png
|
372
|
-
- spec/integration/workplace-search/permissions_spec.rb
|
373
385
|
- spec/integration/workplace-search/synonym_sets_spec.rb
|
374
386
|
- spec/integration/workplace-search/triggers_spec.rb
|
375
387
|
- spec/integration/workplace-search/users_spec.rb
|
@@ -396,14 +408,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
396
408
|
requirements:
|
397
409
|
- - ">="
|
398
410
|
- !ruby/object:Gem::Version
|
399
|
-
version: '2.
|
411
|
+
version: '2.6'
|
400
412
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
401
413
|
requirements:
|
402
|
-
- - "
|
414
|
+
- - ">"
|
403
415
|
- !ruby/object:Gem::Version
|
404
|
-
version:
|
416
|
+
version: 1.3.1
|
405
417
|
requirements: []
|
406
|
-
rubygems_version: 3.
|
418
|
+
rubygems_version: 3.3.3
|
407
419
|
signing_key:
|
408
420
|
specification_version: 4
|
409
421
|
summary: Official API client for Elastic Enterprise Search
|
@@ -1,12 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- job:
|
3
|
-
name: elastic+enterprise-search-ruby+7.10.0.beta.1
|
4
|
-
display-name: 'elastic / enterprise-search-ruby # 7.10.0.beta.1'
|
5
|
-
description: Testing the enterprise-search-ruby 7.10.0.beta.1 branch.
|
6
|
-
junit_results: "*-junit.xml"
|
7
|
-
parameters:
|
8
|
-
- string:
|
9
|
-
name: branch_specifier
|
10
|
-
default: refs/heads/7.10.0.beta.1
|
11
|
-
description: the Git branch specifier to build (<branchName>, <tagName>,
|
12
|
-
<commitId>, etc.)
|