elastic-enterprise-search 7.12.1 → 7.13.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.10.0.beta.1.yml +12 -0
- data/.ci/test-matrix.yml +1 -1
- data/docs/guide/connecting.asciidoc +47 -1
- data/docs/guide/release_notes/712.asciidoc +0 -22
- data/docs/guide/workplace-search-api.asciidoc +19 -2
- data/elastic-enterprise-search.gemspec +1 -1
- data/lib/elastic/enterprise-search/api/put_read_only.rb +2 -0
- data/lib/elastic/enterprise-search/client.rb +0 -12
- data/lib/elastic/enterprise-search/request.rb +4 -0
- data/lib/elastic/enterprise-search/version.rb +1 -1
- data/lib/elastic/enterprise_search.rb +11 -0
- data/lib/elastic/workplace-search/api/content_source.rb +49 -0
- data/lib/elastic/workplace-search/api/create_analytics_event.rb +2 -2
- data/lib/elastic/workplace-search/api/create_content_source.rb +52 -0
- data/lib/elastic/workplace-search/api/create_external_identity.rb +2 -0
- data/lib/elastic/workplace-search/api/delete_all_documents.rb +49 -0
- data/lib/elastic/workplace-search/api/delete_content_source.rb +49 -0
- data/lib/elastic/workplace-search/api/delete_documents.rb +1 -1
- data/lib/elastic/workplace-search/api/document.rb +53 -0
- data/lib/elastic/workplace-search/api/list_content_sources.rb +48 -0
- data/lib/elastic/workplace-search/api/put_content_source.rb +55 -0
- data/lib/elastic/workplace-search/api/put_external_identity.rb +2 -0
- data/lib/elastic/workplace-search/workplace_search.rb +6 -1
- data/spec/integration/enterprise_search_api_spec.rb +4 -0
- data/spec/integration/workplace_search_spec.rb +253 -0
- metadata +18 -32
- data/.ci/jobs/elastic+enterprise-search-ruby+7.11.yml +0 -12
- data/spec/fixtures/vcr/workplace_search/add_user_permissions.yml +0 -53
- data/spec/fixtures/vcr/workplace_search/clear_user_permissions.yml +0 -53
- data/spec/fixtures/vcr/workplace_search/create_external_identity.yml +0 -53
- data/spec/fixtures/vcr/workplace_search/delete_documents.yml +0 -53
- data/spec/fixtures/vcr/workplace_search/delete_external_identity.yml +0 -53
- data/spec/fixtures/vcr/workplace_search/index_documents.yml +0 -55
- data/spec/fixtures/vcr/workplace_search/list_external_identities.yml +0 -53
- data/spec/fixtures/vcr/workplace_search/list_permissions.yml +0 -53
- data/spec/fixtures/vcr/workplace_search/put_external_identity.yml +0 -53
- data/spec/fixtures/vcr/workplace_search/put_user_permissions.yml +0 -103
- data/spec/fixtures/vcr/workplace_search/remove_user_permissions.yml +0 -53
- data/spec/fixtures/vcr/workplace_search/retrieve_external_identity.yml +0 -53
- data/spec/fixtures/vcr/workplace_search/user_permissions_empty.yml +0 -53
- data/spec/workplace-search/documents_spec.rb +0 -80
- data/spec/workplace-search/external_identities_spec.rb +0 -84
- data/spec/workplace-search/permissions_spec.rb +0 -136
@@ -1,53 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: http://localhost:3002/api/ws/v1/sources/content_source_id/external_identities/
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: "{}"
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
12
|
-
elasticsearch-transport: 7.10.0)'
|
13
|
-
Content-Type:
|
14
|
-
- application/json
|
15
|
-
Authorization:
|
16
|
-
- Bearer access_token
|
17
|
-
Accept-Encoding:
|
18
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
-
Accept:
|
20
|
-
- "*/*"
|
21
|
-
response:
|
22
|
-
status:
|
23
|
-
code: 200
|
24
|
-
message: OK
|
25
|
-
headers:
|
26
|
-
X-Frame-Options:
|
27
|
-
- SAMEORIGIN
|
28
|
-
X-Xss-Protection:
|
29
|
-
- 1; mode=block
|
30
|
-
X-Content-Type-Options:
|
31
|
-
- nosniff
|
32
|
-
Content-Type:
|
33
|
-
- application/json;charset=utf-8
|
34
|
-
Etag:
|
35
|
-
- W/"eb0b885758fed84e48b67ddcff7a2a49--gzip"
|
36
|
-
Cache-Control:
|
37
|
-
- max-age=0, private, must-revalidate
|
38
|
-
X-Request-Id:
|
39
|
-
- aa851d6c-5dba-45b0-9cb9-efebffa5adb5
|
40
|
-
X-Runtime:
|
41
|
-
- '0.052190'
|
42
|
-
Vary:
|
43
|
-
- Accept-Encoding, User-Agent
|
44
|
-
Transfer-Encoding:
|
45
|
-
- chunked
|
46
|
-
Server:
|
47
|
-
- Jetty(9.4.33.v20201020)
|
48
|
-
body:
|
49
|
-
encoding: ASCII-8BIT
|
50
|
-
string: '{"meta":{"page":{"current":1,"total_pages":1,"total_results":1,"size":25}},"results":[{"source_user_id":"example@elastic.co","user":"elastic_user"}]}'
|
51
|
-
http_version:
|
52
|
-
recorded_at: Wed, 13 Jan 2021 16:04:16 GMT
|
53
|
-
recorded_with: VCR 3.0.3
|
@@ -1,53 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: http://localhost:3002/api/ws/v1/sources/content_source_id/permissions/
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: "{}"
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
12
|
-
elasticsearch-transport: 7.10.0)'
|
13
|
-
Content-Type:
|
14
|
-
- application/json
|
15
|
-
Authorization:
|
16
|
-
- Bearer access_token
|
17
|
-
Accept-Encoding:
|
18
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
-
Accept:
|
20
|
-
- "*/*"
|
21
|
-
response:
|
22
|
-
status:
|
23
|
-
code: 200
|
24
|
-
message: OK
|
25
|
-
headers:
|
26
|
-
X-Frame-Options:
|
27
|
-
- SAMEORIGIN
|
28
|
-
X-Xss-Protection:
|
29
|
-
- 1; mode=block
|
30
|
-
X-Content-Type-Options:
|
31
|
-
- nosniff
|
32
|
-
Content-Type:
|
33
|
-
- application/json;charset=utf-8
|
34
|
-
Etag:
|
35
|
-
- W/"189e94e4200a0834bb443b8beb476f0c--gzip"
|
36
|
-
Cache-Control:
|
37
|
-
- max-age=0, private, must-revalidate
|
38
|
-
X-Request-Id:
|
39
|
-
- dbd2f122-972f-45dc-bb60-c6b321cb76f2
|
40
|
-
X-Runtime:
|
41
|
-
- '0.096305'
|
42
|
-
Vary:
|
43
|
-
- Accept-Encoding, User-Agent
|
44
|
-
Transfer-Encoding:
|
45
|
-
- chunked
|
46
|
-
Server:
|
47
|
-
- Jetty(9.4.33.v20201020)
|
48
|
-
body:
|
49
|
-
encoding: ASCII-8BIT
|
50
|
-
string: '{"meta":{"page":{"current":1,"total_pages":1,"total_results":1,"size":25}},"results":[{"user":"enterprise_search","permissions":[]}]}'
|
51
|
-
http_version:
|
52
|
-
recorded_at: Wed, 13 Jan 2021 16:00:19 GMT
|
53
|
-
recorded_with: VCR 3.0.3
|
@@ -1,53 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: put
|
5
|
-
uri: http://localhost:3002/api/ws/v1/sources/content_source_id/external_identities/elastic_user/?user=elastic_user
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"source_user_id":"example2@elastic.co"}'
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
12
|
-
elasticsearch-transport: 7.10.0)'
|
13
|
-
Content-Type:
|
14
|
-
- application/json
|
15
|
-
Authorization:
|
16
|
-
- Bearer access_token
|
17
|
-
Accept-Encoding:
|
18
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
-
Accept:
|
20
|
-
- "*/*"
|
21
|
-
response:
|
22
|
-
status:
|
23
|
-
code: 200
|
24
|
-
message: OK
|
25
|
-
headers:
|
26
|
-
X-Frame-Options:
|
27
|
-
- SAMEORIGIN
|
28
|
-
X-Xss-Protection:
|
29
|
-
- 1; mode=block
|
30
|
-
X-Content-Type-Options:
|
31
|
-
- nosniff
|
32
|
-
Content-Type:
|
33
|
-
- application/json;charset=utf-8
|
34
|
-
Etag:
|
35
|
-
- W/"e791eae2a9e8158a885dfdc173ed6b02--gzip"
|
36
|
-
Cache-Control:
|
37
|
-
- max-age=0, private, must-revalidate
|
38
|
-
X-Request-Id:
|
39
|
-
- 59340e3c-f447-4fbf-8ada-de73618a8740
|
40
|
-
X-Runtime:
|
41
|
-
- '0.057303'
|
42
|
-
Vary:
|
43
|
-
- Accept-Encoding, User-Agent
|
44
|
-
Transfer-Encoding:
|
45
|
-
- chunked
|
46
|
-
Server:
|
47
|
-
- Jetty(9.4.33.v20201020)
|
48
|
-
body:
|
49
|
-
encoding: ASCII-8BIT
|
50
|
-
string: '{"source_user_id":"example2@elastic.co","user":"elastic_user"}'
|
51
|
-
http_version:
|
52
|
-
recorded_at: Wed, 13 Jan 2021 16:04:35 GMT
|
53
|
-
recorded_with: VCR 3.0.3
|
@@ -1,103 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: http://localhost:3002/api/ws/v1/sources/content_source_id/permissions/enterprise_search/add/?permissions%5B%5D=more&permissions%5B%5D=permissions&permissions%5B%5D=testing&user=enterprise_search
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: "{}"
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
12
|
-
elasticsearch-transport: 7.10.0)'
|
13
|
-
Content-Type:
|
14
|
-
- application/json
|
15
|
-
Authorization:
|
16
|
-
- Bearer access_token
|
17
|
-
Accept-Encoding:
|
18
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
-
Accept:
|
20
|
-
- "*/*"
|
21
|
-
response:
|
22
|
-
status:
|
23
|
-
code: 200
|
24
|
-
message: OK
|
25
|
-
headers:
|
26
|
-
X-Frame-Options:
|
27
|
-
- SAMEORIGIN
|
28
|
-
X-Xss-Protection:
|
29
|
-
- 1; mode=block
|
30
|
-
X-Content-Type-Options:
|
31
|
-
- nosniff
|
32
|
-
Content-Type:
|
33
|
-
- application/json;charset=utf-8
|
34
|
-
Etag:
|
35
|
-
- W/"d10c028fa9c684778511b469120f4df9--gzip"
|
36
|
-
Cache-Control:
|
37
|
-
- max-age=0, private, must-revalidate
|
38
|
-
X-Request-Id:
|
39
|
-
- 64149045-4d39-402c-8636-bf29f27a974f
|
40
|
-
X-Runtime:
|
41
|
-
- '1.674349'
|
42
|
-
Vary:
|
43
|
-
- Accept-Encoding, User-Agent
|
44
|
-
Transfer-Encoding:
|
45
|
-
- chunked
|
46
|
-
Server:
|
47
|
-
- Jetty(9.4.33.v20201020)
|
48
|
-
body:
|
49
|
-
encoding: ASCII-8BIT
|
50
|
-
string: '{"user":"enterprise_search","permissions":["testing","more","permissions"]}'
|
51
|
-
http_version:
|
52
|
-
recorded_at: Wed, 13 Jan 2021 16:00:57 GMT
|
53
|
-
- request:
|
54
|
-
method: put
|
55
|
-
uri: http://localhost:3002/api/ws/v1/sources/content_source_id/permissions/enterprise_search/?permissions%5B%5D&user=enterprise_search
|
56
|
-
body:
|
57
|
-
encoding: UTF-8
|
58
|
-
string: "{}"
|
59
|
-
headers:
|
60
|
-
User-Agent:
|
61
|
-
- 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
62
|
-
elasticsearch-transport: 7.10.0)'
|
63
|
-
Content-Type:
|
64
|
-
- application/json
|
65
|
-
Authorization:
|
66
|
-
- Bearer access_token
|
67
|
-
Accept-Encoding:
|
68
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
69
|
-
Accept:
|
70
|
-
- "*/*"
|
71
|
-
response:
|
72
|
-
status:
|
73
|
-
code: 200
|
74
|
-
message: OK
|
75
|
-
headers:
|
76
|
-
X-Frame-Options:
|
77
|
-
- SAMEORIGIN
|
78
|
-
X-Xss-Protection:
|
79
|
-
- 1; mode=block
|
80
|
-
X-Content-Type-Options:
|
81
|
-
- nosniff
|
82
|
-
Content-Type:
|
83
|
-
- application/json;charset=utf-8
|
84
|
-
Etag:
|
85
|
-
- W/"eaf0aef29a99d5f9dda5844986aa3880--gzip"
|
86
|
-
Cache-Control:
|
87
|
-
- max-age=0, private, must-revalidate
|
88
|
-
X-Request-Id:
|
89
|
-
- 0ec6ac2d-b631-4038-8b89-d855125e48a9
|
90
|
-
X-Runtime:
|
91
|
-
- '1.993345'
|
92
|
-
Vary:
|
93
|
-
- Accept-Encoding, User-Agent
|
94
|
-
Transfer-Encoding:
|
95
|
-
- chunked
|
96
|
-
Server:
|
97
|
-
- Jetty(9.4.33.v20201020)
|
98
|
-
body:
|
99
|
-
encoding: ASCII-8BIT
|
100
|
-
string: '{"user":"enterprise_search","permissions":[]}'
|
101
|
-
http_version:
|
102
|
-
recorded_at: Wed, 13 Jan 2021 16:00:59 GMT
|
103
|
-
recorded_with: VCR 3.0.3
|
@@ -1,53 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: http://localhost:3002/api/ws/v1/sources/content_source_id/permissions/enterprise_search/remove/?permissions%5B%5D=permission1&permissions%5B%5D=permission2&user=enterprise_search
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: "{}"
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
12
|
-
elasticsearch-transport: 7.10.0)'
|
13
|
-
Content-Type:
|
14
|
-
- application/json
|
15
|
-
Authorization:
|
16
|
-
- Bearer access_token
|
17
|
-
Accept-Encoding:
|
18
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
-
Accept:
|
20
|
-
- "*/*"
|
21
|
-
response:
|
22
|
-
status:
|
23
|
-
code: 200
|
24
|
-
message: OK
|
25
|
-
headers:
|
26
|
-
X-Frame-Options:
|
27
|
-
- SAMEORIGIN
|
28
|
-
X-Xss-Protection:
|
29
|
-
- 1; mode=block
|
30
|
-
X-Content-Type-Options:
|
31
|
-
- nosniff
|
32
|
-
Content-Type:
|
33
|
-
- application/json;charset=utf-8
|
34
|
-
Etag:
|
35
|
-
- W/"eaf0aef29a99d5f9dda5844986aa3880--gzip"
|
36
|
-
Cache-Control:
|
37
|
-
- max-age=0, private, must-revalidate
|
38
|
-
X-Request-Id:
|
39
|
-
- 070c6c38-5aca-492e-ad99-046345766c41
|
40
|
-
X-Runtime:
|
41
|
-
- '2.010759'
|
42
|
-
Vary:
|
43
|
-
- Accept-Encoding, User-Agent
|
44
|
-
Transfer-Encoding:
|
45
|
-
- chunked
|
46
|
-
Server:
|
47
|
-
- Jetty(9.4.33.v20201020)
|
48
|
-
body:
|
49
|
-
encoding: ASCII-8BIT
|
50
|
-
string: '{"user":"enterprise_search","permissions":[]}'
|
51
|
-
http_version:
|
52
|
-
recorded_at: Wed, 13 Jan 2021 16:01:11 GMT
|
53
|
-
recorded_with: VCR 3.0.3
|
@@ -1,53 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: http://localhost:3002/api/ws/v1/sources/content_source_id/external_identities/elastic_user/?user=elastic_user
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: "{}"
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
12
|
-
elasticsearch-transport: 7.10.0)'
|
13
|
-
Content-Type:
|
14
|
-
- application/json
|
15
|
-
Authorization:
|
16
|
-
- Bearer access_token
|
17
|
-
Accept-Encoding:
|
18
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
-
Accept:
|
20
|
-
- "*/*"
|
21
|
-
response:
|
22
|
-
status:
|
23
|
-
code: 200
|
24
|
-
message: OK
|
25
|
-
headers:
|
26
|
-
X-Frame-Options:
|
27
|
-
- SAMEORIGIN
|
28
|
-
X-Xss-Protection:
|
29
|
-
- 1; mode=block
|
30
|
-
X-Content-Type-Options:
|
31
|
-
- nosniff
|
32
|
-
Content-Type:
|
33
|
-
- application/json;charset=utf-8
|
34
|
-
Etag:
|
35
|
-
- W/"58321c212599891b518fb2bac5efb797--gzip"
|
36
|
-
Cache-Control:
|
37
|
-
- max-age=0, private, must-revalidate
|
38
|
-
X-Request-Id:
|
39
|
-
- 68f9b489-9502-4e20-becc-a7f57ba8f7d5
|
40
|
-
X-Runtime:
|
41
|
-
- '0.047753'
|
42
|
-
Vary:
|
43
|
-
- Accept-Encoding, User-Agent
|
44
|
-
Transfer-Encoding:
|
45
|
-
- chunked
|
46
|
-
Server:
|
47
|
-
- Jetty(9.4.33.v20201020)
|
48
|
-
body:
|
49
|
-
encoding: ASCII-8BIT
|
50
|
-
string: '{"source_user_id":"example@elastic.co","user":"elastic_user"}'
|
51
|
-
http_version:
|
52
|
-
recorded_at: Wed, 13 Jan 2021 16:01:57 GMT
|
53
|
-
recorded_with: VCR 3.0.3
|
@@ -1,53 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: http://localhost:3002/api/ws/v1/sources/content_source_id/permissions/enterprise_search/?user=enterprise_search
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: "{}"
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- 'elastic-enteprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
12
|
-
elasticsearch-transport: 7.10.0)'
|
13
|
-
Content-Type:
|
14
|
-
- application/json
|
15
|
-
Authorization:
|
16
|
-
- Bearer access_token
|
17
|
-
Accept-Encoding:
|
18
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
-
Accept:
|
20
|
-
- "*/*"
|
21
|
-
response:
|
22
|
-
status:
|
23
|
-
code: 200
|
24
|
-
message: OK
|
25
|
-
headers:
|
26
|
-
X-Frame-Options:
|
27
|
-
- SAMEORIGIN
|
28
|
-
X-Xss-Protection:
|
29
|
-
- 1; mode=block
|
30
|
-
X-Content-Type-Options:
|
31
|
-
- nosniff
|
32
|
-
Content-Type:
|
33
|
-
- application/json;charset=utf-8
|
34
|
-
Etag:
|
35
|
-
- W/"eaf0aef29a99d5f9dda5844986aa3880--gzip"
|
36
|
-
Cache-Control:
|
37
|
-
- max-age=0, private, must-revalidate
|
38
|
-
X-Request-Id:
|
39
|
-
- ea185891-850b-499f-83b8-9ab960432ceb
|
40
|
-
X-Runtime:
|
41
|
-
- '0.057762'
|
42
|
-
Vary:
|
43
|
-
- Accept-Encoding, User-Agent
|
44
|
-
Transfer-Encoding:
|
45
|
-
- chunked
|
46
|
-
Server:
|
47
|
-
- Jetty(9.4.33.v20201020)
|
48
|
-
body:
|
49
|
-
encoding: ASCII-8BIT
|
50
|
-
string: '{"user":"enterprise_search","permissions":[]}'
|
51
|
-
http_version:
|
52
|
-
recorded_at: Wed, 13 Jan 2021 16:00:47 GMT
|
53
|
-
recorded_with: VCR 3.0.3
|
@@ -1,80 +0,0 @@
|
|
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 '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('workplace_search/index_documents') do
|
51
|
-
response = client.index_documents(content_source_id, documents: 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('workplace_search/delete_documents') do
|
67
|
-
response = client.delete_documents(content_source_id, document_ids: documents.map { |doc| doc['id'] })
|
68
|
-
expect(response.status).to eq 200
|
69
|
-
expect(response.body)
|
70
|
-
.to eq(
|
71
|
-
{ 'results' =>
|
72
|
-
[
|
73
|
-
{ 'id' => '4e696e74656e646f203634', 'success' => true },
|
74
|
-
{ 'id' => '47616d6520426f7920436f6c6f72', 'success' => true }
|
75
|
-
] }
|
76
|
-
)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|