elastic-enterprise-search 7.16.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) 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 +2 -3
  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 +39 -31
  15. data/docs/guide/overview.asciidoc +11 -3
  16. data/docs/guide/release_notes/712.asciidoc +10 -0
  17. data/docs/guide/release_notes/714.asciidoc +0 -12
  18. data/docs/guide/release_notes/715.asciidoc +0 -12
  19. data/docs/guide/release_notes/717.asciidoc +9 -0
  20. data/docs/guide/release_notes/80.asciidoc +117 -0
  21. data/docs/guide/release_notes/index.asciidoc +6 -0
  22. data/docs/guide/workplace-search-api.asciidoc +14 -7
  23. data/elastic-enterprise-search.gemspec +3 -3
  24. data/lib/elastic/api/response.rb +52 -0
  25. data/lib/elastic/app-search/api/adaptive_relevance_settings.rb +3 -6
  26. data/lib/elastic/app-search/api/adaptive_relevance_suggestions.rb +10 -6
  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 +5 -4
  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 +6 -5
  42. data/lib/elastic/app-search/api/crawler_url_validation_result.rb +6 -5
  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 -12
  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 -9
  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 -9
  51. data/lib/elastic/app-search/api/create_curation.rb +10 -9
  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/app-search/api/list_adaptive_relevance_suggestions.rb +4 -4
  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/app-search/api/list_crawler_domains.rb +6 -7
  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/app-search/api/put_adaptive_relevance_settings.rb +6 -5
  81. data/lib/elastic/app-search/api/put_adaptive_relevance_suggestions.rb +4 -4
  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 -13
  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 -10
  87. data/lib/elastic/app-search/api/put_crawler_sitemap.rb +11 -10
  88. data/lib/elastic/app-search/api/put_curation.rb +11 -10
  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 +8 -13
  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/spec/app-search/client_spec.rb +29 -0
  139. data/spec/enterprise-search/client_spec.rb +29 -0
  140. data/spec/enterprise-search/request_spec.rb +1 -1
  141. data/spec/integration/app-search/adaptive_relevance_settings_spec.rb +60 -0
  142. data/spec/integration/app-search/adaptive_relevance_suggestions_spec.rb +54 -0
  143. data/spec/integration/app-search/api_logs_spec.rb +11 -3
  144. data/spec/integration/app-search/app_search_helper.rb +2 -2
  145. data/spec/integration/app-search/count_analytics_spec.rb +3 -2
  146. data/spec/integration/app-search/crawler_domain_spec.rb +17 -6
  147. data/spec/integration/app-search/curations_spec.rb +15 -9
  148. data/spec/integration/app-search/engines_spec.rb +24 -26
  149. data/spec/integration/app-search/log_clickthrough_spec.rb +1 -1
  150. data/spec/integration/app-search/meta_engines_spec.rb +5 -5
  151. data/spec/integration/app-search/search_and_multiple_search_spec.rb +1 -1
  152. data/spec/integration/workplace-search/content_sources_spec.rb +6 -6
  153. data/spec/integration/workplace-search/documents_spec.rb +20 -10
  154. data/spec/integration/workplace-search/external_identities_spec.rb +26 -16
  155. data/spec/integration/workplace-search/triggers_spec.rb +2 -2
  156. data/spec/integration/workplace-search/users_spec.rb +0 -6
  157. data/spec/workplace-search/client_spec.rb +29 -0
  158. metadata +24 -21
  159. data/.ci/jobs/elastic+enterprise-search-ruby+7.10.0.beta.1.yml +0 -12
  160. data/.github/compatibility/Gemfile +0 -23
  161. data/.github/workflows/compatibility.yml +0 -20
  162. data/lib/elastic/workplace-search/api/add_user_permissions.rb +0 -54
  163. data/lib/elastic/workplace-search/api/list_permissions.rb +0 -51
  164. data/lib/elastic/workplace-search/api/put_user_permissions.rb +0 -54
  165. data/lib/elastic/workplace-search/api/remove_user_permissions.rb +0 -54
  166. data/lib/elastic/workplace-search/api/user_permissions.rb +0 -53
  167. data/spec/integration/app-search/adaptive_relevance_spec.rb +0 -80
  168. data/spec/integration/workplace-search/permissions_spec.rb +0 -77
