elastic-enterprise-search 7.17.0 → 8.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/.ci/jobs/elastic+enterprise-search-ruby+7.13.yml +12 -0
  3. data/.ci/jobs/elastic+enterprise-search-ruby+7.14.yml +12 -0
  4. data/.ci/jobs/elastic+enterprise-search-ruby+7.15.yml +12 -0
  5. data/.ci/jobs/elastic+enterprise-search-ruby+7.16.yml +12 -0
  6. data/.ci/test-matrix.yml +1 -2
  7. data/.github/workflows/testing.yml +3 -3
  8. data/.rubocop.yml +1 -1
  9. data/CHANGELOG +1 -0
  10. data/CODE_OF_CONDUCT +1 -0
  11. data/CONTRIBUTING.md +37 -0
  12. data/NOTICE +2 -0
  13. data/README.md +25 -29
  14. data/docs/guide/app-search-api.asciidoc +52 -18
  15. data/docs/guide/connecting.asciidoc +0 -1
  16. data/docs/guide/overview.asciidoc +27 -4
  17. data/docs/guide/release_notes/712.asciidoc +10 -0
  18. data/docs/guide/release_notes/714.asciidoc +0 -12
  19. data/docs/guide/release_notes/715.asciidoc +0 -12
  20. data/docs/guide/release_notes/80.asciidoc +128 -0
  21. data/docs/guide/release_notes/index.asciidoc +4 -0
  22. data/docs/guide/workplace-search-api.asciidoc +38 -11
  23. data/elastic-enterprise-search.gemspec +3 -3
  24. data/lib/elastic/api/response.rb +52 -0
  25. data/lib/elastic/{workplace-search/api/user_permissions.rb → app-search/api/adaptive_relevance_settings.rb} +10 -15
  26. data/lib/elastic/{workplace-search/api/add_user_permissions.rb → app-search/api/adaptive_relevance_suggestions.rb} +20 -14
  27. data/lib/elastic/app-search/api/add_meta_engine_source.rb +4 -5
  28. data/lib/elastic/app-search/api/api_key.rb +4 -6
  29. data/lib/elastic/app-search/api/api_logs.rb +8 -15
  30. data/lib/elastic/app-search/api/count_analytics.rb +5 -5
  31. data/lib/elastic/app-search/api/crawler_active_crawl_request.rb +4 -7
  32. data/lib/elastic/app-search/api/crawler_crawl_request.rb +6 -8
  33. data/lib/elastic/app-search/api/crawler_crawl_schedule.rb +4 -7
  34. data/lib/elastic/app-search/api/crawler_domain.rb +6 -8
  35. data/lib/elastic/app-search/api/crawler_domain_validation_result.rb +6 -5
  36. data/lib/elastic/app-search/api/crawler_metrics.rb +3 -6
  37. data/lib/elastic/app-search/api/crawler_overview.rb +4 -7
  38. data/lib/elastic/app-search/api/crawler_process_crawl.rb +6 -8
  39. data/lib/elastic/app-search/api/crawler_process_crawl_denied_urls.rb +6 -8
  40. data/lib/elastic/app-search/api/crawler_url_extraction_result.rb +6 -6
  41. data/lib/elastic/app-search/api/crawler_url_tracing_result.rb +7 -7
  42. data/lib/elastic/app-search/api/crawler_url_validation_result.rb +7 -7
  43. data/lib/elastic/app-search/api/crawler_user_agent.rb +3 -6
  44. data/lib/elastic/app-search/api/create_api_key.rb +10 -10
  45. data/lib/elastic/app-search/api/create_crawler_crawl_request.rb +9 -5
  46. data/lib/elastic/app-search/api/create_crawler_crawl_rule.rb +13 -11
  47. data/lib/elastic/app-search/api/create_crawler_domain.rb +8 -8
  48. data/lib/elastic/app-search/api/create_crawler_entry_point.rb +10 -8
  49. data/lib/elastic/app-search/api/create_crawler_process_crawl.rb +6 -6
  50. data/lib/elastic/app-search/api/create_crawler_sitemap.rb +10 -8
  51. data/lib/elastic/app-search/api/create_curation.rb +10 -8
  52. data/lib/elastic/app-search/api/create_engine.rb +8 -7
  53. data/lib/elastic/app-search/api/create_synonym_set.rb +6 -6
  54. data/lib/elastic/app-search/api/curation.rb +5 -7
  55. data/lib/elastic/app-search/api/delete_api_key.rb +4 -6
  56. data/lib/elastic/app-search/api/delete_crawler_active_crawl_request.rb +4 -7
  57. data/lib/elastic/app-search/api/delete_crawler_crawl_rule.rb +7 -9
  58. data/lib/elastic/app-search/api/delete_crawler_crawl_schedule.rb +4 -7
  59. data/lib/elastic/app-search/api/delete_crawler_domain.rb +6 -8
  60. data/lib/elastic/app-search/api/delete_crawler_entry_point.rb +7 -9
  61. data/lib/elastic/app-search/api/delete_crawler_sitemap.rb +7 -9
  62. data/lib/elastic/app-search/api/delete_curation.rb +5 -7
  63. data/lib/elastic/app-search/api/delete_documents.rb +4 -5
  64. data/lib/elastic/app-search/api/delete_engine.rb +3 -6
  65. data/lib/elastic/app-search/api/delete_meta_engine_source.rb +4 -4
  66. data/lib/elastic/app-search/api/delete_synonym_set.rb +5 -7
  67. data/lib/elastic/app-search/api/documents.rb +5 -5
  68. data/lib/elastic/app-search/api/engine.rb +3 -6
  69. data/lib/elastic/app-search/api/index_documents.rb +4 -5
  70. data/lib/elastic/{workplace-search/api/remove_user_permissions.rb → app-search/api/list_adaptive_relevance_suggestions.rb} +13 -14
  71. data/lib/elastic/app-search/api/list_api_keys.rb +2 -5
  72. data/lib/elastic/app-search/api/list_crawler_crawl_requests.rb +6 -8
  73. data/lib/elastic/{workplace-search/api/list_permissions.rb → app-search/api/list_crawler_domains.rb} +12 -13
  74. data/lib/elastic/app-search/api/list_crawler_process_crawls.rb +6 -7
  75. data/lib/elastic/app-search/api/list_curations.rb +3 -6
  76. data/lib/elastic/app-search/api/list_documents.rb +3 -6
  77. data/lib/elastic/app-search/api/list_engines.rb +2 -5
  78. data/lib/elastic/app-search/api/list_synonym_sets.rb +3 -6
  79. data/lib/elastic/app-search/api/log_clickthrough.rb +9 -8
  80. data/lib/elastic/{workplace-search/api/put_user_permissions.rb → app-search/api/put_adaptive_relevance_settings.rb} +13 -14
  81. data/lib/elastic/app-search/api/put_adaptive_relevance_suggestions.rb +51 -0
  82. data/lib/elastic/app-search/api/put_api_key.rb +11 -10
  83. data/lib/elastic/app-search/api/put_crawler_crawl_rule.rb +14 -12
  84. data/lib/elastic/app-search/api/put_crawler_crawl_schedule.rb +8 -7
  85. data/lib/elastic/app-search/api/put_crawler_domain.rb +9 -9
  86. data/lib/elastic/app-search/api/put_crawler_entry_point.rb +11 -9
  87. data/lib/elastic/app-search/api/put_crawler_sitemap.rb +11 -9
  88. data/lib/elastic/app-search/api/put_curation.rb +11 -9
  89. data/lib/elastic/app-search/api/put_documents.rb +4 -4
  90. data/lib/elastic/app-search/api/put_schema.rb +4 -4
  91. data/lib/elastic/app-search/api/put_search_settings.rb +6 -6
  92. data/lib/elastic/app-search/api/put_synonym_set.rb +8 -8
  93. data/lib/elastic/app-search/api/query_suggestion.rb +5 -5
  94. data/lib/elastic/app-search/api/refresh_adaptive_relevance_update_process.rb +56 -0
  95. data/lib/elastic/app-search/api/reset_search_settings.rb +3 -6
  96. data/lib/elastic/app-search/api/schema.rb +3 -6
  97. data/lib/elastic/app-search/api/search.rb +6 -5
  98. data/lib/elastic/app-search/api/search_settings.rb +3 -6
  99. data/lib/elastic/app-search/api/synonym_set.rb +5 -7
  100. data/lib/elastic/app-search/api/top_clicks_analytics.rb +5 -5
  101. data/lib/elastic/app-search/api/top_queries_analytics.rb +4 -4
  102. data/lib/elastic/enterprise-search/api/health.rb +2 -3
  103. data/lib/elastic/enterprise-search/api/put_read_only.rb +6 -4
  104. data/lib/elastic/enterprise-search/api/read_only.rb +2 -3
  105. data/lib/elastic/enterprise-search/api/stats.rb +2 -3
  106. data/lib/elastic/enterprise-search/api/version.rb +2 -3
  107. data/lib/elastic/enterprise-search/client.rb +21 -14
  108. data/lib/elastic/enterprise-search/request.rb +5 -3
  109. data/lib/elastic/enterprise-search/version.rb +1 -1
  110. data/lib/elastic/workplace-search/api/auto_query_refinement_details.rb +3 -4
  111. data/lib/elastic/workplace-search/api/command_sync_jobs.rb +4 -5
  112. data/lib/elastic/workplace-search/api/content_source.rb +3 -4
  113. data/lib/elastic/workplace-search/api/create_analytics_event.rb +16 -12
  114. data/lib/elastic/workplace-search/api/create_batch_synonym_sets.rb +4 -3
  115. data/lib/elastic/workplace-search/api/create_content_source.rb +6 -5
  116. data/lib/elastic/workplace-search/api/create_external_identity.rb +11 -6
  117. data/lib/elastic/workplace-search/api/current_user.rb +3 -5
  118. data/lib/elastic/workplace-search/api/delete_content_source.rb +3 -4
  119. data/lib/elastic/workplace-search/api/delete_documents.rb +4 -4
  120. data/lib/elastic/workplace-search/api/delete_documents_by_query.rb +4 -3
  121. data/lib/elastic/workplace-search/api/delete_external_identity.rb +7 -9
  122. data/lib/elastic/workplace-search/api/delete_synonym_set.rb +3 -5
  123. data/lib/elastic/workplace-search/api/document.rb +4 -6
  124. data/lib/elastic/workplace-search/api/external_identity.rb +7 -9
  125. data/lib/elastic/workplace-search/api/index_documents.rb +3 -4
  126. data/lib/elastic/workplace-search/api/list_content_sources.rb +2 -3
  127. data/lib/elastic/workplace-search/api/list_documents.rb +4 -5
  128. data/lib/elastic/workplace-search/api/list_external_identities.rb +3 -4
  129. data/lib/elastic/workplace-search/api/list_synonym_sets.rb +1 -2
  130. data/lib/elastic/workplace-search/api/put_content_source.rb +6 -6
  131. data/lib/elastic/workplace-search/api/put_content_source_icons.rb +6 -6
  132. data/lib/elastic/workplace-search/api/put_external_identity.rb +11 -10
  133. data/lib/elastic/workplace-search/api/put_synonym_set.rb +4 -4
  134. data/lib/elastic/workplace-search/api/put_triggers_blocklist.rb +3 -5
  135. data/lib/elastic/workplace-search/api/search.rb +13 -13
  136. data/lib/elastic/workplace-search/api/synonym_set.rb +3 -5
  137. data/lib/elastic/workplace-search/api/triggers_blocklist.rb +3 -3
  138. data/lib/elastic/workplace-search/workplace_search.rb +9 -2
  139. data/spec/app-search/client_spec.rb +29 -0
  140. data/spec/enterprise-search/client_spec.rb +29 -0
  141. data/spec/enterprise-search/request_spec.rb +1 -1
  142. data/spec/integration/app-search/adaptive_relevance_settings_spec.rb +60 -0
  143. data/spec/integration/app-search/adaptive_relevance_suggestions_spec.rb +54 -0
  144. data/spec/integration/app-search/api_logs_spec.rb +11 -3
  145. data/spec/integration/app-search/app_search_helper.rb +2 -2
  146. data/spec/integration/app-search/count_analytics_spec.rb +3 -2
  147. data/spec/integration/app-search/crawler_domain_spec.rb +16 -0
  148. data/spec/integration/app-search/curations_spec.rb +15 -9
  149. data/spec/integration/app-search/engines_spec.rb +24 -26
  150. data/spec/integration/app-search/log_clickthrough_spec.rb +1 -1
  151. data/spec/integration/app-search/meta_engines_spec.rb +5 -5
  152. data/spec/integration/app-search/search_and_multiple_search_spec.rb +1 -1
  153. data/spec/integration/workplace-search/content_sources_spec.rb +6 -6
  154. data/spec/integration/workplace-search/documents_spec.rb +20 -10
  155. data/spec/integration/workplace-search/external_identities_spec.rb +26 -16
  156. data/spec/integration/workplace-search/triggers_spec.rb +2 -2
  157. data/spec/integration/workplace-search/users_spec.rb +0 -6
  158. data/spec/workplace-search/client_spec.rb +39 -2
  159. metadata +29 -20
  160. data/.ci/jobs/elastic+enterprise-search-ruby+7.10.0.beta.1.yml +0 -12
  161. data/.github/compatibility/Gemfile +0 -23
  162. data/.github/workflows/compatibility.yml +0 -20
  163. data/spec/integration/workplace-search/permissions_spec.rb +0 -77
