elastic-enterprise-search 7.13.0 → 7.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.ci/make.sh +162 -0
  3. data/.ci/test-matrix.yml +1 -1
  4. data/.github/check_license_headers.rb +33 -0
  5. data/.github/license-header.txt +16 -0
  6. data/.github/workflows/license.yml +13 -0
  7. data/.github/workflows/testing.yml +1 -1
  8. data/Rakefile +1 -0
  9. data/docs/guide/app-search-api.asciidoc +28 -0
  10. data/docs/guide/release_notes/712.asciidoc +12 -0
  11. data/docs/guide/release_notes/714.asciidoc +21 -0
  12. data/docs/guide/release_notes/index.asciidoc +2 -0
  13. data/docs/guide/workplace-search-api.asciidoc +55 -0
  14. data/lib/elastic/app-search/api/api_key.rb +51 -0
  15. data/lib/elastic/app-search/api/create_api_key.rb +49 -0
  16. data/lib/elastic/app-search/api/delete_api_key.rb +51 -0
  17. data/lib/elastic/app-search/api/list_api_keys.rb +49 -0
  18. data/lib/elastic/app-search/api/put_api_key.rb +52 -0
  19. data/lib/elastic/enterprise-search/version.rb +1 -1
  20. data/lib/elastic/workplace-search/api/command_sync_jobs.rb +53 -0
  21. data/lib/elastic/workplace-search/api/create_analytics_event.rb +7 -7
  22. data/lib/elastic/workplace-search/api/create_batch_synonym_sets.rb +50 -0
  23. data/lib/elastic/workplace-search/api/create_content_source.rb +4 -2
  24. data/lib/elastic/workplace-search/api/create_external_identity.rb +3 -3
  25. data/lib/elastic/workplace-search/api/current_user.rb +47 -0
  26. data/lib/elastic/workplace-search/api/delete_documents_by_query.rb +50 -0
  27. data/lib/elastic/workplace-search/api/delete_synonym_set.rb +51 -0
  28. data/lib/elastic/workplace-search/api/document.rb +1 -1
  29. data/lib/elastic/workplace-search/api/list_synonym_sets.rb +51 -0
  30. data/lib/elastic/workplace-search/api/put_content_source.rb +6 -4
  31. data/lib/elastic/workplace-search/api/put_content_source_icons.rb +53 -0
  32. data/lib/elastic/workplace-search/api/put_external_identity.rb +3 -3
  33. data/lib/elastic/workplace-search/api/put_synonym_set.rb +53 -0
  34. data/lib/elastic/workplace-search/api/search.rb +1 -1
  35. data/lib/elastic/workplace-search/api/synonym_set.rb +51 -0
  36. data/rake_tasks/unified_release_tasks.rake +46 -0
  37. data/spec/app-search/api_apikey_spec.rb +92 -0
  38. data/spec/app-search/api_spec_helper.rb +16 -0
  39. data/spec/fixtures/vcr/app_search/create_api_key.yml +52 -0
  40. data/spec/fixtures/vcr/app_search/delete_api_key.yml +52 -0
  41. data/spec/fixtures/vcr/app_search/get_api_key.yml +52 -0
  42. data/spec/fixtures/vcr/app_search/list_api_keys.yml +52 -0
  43. data/spec/fixtures/vcr/app_search/put_api_key.yml +52 -0
  44. data/spec/integration/icon.png +0 -0
  45. data/spec/integration/workplace_search_spec.rb +122 -0
  46. data/spec/webmock_requires.rb +16 -0
  47. metadata +30 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f34ee86d14a96362e791a8f5542bf4a4da9ff48df0ee92b35996f08c56219ce
4
- data.tar.gz: 11be1147329f5adafc17769b825c7262a9d3d4309a705233ceebe24b36c3dc05
3
+ metadata.gz: 1eef7550b4a936e514eb9b0eb52272a2b445b3e54c301c7cec29039c789561ee
4
+ data.tar.gz: 47ab2fcbb9b00a3cbb219e713ee9308642345b72dcc6af5b9f0f1f334edd7c09
5
5
  SHA512:
