couchbase 3.7.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/ext/CMakeLists.txt +4 -1
  4. data/ext/cache/extconf_include.rb +4 -3
  5. data/ext/cache/mozilla-ca-bundle.crt +66 -93
  6. data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
  7. data/ext/couchbase/CMakeLists.txt +24 -11
  8. data/ext/couchbase/cmake/APKBUILD.in +17 -1
  9. data/ext/couchbase/cmake/Bundler.cmake +9 -1
  10. data/ext/couchbase/cmake/Cache.cmake +48 -19
  11. data/ext/couchbase/cmake/CompilerOptions.cmake +3 -1
  12. data/ext/couchbase/cmake/OpenSSL.cmake +10 -2
  13. data/ext/couchbase/cmake/Packaging.cmake +48 -8
  14. data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +43 -1
  15. data/ext/couchbase/cmake/build_config.hxx.in +2 -0
  16. data/ext/couchbase/cmake/couchbase-cxx-client.spec.in +18 -0
  17. data/ext/couchbase/cmake/tarball_glob.txt +10 -0
  18. data/ext/couchbase/core/app_telemetry_meter.cxx +1 -0
  19. data/ext/couchbase/core/app_telemetry_reporter.cxx +45 -43
  20. data/ext/couchbase/core/app_telemetry_reporter.hxx +4 -3
  21. data/ext/couchbase/core/bucket.cxx +128 -13
  22. data/ext/couchbase/core/bucket.hxx +12 -2
  23. data/ext/couchbase/core/cluster.cxx +304 -152
  24. data/ext/couchbase/core/cluster.hxx +32 -0
  25. data/ext/couchbase/core/cluster_credentials.cxx +25 -0
  26. data/ext/couchbase/core/cluster_credentials.hxx +5 -0
  27. data/ext/couchbase/core/cluster_label_listener.cxx +72 -0
  28. data/ext/couchbase/core/cluster_label_listener.hxx +46 -0
  29. data/ext/couchbase/core/cluster_options.hxx +4 -0
  30. data/ext/couchbase/core/deprecation_utils.hxx +26 -0
  31. data/ext/couchbase/core/error.hxx +27 -0
  32. data/ext/couchbase/core/free_form_http_request.hxx +0 -2
  33. data/ext/couchbase/core/http_component.cxx +12 -48
  34. data/ext/couchbase/core/impl/analytics.cxx +3 -2
  35. data/ext/couchbase/core/impl/analytics.hxx +2 -1
  36. data/ext/couchbase/core/impl/analytics_index_manager.cxx +249 -137
  37. data/ext/couchbase/core/impl/binary_collection.cxx +134 -58
  38. data/ext/couchbase/core/impl/bucket_manager.cxx +87 -35
  39. data/ext/couchbase/core/impl/collection.cxx +560 -245
  40. data/ext/couchbase/core/impl/collection_manager.cxx +89 -49
  41. data/ext/couchbase/core/impl/dns_srv_tracker.cxx +4 -4
  42. data/ext/couchbase/core/impl/error.cxx +20 -13
  43. data/ext/couchbase/core/impl/error.hxx +15 -10
  44. data/ext/couchbase/core/impl/get_all_replicas.hxx +1 -1
  45. data/ext/couchbase/core/impl/get_any_replica.hxx +2 -1
  46. data/ext/couchbase/core/impl/get_replica.hxx +2 -0
  47. data/ext/couchbase/core/impl/lookup_in_replica.hxx +1 -1
  48. data/ext/couchbase/core/impl/observability_recorder.cxx +161 -0
  49. data/ext/couchbase/core/impl/observability_recorder.hxx +77 -0
  50. data/ext/couchbase/core/impl/observe_seqno.hxx +2 -0
  51. data/ext/couchbase/core/impl/public_bucket.cxx +31 -7
  52. data/ext/couchbase/core/impl/public_cluster.cxx +107 -19
  53. data/ext/couchbase/core/impl/query.cxx +6 -3
  54. data/ext/couchbase/core/impl/query.hxx +3 -1
  55. data/ext/couchbase/core/impl/query_index_manager.cxx +267 -102
  56. data/ext/couchbase/core/impl/scope.cxx +53 -11
  57. data/ext/couchbase/core/impl/search.cxx +8 -4
  58. data/ext/couchbase/core/impl/search.hxx +6 -2
  59. data/ext/couchbase/core/impl/search_index_manager.cxx +131 -41
  60. data/ext/couchbase/core/impl/with_cancellation.hxx +75 -0
  61. data/ext/couchbase/core/io/config_tracker.cxx +9 -9
  62. data/ext/couchbase/core/io/config_tracker.hxx +2 -1
  63. data/ext/couchbase/core/io/http_command.hxx +98 -49
  64. data/ext/couchbase/core/io/http_context.hxx +2 -0
  65. data/ext/couchbase/core/io/http_session.cxx +23 -10
  66. data/ext/couchbase/core/io/http_session.hxx +17 -9
  67. data/ext/couchbase/core/io/http_session_manager.hxx +163 -228
  68. data/ext/couchbase/core/io/http_traits.hxx +0 -7
  69. data/ext/couchbase/core/io/mcbp_command.hxx +123 -44
  70. data/ext/couchbase/core/io/mcbp_session.cxx +251 -26
  71. data/ext/couchbase/core/io/mcbp_session.hxx +9 -1
  72. data/ext/couchbase/core/io/mcbp_traits.hxx +0 -8
  73. data/ext/couchbase/core/io/streams.cxx +3 -3
  74. data/ext/couchbase/core/io/streams.hxx +3 -2
  75. data/ext/couchbase/core/meta/features.hxx +15 -0
  76. data/ext/couchbase/core/meta/version.cxx +13 -0
  77. data/ext/couchbase/core/meta/version.hxx +3 -0
  78. data/ext/couchbase/core/metrics/constants.hxx +23 -0
  79. data/ext/couchbase/core/metrics/logging_meter.cxx +5 -5
  80. data/ext/couchbase/core/metrics/meter_wrapper.cxx +65 -63
  81. data/ext/couchbase/core/metrics/meter_wrapper.hxx +12 -10
  82. data/ext/couchbase/core/operations/document_analytics.hxx +0 -5
  83. data/ext/couchbase/core/operations/document_append.hxx +0 -4
  84. data/ext/couchbase/core/operations/document_decrement.hxx +0 -5
  85. data/ext/couchbase/core/operations/document_exists.hxx +0 -7
  86. data/ext/couchbase/core/operations/document_get.hxx +0 -7
  87. data/ext/couchbase/core/operations/document_get_all_replicas.hxx +77 -27
  88. data/ext/couchbase/core/operations/document_get_and_lock.hxx +0 -9
  89. data/ext/couchbase/core/operations/document_get_and_touch.hxx +0 -9
  90. data/ext/couchbase/core/operations/document_get_any_replica.hxx +83 -2
  91. data/ext/couchbase/core/operations/document_get_projected.hxx +0 -9
  92. data/ext/couchbase/core/operations/document_increment.hxx +0 -5
  93. data/ext/couchbase/core/operations/document_insert.hxx +0 -4
  94. data/ext/couchbase/core/operations/document_lookup_in.hxx +0 -9
  95. data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +46 -4
  96. data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +121 -43
  97. data/ext/couchbase/core/operations/document_mutate_in.hxx +0 -5
  98. data/ext/couchbase/core/operations/document_prepend.hxx +0 -4
  99. data/ext/couchbase/core/operations/document_query.hxx +0 -4
  100. data/ext/couchbase/core/operations/document_remove.hxx +0 -4
  101. data/ext/couchbase/core/operations/document_replace.hxx +0 -4
  102. data/ext/couchbase/core/operations/document_search.hxx +0 -7
  103. data/ext/couchbase/core/operations/document_touch.hxx +0 -7
  104. data/ext/couchbase/core/operations/document_unlock.hxx +0 -6
  105. data/ext/couchbase/core/operations/document_upsert.hxx +0 -4
  106. data/ext/couchbase/core/operations/document_view.cxx +2 -0
  107. data/ext/couchbase/core/operations/document_view.hxx +10 -13
  108. data/ext/couchbase/core/operations/http_noop.hxx +2 -0
  109. data/ext/couchbase/core/operations/management/analytics_dataset_create.hxx +2 -0
  110. data/ext/couchbase/core/operations/management/analytics_dataset_drop.hxx +2 -0
  111. data/ext/couchbase/core/operations/management/analytics_dataset_get_all.hxx +2 -0
  112. data/ext/couchbase/core/operations/management/analytics_dataverse_create.hxx +2 -0
  113. data/ext/couchbase/core/operations/management/analytics_dataverse_drop.hxx +2 -0
  114. data/ext/couchbase/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
  115. data/ext/couchbase/core/operations/management/analytics_index_create.hxx +2 -0
  116. data/ext/couchbase/core/operations/management/analytics_index_drop.hxx +2 -0
  117. data/ext/couchbase/core/operations/management/analytics_index_get_all.hxx +2 -0
  118. data/ext/couchbase/core/operations/management/analytics_link_connect.hxx +2 -0
  119. data/ext/couchbase/core/operations/management/analytics_link_create.hxx +2 -0
  120. data/ext/couchbase/core/operations/management/analytics_link_disconnect.hxx +2 -0
  121. data/ext/couchbase/core/operations/management/analytics_link_drop.hxx +2 -0
  122. data/ext/couchbase/core/operations/management/analytics_link_get_all.hxx +2 -0
  123. data/ext/couchbase/core/operations/management/analytics_link_replace.hxx +2 -0
  124. data/ext/couchbase/core/operations/management/bucket_create.hxx +2 -0
  125. data/ext/couchbase/core/operations/management/bucket_describe.hxx +2 -0
  126. data/ext/couchbase/core/operations/management/bucket_drop.hxx +2 -0
  127. data/ext/couchbase/core/operations/management/bucket_flush.hxx +2 -0
  128. data/ext/couchbase/core/operations/management/bucket_get.hxx +2 -0
  129. data/ext/couchbase/core/operations/management/bucket_get_all.hxx +2 -0
  130. data/ext/couchbase/core/operations/management/bucket_update.hxx +2 -0
  131. data/ext/couchbase/core/operations/management/change_password.hxx +2 -0
  132. data/ext/couchbase/core/operations/management/cluster_describe.hxx +2 -0
  133. data/ext/couchbase/core/operations/management/cluster_developer_preview_enable.hxx +2 -0
  134. data/ext/couchbase/core/operations/management/collection_create.hxx +2 -0
  135. data/ext/couchbase/core/operations/management/collection_drop.hxx +2 -0
  136. data/ext/couchbase/core/operations/management/collection_update.hxx +2 -0
  137. data/ext/couchbase/core/operations/management/collections_manifest_get.hxx +2 -0
  138. data/ext/couchbase/core/operations/management/error_utils.cxx +4 -1
  139. data/ext/couchbase/core/operations/management/eventing_deploy_function.hxx +2 -0
  140. data/ext/couchbase/core/operations/management/eventing_drop_function.hxx +2 -0
  141. data/ext/couchbase/core/operations/management/eventing_get_all_functions.hxx +2 -0
  142. data/ext/couchbase/core/operations/management/eventing_get_function.hxx +2 -0
  143. data/ext/couchbase/core/operations/management/eventing_get_status.hxx +2 -0
  144. data/ext/couchbase/core/operations/management/eventing_pause_function.hxx +2 -0
  145. data/ext/couchbase/core/operations/management/eventing_resume_function.hxx +2 -0
  146. data/ext/couchbase/core/operations/management/eventing_undeploy_function.hxx +2 -0
  147. data/ext/couchbase/core/operations/management/eventing_upsert_function.hxx +2 -0
  148. data/ext/couchbase/core/operations/management/freeform.hxx +2 -0
  149. data/ext/couchbase/core/operations/management/group_drop.hxx +2 -0
  150. data/ext/couchbase/core/operations/management/group_get.hxx +2 -0
  151. data/ext/couchbase/core/operations/management/group_get_all.hxx +2 -0
  152. data/ext/couchbase/core/operations/management/group_upsert.hxx +2 -0
  153. data/ext/couchbase/core/operations/management/query_index_build.hxx +2 -0
  154. data/ext/couchbase/core/operations/management/query_index_build_deferred.hxx +68 -30
  155. data/ext/couchbase/core/operations/management/query_index_create.hxx +2 -0
  156. data/ext/couchbase/core/operations/management/query_index_drop.hxx +2 -0
  157. data/ext/couchbase/core/operations/management/query_index_get_all.hxx +4 -3
  158. data/ext/couchbase/core/operations/management/query_index_get_all_deferred.hxx +2 -1
  159. data/ext/couchbase/core/operations/management/role_get_all.hxx +2 -0
  160. data/ext/couchbase/core/operations/management/scope_create.hxx +2 -0
  161. data/ext/couchbase/core/operations/management/scope_drop.hxx +2 -0
  162. data/ext/couchbase/core/operations/management/scope_get_all.hxx +2 -0
  163. data/ext/couchbase/core/operations/management/search_get_stats.hxx +2 -0
  164. data/ext/couchbase/core/operations/management/search_index_analyze_document.hxx +2 -0
  165. data/ext/couchbase/core/operations/management/search_index_control_ingest.hxx +2 -0
  166. data/ext/couchbase/core/operations/management/search_index_control_plan_freeze.hxx +2 -0
  167. data/ext/couchbase/core/operations/management/search_index_control_query.hxx +2 -0
  168. data/ext/couchbase/core/operations/management/search_index_drop.hxx +2 -0
  169. data/ext/couchbase/core/operations/management/search_index_get.hxx +2 -0
  170. data/ext/couchbase/core/operations/management/search_index_get_all.hxx +2 -0
  171. data/ext/couchbase/core/operations/management/search_index_get_documents_count.hxx +2 -0
  172. data/ext/couchbase/core/operations/management/search_index_get_stats.hxx +2 -0
  173. data/ext/couchbase/core/operations/management/search_index_upsert.hxx +2 -0
  174. data/ext/couchbase/core/operations/management/user_drop.hxx +2 -0
  175. data/ext/couchbase/core/operations/management/user_get.hxx +2 -0
  176. data/ext/couchbase/core/operations/management/user_get_all.hxx +2 -0
  177. data/ext/couchbase/core/operations/management/user_upsert.hxx +2 -0
  178. data/ext/couchbase/core/operations/management/view_index_drop.hxx +2 -0
  179. data/ext/couchbase/core/operations/management/view_index_get.hxx +2 -0
  180. data/ext/couchbase/core/operations/management/view_index_get_all.hxx +2 -0
  181. data/ext/couchbase/core/operations/management/view_index_upsert.hxx +2 -0
  182. data/ext/couchbase/core/operations/operation_traits.hxx +6 -0
  183. data/ext/couchbase/core/operations.hxx +0 -1
  184. data/ext/couchbase/core/operations_fwd.hxx +8 -0
  185. data/ext/couchbase/core/origin.cxx +67 -12
  186. data/ext/couchbase/core/origin.hxx +13 -8
  187. data/ext/couchbase/core/orphan_reporter.cxx +164 -0
  188. data/ext/couchbase/core/orphan_reporter.hxx +65 -0
  189. data/ext/couchbase/core/sasl/CMakeLists.txt +1 -0
  190. data/ext/couchbase/core/sasl/client.cc +6 -0
  191. data/ext/couchbase/core/sasl/mechanism.cc +2 -1
  192. data/ext/couchbase/core/sasl/mechanism.h +2 -1
  193. data/ext/couchbase/core/sasl/oauthbearer/oauthbearer.cc +41 -0
  194. data/ext/couchbase/core/sasl/oauthbearer/oauthbearer.h +47 -0
  195. data/ext/couchbase/core/tls_context_provider.cxx +44 -0
  196. data/ext/couchbase/core/tls_context_provider.hxx +44 -0
  197. data/ext/couchbase/core/tracing/attribute_helpers.hxx +45 -0
  198. data/ext/couchbase/core/tracing/constants.hxx +148 -68
  199. data/ext/couchbase/core/tracing/threshold_logging_options.hxx +0 -3
  200. data/ext/couchbase/core/tracing/threshold_logging_tracer.cxx +122 -170
  201. data/ext/couchbase/core/tracing/tracer_wrapper.cxx +17 -24
  202. data/ext/couchbase/core/tracing/tracer_wrapper.hxx +8 -10
  203. data/ext/couchbase/core/tracing/wrapper_sdk_tracer.cxx +114 -0
  204. data/ext/couchbase/core/tracing/wrapper_sdk_tracer.hxx +85 -0
  205. data/ext/couchbase/core/transactions/attempt_context_impl.cxx +16 -14
  206. data/ext/couchbase/core/transactions/attempt_context_impl.hxx +4 -4
  207. data/ext/couchbase/core/transactions/transactions.cxx +1 -1
  208. data/ext/couchbase/core/transactions/transactions_cleanup.cxx +1 -2
  209. data/ext/couchbase/core/utils/byteswap.hxx +12 -0
  210. data/ext/couchbase/core/utils/concurrent_fixed_priority_queue.hxx +102 -0
  211. data/ext/couchbase/core/utils/connection_string.cxx +2 -0
  212. data/ext/couchbase/couchbase/certificate_authenticator.hxx +1 -0
  213. data/ext/couchbase/couchbase/cluster.hxx +47 -0
  214. data/ext/couchbase/couchbase/cluster_options.hxx +16 -0
  215. data/ext/couchbase/couchbase/collection.hxx +60 -15
  216. data/ext/couchbase/couchbase/error_codes.hxx +48 -48
  217. data/ext/couchbase/couchbase/jwt_authenticator.hxx +52 -0
  218. data/ext/couchbase/couchbase/metrics/meter.hxx +2 -1
  219. data/ext/couchbase/couchbase/metrics/otel_meter.hxx +75 -80
  220. data/ext/couchbase/couchbase/network_options.hxx +19 -0
  221. data/ext/couchbase/couchbase/password_authenticator.hxx +1 -0
  222. data/ext/couchbase/couchbase/tracing/otel_tracer.hxx +15 -17
  223. data/ext/couchbase/couchbase/tracing/request_span.hxx +2 -2
  224. data/ext/couchbase.cxx +4 -0
  225. data/ext/extconf.rb +1 -0
  226. data/ext/rcb_analytics.cxx +157 -47
  227. data/ext/rcb_backend.cxx +118 -71
  228. data/ext/rcb_buckets.cxx +39 -16
  229. data/ext/rcb_collections.cxx +36 -12
  230. data/ext/rcb_crud.cxx +587 -294
  231. data/ext/rcb_hdr_histogram.cxx +219 -0
  232. data/ext/rcb_hdr_histogram.hxx +28 -0
  233. data/ext/rcb_multi.cxx +142 -59
  234. data/ext/rcb_observability.cxx +132 -0
  235. data/ext/rcb_observability.hxx +49 -0
  236. data/ext/rcb_query.cxx +77 -27
  237. data/ext/rcb_search.cxx +92 -31
  238. data/ext/rcb_users.cxx +69 -26
  239. data/ext/rcb_utils.cxx +91 -0
  240. data/ext/rcb_utils.hxx +141 -168
  241. data/ext/rcb_views.cxx +36 -12
  242. data/lib/active_support/cache/couchbase_store.rb +6 -6
  243. data/lib/couchbase/authenticator.rb +14 -0
  244. data/lib/couchbase/binary_collection.rb +37 -22
  245. data/lib/couchbase/bucket.rb +46 -31
  246. data/lib/couchbase/cluster.rb +146 -61
  247. data/lib/couchbase/collection.rb +257 -186
  248. data/lib/couchbase/datastructures/couchbase_list.rb +81 -50
  249. data/lib/couchbase/datastructures/couchbase_map.rb +86 -50
  250. data/lib/couchbase/datastructures/couchbase_queue.rb +64 -38
  251. data/lib/couchbase/datastructures/couchbase_set.rb +57 -41
  252. data/lib/couchbase/deprecations.rb +1 -1
  253. data/lib/couchbase/diagnostics.rb +8 -8
  254. data/lib/couchbase/errors.rb +6 -0
  255. data/lib/couchbase/management/analytics_index_manager.rb +90 -59
  256. data/lib/couchbase/management/bucket_manager.rb +73 -45
  257. data/lib/couchbase/management/collection_manager.rb +86 -43
  258. data/lib/couchbase/management/collection_query_index_manager.rb +56 -33
  259. data/lib/couchbase/management/query_index_manager.rb +88 -36
  260. data/lib/couchbase/management/scope_search_index_manager.rb +119 -52
  261. data/lib/couchbase/management/search_index_manager.rb +401 -178
  262. data/lib/couchbase/management/user_manager.rb +343 -174
  263. data/lib/couchbase/management/view_index_manager.rb +166 -73
  264. data/lib/couchbase/metrics/logging_meter.rb +108 -0
  265. data/lib/couchbase/metrics/logging_value_recorder.rb +50 -0
  266. data/lib/couchbase/metrics/meter.rb +27 -0
  267. data/lib/couchbase/metrics/noop_meter.rb +30 -0
  268. data/lib/couchbase/metrics/noop_value_recorder.rb +27 -0
  269. data/lib/couchbase/metrics/value_recorder.rb +25 -0
  270. data/lib/couchbase/options.rb +69 -3
  271. data/lib/couchbase/protostellar/cluster.rb +3 -0
  272. data/lib/couchbase/scope.rb +62 -48
  273. data/lib/couchbase/search_options.rb +18 -18
  274. data/lib/couchbase/tracing/noop_span.rb +29 -0
  275. data/lib/couchbase/tracing/noop_tracer.rb +29 -0
  276. data/lib/couchbase/tracing/request_span.rb +34 -0
  277. data/lib/couchbase/tracing/request_tracer.rb +28 -0
  278. data/lib/couchbase/tracing/threshold_logging_span.rb +112 -0
  279. data/lib/couchbase/tracing/threshold_logging_tracer.rb +231 -0
  280. data/lib/couchbase/utils/hdr_histogram.rb +55 -0
  281. data/lib/couchbase/utils/observability.rb +257 -0
  282. data/lib/couchbase/utils/observability_constants.rb +200 -0
  283. data/lib/couchbase/utils/stdlib_logger_adapter.rb +1 -3
  284. data/lib/couchbase/version.rb +1 -1
  285. data/lib/couchbase.rb +2 -2
  286. metadata +58 -6