@@ -24,8 +24,8 @@ module Elastic
24
24
  # Documents - Retrieves a document by ID from the specified content source
25
25
  # Retrieves a document by ID from the specified content source
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
27
+ # @param [String] content_source_id Unique ID for a Custom API source, provided upon creation of a Custom API Source (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
29
  # @option arguments [String] :document_id Unique ID for a content source document. Provided upon or returned at creation. (*Required*)
30
30
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
31
31
  #
@@ -35,15 +35,13 @@ module Elastic
35
35
  raise ArgumentError, "Required parameter 'content_source_id' missing" unless content_source_id
36
36
  raise ArgumentError, "Required parameter 'document_id' missing" unless arguments[:document_id]
37
37
 
38
- document_id = arguments[:document_id]
39
-
38
+ document_id = arguments.delete(:document_id)
40
39
  headers = arguments.delete(:headers) || {}
41
-
42
40
  request(
43
41
  :get,
44
42
  "api/ws/v1/sources/#{content_source_id}/documents/#{document_id}/",
45
43
  arguments,
46
- {},
44
+ nil,
47
45
  headers
48
46
  )
49
47
  end
@@ -24,26 +24,24 @@ module Elastic
24
24
  # ExternalIdentities - Retrieves an external identity
25
25
  # Retrieves an external identity
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] content_source_id Unique ID for a Custom API source, provided upon creation of a Custom API Source (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
+ # @option arguments [String] :external_user_id Unique identifier of an external user, such as username or email address. (*Required*)
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/workplace-search/current/workplace-search-external-identities-api.html#show-external-identity
33
33
  #
34
34
  def external_identity(content_source_id, arguments = {})
35
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]
36
+ raise ArgumentError, "Required parameter 'external_user_id' missing" unless arguments[:external_user_id]
39
37
 
38
+ external_user_id = arguments.delete(:external_user_id)
40
39
  headers = arguments.delete(:headers) || {}
41
-
42
40
  request(
43
41
  :get,
44
- "api/ws/v1/sources/#{content_source_id}/external_identities/#{user}/",
42
+ "api/ws/v1/sources/#{content_source_id}/external_identities/#{external_user_id}/",
45
43
  arguments,
46
- {},
44
+ nil,
47
45
  headers
48
46
  )
49
47
  end
@@ -24,9 +24,9 @@ module Elastic
24
24
  # Documents - Indexes one or more new documents into a custom content source, or updates one or more existing documents
25
25
  # Indexes one or more new documents into a custom content source, or updates one or more existing documents
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 [Array] :documents (*Required*)
27
+ # @param [String] content_source_id Unique ID for a Custom API source, provided upon creation of a Custom API Source (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
+ # @option arguments [Array<Hash> { id: [] }, { last_updated: [] }, { _allow_permissions: [] }, { _deny_permissions: [] }] :documents *Required*
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/workplace-search/current/workplace-search-custom-sources-api.html#index-and-update
@@ -37,7 +37,6 @@ module Elastic
37
37
 
38
38
  documents = arguments.delete(:documents) || {}
39
39
  headers = arguments.delete(:headers) || {}