6
- metadata.gz: c867f7c2c897cade800f5e6c6c415eece5c939f53996246378021cb584a39a5b768b02459525741fa3d59654a44893ce8d0c02084a22daf3d7c352230fcf3895
7
- data.tar.gz: 368a0e0137e5315ca34c5b661cca686eff108a2ee31a7951bc1043e57558bc3d48b403dc3d5c03967da7c7fdf6b24cd03018889f6651760e22a6db6d5da17f0e
6
+ metadata.gz: 38a4519bfa5d4b3ea04507468b0c5ddb7122d8c5c928943b45d3d1ce120d3a1652ac7c2aff217082aaca4cdc3124b732e4f31c265bf5c6f0cdc0173672e020f0
7
+ data.tar.gz: 7cd26fe0a7fc874ccbcfb16ef443d5c9ddd69b0a882690dcbfc0b90d698a10bd89d942530ba93aae78531cddc6960721edd8d2a410728be87aacd018e1aeed31
data/.ci/make.sh ADDED
@@ -0,0 +1,162 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # ------------------------------------------------------- #
4
+ #
5
+ # Skeleton for common build entry script for all elastic
6
+ # clients. Needs to be adapted to individual client usage.
7
+ #
8
+ # Must be called: ./.ci/make.sh <target> <params>
9
+ #
10
+ # Version: 1.1.0
11
+ #
12
+ # Targets:
13
+ # ---------------------------
14
+ # assemble <VERSION> : build client artefacts with version
15
+ # bump <VERSION> : bump client internals to version
16
+ # codegen <VERSION> : generate endpoints
17
+ # docsgen <VERSION> : generate documentation
18
+ # examplegen : generate the doc examples
19
+ # clean : clean workspace
20
+ #
21
+ # ------------------------------------------------------- #
22
+
23
+ # ------------------------------------------------------- #
24
+ # Bootstrap
25
+ # ------------------------------------------------------- #
26
+
27
+ script_path=$(dirname "$(realpath -s "$0")")
28
+ repo=$(realpath "$script_path/../")
29
+
30
+ # shellcheck disable=SC1090
31
+ CMD=$1
32
+ TASK=$1
33
+ TASK_ARGS=()
34
+ VERSION=$2
35
+ STACK_VERSION=$VERSION
36
+ set -euo pipefail
37
+
38
+ product="elastic/enterprise-search-ruby"
39
+ output_folder=".ci/output"
40
+ codegen_folder=".ci/output"
41
+ OUTPUT_DIR="$repo/${output_folder}"
42
+ REPO_BINDING="${OUTPUT_DIR}:/sln/${output_folder}"
43
+ mkdir -p "$OUTPUT_DIR"
44
+
45
+ echo -e "\033[34;1mINFO:\033[0m PRODUCT ${product}\033[0m"
46
+ echo -e "\033[34;1mINFO:\033[0m VERSION ${STACK_VERSION}\033[0m"
47
+ echo -e "\033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR}\033[0m"
48
+
49
+ RUBY_TEST_VERSION=${RUBY_TEST_VERSION-2.7}
50
+
51
+ case $CMD in
52
+ clean)
53
+ echo -e "\033[36;1mTARGET: clean workspace $output_folder\033[0m"
54
+ rm -rf "$output_folder"
55
+ echo -e "\033[32;1mdone.\033[0m"
56
+ exit 0
57
+ ;;
58
+ assemble)
59
+ if [ -v $VERSION ]; then
60
+ echo -e "\033[31;1mTARGET: assemble -> missing version parameter\033[0m"
61
+ exit 1
62
+ fi
63
+ echo -e "\033[36;1mTARGET: assemble artefact $VERSION\033[0m"
64
+ TASK=assemble
65
+ TASK_ARGS=("$VERSION" "$output_folder")
66
+ ;;
67
+ codegen)
68
+ if [ -v $VERSION ]; then
69
+ echo -e "\033[31;1mTARGET: codegen -> missing version parameter\033[0m"
70
+ exit 1
71
+ fi
72
+ echo -e "\033[36;1mTARGET: codegen API v$VERSION\033[0m"
73
+ TASK=codegen
74
+ # VERSION is BRANCH here for now
75
+ TASK_ARGS=("$VERSION" "$codegen_folder")
76
+ ;;
77
+ docsgen)
78
+ if [ -v $VERSION ]; then
79
+ echo -e "\033[31;1mTARGET: docsgen -> missing version parameter\033[0m"
80
+ exit 1
81
+ fi
82
+ echo -e "\033[36;1mTARGET: generate docs for $VERSION\033[0m"
83
+ TASK=codegen
84
+ # VERSION is BRANCH here for now
85
+ TASK_ARGS=("$VERSION" "$codegen_folder")
86
+ ;;
87
+ examplesgen)
88
+ echo -e "\033[36;1mTARGET: generate examples\033[0m"
89
+ TASK=codegen
90
+ # VERSION is BRANCH here for now
91
+ TASK_ARGS=("$VERSION" "$codegen_folder")
92
+ ;;
93
+ bump)
94
+ if [ -v $VERSION ]; then
95
+ echo -e "\033[31;1mTARGET: bump -> missing version parameter\033[0m"
96
+ exit 1
97
+ fi
98
+ echo -e "\033[36;1mTARGET: bump to version $VERSION\033[0m"
99
+ TASK=bump
100
+ # VERSION is BRANCH here for now
101
+ TASK_ARGS=("$VERSION")
102
+ ;;
103
+ *)
104
+ echo -e "\nUsage:\n\t $CMD is not supported right now\n"
105
+ exit 1
106
+ esac
107
+
108
+
109
+ # ------------------------------------------------------- #
110
+ # Build Container
111
+ # ------------------------------------------------------- #
112
+
113
+ echo -e "\033[34;1mINFO: building $product container\033[0m"
114
+
115
+ docker build --file .ci/Dockerfile --tag ${product} \
116
+ --build-arg USER_ID="$(id -u)" \
117
+ --build-arg GROUP_ID="$(id -g)" .
118
+
119
+
120
+ # ------------------------------------------------------- #
121
+ # Run the Container
122
+ # ------------------------------------------------------- #
123
+
124
+ echo -e "\033[34;1mINFO: running $product container\033[0m"
125
+
126
+ # Convert ARGS to comma separated string for Rake:
127
+ args_string="${TASK_ARGS[*]}"
128
+ args_string="${args_string// /,}"
129
+
130
+ docker run \
131
+ --env "RUBY_TEST_VERSION=${RUBY_TEST_VERSION}" \
132
+ --name test-runner \
133
+ --volume $REPO_BINDING \
134
+ --volume $repo:/usr/src/app \
135
+ --rm \
136
+ $product \
137
+ bundle exec rake unified_release:"$TASK"["$args_string"]
138
+
139
+ # ------------------------------------------------------- #
140
+ # Post Command tasks & checks
141
+ # ------------------------------------------------------- #
142
+
143
+ if [[ "$CMD" == "assemble" ]]; then
144
+ if compgen -G ".ci/output/*" > /dev/null; then
145
+ echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m"
146
+ else
147
+ echo -e "\033[31;1mTARGET: assemble failed, empty workspace!\033[0m"
148
+ exit 1
149
+ fi
150
+ fi
151
+
152
+ if [[ "$CMD" == "codegen" ]]; then
153
+ echo "TODO"
154
+ fi
155
+
156
+ if [[ "$CMD" == "docsgen" ]]; then
157
+ echo "TODO"
158
+ fi
159
+
160
+ if [[ "$CMD" == "examplesgen" ]]; then
161
+ echo "TODO"
162
+ fi
data/.ci/test-matrix.yml CHANGED
@@ -6,7 +6,7 @@ RUBY_VERSION:
6
6
  - 2.5