@@ -15,92 +15,374 @@
15
15
  # limitations under the License.
16
16
 
17
17
  require "couchbase/errors"
18
+ require "couchbase/options"
18
19
 
19
20
  module Couchbase
20
21
  module Management
22
+ module Options
23
+ module Search
24
+ # Options for {SearchIndexManager#get_index}
25
+ class GetIndex < ::Couchbase::Options::Base
26
+ # Creates an instance of options for {SearchIndexManager#get_index}
27
+ #
28
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
29
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
30
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
31
+ #
32
+ # @yieldparam [GetIndex] self
33
+ def initialize(timeout: nil,
34
+ retry_strategy: nil,
35
+ parent_span: nil)
36
+ super
37
+ yield self if block_given?
38
+ end
39
+
40
+ # @api private
41
+ DEFAULT = new.freeze
42
+ end
43
+
44
+ # Options for {SearchIndexManager#get_all_indexes}
45
+ class GetAllIndexes < ::Couchbase::Options::Base
46
+ # Creates an instance of options for {SearchIndexManager#get_all_indexes}
47
+ #
48
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
49
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
50
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
51
+ #
52
+ # @yieldparam [GetAllIndexes] self
53
+ def initialize(timeout: nil,
54
+ retry_strategy: nil,
55
+ parent_span: nil)
56
+ super
57
+ yield self if block_given?
58
+ end
59
+
60
+ # @api private
61
+ DEFAULT = new.freeze
62
+ end
63
+
64
+ # Options for {SearchIndexManager#upsert_index}
65
+ class UpsertIndex < ::Couchbase::Options::Base
66
+ # Creates an instance of options for {SearchIndexManager#upsert_index}
67
+ #
68
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
69
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
70
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
71
+ #
72
+ # @yieldparam [UpsertIndex] self
73
+ def initialize(timeout: nil,
74
+ retry_strategy: nil,
75
+ parent_span: nil)
76
+ super
77
+ yield self if block_given?
78
+ end
79
+
80
+ # @api private
81
+ DEFAULT = new.freeze
82
+ end
83
+
84
+ # Options for {SearchIndexManager#drop_index}
85
+ class DropIndex < ::Couchbase::Options::Base
86
+ # Creates an instance of options for {SearchIndexManager#drop_index}
87
+ #
88
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
89
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
90
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
91
+ #
92
+ # @yieldparam [DropIndex] self
93
+ def initialize(timeout: nil,
94
+ retry_strategy: nil,
95
+ parent_span: nil)
96
+ super
97
+ yield self if block_given?
98
+ end
99
+
100
+ # @api private
101
+ DEFAULT = new.freeze
102
+ end
103
+
104
+ # Options for {SearchIndexManager#get_indexed_documents_count}
105
+ class GetIndexedDocumentsCount < ::Couchbase::Options::Base
106
+ # Creates an instance of options for {SearchIndexManager#get_indexed_documents_count}
107
+ #
108
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
109
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
110
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
111
+ #
112
+ # @yieldparam [GetIndexedDocumentsCount] self
113
+ def initialize(timeout: nil,
114
+ retry_strategy: nil,
115
+ parent_span: nil)
116
+ super
117
+ yield self if block_given?
118
+ end
119
+
120
+ # @api private
121
+ DEFAULT = new.freeze
122
+ end
123
+
124
+ # Options for {SearchIndexManager#get_index_stats}
125
+ class GetIndexStats < ::Couchbase::Options::Base
126
+ # Creates an instance of options for {SearchIndexManager#get_index_stats}
127
+ #
128
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
129
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
130
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
131
+ #
132
+ # @yieldparam [GetIndexStats] self
133
+ def initialize(timeout: nil,
134
+ retry_strategy: nil,
135
+ parent_span: nil)
136
+ super
137
+ yield self if block_given?
138
+ end
139
+
140
+ # @api private
141
+ DEFAULT = new.freeze
142
+ end
143
+
144
+ # Options for {SearchIndexManager#pause_ingest}
145
+ class PauseIngest < ::Couchbase::Options::Base
146
+ # Creates an instance of options for {SearchIndexManager#pause_ingest}
147
+ #
148
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
149
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
150
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
151
+ #
152
+ # @yieldparam [PauseIngest] self
153
+ def initialize(timeout: nil,
154
+ retry_strategy: nil,
155
+ parent_span: nil)
156
+ super
157
+ yield self if block_given?
158
+ end
159
+
160
+ # @api private
161
+ DEFAULT = new.freeze
162
+ end
163
+
164
+ # Options for {SearchIndexManager#resume_ingest}
165
+ class ResumeIngest < ::Couchbase::Options::Base
166
+ # Creates an instance of options for {SearchIndexManager#resume_ingest}
167
+ #
168
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
169
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
170
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
171
+ #
172
+ # @yieldparam [ResumeIngest] self
173
+ def initialize(timeout: nil,
174
+ retry_strategy: nil,
175
+ parent_span: nil)
176
+ super
177
+ yield self if block_given?
178
+ end
179
+
180
+ # @api private
181
+ DEFAULT = new.freeze
182
+ end
183
+
184
+ # Options for {SearchIndexManager#allow_querying}
185
+ class AllowQuerying < ::Couchbase::Options::Base
186
+ # Creates an instance of options for {SearchIndexManager#allow_querying}
187
+ #
188
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
189
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
190
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
191
+ #
192
+ # @yieldparam [AllowQuerying] self
193
+ def initialize(timeout: nil,
194
+ retry_strategy: nil,
195
+ parent_span: nil)
196
+ super
197
+ yield self if block_given?
198
+ end
199
+
200
+ # @api private
201
+ DEFAULT = new.freeze
202
+ end
203
+
204
+ # Options for {SearchIndexManager#disallow_querying}
205
+ class DisallowQuerying < ::Couchbase::Options::Base
206
+ # Creates an instance of options for {SearchIndexManager#disallow_querying}
207
+ #
208
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
209
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
210
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
211
+ #
212
+ # @yieldparam [DisallowQuerying] self
213
+ def initialize(timeout: nil,
214
+ retry_strategy: nil,
215
+ parent_span: nil)
216
+ super
217
+ yield self if block_given?
218
+ end
219
+
220
+ # @api private
221
+ DEFAULT = new.freeze
222
+ end
223
+
224
+ # Options for {SearchIndexManager#freeze_plan}
225
+ class FreezePlan < ::Couchbase::Options::Base
226
+ # Creates an instance of options for {SearchIndexManager#freeze_plan}
227
+ #
228
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
229
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
230
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
231
+ #
232
+ # @yieldparam [FreezePlan] self
233
+ def initialize(timeout: nil,
234
+ retry_strategy: nil,
235
+ parent_span: nil)
236
+ super
237
+ yield self if block_given?
238
+ end
239
+
240
+ # @api private
241
+ DEFAULT = new.freeze
242
+ end
243
+
244
+ # Options for {SearchIndexManager#unfreeze_plan}
245
+ class UnfreezePlan < ::Couchbase::Options::Base
246
+ # Creates an instance of options for {SearchIndexManager#unfreeze_plan}
247
+ #
248
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
249
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
250
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
251
+ #
252
+ # @yieldparam [UnfreezePlan] self
253
+ def initialize(timeout: nil,
254
+ retry_strategy: nil,
255
+ parent_span: nil)
256
+ super
257
+ yield self if block_given?
258
+ end
259
+
260
+ # @api private
261
+ DEFAULT = new.freeze
262
+ end
263
+
264
+ # Options for {SearchIndexManager#analyze_document}
265
+ class AnalyzeDocument < ::Couchbase::Options::Base
266
+ # Creates an instance of options for {SearchIndexManager#analyze_document}
267
+ #
268
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
269
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
270
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
271
+ #
272
+ # @yieldparam [AnalyzeDocument] self
273
+ def initialize(timeout: nil,
274
+ retry_strategy: nil,
275
+ parent_span: nil)
276
+ super
277
+ yield self if block_given?
278
+ end
279
+
280
+ # @api private
281
+ DEFAULT = new.freeze
282
+ end
283
+ end
284
+ end
285
+
21
286
  class SearchIndexManager