@@ -6,10 +6,10 @@
6
6
  [source,rb]
7
7
  ----------------------------
8
8
  # Create a custom content source
9
- client.create_content_source(name: 'test')
9
+ client.create_content_source(body: { name: 'test' })
10
10
 
11
11
  # Retrieve a content source by ID
12
- content_source_id = client.create_content_source(name: 'books').body['id']
12
+ content_source_id = client.create_content_source(body: { name: 'books' }).body['id']
13
13
  client.content_source(content_source_id)
14
14
 
15
15
  # Delete a content source by ID
@@ -76,22 +76,42 @@ client.delete_documents_by_query(content_source_id, query: query)
76
76
  [[ws-oauth-authentication]]
77
77
  === OAuth Authentication
78
78
 
79
- You need to configure the OAuth Application for Search in order to use the Workplace Search client's `search` and `create_analytics` endpoints. You need to follow the steps in https://www.elastic.co/guide/en/workplace-search/current/building-custom-search-workplace-search.html#configuring-search-oauth[Configuring the OAuth Application for Search] to retrieve the credentials: Client ID and Client Secret to request access tokens from the authentication server.
79
+ You need to configure the OAuth Application for Search in order to use the Workplace Search client's `search` and `create_analytics` endpoints. You need to follow the steps in https://www.elastic.co/guide/en/workplace-search/current/building-custom-search-workplace-search.html#configuring-search-oauth[Configuring the OAuth Application for Search] to retrieve the credentials: **Client ID** and **Client Secret** to request access tokens from the authentication server.
80
+
81
+ The client implements https://www.elastic.co/guide/en/workplace-search/current/building-custom-search-workplace-search.html#authenticating-search-user-confidential[Authenticating Users with a Confidential OAuth Flow]. It provides a helper to obtain the autorization URL directly from the client once you've set the necessary values.
82
+
83
+ The authorization endpoint is hosted by your Kibana deployment, so you need to provide the client with the https://www.elastic.co/guide/en/enterprise-search/current/endpoints-ref.html#kibana-base-url[base URL of your Kibana instance]. You can do this when you initialize the client:
84
+
85
+ [source,rb]
86
+ ----------------------------
87
+ client = Elastic::EnterpriseSearch::WorkplaceSearch::Client.new(http_auth: <access_token>, kibana_url: <kibana_url>)
88
+ ----------------------------
89
+
90
+ Or you can set in an existing client:
80
91
 