7
7
 
8
8
  STACK_VERSION:
9
- - 7.13-SNAPSHOT
9
+ - 7.14-SNAPSHOT
10
10
 
11
11
  TEST_SUITE:
12
12
  - platinum
@@ -0,0 +1,33 @@
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
+ LICENSE = File.read('./.github/license-header.txt')
19
+ files = `git ls-files | grep -E '\.rb|Rakefile|\.rake|\.erb|Gemfile|gemspec'`.split("\n")
20
+ errors = []
21
+
22
+ files.each do |file|
23
+ unless File.read(file).include?(LICENSE)
24
+ errors << file
25
+ puts "#{file} doesn't contain the correct license header"
26
+ end
27
+ end
28
+
29
+ if errors.empty?
30
+ puts 'All checked files have the correct license header'
31
+ else
32
+ exit 1
33
+ end
@@ -0,0 +1,16 @@
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.
@@ -0,0 +1,13 @@
1
+ name: License headers
2
+ on: [pull_request]
3
+ jobs:
4
+ build:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v2
8
+ - uses: ruby/setup-ruby@v1
9
+ with:
10
+ ruby-version: 3
11
+ - name: Check license headers
12
+ run: |
13
+ ruby ./.github/check_license_headers.rb
@@ -1,4 +1,4 @@
1
- name: master
1
+ name: 7.14
2
2
  on: [push, pull_request]