22
287
  alias inspect to_s
23
288
 
24
289
  # @param [Couchbase::Backend] backend
25
- def initialize(backend)
290
+ # @param [Couchbase::Observability::Wrapper] observability wrapper
291
+ #
292
+ # @api private
293
+ def initialize(backend, observability)
26
294
  @backend = backend
295
+ @observability = observability
27
296
  end
28
297
 
29
298
  # Fetches an index from the server if it exists
30
299
  #
31
300
  # @param [String] index_name name of the index
32
- # @param [GetIndexOptions] options
301
+ # @param [Options::Search::GetIndex] options
33
302
  #
34
303
  # @return [SearchIndex]
35
304
  #
36
305
  # @raise [ArgumentError]
37
306
  # @raise [Error::IndexNotFound]
38
- def get_index(index_name, options = GetIndexOptions.new)
39
- res = @backend.search_index_get(nil, nil, index_name, options.timeout)
40
- self.class.extract_search_index(res)
307
+ def get_index(index_name, options = Options::Search::GetIndex::DEFAULT)
308
+ @observability.record_operation(Observability::OP_SM_GET_INDEX, options.parent_span, self, :search) do |obs_handler|
309
+ res = @backend.search_index_get(nil, nil, index_name, options.timeout, obs_handler)
310
+ self.class.extract_search_index(res)
311
+ end
41
312
  end