81
92
  [source,rb]
82
93
  ----------------------------
83
94
  client = Elastic::EnterpriseSearch::WorkplaceSearch::Client.new(http_auth: <access_token>)
95
+ client.kibana_url = <kibana_url>
96
+ ----------------------------
84
97
 
98
+ Once you've instantiated a client and the base URL of your Kibana instance is set, you can get the URL for authorization like so:
99
+ [source,rb]
100
+ ----------------------------
101
+ # You get the values for client_id and client_secret when configuring the OAuth Application:
85
102
  client_id = <client_id>
86
103
  client_secret = <client_secret>
87
104
  redirect_uri = <redirect_uri>
88
105
 
89
106
  # Get the authorization URL:
90
107
  client.authorization_url(client_id, redirect_uri)
91
- > https://host:port/ws/oauth/authorize?response_type=code&client_id=client_id&redirect_uri=https%3A%2F%2Flocalhost%3A3002
108
+ > https://kibana_url/app/enterprise_search/workplace_search/p/oauth/authorize?response_type=code&client_id=client_id&redirect_uri=https%3A%2F%2Flocalhost%3A3002
109
+
92
110
  ----------------------------
93
111
 
94
- Open the URL to authorize your application. Successful authorization redirects the user in accordance to the redirect URI provided (and configured for the application). The application server must now request for an access_token, which is generated by Workplace Search using the oauth/token endpoint, using the Client ID and Client Secret.
112
+ Open the URL to authorize your application. Successful authorization redirects the user in accordance to the redirect URI provided (and configured for the application).
113
+
114
+ The application server must now request for an `access_token`, which is generated by Workplace Search using the `oauth/token` endpoint, using the **Client ID** and **Client Secret**.
95
115
 
