elastic-enterprise-search 0.3.0 → 7.13.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/.ci/.gitignore +1 -0
  3. data/.ci/Dockerfile +12 -0
  4. data/.ci/certs/README.md +50 -0
  5. data/.ci/certs/ca.crt +20 -0
  6. data/.ci/certs/ca.key +27 -0
  7. data/.ci/certs/testnode.crt +21 -0
  8. data/.ci/certs/testnode.key +27 -0
  9. data/.ci/certs/testnode_no_san.crt +19 -0
  10. data/.ci/certs/testnode_no_san.key +27 -0
  11. data/.ci/functions/cleanup.sh +67 -0
  12. data/.ci/functions/imports.sh +59 -0
  13. data/.ci/functions/wait-for-container.sh +36 -0
  14. data/.ci/jobs/defaults.yml +69 -0
  15. data/.ci/jobs/elastic+enterprise-search-ruby+7.10.0.beta.1.yml +12 -0
  16. data/.ci/jobs/elastic+enterprise-search-ruby+master.yml +12 -0
  17. data/.ci/jobs/elastic+enterprise-search-ruby+pull-request.yml +19 -0
  18. data/.ci/run-elasticsearch.sh +127 -0
  19. data/.ci/run-enterprise-search.sh +71 -0
  20. data/.ci/run-local.sh +14 -0
  21. data/.ci/run-repository.sh +49 -0
  22. data/.ci/run-tests +27 -0
  23. data/.ci/test-matrix.yml +14 -0
  24. data/.github/workflows/rubocop.yml +15 -0
  25. data/.github/workflows/testing.yml +40 -0
  26. data/.gitignore +4 -0
  27. data/.rubocop.yml +52 -0
  28. data/CONTRIBUTING.md +43 -0
  29. data/Gemfile +23 -1
  30. data/{LICENSE.txt → LICENSE} +33 -32
  31. data/README.md +27 -147
  32. data/Rakefile +48 -1
  33. data/docs/guide/app-search-api.asciidoc +186 -0
  34. data/docs/guide/connecting.asciidoc +171 -0
  35. data/docs/guide/development.asciidoc +42 -0
  36. data/docs/guide/enterprise-search-api.asciidoc +46 -0
  37. data/docs/guide/index.asciidoc +19 -0
  38. data/docs/guide/installation.asciidoc +18 -0
  39. data/docs/guide/overview.asciidoc +59 -0
  40. data/docs/guide/release_notes/710.asciidoc +4 -0
  41. data/docs/guide/release_notes/711.asciidoc +27 -0
  42. data/docs/guide/release_notes/712.asciidoc +16 -0
  43. data/docs/guide/release_notes/index.asciidoc +14 -0
  44. data/docs/guide/workplace-search-api.asciidoc +138 -0
  45. data/elastic-enterprise-search.gemspec +49 -12
  46. data/lib/elastic-enterprise-search.rb +20 -1
  47. data/lib/elastic/.rubocop.yml +6 -0
  48. data/lib/elastic/app-search/api/add_meta_engine_source.rb +51 -0
  49. data/lib/elastic/app-search/api/api_logs.rb +62 -0
  50. data/lib/elastic/app-search/api/count_analytics.rb +52 -0
  51. data/lib/elastic/app-search/api/create_curation.rb +54 -0
  52. data/lib/elastic/app-search/api/create_engine.rb +53 -0
  53. data/lib/elastic/app-search/api/create_synonym_set.rb +51 -0
  54. data/lib/elastic/app-search/api/curation.rb +53 -0
  55. data/lib/elastic/app-search/api/delete_curation.rb +53 -0
  56. data/lib/elastic/app-search/api/delete_documents.rb +51 -0
  57. data/lib/elastic/app-search/api/delete_engine.rb +50 -0
  58. data/lib/elastic/app-search/api/delete_meta_engine_source.rb +51 -0
  59. data/lib/elastic/app-search/api/delete_synonym_set.rb +53 -0
  60. data/lib/elastic/app-search/api/documents.rb +51 -0
  61. data/lib/elastic/app-search/api/engine.rb +50 -0
  62. data/lib/elastic/app-search/api/index_documents.rb +51 -0
  63. data/lib/elastic/app-search/api/list_curations.rb +52 -0
  64. data/lib/elastic/app-search/api/list_documents.rb +52 -0
  65. data/lib/elastic/app-search/api/list_engines.rb +49 -0
  66. data/lib/elastic/app-search/api/list_synonym_sets.rb +52 -0
  67. data/lib/elastic/app-search/api/log_clickthrough.rb +57 -0
  68. data/lib/elastic/app-search/api/multi_search.rb +51 -0
  69. data/lib/elastic/app-search/api/put_curation.rb +57 -0
  70. data/lib/elastic/app-search/api/put_documents.rb +51 -0
  71. data/lib/elastic/app-search/api/put_schema.rb +51 -0
  72. data/lib/elastic/app-search/api/put_search_settings.rb +51 -0
  73. data/lib/elastic/app-search/api/put_synonym_set.rb +54 -0
  74. data/lib/elastic/app-search/api/query_suggestion.rb +54 -0
  75. data/lib/elastic/app-search/api/reset_search_settings.rb +50 -0
  76. data/lib/elastic/app-search/api/schema.rb +50 -0
  77. data/lib/elastic/app-search/api/search.rb +50 -0
  78. data/lib/elastic/app-search/api/search_settings.rb +50 -0
  79. data/lib/elastic/app-search/api/synonym_set.rb +53 -0
  80. data/lib/elastic/app-search/api/top_clicks_analytics.rb +54 -0
  81. data/lib/elastic/app-search/api/top_queries_analytics.rb +53 -0
  82. data/lib/elastic/app-search/app_search.rb +82 -0
  83. data/lib/elastic/enterprise-search/api/health.rb +43 -0
  84. data/lib/elastic/enterprise-search/api/put_read_only.rb +46 -0
  85. data/lib/elastic/enterprise-search/api/read_only.rb +43 -0
  86. data/lib/elastic/enterprise-search/api/stats.rb +45 -0
  87. data/lib/elastic/enterprise-search/api/version.rb +43 -0
  88. data/lib/elastic/enterprise-search/client.rb +81 -15
  89. data/lib/elastic/enterprise-search/configuration.rb +32 -16
  90. data/lib/elastic/enterprise-search/exceptions.rb +19 -0
  91. data/lib/elastic/enterprise-search/request.rb +62 -80
  92. data/lib/elastic/enterprise-search/utils.rb +28 -1
  93. data/lib/elastic/enterprise-search/version.rb +20 -1
  94. data/lib/elastic/enterprise_search.rb +49 -0
  95. data/lib/elastic/workplace-search/api/add_user_permissions.rb +54 -0
  96. data/lib/elastic/workplace-search/api/content_source.rb +49 -0
  97. data/lib/elastic/workplace-search/api/create_analytics_event.rb +59 -0
  98. data/lib/elastic/workplace-search/api/create_content_source.rb +52 -0
  99. data/lib/elastic/workplace-search/api/create_external_identity.rb +53 -0
  100. data/lib/elastic/workplace-search/api/delete_all_documents.rb +49 -0
  101. data/lib/elastic/workplace-search/api/delete_content_source.rb +49 -0
  102. data/lib/elastic/workplace-search/api/delete_documents.rb +51 -0
  103. data/lib/elastic/workplace-search/api/delete_external_identity.rb +53 -0
  104. data/lib/elastic/workplace-search/api/document.rb +53 -0
  105. data/lib/elastic/workplace-search/api/external_identity.rb +53 -0
  106. data/lib/elastic/workplace-search/api/index_documents.rb +52 -0
  107. data/lib/elastic/workplace-search/api/list_content_sources.rb +48 -0
  108. data/lib/elastic/workplace-search/api/list_external_identities.rb +51 -0
  109. data/lib/elastic/workplace-search/api/list_permissions.rb +51 -0
  110. data/lib/elastic/workplace-search/api/put_content_source.rb +55 -0
  111. data/lib/elastic/workplace-search/api/put_external_identity.rb +56 -0
  112. data/lib/elastic/workplace-search/api/put_user_permissions.rb +54 -0
  113. data/lib/elastic/workplace-search/api/remove_user_permissions.rb +54 -0
  114. data/lib/elastic/workplace-search/api/search.rb +60 -0
  115. data/lib/elastic/workplace-search/api/user_permissions.rb +53 -0
  116. data/lib/elastic/workplace-search/workplace_search.rb +89 -0
  117. data/spec/app-search/api_count_analytics_spec.rb +34 -0
  118. data/spec/app-search/api_curations_spec.rb +97 -0
  119. data/spec/app-search/api_documents_spec.rb +102 -0
  120. data/spec/app-search/api_engines_spec.rb +67 -0
  121. data/spec/app-search/api_log_clickthrough_spec.rb +34 -0
  122. data/spec/app-search/api_logs_spec.rb +36 -0
  123. data/spec/app-search/api_meta_engines_spec.rb +72 -0
  124. data/spec/app-search/api_query_suggestion_spec.rb +39 -0
  125. data/spec/app-search/api_schema_spec.rb +48 -0
  126. data/spec/app-search/api_search_and_multi_search_spec.rb +48 -0
  127. data/spec/app-search/api_search_settings_spec.rb +76 -0
  128. data/spec/app-search/api_spec_helper.rb +14 -0
  129. data/spec/app-search/api_synonyms_spec.rb +79 -0
  130. data/spec/app-search/api_top_clicks_analytics_spec.rb +44 -0
  131. data/spec/app-search/api_top_queries_analytics_spec.rb +34 -0
  132. data/spec/app-search/client_spec.rb +88 -0
  133. data/spec/app-search/date_spec.rb +69 -0
  134. data/spec/enterprise-search/client_spec.rb +107 -0
  135. data/spec/enterprise-search/request_spec.rb +136 -0
  136. data/spec/enterprise-search/utils_spec.rb +46 -0
  137. data/spec/fixtures/vcr/app_search/add_meta_engine_source.yml +109 -0
  138. data/spec/fixtures/vcr/app_search/api_documents.yml +56 -0
  139. data/spec/fixtures/vcr/app_search/api_index_documents.yml +57 -0
  140. data/spec/fixtures/vcr/app_search/api_log_clickthrough.yml +54 -0
  141. data/spec/fixtures/vcr/app_search/api_logs.yml +70 -0
  142. data/spec/fixtures/vcr/app_search/api_put_schema.yml +109 -0
  143. data/spec/fixtures/vcr/app_search/api_put_search_settings.yml +56 -0
  144. data/spec/fixtures/vcr/app_search/api_query_suggestion.yml +59 -0
  145. data/spec/fixtures/vcr/app_search/api_reset_search_settings.yml +56 -0
  146. data/spec/fixtures/vcr/app_search/api_schema.yml +56 -0
  147. data/spec/fixtures/vcr/app_search/api_search_settings.yml +56 -0
  148. data/spec/fixtures/vcr/app_search/api_top_clicks_analytics.yml +55 -0
  149. data/spec/fixtures/vcr/app_search/api_top_clicks_analytics_query.yml +55 -0
  150. data/spec/fixtures/vcr/app_search/api_top_queries_analytics.yml +55 -0
  151. data/spec/fixtures/vcr/app_search/count_analytics.yml +55 -0
  152. data/spec/fixtures/vcr/app_search/create_and_update_document.yml +107 -0
  153. data/spec/fixtures/vcr/app_search/create_curation.yml +113 -0
  154. data/spec/fixtures/vcr/app_search/create_engine.yml +55 -0
  155. data/spec/fixtures/vcr/app_search/create_meta_engine.yml +56 -0
  156. data/spec/fixtures/vcr/app_search/create_synonym_set.yml +56 -0
  157. data/spec/fixtures/vcr/app_search/delete_curation.yml +56 -0
  158. data/spec/fixtures/vcr/app_search/delete_engine.yml +55 -0
  159. data/spec/fixtures/vcr/app_search/delete_meta_engine_source.yml +56 -0
  160. data/spec/fixtures/vcr/app_search/delete_synonym_set.yml +56 -0
  161. data/spec/fixtures/vcr/app_search/get_curation.yml +56 -0
  162. data/spec/fixtures/vcr/app_search/get_engine.yml +55 -0
  163. data/spec/fixtures/vcr/app_search/index_and_delete_document.yml +107 -0
  164. data/spec/fixtures/vcr/app_search/list_curations.yml +56 -0
  165. data/spec/fixtures/vcr/app_search/list_documents.yml +57 -0
  166. data/spec/fixtures/vcr/app_search/list_engines.yml +55 -0
  167. data/spec/fixtures/vcr/app_search/list_synonym_sets.yml +56 -0
  168. data/spec/fixtures/vcr/app_search/multi_query_search.yml +63 -0
  169. data/spec/fixtures/vcr/app_search/put_curation.yml +113 -0
  170. data/spec/fixtures/vcr/app_search/put_synonym_set.yml +56 -0
  171. data/spec/fixtures/vcr/app_search/search.yml +57 -0
  172. data/spec/fixtures/vcr/app_search/single_query_search.yml +60 -0
  173. data/spec/fixtures/vcr/app_search/synonym_set.yml +56 -0
  174. data/spec/fixtures/vcr/workplace_search/create_analytics_event.yml +55 -0
  175. data/spec/fixtures/vcr/workplace_search/oauth_request_token.yml +57 -0
  176. data/spec/fixtures/vcr/workplace_search/search_request.yml +60 -0
  177. data/spec/integration/enterprise_search_api_spec.rb +100 -0
  178. data/spec/integration/workplace_search_spec.rb +253 -0
  179. data/spec/spec_helper.rb +27 -14
  180. data/spec/webmock_requires.rb +4 -0
  181. data/spec/workplace-search/client_spec.rb +77 -0
  182. data/spec/workplace-search/create_analytics_event_spec.rb +59 -0
  183. data/spec/workplace-search/search_spec.rb +53 -0
  184. metadata +266 -45
  185. data/.circleci/config.yml +0 -68
  186. data/.travis.yml +0 -15
  187. data/NOTICE.txt +0 -3
  188. data/lib/elastic/enterprise-search.rb +0 -7
  189. data/lib/elastic/enterprise-search/client/content_source_documents.rb +0 -46
  190. data/lib/elastic/enterprise-search/client/permissions.rb +0 -30
  191. data/logo-enterprise-search.png +0 -0
  192. data/spec/client/content_source_documents_spec.rb +0 -55
  193. data/spec/client/permissions_spec.rb +0 -75
  194. data/spec/configuration_spec.rb +0 -19
  195. data/spec/fixtures/vcr/add_user_permissions.yml +0 -55
  196. data/spec/fixtures/vcr/async_create_or_update_document_success.yml +0 -51
  197. data/spec/fixtures/vcr/destroy_documents_success.yml +0 -51
  198. data/spec/fixtures/vcr/get_user_permissions.yml +0 -55
  199. data/spec/fixtures/vcr/list_all_permissions.yml +0 -55
  200. data/spec/fixtures/vcr/list_all_permissions_with_paging.yml +0 -55
  201. data/spec/fixtures/vcr/remove_user_permissions.yml +0 -55
  202. data/spec/fixtures/vcr/update_user_permissions.yml +0 -55
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,43 @@
1
+ # Contributing to enterprise-search-ruby
2
+
3
+ ## Contributing Code Changes
4
+
5
+ 1. Please make sure you have signed the [Contributor License
6
+ Agreement](http://www.elastic.co/contributor-agreement/). We are not
7
+ asking you to assign copyright to us, but to give us the right to distribute
8
+ your code without restriction. We ask this of all contributors in order to
9
+ assure our users of the origin and continuing existence of the code. You only
10
+ need to sign the CLA once.
11
+
12
+ 2. Run rubocop and the test suite to ensure your changes do not break existing
13
+ code:
14
+
15
+ ```
16
+ $ bundle exec rubocop
17
+ ```
18
+
19
+ Check [Running
20
+ tests](https://github.com/elastic/enterprise-search-ruby/#run-tests) on the
21
+ README for instructions on how to run all the tests.
22
+
23
+ 3. Rebase your changes. Update your local repository with the most recent code
24
+ from the main `enterprise-search-ruby` repository and rebase your branch
25
+ on top of the latest `master` branch. All of your changes will be squashed
26
+ into a single commit so don't worry about pushing multiple times.
27
+
28
+ 4. Submit a pull request. Push your local changes to your forked repository
29
+ and [submit a pull request](https://github.com/elastic/enterprise-search-python/pulls)
30
+ and mention the issue number if any (`Closes #123`) Make sure that you
31
+ add or modify tests related to your changes so that CI will pass.
32
+
33
+ 5. Sit back and wait. There may be some discussion on your pull request and
34
+ if changes are needed we would love to work with you to get your pull request
35
+ merged into enterprise-search-ruby.
36
+
37
+ ## API Code Generation
38
+
39
+ All the API methods within
40
+ `lib/elastic/[app-search|enterprise-search|workplace-search]/api/*.rb` are
41
+ generated from an API specification that is not available publicly currently.
42
+ Because these files are generated, changes should instead be suggested in an
43
+ issue or as part of the description in your Pull Request.
data/Gemfile CHANGED
@@ -1,4 +1,26 @@
1
- source "https://rubygems.org"
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
+ source 'https://rubygems.org'
2
21
 
3
22
  # Specify your gem's dependencies in elastic-enterprise-search.gemspec
4
23
  gemspec
24
+
25
+ gem 'rake'
26
+ gem 'simplecov', require: false, group: :test
@@ -1,18 +1,19 @@
1
+
1
2
  Apache License
2
3
  Version 2.0, January 2004
3
4
  http://www.apache.org/licenses/
4
5
 
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
7
 
7
- 1. Definitions.
8
+ 1. Definitions.
8
9
 
9
- "License" shall mean the terms and conditions for use, reproduction,
10
+ "License" shall mean the terms and conditions for use, reproduction,
10
11
  and distribution as defined by Sections 1 through 9 of this document.
11
12
 
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
+ "Licensor" shall mean the copyright owner or entity authorized by
13
14
  the copyright owner that is granting the License.
14
15
 
15
- "Legal Entity" shall mean the union of the acting entity and all
16
+ "Legal Entity" shall mean the union of the acting entity and all
16
17
  other entities that control, are controlled by, or are under common
17
18
  control with that entity. For the purposes of this definition,
18
19
  "control" means (i) the power, direct or indirect, to cause the
@@ -20,24 +21,24 @@
20
21
  otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
22
  outstanding shares, or (iii) beneficial ownership of such entity.
22
23
 
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
+ "You" (or "Your") shall mean an individual or Legal Entity
24
25
  exercising permissions granted by this License.
25
26
 
26
- "Source" form shall mean the preferred form for making modifications,
27
+ "Source" form shall mean the preferred form for making modifications,
27
28
  including but not limited to software source code, documentation
28
29
  source, and configuration files.
29
30
 
30
- "Object" form shall mean any form resulting from mechanical
31
+ "Object" form shall mean any form resulting from mechanical
31
32
  transformation or translation of a Source form, including but
32
33
  not limited to compiled object code, generated documentation,
33
34
  and conversions to other media types.
34
35
 
35
- "Work" shall mean the work of authorship, whether in Source or
36
+ "Work" shall mean the work of authorship, whether in Source or
36
37
  Object form, made available under the License, as indicated by a
37
38
  copyright notice that is included in or attached to the work
38
39
  (an example is provided in the Appendix below).
39
40
 
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
+ "Derivative Works" shall mean any work, whether in Source or Object
41
42
  form, that is based on (or derived from) the Work and for which the
42
43
  editorial revisions, annotations, elaborations, or other modifications
43
44
  represent, as a whole, an original work of authorship. For the purposes
@@ -45,7 +46,7 @@
45
46
  separable from, or merely link (or bind by name) to the interfaces of,
46
47
  the Work and Derivative Works thereof.
47
48
 
48
- "Contribution" shall mean any work of authorship, including
49
+ "Contribution" shall mean any work of authorship, including
49
50
  the original version of the Work and any modifications or additions
50
51
  to that Work or Derivative Works thereof, that is intentionally
51
52
  submitted to Licensor for inclusion in the Work by the copyright owner
@@ -59,18 +60,18 @@
59
60
  excluding communication that is conspicuously marked or otherwise
60
61
  designated in writing by the copyright owner as "Not a Contribution."
61
62
 
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
64
  on behalf of whom a Contribution has been received by Licensor and
64
65
  subsequently incorporated within the Work.
65
66
 
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
68
  this License, each Contributor hereby grants to You a perpetual,
68
69
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
70
  copyright license to reproduce, prepare Derivative Works of,
70
71
  publicly display, publicly perform, sublicense, and distribute the
71
72
  Work and such Derivative Works in Source or Object form.
72
73
 
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
75
  this License, each Contributor hereby grants to You a perpetual,
75
76
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
77
  (except as stated in this section) patent license to make, have made,
@@ -86,24 +87,24 @@
86
87
  granted to You under this License for that Work shall terminate
87
88
  as of the date such litigation is filed.
88
89
 
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
+ 4. Redistribution. You may reproduce and distribute copies of the
90
91
  Work or Derivative Works thereof in any medium, with or without
91
92
  modifications, and in Source or Object form, provided that You
92
93
  meet the following conditions:
93
94
 
94
- (a) You must give any other recipients of the Work or
95
+ (a) You must give any other recipients of the Work or
95
96
  Derivative Works a copy of this License; and
96
97
 
97
- (b) You must cause any modified files to carry prominent notices
98
+ (b) You must cause any modified files to carry prominent notices
98
99
  stating that You changed the files; and
99
100
 
100
- (c) You must retain, in the Source form of any Derivative Works
101
+ (c) You must retain, in the Source form of any Derivative Works
101
102
  that You distribute, all copyright, patent, trademark, and
102
103
  attribution notices from the Source form of the Work,
103
104
  excluding those notices that do not pertain to any part of
104
105
  the Derivative Works; and
105
106
 
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
+ (d) If the Work includes a "NOTICE" text file as part of its
107
108
  distribution, then any Derivative Works that You distribute must
108
109
  include a readable copy of the attribution notices contained
109
110
  within such NOTICE file, excluding those notices that do not
@@ -120,14 +121,14 @@
120
121
  that such additional attribution notices cannot be construed
121
122
  as modifying the License.
122
123
 
123
- You may add Your own copyright statement to Your modifications and
124
+ You may add Your own copyright statement to Your modifications and
124
125
  may provide additional or different license terms and conditions
125
126
  for use, reproduction, or distribution of Your modifications, or
126
127
  for any such Derivative Works as a whole, provided Your use,
127
128
  reproduction, and distribution of the Work otherwise complies with
128
129
  the conditions stated in this License.
129
130
 
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
132
  any Contribution intentionally submitted for inclusion in the Work
132
133
  by You to the Licensor shall be under the terms and conditions of
133
134
  this License, without any additional terms or conditions.
@@ -135,12 +136,12 @@
135
136
  the terms of any separate license agreement you may have executed
136
137
  with Licensor regarding such Contributions.
137
138
 
138
- 6. Trademarks. This License does not grant permission to use the trade
139
+ 6. Trademarks. This License does not grant permission to use the trade
139
140
  names, trademarks, service marks, or product names of the Licensor,
140
141
  except as required for reasonable and customary use in describing the
141
142
  origin of the Work and reproducing the content of the NOTICE file.
142
143
 
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
145
  agreed to in writing, Licensor provides the Work (and each
145
146
  Contributor provides its Contributions) on an "AS IS" BASIS,
146
147
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
@@ -150,7 +151,7 @@
150
151
  appropriateness of using or redistributing the Work and assume any
151
152
  risks associated with Your exercise of permissions under this License.
152
153
 
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
+ 8. Limitation of Liability. In no event and under no legal theory,
154
155
  whether in tort (including negligence), contract, or otherwise,
155
156
  unless required by applicable law (such as deliberate and grossly
156
157
  negligent acts) or agreed to in writing, shall any Contributor be
@@ -162,7 +163,7 @@
162
163
  other commercial damages or losses), even if such Contributor
163
164
  has been advised of the possibility of such damages.
164
165
 
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
167
  the Work or Derivative Works thereof, You may choose to offer,
167
168
  and charge a fee for, acceptance of support, warranty, indemnity,
168
169
  or other liability obligations and/or rights consistent with this
@@ -173,11 +174,11 @@
173
174
  incurred by, or claims asserted against, such Contributor by reason
174
175
  of your accepting any such warranty or additional liability.
175
176
 
176
- END OF TERMS AND CONDITIONS
177
+ END OF TERMS AND CONDITIONS
177
178
 
178
- APPENDIX: How to apply the Apache License to your work.
179
+ APPENDIX: How to apply the Apache License to your work.
179
180
 
180
- To apply the Apache License to your work, attach the following
181
+ To apply the Apache License to your work, attach the following
181
182
  boilerplate notice, with the fields enclosed by brackets "[]"
182
183
  replaced with your own identifying information. (Don't include
183
184
  the brackets!) The text should be enclosed in the appropriate
@@ -186,15 +187,15 @@
186
187
  same "printed page" as the copyright notice for easier
187
188
  identification within third-party archives.
188
189
 
189
- Copyright 2019 Elasticsearch B.V.
190
+ Copyright [yyyy] [name of copyright owner]
190
191
 
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
+ Licensed under the Apache License, Version 2.0 (the "License");
192
193
  you may not use this file except in compliance with the License.
193
194
  You may obtain a copy of the License at
194
195
 
195
- http://www.apache.org/licenses/LICENSE-2.0
196
+ http://www.apache.org/licenses/LICENSE-2.0
196
197
 
197
- Unless required by applicable law or agreed to in writing, software
198
+ Unless required by applicable law or agreed to in writing, software
198
199
  distributed under the License is distributed on an "AS IS" BASIS,
199
200
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
201
  See the License for the specific language governing permissions and
data/README.md CHANGED
@@ -1,173 +1,53 @@
1
- <p align="center"><img src="https://github.com/elastic/enterprise-search-ruby/blob/master/logo-enterprise-search.png?raw=true" alt="Elastic Enterprise Search Logo"></p>
1
+ # Elastic Enterprise Search Client
2
2
 
3
- <p align="center"><a href="https://circleci.com/gh/elastic/enterprise-search-ruby"><img src="https://circleci.com/gh/elastic/enterprise-search-ruby.svg?style=svg" alt="CircleCI build"></a></p>
3
+ ![build](https://github.com/elastic/enterprise-search-ruby/workflows/master/badge.svg)
4
+ ![rubocop](https://github.com/elastic/enterprise-search-ruby/workflows/rubocop/badge.svg)
5
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
4
6
 
5
- > A first-party Ruby client for [Elastic Enterprise Search](https://www.elastic.co/solutions/enterprise-search).
7
+ Official Ruby API client for [Elastic Enterprise Search](https://www.elastic.co/enterprise-search). Use this gem to integrate App Search and Workplace Search into your Ruby code.
6
8
 
7
- ## Contents
9
+ ## Documentation
8
10
 
9
- + [Getting started](#getting-started-)
10
- + [Usage](#usage)
11
- + [FAQ](#faq-)
12
- + [Contribute](#contribute-)
13
- + [License](#license-)
11
+ [See the documentation](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/index.html) for compatibility info, configuring, and an API reference.
14
12
 
15
- ***
13
+ ## Development
16
14
 
17
- ## Getting started 🐣
15
+ ### Run Stack locally
18
16
 
19
- To install the gem, execute:
17
+ A rake task is included to run the Elastic Enterprise Search stack locally via Docker:
20
18
 
21
- ```bash
22
- gem install elastic-enterprise-search
23
19
  ```
24
-
25
- Or place `gem 'elastic-enterprise-search', '~> 0.3.0` in your `Gemfile` and run `bundle install`.
26
-
27
- ## Usage
28
-
29
- Create a new instance of the Enterprise Search Client with your access token:
30
-
31
- ```ruby
32
- Elastic::EnterpriseSearch.access_token = '' # your access token
33
- client = Elastic::EnterpriseSearch::Client.new
20
+ $ rake stack[7.10.0]
34
21
  ```
35
22
 
36
- ### Change API endpoint
23
+ This will run Elastic Enterprise Search in http://localhost:3002
24
+ - Username: `enterprise_search`
25
+ - Password: `changeme`
37
26
 
38
- ```ruby
39
- client = Elastic::EnterpriseSearch::Client.new
40
- Elastic::EnterpriseSearch.endpoint = 'https://your-server.example.com/api/v1'
41
- ```
27
+ The version of the Elastic Enterprise Search Stack to use should be the same as tags of `https://www.docker.elastic.co/r/enterprise-search`. You can also use SNAPSHOT builds such as `8.0.0-SNAPSHOT`, `7.11-SNAPSHOT`, etc.
42
28
 
43
- ### Specifying an HTTP Proxy
29
+ ### Running Tests
44
30
 
45
- ```ruby
46
- client = Elastic::EnterpriseSearch::Client.new(:proxy => 'http://localhost:8888')
47
- ```
31
+ Unit tests for the clients:
48
32
 
49
- ### Documents
50
-
51
- #### Indexing Documents
52
-
53
- This example shows how to use the index_documents method:
54
-
55
- ```ruby
56
- content_source_key = '' # your content source key
57
- documents = [
58
- {
59
- 'id' => 'INscMGmhmX4',
60
- 'url' => 'http://www.youtube.com/watch?v=v1uyQZNg2vE',
61
- 'title' => 'The Original Grumpy Cat',
62
- 'body' => 'this is a test'
63
- },
64
- {
65
- 'id' => 'JNDFojsd02',
66
- 'url' => 'http://www.youtube.com/watch?v=tsdfhk2j',
67
- 'title' => 'Another Grumpy Cat',
68
- 'body' => 'this is also a test'
69
- }
70
- ]
71
-
72
- begin
73
- document_receipts = client.index_documents(content_source_key, documents)
74
- # handle results
75
- rescue Elastic::EnterpriseSearch::ClientException => e
76
- # handle error
77
- end
78
33
  ```
79
-
80
- #### Destroying Documents
81
-
82
- ```ruby
83
- content_source_key = '' # your content source key
84
- document_ids = ['INscMGmhmX4', 'JNDFojsd02']
85
-
86
- begin
87
- destroy_document_results = client.destroy_documents(content_source_key, document_ids)
88
- # handle destroy document results
89
- rescue Elastic::EnterpriseSearch::ClientException => e
90
- # handle error
91
- end
34
+ $ rake spec:client
92
35
  ```
93
36
 
94
- ### Permissions
37
+ Integration tests: you need to have an instance of Enterprise Search running either locally or remotely, and specify the host and credentials in environment variables (see below for a complete dockerized setup). If you're using the included rake task `rake stack[:version]`, you can run the integration tests with the following command:
95
38
 
96
- #### Listing all permissions
97
-
98
- ```ruby
99
- content_source_key = '' # your content source key
100
-
101
- client.list_all_permissions(content_source_key)
102
39
  ```
103
-
104
- #### Listing all permissions with paging
105
-
106
- ```ruby
107
- content_source_key = '' # your content source key
108
-
109
- client.list_all_permissions(content_source_key, :current => 2, :size => 20)
40
+ $ ELASTIC_ENTERPRISE_HOST='http://localhost:3002' \
41
+ ELASTIC_ENTERPRISE_USER='elastic' \
42
+ ELASTIC_ENTERPRISE_PASSWORD='changeme' \
43
+ rake spec:integration
110
44
  ```
111
45
 
112
- #### Retrieve a User's permissions
113
-
114
- ```ruby
115
- content_source_key = '' # your content source key
116
- user = 'enterprise_search'
117
-
118
- client.get_user_permissions(content_source_key, user)
46
+ Run integration tests completely within containers, the way we run them on our CI:
119
47
  ```
120
-
121
- #### Add permissions to a User
122
- ```ruby
123
- content_source_key = '' # your content source key
124
- user = 'enterprise_search'
125
- permissions = ['permission1']
126
-
127
- client.add_user_permissions(content_source_key, user, :permissions => permissions)
48
+ RUNSCRIPTS=enterprise-search STACK_VERSION=7.10.0 ./.ci/run-tests
128
49
  ```
129
50
 
130
- #### Update a User's permissions
131
- ```ruby
132
- content_source_key = '' # your content source key
133
- user = 'enterprise_search'
134
- permissions = ['permission2']
135
-
136
- client.update_user_permissions(content_source_key, user, :permissions => permissions)
137
- ```
138
-
139
- #### Remove permissions from a User
140
- ```ruby
141
- content_source_key = '' # your content source key
142
- user = 'enterprise_search'
143
- permissions = ['permission2']
144
-
145
- client.remove_user_permissions(content_source_key, user, :permissions => permissions)
146
- ```
147
-
148
- ## Running tests
149
-
150
- Run tests via rspec:
151
-
152
- ```bash
153
- $ ENDPOINT=http://localhost:3002/api/v1 bundle exec rspec
154
- ```
155
-
156
- ## FAQ 🔮
157
-
158
- ### Where do I report issues with the client?
159
-
160
- If something is not working as expected, please open an [issue](https://github.com/elastic/enterprise-search-ruby/issues/new).
161
-
162
- ## Contribute 🚀
163
-
164
- We welcome contributors to the project. Before you begin, a couple notes...
165
-
166
- + Before opening a pull request, please create an issue to [discuss the scope of your proposal](https://github.com/elastic/enterprise-search-ruby/issues).
167
- + Please write simple code and concise documentation, when appropriate.
168
-
169
- ## License 📗
170
-
171
- [Apache 2.0](https://github.com/elastic/enterprise-search-ruby/blob/master/LICENSE.txt) © [Elastic](https://github.com/elastic)
51
+ ## License
172
52
 
173
- Thank you to all the [contributors](https://github.com/elastic/enterprise-search-ruby/graphs/contributors)!
53
+ Apache-2.0