42
313
 
43
314
  # Fetches all indexes from the server
44
315
  #
45
- # @param [GetAllIndexesOptions] options
316
+ # @param [Options::Search::GetAllIndexes] options
46
317
  #
47
318
  # @return [Array<SearchIndex>]
48
- def get_all_indexes(options = GetAllIndexesOptions.new)
49
- res = @backend.search_index_get_all(nil, nil, options.timeout)
50
- res[:indexes].map { |idx| self.class.extract_search_index(idx) }
319
+ def get_all_indexes(options = Options::Search::GetAllIndexes::DEFAULT)
320
+ @observability.record_operation(Observability::OP_SM_GET_ALL_INDEXES, options.parent_span, self, :search) do |obs_handler|
321
+ res = @backend.search_index_get_all(nil, nil, options.timeout, obs_handler)
322
+ res[:indexes].map { |idx| self.class.extract_search_index(idx) }
323
+ end
51
324
  end
52
325
 
53
326
  # Creates or updates the index
54
327
  #
55
328
  # @param [SearchIndex] index_definition the index definition
56
- # @param [UpsertIndexOptions] options
329
+ # @param [Options::Search::UpsertIndex] options
57
330
  #
58
331
  # @return void
59
332
  #
60
333
  # @raise [ArgumentError] if name, type or source_type is empty