96
116
  [source,rb]
97
117
  ----------------------------
@@ -100,7 +120,7 @@ authorization_code = '<paste code from redirect>'
100
120
  access_token = client.request_access_token(client_id, client_secret, authorization_code, redirect_uri)
101
121
 
102
122
  # The access_token can now be used to issue a search request:
103
- client.search(body: {query: 'search query'}, access_token: access_token)
123
+ client.search(body: { query: 'search query' }, access_token: access_token)
104
124
  ----------------------------
105
125
 
106
126
  See https://www.elastic.co/guide/en/workplace-search/current/workplace-search-search-api.html#search-api-overview[Search API Overview] for more search parameters.
@@ -139,21 +159,28 @@ client.remove_user_permissions(
139
159
  [source,rb]
140
160
  ----------------------------
141
161
  # Create external identities
142
- body = { user: 'elastic_user', source_user_id: 'example@elastic.co' }
162
+ body = {
163
+ external_user_id: external_user_id,
164
+ permissions: [],
165
+ external_user_properties: [
166
+ 'attribute_name' => '_elasticsearch_username',
167
+ 'attribute_value' => 'fernando'
168
+ ]
169
+ }
143
170
  client.create_external_identity(content_source_id, body: body)
144
171
 
145
172
  # Retrieve an external identity
146
- client.external_identity(content_source_id, user: 'elastic_user')
173
+ client.external_identity(content_source_id, external_user_id: external_user_id)
147
174
 
148
175
  # List external identities
149
176
  client.list_external_identities(content_source_id)
150
177
 
151
178
  # Update external identity
152
- body = { source_user_id: 'example2@elastic.co' }
153
- client.put_external_identity(content_source_id, user: 'elastic_user', body: body)
179
+ body = { external_user_id: external_user_id, permissions: ['permission1'] }
180
+ client.put_external_identity(content_source_id, external_user_id: external_user_id, body: body)
154
181
 
155
182
  # Delete an external identity
156
- client.delete_external_identity(content_source_id, user: 'elastic_user')
183
+ client.delete_external_identity(content_source_id, external_user_id: external_user_id)
157
184
  ----------------------------
158
185
 
159
186
  === Search
@@ -22,7 +22,7 @@ require 'elastic/enterprise-search/version'
22
22
 
23
23
  # rubocop:disable Metrics/BlockLength
24
24
  Gem::Specification.new do |s|
25
- s.required_ruby_version = '>= 2.5'
25
+ s.required_ruby_version = '>= 2.6'
26
26
  s.name = 'elastic-enterprise-search'
27
27
  s.version = Elastic::EnterpriseSearch::VERSION
28
28
  s.authors = ['Fernando Briano']
@@ -47,13 +47,13 @@ Gem::Specification.new do |s|
47
47
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
48
48
  s.require_paths = ['lib']
49
49
 
50
- s.add_dependency 'elasticsearch-transport', '>= 7.11'
50
+ s.add_dependency 'elastic-transport', '8.0.0.pre.1'
51
51
  s.add_runtime_dependency 'jwt', '>= 1.5', '< 3.0'
52
52
  s.add_development_dependency 'awesome_print'
53
53
  s.add_development_dependency 'byebug' unless defined?(JRUBY_VERSION)
54
54
  s.add_development_dependency 'rspec', '~> 3.9.0'
55
55
  s.add_development_dependency 'rspec_junit_formatter'
56
- s.add_development_dependency 'rubocop', '~> 1.0.0'
56
+ s.add_development_dependency 'rubocop', '~> 1'
57
57
  s.add_development_dependency 'vcr', '~> 3.0.3'
58
58
  s.add_development_dependency 'webmock'
59
59
  end
@@ -0,0 +1,52 @@
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 API
22
+ # Elastic client API Response object. Receives an Elastic::Transport::Transport::Response in
23
+ # the initializer and behaves like a Hash, except when status or headers are called upon it, in
24
+ # which case it returns the original object's status and headers.
25
+ # This class is based on Elasticsearch::API::Response in the Elasticsearch client. For future
26
+ # versions, we'll want this to live in elastic-transport instead.
27
+ class Response
28
+ RESPONSE_METHODS = [:status, :body, :headers].freeze
29
+
30
+ def initialize(response)
31
+ @response = response
32
+ end
33
+
34
+ def method_missing(method, *args, &block)
35
+ if RESPONSE_METHODS.include? method
36
+ @response.send method.to_sym
37
+ else
38
+ @response.body.send(method.to_sym, *args, &block)
39
+ end
40
+ end
41
+
42
+ def respond_to_missing?(method_name, include_private = false)
43
+ @response.body.respond_to?(method_name, include_private) ||
44
+ RESPONSE_METHODS.include?(method_name)
45
+ end
46
+
47
+ def to_s
48
+ @response.body.to_s
49
+ end
50
+ end
51
+ end
52
+ end
@@ -19,31 +19,26 @@
19
19
 
20
20
  module Elastic
21
21
  module EnterpriseSearch
22
- module WorkplaceSearch
22
+ module AppSearch
23
23
  module Actions
24
- # Permissions - Lists all permissions for one user
25
- # List permissions for a user
24
+ # AdaptiveRelevanceSettings - Retrieve adaptive relevance settings
25
+ # Retrieve adaptive relevance settings
26
26
  #
27
- # @param content_source_id [String] Unique ID for a Custom API source, provided upon creation of a Custom API Source (*Required*)
28
- # @param arguments [Hash] endpoint arguments
29
- # @option arguments [String] :user The username in context (*Required*)
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
30
29
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
31
30
  #
32
- # @see https://www.elastic.co/guide/en/workplace-search/current/workplace-search-document-permissions-api.html#list-one
31
+ # @see https://www.elastic.co/guide/en/app-search/current/adaptive-relevance-api-reference.html#adaptive-relevance-api-get-engine-adaptive-relevance-settings
33
32
  #
34
- def user_permissions(content_source_id, arguments = {})
35
- raise ArgumentError, "Required parameter 'content_source_id' missing" unless content_source_id
36
- raise ArgumentError, "Required parameter 'user' missing" unless arguments[:user]
37
-
38
- user = arguments[:user]
33
+ def adaptive_relevance_settings(engine_name, arguments = {})
34
+ raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
39
35
 
40
36
  headers = arguments.delete(:headers) || {}
41
-
42
37
  request(
43
38
  :get,
44
- "api/ws/v1/sources/#{content_source_id}/permissions/#{user}/",
39
+ "api/as/v0/engines/#{engine_name}/adaptive_relevance/settings/",
45
40
  arguments,
46
- {},
41
+ nil,
47
42
  headers
48
43
  )
49
44
  end
@@ -19,30 +19,36 @@
19
19
 
20
20
  module Elastic
21
21
  module EnterpriseSearch
22
- module WorkplaceSearch
22
+ module AppSearch
23
23
  module Actions
24
- # Permissions - Adds one or more new permissions atop existing permissions
25
- # Add one or more permission for a given user. Permissions are added atop the existing
24
+ # AdaptiveRelevanceSuggestions - Retrieve adaptive relevance
25
+ # Retrieve adaptive relevance for a single query
26
26
  #
27
- # @param content_source_id [String] Unique ID for a Custom API source, provided upon creation of a Custom API Source (*Required*)
28
- # @param arguments [Hash] endpoint arguments
29
- # @option arguments [String] :user The username in context (*Required*)
30
- # @option arguments [Array] :body List of permissions
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
+ # @option arguments [String] :search_suggestion_query Query to obtain suggestions (*Required*)
30
+ # @option arguments [Hash] :body
31
+ # @option body :page
32
+ # @option body [string] :filters
31
33
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
32
34
  #
33
- # @see https://www.elastic.co/guide/en/workplace-search/current/workplace-search-document-permissions-api.html#add-one
35
+ # @see https://www.elastic.co/guide/en/app-search/current/adaptive-relevance-api-reference.html#adaptive-relevance-api-get-engine-adaptive-relevance-suggestions-query
34
36
  #
35
- def add_user_permissions(content_source_id, arguments = {})
36
- raise ArgumentError, "Required parameter 'content_source_id' missing" unless content_source_id
37
- raise ArgumentError, "Required parameter 'user' missing" unless arguments[:user]
37
+ def adaptive_relevance_suggestions(engine_name, arguments = {})
38
+ raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
38
39
 
39
- user = arguments[:user]
40
+ unless arguments[:search_suggestion_query]
41
+ raise ArgumentError,
42
+ "Required parameter 'search_suggestion_query' missing"
43
+ end
44
+
45
+ search_suggestion_query = arguments.delete(:search_suggestion_query)
40
46
  body = arguments.delete(:body) || {}
41
- headers = arguments.delete(:headers) || {}
42
47
 
48
+ headers = arguments.delete(:headers) || {}
43
49
  request(
44
50
  :post,
45
- "api/ws/v1/sources/#{content_source_id}/permissions/#{user}/add/",
51
+ "api/as/v0/engines/#{engine_name}/adaptive_relevance/suggestions/#{search_suggestion_query}/",
46
52
  arguments,
47
53
  body,
48
54
  headers
@@ -24,20 +24,19 @@ module Elastic
24
24
  # Engines - Add a source engine
25
25
  # Adds a source engine to a given meta engine
26
26
  #
27
- # @param engine_name [String] Name of the engine (*Required*)
28
- # @param arguments [Hash] endpoint arguments
29
- # @option arguments [Array] :source_engines List of engine names (*Required*)
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
+ # @option arguments [Array<String>] :source_engines
30
30
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
31
31
  #
32
32
  # @see https://www.elastic.co/guide/en/app-search/current/meta-engines.html#meta-engines-add-source-engines
33
33
  #
34
34
  def add_meta_engine_source(engine_name, arguments = {})
35
35
  raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
36
- raise ArgumentError, "Required parameter 'source_engines' missing" unless arguments[:source_engines]
37
36
 
38
37
  source_engines = arguments.delete(:source_engines) || {}
39
- headers = arguments.delete(:headers) || {}
40
38
 
39
+ headers = arguments.delete(:headers) || {}
41
40
  request(
42
41
  :post,
43
42
  "api/as/v1/engines/#{engine_name}/source_engines/",
@@ -24,9 +24,8 @@ module Elastic
24
24
  # Credentials - Retrieve an API key
25
25
  # Retrieves details of an API key
26
26
  #
27
- # @param arguments [Hash] endpoint arguments
27
+ # @param [Hash] arguments endpoint arguments
28
28
  # @option arguments [String] :api_key_name Name of an API key (*Required*)
29
- # @option arguments [Hash] :body The request body
30
29
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
31
30
  #
32
31
  # @see https://www.elastic.co/guide/en/app-search/current/credentials.html#credentials-single
@@ -34,15 +33,14 @@ module Elastic
34
33
  def api_key(arguments = {})
35
34
  raise ArgumentError, "Required parameter 'api_key_name' missing" unless arguments[:api_key_name]
36
35
 
37
- api_key_name = arguments[:api_key_name]
38
- body = arguments.delete(:body) || {}
39
- headers = arguments.delete(:headers) || {}
36
+ api_key_name = arguments.delete(:api_key_name)
40
37
 
38
+ headers = arguments.delete(:headers) || {}
41
39
  request(
42
40
  :get,
43
41
  "api/as/v1/credentials/#{api_key_name}/",
44
42
  arguments,
45
- body,
43
+ nil,
46
44
  headers
47
45
  )
48
46
  end
@@ -24,31 +24,24 @@ module Elastic
24
24
  # APILogs - Retrieve API logs
25
25
  # The API Log displays API request and response data at the Engine level
26
26
  #
27
- # @param engine_name [String] Name of the engine (*Required*)
28
- # @param arguments [Hash] endpoint arguments
29
- # @option arguments [Date] :from_date Filter date from (*Required*)
30
- # @option arguments [Date] :to_date Filter date to (*Required*)
31
- # @option arguments [Hash] :body
32
- # @option body [String] :query You can search over the full_request_path of an API Log event. Use this to specify a particular endpoint, like analytics, search, curations and so on.
33
- # @option body [String] :sort_direction Would you like to have your results ascending, oldest to newest, or descending, newest to oldest? Accepts asc or desc. Defaults to ascending.
34
- # @option body [Integer] :page current for current page, total_pages for the net number of pages, total_results for the overall number of results, size for the amount of results per page.
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
+ # @option arguments [Hash] :body (Required: filters)
35
30
  # @option body :filters
36
- # @option filters [String] :status Filter based on a particular status code: 400, 401, 403, 429, 200
37
- # @option filters [String] :method Filter based on a particular HTTP method: GET, POST, PUT, PATCH, DELETE
31
+ # @option body :page
32
+ # @option body [string] :query
33
+ # @option body :sort_direction
38
34
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
39
35
  #
40
36
  # @see https://www.elastic.co/guide/en/app-search/current/api-logs.html
41
37
  #
42
38
  def api_logs(engine_name, arguments = {})
43
39
  raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
44
- raise ArgumentError, "Required parameter 'from_date' missing" unless arguments[:from_date]
45
- raise ArgumentError, "Required parameter 'to_date' missing" unless arguments[:to_date]
40
+ raise ArgumentError, "Required parameter 'body (filters)' missing" unless arguments[:body]
46
41
 
47
42
  body = arguments.delete(:body) || {}
48
- headers = arguments.delete(:headers) || {}
49
- arguments['filters[date][from]'] = date_to_rfc3339(arguments.delete(:from_date))
50
- arguments['filters[date][to]'] = date_to_rfc3339(arguments.delete(:to_date))
51
43
 
44
+ headers = arguments.delete(:headers) || {}
52
45
  request(
53
46
  :post,
54
47
  "api/as/v1/engines/#{engine_name}/logs/api/",
@@ -24,11 +24,11 @@ module Elastic
24
24
  # Analytics - Query for analytics counts data
25
25
  # Returns the number of clicks and total number of queries over a period
26
26
  #
27
- # @param engine_name [String] Name of the engine (*Required*)
28
- # @param arguments [Hash] endpoint arguments
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
29
  # @option arguments [Hash] :body
30
- # @option body :filters Analytics filters
31
- # @option body [String] :interval You can define an interval along with your date range. Can be either hour or day
30
+ # @option body :filters
31
+ # @option body [string] :interval
32
32
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
33
33
  #
34
34
  # @see https://www.elastic.co/guide/en/app-search/current/counts.html
@@ -37,8 +37,8 @@ module Elastic
37
37
  raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
38
38
 
39
39
  body = arguments.delete(:body) || {}
40
- headers = arguments.delete(:headers) || {}
41
40
 
41
+ headers = arguments.delete(:headers) || {}
42
42
  request(
43
43
  :post,
44
44
  "api/as/v1/engines/#{engine_name}/analytics/counts/",
@@ -24,9 +24,8 @@ module Elastic
24
24
  # Crawler - Get active crawl request details
25
25
  # Returns active crawl request details.
26
26
  #
27
- # @param engine_name [String] Name of the engine (*Required*)
28
- # @param arguments [Hash] endpoint arguments
29
- # @option arguments [Hash] :body The request body
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
30
29
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
31
30
  #
32
31
  # @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-get-crawler-crawl-requests-active
@@ -34,14 +33,12 @@ module Elastic
34
33
  def crawler_active_crawl_request(engine_name, arguments = {})
35
34
  raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
36
35
 
37
- body = arguments.delete(:body) || {}
38
36
  headers = arguments.delete(:headers) || {}
39
-
40
37
  request(
41
38
  :get,
42
- "api/as/v0/engines/#{engine_name}/crawler/crawl_requests/active/",
39
+ "api/as/v1/engines/#{engine_name}/crawler/crawl_requests/active/",
43
40
  arguments,
44
- body,
41
+ nil,
45
42
  headers
46
43
  )
47
44
  end
@@ -24,10 +24,9 @@ module Elastic
24
24
  # Crawler - Get crawl request details
25
25
  # Returns crawl request details.
26
26
  #
27
- # @param engine_name [String] Name of the engine (*Required*)
28
- # @param arguments [Hash] endpoint arguments
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
29
  # @option arguments [String] :crawl_request_id Crawl Request ID (*Required*)
30
- # @option arguments [Hash] :body The request body
31
30
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
32
31
  #
33
32
  # @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-get-crawler-crawl-requests-id
@@ -36,15 +35,14 @@ module Elastic
36
35
  raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
37
36
  raise ArgumentError, "Required parameter 'crawl_request_id' missing" unless arguments[:crawl_request_id]
38
37
 
39
- crawl_request_id = arguments[:crawl_request_id]
40
- body = arguments.delete(:body) || {}
41
- headers = arguments.delete(:headers) || {}
38
+ crawl_request_id = arguments.delete(:crawl_request_id)
42
39
 
40
+ headers = arguments.delete(:headers) || {}
43
41
  request(
44
42
  :get,
45
- "api/as/v0/engines/#{engine_name}/crawler/crawl_requests/#{crawl_request_id}/",
43
+ "api/as/v1/engines/#{engine_name}/crawler/crawl_requests/#{crawl_request_id}/",
46
44
  arguments,
47
- body,
45
+ nil,
48
46
  headers
49
47
  )
50
48
  end
@@ -24,9 +24,8 @@ module Elastic
24
24
  # Crawler - Get crawl schedule
25
25
  # Returns the current crawl schedule for a given engine
26
26
  #
27
- # @param engine_name [String] Name of the engine (*Required*)
28
- # @param arguments [Hash] endpoint arguments
29
- # @option arguments [Hash] :body The request body
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
30
29
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
31
30
  #
32
31
  # @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-get-crawler-crawl-schedule
@@ -34,14 +33,12 @@ module Elastic
34
33
  def crawler_crawl_schedule(engine_name, arguments = {})
35
34
  raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
36
35
 
37
- body = arguments.delete(:body) || {}
38
36
  headers = arguments.delete(:headers) || {}
39
-
40
37
  request(
41
38
  :get,
42
- "api/as/v0/engines/#{engine_name}/crawler/crawl_schedule/",
39
+ "api/as/v1/engines/#{engine_name}/crawler/crawl_schedule/",
43
40
  arguments,
44
- body,
41
+ nil,
45
42
  headers
46
43
  )
47
44
  end
@@ -24,10 +24,9 @@ module Elastic
24
24
  # Crawler - Get domain configuration
25
25
  # Returns crawler domain configuration details
26
26
  #
27
- # @param engine_name [String] Name of the engine (*Required*)
28
- # @param arguments [Hash] endpoint arguments
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
29
  # @option arguments [String] :domain_id Crawler Domain ID (*Required*)
30
- # @option arguments [Hash] :body The request body
31
30
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
32
31
  #
33
32
  # @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-get-crawler-domain
@@ -36,15 +35,14 @@ module Elastic
36
35
  raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
37
36
  raise ArgumentError, "Required parameter 'domain_id' missing" unless arguments[:domain_id]
38
37
 
39
- domain_id = arguments[:domain_id]
40
- body = arguments.delete(:body) || {}
41
- headers = arguments.delete(:headers) || {}
38
+ domain_id = arguments.delete(:domain_id)
42
39
 
40
+ headers = arguments.delete(:headers) || {}
43
41
  request(
44
42
  :get,
45
- "api/as/v0/engines/#{engine_name}/crawler/domains/#{domain_id}/",
43
+ "api/as/v1/engines/#{engine_name}/crawler/domains/#{domain_id}/",
46
44
  arguments,
47
- body,
45
+ nil,
48
46
  headers
49
47
  )
50
48
  end
@@ -24,19 +24,20 @@ module Elastic
24
24
  # Crawler - Validate Domain with Crawler
25
25
  # Performs a number of checks on a given domain name to make sure it is ready to be crawled and ingested into App Search.
26
26
  #
27
- # @param arguments [Hash] endpoint arguments
28
- # @option arguments [String] :body
27
+ # @param [Hash] arguments endpoint arguments
28
+ # @option arguments [string] :body
29
+ # @option body [string] :url *Required*
29
30
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
30
31
  #
31
- # @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html
32
+ # @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-post-crawler-validate-domain
32
33
  #
33
34
  def crawler_domain_validation_result(arguments = {})
34
35
  body = arguments.delete(:body) || {}
35
- headers = arguments.delete(:headers) || {}
36
36
 
37
+ headers = arguments.delete(:headers) || {}
37
38
  request(
38
39
  :post,
39
- 'api/as/v0/crawler/validate_url/',
40
+ 'api/as/v1/crawler/validate_url/',
40
41
  arguments,
41
42
  body,
42
43
  headers
@@ -24,21 +24,18 @@ module Elastic
24
24
  # Crawler - Retrieve a snapshot of crawler metrics
25
25
  # Retrieves a momentary snapshot of key crawler metrics, including global and node-level crawler health
26
26
  #
27
- # @param arguments [Hash] endpoint arguments
28
- # @option arguments [Hash] :body The request body
27
+ # @param [Hash] arguments endpoint arguments
29
28
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
30
29
  #
31
30
  # @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html
32
31
  #
33
32
  def crawler_metrics(arguments = {})
34
- body = arguments.delete(:body) || {}
35
33
  headers = arguments.delete(:headers) || {}
36
-
37
34
  request(
38
35
  :get,
39
- 'api/as/v0/crawler/metrics/',
36
+ 'api/as/v1/crawler/metrics/',
40
37
  arguments,
41
- body,
38
+ nil,
42
39
  headers
43
40
  )
44
41
  end
@@ -24,9 +24,8 @@ module Elastic
24
24
  # Crawler - Retrieve crawler configuration overview
25
25
  # Retrieves crawler configuration overview of a given engine, including configured domains
26
26
  #
27
- # @param engine_name [String] Name of the engine (*Required*)
28
- # @param arguments [Hash] endpoint arguments
29
- # @option arguments [Hash] :body The request body
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
30
29
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
31
30
  #
32
31
  # @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-get-crawler
@@ -34,14 +33,12 @@ module Elastic
34
33
  def crawler_overview(engine_name, arguments = {})
35
34
  raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
36
35
 
37
- body = arguments.delete(:body) || {}
38
36
  headers = arguments.delete(:headers) || {}
39
-
40
37
  request(
41
38
  :get,
42
- "api/as/v0/engines/#{engine_name}/crawler/",
39
+ "api/as/v1/engines/#{engine_name}/crawler/",
43
40
  arguments,
44
- body,
41
+ nil,
45
42
  headers
46
43
  )
47
44
  end
@@ -24,10 +24,9 @@ module Elastic
24
24
  # Crawler - Get process crawl details
25
25
  # Returns process crawl details.
26
26
  #
27
- # @param engine_name [String] Name of the engine (*Required*)
28
- # @param arguments [Hash] endpoint arguments
27
+ # @param [String] engine_name Name of the engine (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
29
  # @option arguments [String] :process_crawl_id Process Crawl identifier (*Required*)
30
- # @option arguments [Hash] :body The request body
31
30
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
32
31
  #
33
32
  # @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-get-crawler-process-crawls-id
@@ -36,15 +35,14 @@ module Elastic
36
35
  raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
37
36
  raise ArgumentError, "Required parameter 'process_crawl_id' missing" unless arguments[:process_crawl_id]
38
37
 
39
- process_crawl_id = arguments[:process_crawl_id]
40
- body = arguments.delete(:body) || {}
41
- headers = arguments.delete(:headers) || {}
38
+ process_crawl_id = arguments.delete(:process_crawl_id)
42
39
 
40
+ headers = arguments.delete(:headers) || {}
43
41
  request(
44
42
  :get,
45
- "api/as/v0/engines/#{engine_name}/crawler/process_crawls/#{process_crawl_id}/",
43
+ "api/as/v1/engines/#{engine_name}/crawler/process_crawls/#{process_crawl_id}/",
46
44
  arguments,
47
- body,
45
+ nil,
48
46
  headers
49
47
  )
50
48
  end