40
-
41
40
  request(
42
41
  :post,
43
42
  "api/ws/v1/sources/#{content_source_id}/documents/bulk_create/",
@@ -24,7 +24,7 @@ module Elastic
24
24
  # ContentSources - Retrieves all content sources
25
25
  # Retrieves all content sources
26
26
  #
27
- # @param arguments [Hash] endpoint arguments
27
+ # @param [Hash] arguments endpoint arguments
28
28
  # @option arguments [Integer] :current_page Which page of results to request
29
29
  # @option arguments [Integer] :page_size The number of results to return in a page
30
30
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
@@ -33,12 +33,11 @@ module Elastic
33
33
  #
34
34
  def list_content_sources(arguments = {})
35
35
  headers = arguments.delete(:headers) || {}
36
-
37
36
  request(
38
37
  :get,
39
38
  'api/ws/v1/sources/',
40
39
  arguments,
41
- {},
40
+ nil,
42
41
  headers
43
42
  )
44
43
  end
@@ -24,13 +24,13 @@ module Elastic
24
24
  # Documents - Lists documents from a custom content source
25
25
  # Lists documents from a custom content source
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
27
+ # @param [String] content_source_id Unique ID for a Custom API source, provided upon creation of a Custom API Source (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
29
  # @option arguments [Hash] :body
30
- # @option body [Object] :page Paging controls for the result set
30
+ # @option body [Hash] :page Paging controls for the result set
31
31
  # @option body :filters
32
32
  # @option body :sort
33
- # @option body [String] :cursor
33
+ # @option body [string] :cursor
34
34
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
35
35
  #
36
36
  # @see https://www.elastic.co/guide/en/workplace-search/current/workplace-search-custom-sources-api.html#list-documents
@@ -40,7 +40,6 @@ module Elastic
40
40
 
41
41
  body = arguments.delete(:body) || {}
42
42
  headers = arguments.delete(:headers) || {}
43
-
44
43
  request(
45
44
  :post,
46
45
  "api/ws/v1/sources/#{content_source_id}/documents/",
@@ -24,8 +24,8 @@ module Elastic
24
24
  # ExternalIdentities - Retrieves all external identities
25
25
  # Retrieves all external identities
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
27
+ # @param [String] content_source_id Unique ID for a Custom API source, provided upon creation of a Custom API Source (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
29
  # @option arguments [Integer] :current_page Which page of results to request
30
30
  # @option arguments [Integer] :page_size The number of results to return in a page
31
31
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
@@ -36,12 +36,11 @@ module Elastic
36
36
  raise ArgumentError, "Required parameter 'content_source_id' missing" unless content_source_id
37
37
 
38
38
  headers = arguments.delete(:headers) || {}
39
-
40
39
  request(
41
40
  :get,
42
41
  "api/ws/v1/sources/#{content_source_id}/external_identities/",
43
42
  arguments,
44
- {},
43
+ nil,
45
44
  headers
46
45
  )
47
46
  end
@@ -24,7 +24,7 @@ module Elastic
24
24
  # Synonyms - Retrieves all synonym sets
25
25
  # Retrieve a list of synonym sets
26
26
  #
27
- # @param arguments [Hash] endpoint arguments
27
+ # @param [Hash] arguments endpoint arguments
28
28
  # @option arguments [Hash] :body
29
29
  # @option body :page
30
30
  # @option body :sort
@@ -36,7 +36,6 @@ module Elastic
36
36
  def list_synonym_sets(arguments = {})
37
37
  body = arguments.delete(:body) || {}
38
38
  headers = arguments.delete(:headers) || {}
39
-
40
39
  request(
41
40
  :get,
42
41
  'api/ws/v1/synonyms/',
@@ -24,13 +24,13 @@ module Elastic
24
24
  # ContentSources - Update a content source
25
25
  # Update a content source
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 [Hash] :body Definition to update a Workplace Search Content Source (Required: name, is_searchable)
30
- # @option body [String] :name The human readable display name for this Content Source. (*Required)
27
+ # @param [String] content_source_id Unique ID for a Custom API source, provided upon creation of a Custom API Source (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
+ # @option arguments [Hash] :body (Required: name, is_searchable)
30
+ # @option body [string] :name The human readable display name for this Content Source.
31
31
  # @option body :schema The schema that each document in this Content Source will adhere to.
32
32
  # @option body :display The display details which governs which fields will be displayed, and in what order, in the search results.
33
- # @option body [Boolean] :is_searchable Whether or not this Content Source will be searchable on the search page. (*Required)
33
+ # @option body [boolean] :is_searchable Whether or not this Content Source will be searchable on the search page.
34
34
  # @option body :indexing
35
35
  # @option body :facets
36
36
  # @option body :automatic_query_refinement
@@ -40,10 +40,10 @@ module Elastic
40
40
  #
41
41
  def put_content_source(content_source_id, arguments = {})
42
42
  raise ArgumentError, "Required parameter 'content_source_id' missing" unless content_source_id
43
+ raise ArgumentError, "Required parameter 'body (name,is_searchable)' missing" unless arguments[:body]
43
44
 
44
45
  body = arguments.delete(:body) || {}
45
46
  headers = arguments.delete(:headers) || {}
46
-
47
47
  request(
48
48
  :put,
49
49
  "api/ws/v1/sources/#{content_source_id}/",
@@ -24,21 +24,21 @@ module Elastic
24
24
  # ContentSources - Upload content source icons
25
25
  # Upload content source icons
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 [Hash] :body Definition to upload Workplace Search Custom Source icons
30
- # @option body [String] :main_icon
31
- # @option body [String] :alt_icon
27
+ # @param [String] content_source_id Unique ID for a Custom API source, provided upon creation of a Custom API Source (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
+ # @option arguments [Hash] :body *Required*
30
+ # @option body [string] :main_icon
31
+ # @option body [string] :alt_icon
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/workplace-search/current/workplace-search-content-sources-api.html#upload-content-source-icon-api
35
35
  #
36
36
  def put_content_source_icons(content_source_id, arguments = {})
37
37
  raise ArgumentError, "Required parameter 'content_source_id' missing" unless content_source_id
38
+ raise ArgumentError, "Required parameter 'body' missing" unless arguments[:body]
38
39
 
39
40
  body = arguments.delete(:body) || {}
40
41
  headers = arguments.delete(:headers) || {}
41
-
42
42
  request(
43
43
  :put,
44
44
  "api/ws/v1/sources/#{content_source_id}/icon/",
@@ -24,27 +24,28 @@ module Elastic
24
24
  # ExternalIdentities - Updates an external identity
25
25
  # Updates an external identity
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 [Hash] :body (Required: source_user_id, user)
31
- # @option body [String] :source_user_id (*Required)
32
- # @option body [String] :user (*Required)
27
+ # @param [String] content_source_id Unique ID for a Custom API source, provided upon creation of a Custom API Source (*Required*)
28
+ # @param [Hash] arguments endpoint arguments
29
+ # @option arguments [String] :external_user_id Unique identifier of an external user, such as username or email address. (*Required*)
30
+ # @option arguments [Hash] :body (Required: external_user_id)
31
+ # @option body [string] :external_user_id
32
+ # @option body [["array", "null"]] :external_user_properties A list of external user properties, where each property is an object with an attribute_name and attribute_value.
33
+ # @option body [["array", "null"]] :permissions A list of user permissions.
33
34
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
34
35
  #
35
36
  # @see https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html#update-external-identity
36
37
  #
37
38
  def put_external_identity(content_source_id, arguments = {})
38
39
  raise ArgumentError, "Required parameter 'content_source_id' missing" unless content_source_id
39
- raise ArgumentError, "Required parameter 'user' missing" unless arguments[:user]
40
+ raise ArgumentError, "Required parameter 'external_user_id' missing" unless arguments[:external_user_id]
41
+ raise ArgumentError, "Required parameter 'body (external_user_id)' missing" unless arguments[:body]
40
42
 
41
- user = arguments[:user]
43
+ external_user_id = arguments.delete(:external_user_id)
42
44
  body = arguments.delete(:body) || {}
43
45
  headers = arguments.delete(:headers) || {}
44
-
45
46
  request(
46
47
  :put,
47
- "api/ws/v1/sources/#{content_source_id}/external_identities/#{user}/",
48
+ "api/ws/v1/sources/#{content_source_id}/external_identities/#{external_user_id}/",
48
49
  arguments,
49
50
  body,
50
51
  headers
@@ -24,21 +24,21 @@ module Elastic
24
24
  # Synonyms - Update a synonym set
25
25
  # Update a synonym set
26
26
  #
27
- # @param arguments [Hash] endpoint arguments
27
+ # @param [Hash] arguments endpoint arguments
28
28
  # @option arguments [String] :synonym_set_id Synonym Set ID (*Required*)
29
- # @option arguments [Hash] :body (Required: synonyms)
30
- # @option body [Array] :synonyms A list of terms for this synonym set (*Required)
29
+ # @option arguments [Hash] :body (Required: synonyms)
30
+ # @option body [Array<string>] :synonyms A list of terms for this synonym set
31
31
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
32
32
  #
33
33
  # @see https://www.elastic.co/guide/en/workplace-search/current/workplace-synonyms-api.html#update-synonym
34
34
  #
35
35
  def put_synonym_set(arguments = {})
36
36
  raise ArgumentError, "Required parameter 'synonym_set_id' missing" unless arguments[:synonym_set_id]
37
+ raise ArgumentError, "Required parameter 'body (synonyms)' missing" unless arguments[:body]
37
38
 
38
39
  synonym_set_id = arguments.delete(:synonym_set_id)
39
40
  body = arguments.delete(:body) || {}
40
41
  headers = arguments.delete(:headers) || {}
41
-
42
42
  request(
43
43
  :put,
44
44
  "api/ws/v1/synonyms/#{synonym_set_id}/",
@@ -21,23 +21,21 @@ module Elastic
21
21
  module EnterpriseSearch
22
22
  module WorkplaceSearch
23
23
  module Actions
24
+ # putTriggersBlocklist - Update current triggers blocklist
24
25
  # Update current triggers blocklist
25
26
  #
26
- # @param arguments [Hash] endpoint arguments
27
- # @option arguments [Hash] :body The request body
27
+ # @param [Hash] arguments endpoint arguments
28
28
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
29
29
  #
30
30
  # @see https://www.elastic.co/guide/en/workplace-search/current/automatic-query-refinement-blocklist.html
31
31
  #
32
32
  def put_triggers_blocklist(arguments = {})
33
- body = arguments.delete(:body) || {}
34
33
  headers = arguments.delete(:headers) || {}
35
-
36
34
  request(
37
35
  :put,
38
36
  'api/ws/v1/automatic_query_refinement/',
39
37
  arguments,
40
- body,
38
+ nil,
41
39
  headers
42
40
  )
43
41
  end
@@ -24,31 +24,31 @@ module Elastic
24
24
  # Search - Search across available sources with various query tuning options
25
25
  # Issue a Search Query
26
26
  #
27
- # @param arguments [Hash] endpoint arguments
28
- # @option arguments [String] :access_token OAuth Access Token (*Required*)
29
- # @option arguments [Hash] :body
30
- # @option body [String] :query A string or number used to find related documents
31
- # @option body [Boolean] :automatic_query_refinement Set to false to not automatically refine the query by keywords
32
- # @option body [Object] :page Paging controls for the result set
33
- # @option body [Object] :search_fields Restrict the fulltext search to only specific fields
34
- # @option body [Object] :result_fields Restrict the result fields for each item to the specified fields
27
+ # @param [Hash] arguments endpoint arguments
28
+ # @param [String] access_token OAuth Access Token (*Required*)
29
+ # @option arguments [Hash] :body *Required*
30
+ # @option body [string] :query A string or number used to find related documents
31
+ # @option body [boolean] :automatic_query_refinement Set to false to not automatically refine the query by keywords
32
+ # @option body [Hash] :page Paging controls for the result set
33
+ # @option body [Hash] :search_fields Restrict the fulltext search to only specific fields
34
+ # @option body [Hash] :result_fields Restrict the result fields for each item to the specified fields
35
35
  # @option body :filters
36
36
  # @option body :sort
37
- # @option body [Object] :facets
38
- # @option body [Object] :boosts
37
+ # @option body [Hash] :facets
38
+ # @option body [Hash] :boosts
39
39
  # @option body :source_type Optional parameter to search standard, remote only, or all available sources
40
- # @option body [Integer] :timeout Optional timeout in ms for searching remote sources
41
- # @option body [Array] :content_sources Optional list of content source ids to only return results from
40
+ # @option body [integer] :timeout Optional timeout in ms for searching remote sources
41
+ # @option body [Array<string>] :content_sources Optional list of content source ids to only return results from
42
42
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
43
43
  #
44
44
  # @see https://www.elastic.co/guide/en/workplace-search/current/workplace-search-search-api.html
45
45
  #
46
46
  def search(arguments = {})
47
47
  raise ArgumentError, "Required parameter 'access_token' missing" unless arguments[:access_token]
48
+ raise ArgumentError, "Required parameter 'body' missing" unless arguments[:body]
48
49
 
49
50
  body = arguments.delete(:body) || {}
50
51
  headers = arguments.delete(:headers) || {}
51
-
52
52
  request(
53
53
  :post,
54
54
  'api/ws/v1/search/',
@@ -24,7 +24,7 @@ module Elastic
24
24
  # Synonyms - Retrieve a synonym set by ID
25
25
  # Retrieve a synonym set by ID
26
26
  #
27
- # @param arguments [Hash] endpoint arguments
27
+ # @param [Hash] arguments endpoint arguments
28
28
  # @option arguments [String] :synonym_set_id Synonym Set ID (*Required*)
29
29
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
30
30
  #
@@ -33,15 +33,13 @@ module Elastic
33
33
  def synonym_set(arguments = {})
34
34
  raise ArgumentError, "Required parameter 'synonym_set_id' missing" unless arguments[:synonym_set_id]
35
35
 
36
- synonym_set_id = arguments[:synonym_set_id]
37
-
36
+ synonym_set_id = arguments.delete(:synonym_set_id)
38
37
  headers = arguments.delete(:headers) || {}
39
-
40
38
  request(
41
39
  :get,
42
40
  "api/ws/v1/synonyms/#{synonym_set_id}/",
43
41
  arguments,
44
- {},
42
+ nil,
45
43
  headers
46
44
  )
47
45
  end
@@ -21,21 +21,21 @@ module Elastic
21
21
  module EnterpriseSearch
22
22
  module WorkplaceSearch
23
23
  module Actions
24
+ # getTriggersBlocklist - Get current triggers blocklist
24
25
  # Get current triggers blocklist
25
26
  #
26
- # @param arguments [Hash] endpoint arguments
27
+ # @param [Hash] arguments endpoint arguments
27
28
  # @option arguments [Hash] :headers optional HTTP headers to send with the request
28
29
  #
29
30
  # @see https://www.elastic.co/guide/en/workplace-search/current/automatic-query-refinement-blocklist.html
30
31
  #
31
32
  def triggers_blocklist(arguments = {})
32
33
  headers = arguments.delete(:headers) || {}
33
-
34
34
  request(
35
35
  :get,
36
36
  'api/ws/v1/automatic_query_refinement/',
37
37
  arguments,
38
- {},
38
+ nil,
39
39
  headers
40
40
  )
41
41
  end
@@ -85,4 +85,33 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
85
85
  expect(decoded_token[0]['query']).to(eq('cat'))
86
86
  end
87
87
  end
88
+
89
+ context 'adapters' do
90
+ let(:client) { described_class.new }
91
+ let(:adapter) { client.transport.transport.connections.all.first.connection.builder.adapter }
92
+
93
+ context 'when no adapter is specified' do
94
+ it 'uses Faraday NetHttp' do
95
+ expect(adapter).to eq Faraday::Adapter::NetHttp
96
+ end
97
+ end
98
+
99
+ context 'when the adapter is patron' do
100
+ let(:client) { described_class.new(adapter: :patron) }
101
+
102
+ it 'uses Faraday with the adapter' do
103
+ expect(adapter).to eq Faraday::Adapter::Patron
104
+ end
105
+ end
106
+
107
+ unless defined?(JRUBY_VERSION)
108
+ context 'when the adapter is typhoeus' do
109
+ let(:client) { described_class.new(adapter: :patron) }
110
+
111
+ it 'uses Faraday with the adapter' do
112
+ expect(adapter).to eq Faraday::Adapter::Patron
113
+ end
114
+ end
115
+ end
116
+ end
88
117
  end
@@ -103,4 +103,33 @@ describe Elastic::EnterpriseSearch::Client do
103
103
  expect(subject['x-elastic-client-meta']).to match(/^ent=[0-9]+\.[0-9]+\.[0-9]+(p)?,/)
104
104
  end
105
105
  end
106
+
107
+ context 'adapters' do
108
+ let(:client) { described_class.new }
109
+ let(:adapter) { client.transport.transport.connections.all.first.connection.builder.adapter }
110
+
111
+ context 'when no adapter is specified' do
112
+ it 'uses Faraday NetHttp' do
113
+ expect(adapter).to eq Faraday::Adapter::NetHttp
114
+ end
115
+ end
116
+
117
+ context 'when the adapter is patron' do
118
+ let(:client) { described_class.new(adapter: :patron) }
119
+
120
+ it 'uses Faraday with the adapter' do
121
+ expect(adapter).to eq Faraday::Adapter::Patron
122
+ end
123
+ end
124
+
125
+ unless defined?(JRUBY_VERSION)
126
+ context 'when the adapter is typhoeus' do
127
+ let(:client) { described_class.new(adapter: :patron) }
128
+
129
+ it 'uses Faraday with the adapter' do
130
+ expect(adapter).to eq Faraday::Adapter::Patron
131
+ end
132
+ end
133
+ end
134
+ end
106
135
  end
@@ -32,7 +32,7 @@ describe Elastic::EnterpriseSearch::Client do
32
32
  "(RUBY_VERSION: #{RUBY_VERSION}; ",
33
33
  "#{RbConfig::CONFIG['host_os'].split('_').first[/[a-z]+/i].downcase} ",
34
34
  "#{RbConfig::CONFIG['target_cpu']}; ",
35
- "elasticsearch-transport: #{Elasticsearch::Transport::VERSION})"
35
+ "elastic-transport: #{Elastic::Transport::VERSION})"
36
36
  ].join
37
37
  end
38
38
 
@@ -0,0 +1,60 @@
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_relative "#{__dir__}/app_search_helper.rb"
21
+
22
+ describe Elastic::EnterpriseSearch::AppSearch::Client do
23
+ context 'Adaptive Relevance Settings' do
24
+ let(:engine_name) { 'relevance-settings' }
25
+
26
+ before do
27
+ create_engine(engine_name)
28
+ client.put_adaptive_relevance_settings(engine_name, body: { curation: { enabled: true } })
29
+ end
30
+
31
+ after do
32
+ delete_engines
33
+ end
34
+
35
+ it 'Shows the settings for an engine' do
36
+ response = client.adaptive_relevance_settings(engine_name)
37
+
38
+ expect(response.status).to eq 200
39
+ expect(response.body['curation'])
40
+ end
41
+
42
+ it 'Updates relevance settings' do
43
+ body = {
44
+ curation: { enabled: true }
45
+ }
46
+ response = client.put_adaptive_relevance_settings(engine_name, body: body)
47
+ expect(response.status).to eq 200
48
+ expect(response.body['curation']['enabled'])
49
+ end
50
+
51
+ it 'Refreshes adaptive relevance update process' do
52
+ response = client.refresh_adaptive_relevance_update_process(
53
+ engine_name,
54
+ adaptive_relevance_suggestion_type: 'curation'
55
+ )
56
+ expect(response.status).to eq 200
57
+ expect(response.body['process']['type']).to eq 'curation'
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,54 @@
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_relative "#{__dir__}/app_search_helper.rb"
21
+
22
+ describe Elastic::EnterpriseSearch::AppSearch::Client do
23
+ context 'Adaptive Relevance Suggestions' do
24
+ let(:engine_name) { 'relevance-suggestions' }
25
+
26
+ before do
27
+ create_engine(engine_name)
28
+ client.put_adaptive_relevance_settings(engine_name, body: { curation: { enabled: true } })
29
+ end
30
+
31
+ after do
32
+ delete_engines
33
+ end
34
+
35
+ it 'Updates an adaptive relevance suggestion' do
36
+ body = [{ query: 'forest', type: 'curation', status: 'applied' }]
37
+ response = client.put_adaptive_relevance_suggestions(engine_name, body: body)
38
+ expect(response.status).to eq 200
39
+ expect(response.body['results'].first.keys).to include('query', 'type', 'status')
40
+ end
41
+
42
+ it 'Retrieves an adaptive relevance suggestion' do
43
+ expect do
44
+ client.adaptive_relevance_suggestions(engine_name, search_suggestion_query: 'test')
45
+ end.to raise_error(Elastic::Transport::Transport::Errors::NotFound)
46
+ end
47
+
48
+ it 'Lists adaptive relevance suggestions' do
49
+ response = client.list_adaptive_relevance_suggestions(engine_name)
50
+ expect(response.status).to eq 200
51
+ expect(response.body)
52
+ end
53
+ end
54
+ end