61
- def upsert_index(index_definition, options = UpsertIndexOptions.new)
62
- @backend.search_index_upsert(
63
- nil,
64
- nil,
65
- {
66
- name: index_definition.name,
67
- type: index_definition.type,
68
- uuid: index_definition.uuid,
69
- params: (JSON.generate(index_definition.params) if index_definition.params),
70
- source_name: index_definition.source_name,
71
- source_type: index_definition.source_type,
72
- source_uuid: index_definition.source_uuid,
73
- source_params: (JSON.generate(index_definition.source_params) if index_definition.source_params),
74
- plan_params: (JSON.generate(index_definition.plan_params) if index_definition.plan_params),
75
- }, options.timeout
76
- )
334
+ def upsert_index(index_definition, options = Options::Search::UpsertIndex::DEFAULT)
335
+ @observability.record_operation(Observability::OP_SM_UPSERT_INDEX, options.parent_span, self, :search) do |obs_handler|
336
+ @backend.search_index_upsert(
337
+ nil,
338
+ nil,
339
+ {
340
+ name: index_definition.name,
341
+ type: index_definition.type,
342
+ uuid: index_definition.uuid,
343
+ params: (JSON.generate(index_definition.params) if index_definition.params),
344
+ source_name: index_definition.source_name,
345
+ source_type: index_definition.source_type,
346
+ source_uuid: index_definition.source_uuid,
347
+ source_params: (JSON.generate(index_definition.source_params) if index_definition.source_params),
348
+ plan_params: (JSON.generate(index_definition.plan_params) if index_definition.plan_params),
349
+ },
350
+ options.timeout,
351
+ obs_handler,
352
+ )
353
+ end
77
354
  end