3
3
 
4
4
  jobs:
data/Rakefile CHANGED
@@ -19,6 +19,7 @@
19
19
 
20
20
  require 'rspec/core/rake_task'
21
21
  require 'bundler/gem_tasks'
22
+ import 'rake_tasks/unified_release_tasks.rake'
22
23
 
23
24
  desc 'Open an irb session preloaded with this library'
24
25
  task :console do
@@ -146,6 +146,34 @@ client.list_curations(engine_name)
146
146
  client.delete_curation(engine_name, curation_id: 'cur-id')
147
147
  ----------------------------
148
148
 
149
+ === Api Key
150
+
151
+ [source,rb]
152
+ ----------------------------
153
+ # Create API Key
154
+ body = {
155
+ name: name,
156
+ type: 'private',
157
+ read: true,
158
+ write: true,
159
+ access_all_engines: true
160
+ }
161
+ response = client.create_api_key(body: body)
162
+
163
+ # Get the details of an API Key
164
+ client.api_key(api_key_name: name)
165
+
166
+ # List API Keys
167
+ client.list_api_keys
168
+
169
+ # Update an API Key
170
+ body = { name: name, type: 'private', read: true, write: true, engines: ['test'] }
171
+ client.put_api_key(api_key_name: name, body: body)
172
+
173
+ # Delete an API Key
174
+ client.delete_api_key(api_key_name: name)
175
+ ----------------------------
176
+
149
177
  === Other API Endpoints
150
178
 
151
179
  [source,rb]
@@ -1,6 +1,18 @@
1
1
  [[release_notes_712]]
2
+ === 7.12 Release notes
3
+
4
+ [discrete]
5
+ [[release_notes_7121]]
6
+ === 7.12.1 Release notes
7
+
8
+ - Elastic Transport: Locks dependency version to < 7.14
9
+ - Elastic Transport: Adds ENTERPRISE_SERVICE_VERSION constant for compatibility
10
+
11
+ [discrete]
12
+ [[release_notes_7120]]
2
13
  === 7.12.0 Release notes
3
14
 
15
+
4
16
  [discrete]
5
17
  ==== General
6
18
 
@@ -0,0 +1,21 @@
1
+ [[release_notes_714]]
2
+ === 7.14.0 Release notes
3
+
4
+ [discrete]
5
+ ==== General
6
+
7
+ - Tested with Elastic Enterprise Search API version 7.14.0.
8
+
9
+ [discrete]
10
+ ==== App Search
11
+
12
+ - Adds API Key endpoints: `api_key`, `create_api_key`, `delete_api_key`, `list_api_keys`, `put_api_key`
13
+
14
+ [discrete]
15
+ ==== Workplace Search
16
+
17
+ - Adds synonym set endpoints: `create_batch_synonym_sets`, `delete_synonym_set`, `list_synonym_sets`, `put_synonym_set`, `synonym_set`
18
+ - Adds `current_user` endpoint
19
+ - Adds `command_sync_jobs` endpoint
20
+ - Adds `delete_documents_by_query` endpoint
21
+ - Adds `put_content_source_icons` endpoint
@@ -5,11 +5,13 @@
5
5
  [discrete]
6
6
  === 7.x
7
7
 
8
+ * <<release_notes_714, 7.14.0 Release Notes>>
8
9
  * <<release_notes_713, 7.13.0 Release Notes>>
9
10
  * <<release_notes_712, 7.12.0 Release Notes>>
10
11
  * <<release_notes_711, 7.11.0 Release Notes>>
11
12
  * <<release_notes_710, 7.10.0.beta.1 Release Notes>>