78
355
 
79
356
  # Drops the index
80
357
  #
81
358
  # @param [String] index_name name of the index
82
- # @param [DropIndexOptions] options
359
+ # @param [Options::Search::DropIndex] options
83
360
  #
84
361
  # @return void
85
362
  #
86
363
  # @raise [ArgumentError]
87
364
  # @raise [Error::IndexNotFound]
88
- def drop_index(index_name, options = DropIndexOptions.new)
89
- @backend.search_index_drop(nil, nil, index_name, options.timeout)
365
+ def drop_index(index_name, options = Options::Search::DropIndex::DEFAULT)
366
+ @observability.record_operation(Observability::OP_SM_DROP_INDEX, options.parent_span, self, :search) do |obs_handler|
367
+ @backend.search_index_drop(nil, nil, index_name, options.timeout, obs_handler)
368
+ end
90
369
  end
91
370
 
92
371
  # Retrieves the number of documents that have been indexed for an index
93
372
  #
94
373
  # @param [String] index_name name of the index
95
- # @param [GetIndexedDocumentsCountOptions] options
374
+ # @param [Options::Search::GetIndexedDocumentsCount] options
96
375
  #
97
376
  # @return [Integer]
98
377
  #
99
378
  # @raise [ArgumentError]
100
379
  # @raise [Error::IndexNotFound]
101
- def get_indexed_documents_count(index_name, options = GetIndexedDocumentsCountOptions.new)
102
- res = @backend.search_index_get_documents_count(nil, nil, index_name, options.timeout)
103
- res[:count]
380
+ def get_indexed_documents_count(index_name, options = Options::Search::GetIndexedDocumentsCount::DEFAULT)
381
+ @observability.record_operation(Observability::OP_SM_GET_INDEXED_DOCUMENTS_COUNT, options.parent_span, self,
382
+ :search) do |obs_handler|
383
+ res = @backend.search_index_get_documents_count(nil, nil, index_name, options.timeout, obs_handler)
384
+ res[:count]
385
+ end
104
386
  end
105
387
 
106
388
  # Retrieves metrics, timings and counters for a given index
@@ -108,15 +390,17 @@ module Couchbase
108
390
  # @!macro uncommitted
109
391
  #
110
392
  # @param [String] index_name name of the index
111
- # @param [GetIndexStatsOptions] options
393
+ # @param [Options::Search::GetIndexStats] options
112
394
  #
113
395
  # @return [Integer]
114
396
  #
115
397
  # @raise [ArgumentError]
116
398
  # @raise [Error::IndexNotFound]
117
- def get_index_stats(index_name, options = GetIndexStatsOptions.new)
118
- res = @backend.search_index_get_stats(index_name, options.timeout)
119
- JSON.parse(res)
399
+ def get_index_stats(index_name, options = Options::Search::GetIndexStats::DEFAULT)
400
+ @observability.record_operation(Observability::OP_SM_GET_INDEX_STATS, options.parent_span, self, :search) do |obs_handler|
401
+ res = @backend.search_index_get_stats(index_name, options.timeout, obs_handler)
402
+ JSON.parse(res)
403
+ end
120
404
  end
121
405
 
122
406
  # Retrieves statistics on search service. Information is provided on documents, partition indexes, mutations,
@@ -124,237 +408,176 @@ module Couchbase
124
408
  #
125
409
  # @!macro uncommitted
126
410
  #
127
- # @param [GetIndexStatsOptions] options
411
+ # @param [Options::Search::GetIndexStats] options
128
412
  #
129
413
  # @return [Integer]
130
414
  #
131
415
  # @raise [ArgumentError]
132
- def get_stats(options = GetIndexStatsOptions.new)
133
- res = @backend.search_get_stats(options.timeout)
134
- JSON.parse(res)
416
+ def get_stats(options = Options::Search::GetIndexStats::DEFAULT)
417
+ @observability.record_operation(Observability::OP_SM_GET_STATS, options.parent_span, self, :search) do |obs_handler|
418
+ res = @backend.search_get_stats(options.timeout, obs_handler)
419
+ JSON.parse(res)
420
+ end
135
421
  end
136
422
 
137
423
  # Pauses updates and maintenance for the index
138
424
  #
139
425
  # @param [String] index_name name of the index
140
- # @param [PauseIngestOptions] options
426
+ # @param [Options::Search::PauseIngest] options
141
427
  #
142
428
  # @return void
143
429
  #
144
430
  # @raise [ArgumentError]
145
431
  # @raise [Error::IndexNotFound]
146
- def pause_ingest(index_name, options = PauseIngestOptions.new)
147
- @backend.search_index_pause_ingest(nil, nil, index_name, options.timeout)
432
+ def pause_ingest(index_name, options = Options::Search::PauseIngest::DEFAULT)
433
+ @observability.record_operation(Observability::OP_SM_PAUSE_INGEST, options.parent_span, self, :search) do |obs_handler|
434
+ @backend.search_index_pause_ingest(nil, nil, index_name, options.timeout, obs_handler)
435
+ end
148
436
  end
149
437
 
150
438
  # Resumes updates and maintenance for an index
151
439
  #
152
440
  # @param [String] index_name name of the index
153
- # @param [ResumeIngestOptions] options
441
+ # @param [Options::Search::ResumeIngest] options
154
442
  #
155
443
  # @return void
156
444
  #
157
445
  # @raise [ArgumentError]
158
446
  # @raise [Error::IndexNotFound]
159
- def resume_ingest(index_name, options = ResumeIngestOptions.new)
160
- @backend.search_index_resume_ingest(nil, nil, index_name, options.timeout)
447
+ def resume_ingest(index_name, options = Options::Search::ResumeIngest::DEFAULT)
448
+ @observability.record_operation(Observability::OP_SM_RESUME_INGEST, options.parent_span, self, :search) do |obs_handler|
449
+ @backend.search_index_resume_ingest(nil, nil, index_name, options.timeout, obs_handler)
450
+ end
161
451
  end
162
452
 
163
453
  # Allows querying against the index
164
454
  #
165
455
  # @param [String] index_name name of the index
166
- # @param [AllowQueryingOptions] options
456
+ # @param [Options::Search::AllowQuerying] options
167
457
  #
168
458
  # @return void
169
459
  #
170
460
  # @raise [ArgumentError]
171
461
  # @raise [Error::IndexNotFound]
172
- def allow_querying(index_name, options = AllowQueryingOptions.new)
173
- @backend.search_index_allow_querying(nil, nil, index_name, options.timeout)
462
+ def allow_querying(index_name, options = Options::Search::AllowQuerying::DEFAULT)
463
+ @observability.record_operation(Observability::OP_SM_ALLOW_QUERYING, options.parent_span, self, :search) do |obs_handler|
464
+ @backend.search_index_allow_querying(nil, nil, index_name, options.timeout, obs_handler)
465
+ end
174
466
  end
175
467
 
176
468
  # Disallows querying against the index
177
469
  #
178
470
  # @param [String] index_name name of the index
179
- # @param [DisallowQueryingOptions] options
471
+ # @param [Options::Search::DisallowQuerying] options
180
472
  #
181
473
  # @return void
182
474
  #
183
475
  # @raise [ArgumentError]
184
476
  # @raise [Error::IndexNotFound]
185
- def disallow_querying(index_name, options = DisallowQueryingOptions.new)
186
- @backend.search_index_disallow_querying(nil, nil, index_name, options.timeout)
477
+ def disallow_querying(index_name, options = Options::Search::DisallowQuerying::DEFAULT)
478
+ @observability.record_operation(Observability::OP_SM_DISALLOW_QUERYING, options.parent_span, self, :search) do |obs_handler|
479
+ @backend.search_index_disallow_querying(nil, nil, index_name, options.timeout, obs_handler)
480
+ end
187
481
  end
188
482
 
189
483
  # Freeze the assignment of index partitions to nodes
190
484
  #
191
485
  # @param [String] index_name name of the index
192
- # @param [FreezePlanOptions] options
486
+ # @param [Options::Search::FreezePlan] options
193
487
  #
194
488
  # @return void
195
489
  #
196
490
  # @raise [ArgumentError]
197
491
  # @raise [Error::IndexNotFound]
198
- def freeze_plan(index_name, options = FreezePlanOptions.new)
199
- @backend.search_index_freeze_plan(nil, nil, index_name, options.timeout)
492
+ def freeze_plan(index_name, options = Options::Search::FreezePlan::DEFAULT)
493
+ @observability.record_operation(Observability::OP_SM_FREEZE_PLAN, options.parent_span, self, :search) do |obs_handler|
494
+ @backend.search_index_freeze_plan(nil, nil, index_name, options.timeout, obs_handler)
495
+ end
200
496
  end
201
497
 
202
498
  # Unfreeze the assignment of index partitions to nodes
203
499
  #
204
500
  # @param [String] index_name name of the index
205
- # @param [UnfreezePlanOptions] options
501
+ # @param [Options::Search::UnfreezePlan] options
206
502
  #
207
503
  # @return void
208
504
  #
209
505
  # @raise [ArgumentError]
210
506
  # @raise [Error::IndexNotFound]
211
- def unfreeze_plan(index_name, options = UnfreezePlanOptions.new)
212
- @backend.search_index_unfreeze_plan(nil, nil, index_name, options.timeout)
507
+ def unfreeze_plan(index_name, options = Options::Search::UnfreezePlan::DEFAULT)
508
+ @observability.record_operation(Observability::OP_SM_UNFREEZE_PLAN, options.parent_span, self, :search) do |obs_handler|
509
+ @backend.search_index_unfreeze_plan(nil, nil, index_name, options.timeout, obs_handler)
510
+ end
213
511
  end
214
512
 
215
513
  # Allows to see how a document is analyzed against a specific index
216
514
  #
217
515
  # @param [String] index_name name of the index
218
516
  # @param [Hash] document the document to be analyzed
517
+ # @param [Options::Search::AnalyzeDocument] options
219
518
  #
220
519
  # @return [Array<Hash>]
221
520
  #
222
521
  # @raise [ArgumentError]
223
522
  # @raise [Error::IndexNotFound]