12
13
 
14
+ include::714.asciidoc[]
13
15
  include::713.asciidoc[]
14
16
  include::712.asciidoc[]
15
17
  include::711.asciidoc[]
@@ -26,6 +26,17 @@ body = {
26
26
  is_searchable: true
27
27
  }
28
28
  client.put_content_source(id, body: body)
29
+
30
+ # Issue commands to a Content Source's sync jobs
31
+ client.command_sync_jobs(content_source_id, body: { command: 'interrupt' })
32
+
33
+ # Update a content source icon
34
+ # You need to encode the file with Base64:
35
+ require 'base64'
36
+
37
+ path = File.expand_path("#{File.dirname(__FILE__)}/icon.png")
38
+ icon = Base64.strict_encode64(File.read(path))
39
+ response = client.put_content_source_icons(content_source_id, main_icon: icon, alt_icon: icon)
29
40
  ----------------------------
30
41
 
31
42
  === Documents
@@ -50,6 +61,9 @@ client.delete_documents(content_source_id, document_ids: ['e68fbc2688f1', 'c535e
50
61
 
51
62
  # Delete all documents for a given content source
52
63
  client.delete_all_documents(content_source_id)
64
+
65
+ # Delete documents by query
66
+ client.delete_documents_by_query(content_source_id, query: query)
53
67
  ----------------------------
54
68
 
55
69
  [discrete]
@@ -163,3 +177,44 @@ body = {
163
177
 
164
178
  client.create_analytics_event(access_token: oauth_access_token, body: body)
165
179
  ----------------------------
180
+
181
+ === Synonym Sets
182
+
183
+ [source,rb]
184
+ ----------------------------
185
+ body = {
186
+ synonym_sets: [
187
+ { 'synonyms' => ['house', 'home', 'abode'] },
188
+ { 'synonyms' => ['cat', 'feline', 'kitty'] },
189
+ { 'synonyms' => ['mouses', 'mice'] }
190
+ ]
191
+ }
192
+
193
+ # Create batch synonym set
194
+ client.create_batch_synonym_sets(body: body)
195
+
196
+ # Delete synonym set
197
+ client.delete_synonym_set(synonym_set_id: id)
198
+
199
+ # List synonym sets
200
+ client.list_synonym_sets
201
+
202
+ # Get a synonym set
203
+ client.synonym_set(synonym_set_id: id)
204
+
205
+ # Update a synonym set
206
+ body = { synonyms: ['mouses', 'mice', 'luch'] }
207
+ client.put_synonym_set(synonym_set_id: id, body: body)
208
+ ----------------------------
209
+
210
+
211
+ === Current User
212
+
213
+ [source,rb]
214
+ ----------------------------
215
+ # Get the current user
216
+ client.current_user
217
+
218
+ # Get the current user and return the access token
219
+ client.current_user(get_token: true)
220
+ ----------------------------
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed to Elasticsearch B.V. under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with
5
+ # this work for additional information regarding copyright
6
+ # ownership. Elasticsearch B.V. licenses this file to you under
7
+ # the Apache License, Version 2.0 (the "License"); you may
8
+ # not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+
20
+ module Elastic
21
+ module EnterpriseSearch
22
+ module AppSearch
23
+ module Actions
24
+ # Credentials - Get the details of an API key
25
+ #
26
+ # @param arguments [Hash] endpoint arguments
27
+ # @option arguments [String] :api_key_name Name of an API key (*Required*)
28
+ # @option arguments [Hash] :body The request body
29
+ # @option arguments [Hash] :headers optional HTTP headers to send with the request
30
+ #
31
+ # @see https://www.elastic.co/guide/en/app-search/current/credentials.html#credentials-single
32
+ #
33
+ def api_key(arguments = {})
34
+ raise ArgumentError, "Required parameter 'api_key_name' missing" unless arguments[:api_key_name]
35
+
36
+ api_key_name = arguments[:api_key_name]
37
+ body = arguments.delete(:body) || {}
38
+ headers = arguments.delete(:headers) || {}
39
+
40
+ request(
41
+ :get,
42
+ "api/as/v1/credentials/#{api_key_name}/",
43
+ arguments,
44
+ body,
45
+ headers
46
+ )
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end