224
- def analyze_document(index_name, document, options = AnalyzeDocumentOptions.new)
225
- res = @backend.search_index_analyze_document(nil, nil, index_name, JSON.generate(document), options.timeout)
226
- JSON.parse(res[:analysis])
227
- end
228
-
229
- class GetIndexOptions
230
- # @return [Integer] the time in milliseconds allowed for the operation to complete
231
- attr_accessor :timeout
232
-
233
- # @yieldparam [GetIndexOptions] self
234
- def initialize
235
- yield self if block_given?
236
- end
237
- end
238
-
239
- class GetAllIndexesOptions
240
- # @return [Integer] the time in milliseconds allowed for the operation to complete
241
- attr_accessor :timeout
242
-
243
- # @yieldparam [GetAllIndexesOptions] self
244
- def initialize
245
- yield self if block_given?
246
- end
247
- end
248
-
249
- class UpsertIndexOptions
250
- # @return [Integer] the time in milliseconds allowed for the operation to complete
251
- attr_accessor :timeout
252
-
253
- # @yieldparam [UpsertIndexOptions] self
254
- def initialize
255
- yield self if block_given?
256
- end
257
- end
258
-
259
- class DropIndexOptions
260
- # @return [Integer] the time in milliseconds allowed for the operation to complete
261
- attr_accessor :timeout
262
-
263
- # @yieldparam [DropIndexOptions] self
264
- def initialize
265
- yield self if block_given?
266
- end
267
- end
268
-
269
- class GetIndexedDocumentsCountOptions
270
- # @return [Integer] the time in milliseconds allowed for the operation to complete
271
- attr_accessor :timeout
272
-
273
- # @yieldparam [GetIndexedDocumentCountOptions] self
274
- def initialize
275
- yield self if block_given?
276
- end
277
- end
278
-
279
- class GetIndexStatsOptions
280
- # @return [Integer] the time in milliseconds allowed for the operation to complete
281
- attr_accessor :timeout
282
-
283
- # @yieldparam [GetStatsOptions] self
284
- def initialize
285
- yield self if block_given?
523
+ def analyze_document(index_name, document, options = Options::Search::AnalyzeDocument::DEFAULT)
524
+ @observability.record_operation(Observability::OP_SM_ANALYZE_DOCUMENT, options.parent_span, self, :search) do |obs_handler|
525
+ res = @backend.search_index_analyze_document(nil, nil, index_name, JSON.generate(document), options.timeout, obs_handler)
526
+ JSON.parse(res[:analysis])
286
527
  end
287
528
  end
288
529
 
289
- class PauseIngestOptions
290
- # @return [Integer] the time in milliseconds allowed for the operation to complete
291
- attr_accessor :timeout
292
-
293
- # @yieldparam [PauseIngestOptions] self
294
- def initialize
295
- yield self if block_given?
296
- end
297
- end
530
+ # @api private
531
+ # @deprecated use {Options::Search::GetIndex} instead
532
+ GetIndexOptions = Options::Search::GetIndex
298
533
 
299
- class ResumeIngestOptions
300
- # @return [Integer] the time in milliseconds allowed for the operation to complete
301
- attr_accessor :timeout
534
+ # @api private
535
+ # @deprecated use {Options::Search::GetAllIndexes} instead
536
+ GetAllIndexesOptions = Options::Search::GetAllIndexes
302
537
 
303
- # @yieldparam [ResumeIngestOptions] self
304
- def initialize
305
- yield self if block_given?
306
- end
307
- end
538
+ # @api private
539
+ # @deprecated use {Options::Search::UpsertIndex} instead
540
+ UpsertIndexOptions = Options::Search::UpsertIndex
308
541
 
309
- class AllowQueryingOptions
310
- # @return [Integer] the time in milliseconds allowed for the operation to complete
311
- attr_accessor :timeout
542
+ # @api private
543
+ # @deprecated use {Options::Search::DropIndex} instead
544
+ DropIndexOptions = Options::Search::DropIndex
312
545
 
313
- # @yieldparam [AllowQueryingOptions] self
314
- def initialize
315
- yield self if block_given?
316
- end
317
- end
546
+ # @api private
547
+ # @deprecated use {Options::Search::GetIndexedDocumentsCount} instead
548
+ GetIndexedDocumentsCountOptions = Options::Search::GetIndexedDocumentsCount
318
549
 
319
- class DisallowQueryingOptions
320
- # @return [Integer] the time in milliseconds allowed for the operation to complete
321
- attr_accessor :timeout
550
+ # @api private
551
+ # @deprecated use {Options::Search::GetIndexStats} instead
552
+ GetIndexStatsOptions = Options::Search::GetIndexStats
322
553
 
323
- # @yieldparam [DisallowQueryingOptions] self
324
- def initialize
325
- yield self if block_given?
326
- end
327
- end
554
+ # @api private
555
+ # @deprecated use {Options::Search::PauseIngest} instead
556
+ PauseIngestOptions = Options::Search::PauseIngest
328
557
 
329
- class FreezePlanOptions
330
- # @return [Integer] the time in milliseconds allowed for the operation to complete
331
- attr_accessor :timeout
558
+ # @api private
559
+ # @deprecated use {Options::Search::ResumeIngest} instead
560
+ ResumeIngestOptions = Options::Search::ResumeIngest
332
561
 
333
- # @yieldparam [FreezePlanOptions] self
334
- def initialize
335
- yield self if block_given?
336
- end
337
- end
562
+ # @api private
563
+ # @deprecated use {Options::Search::AllowQuerying} instead
564
+ AllowQueryingOptions = Options::Search::AllowQuerying
338
565
 
339
- class UnfreezePlanOptions
340
- # @return [Integer] the time in milliseconds allowed for the operation to complete
341
- attr_accessor :timeout
566
+ # @api private
567
+ # @deprecated use {Options::Search::DisallowQuerying} instead
568
+ DisallowQueryingOptions = Options::Search::DisallowQuerying
342
569
 
343
- # @yieldparam [UnfreezePlanOptions] self
344
- def initialize
345
- yield self if block_given?
346
- end
347
- end
570
+ # @api private
571
+ # @deprecated use {Options::Search::FreezePlan} instead
572
+ FreezePlanOptions = Options::Search::FreezePlan
348
573
 
349
- class AnalyzeDocumentOptions
350
- # @return [Integer] the time in milliseconds allowed for the operation to complete
351
- attr_accessor :timeout
574
+ # @api private
575
+ # @deprecated use {Options::Search::UnfreezePlan} instead
576
+ UnfreezePlanOptions = Options::Search::UnfreezePlan
352
577
 
353
- # @yieldparam [AnalyzeDocumentOptions] self
354
- def initialize
355
- yield self if block_given?
356
- end
357
- end
578
+ # @api private
579
+ # @deprecated use {Options::Search::AnalyzeDocument} instead
580
+ AnalyzeDocumentOptions = Options::Search::AnalyzeDocument
358
581
 
359
582
  # @api private
360
583
  def self.extract_search_index(resp)