opensearch-api 1.0.0 → 2.1.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 (136) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/Gemfile +2 -2
  4. data/README.md +3 -3
  5. data/Rakefile +3 -3
  6. data/lib/opensearch/api/actions/benchmark.rb +0 -1
  7. data/lib/opensearch/api/actions/bulk.rb +1 -7
  8. data/lib/opensearch/api/actions/cat/allocation.rb +4 -2
  9. data/lib/opensearch/api/actions/cat/cluster_manager.rb +54 -0
  10. data/lib/opensearch/api/actions/cat/indices.rb +4 -2
  11. data/lib/opensearch/api/actions/cat/master.rb +3 -1
  12. data/lib/opensearch/api/actions/cat/nodeattrs.rb +4 -2
  13. data/lib/opensearch/api/actions/cat/nodes.rb +4 -2
  14. data/lib/opensearch/api/actions/cat/pending_tasks.rb +4 -2
  15. data/lib/opensearch/api/actions/cat/plugins.rb +4 -2
  16. data/lib/opensearch/api/actions/cat/repositories.rb +4 -2
  17. data/lib/opensearch/api/actions/cat/shards.rb +4 -2
  18. data/lib/opensearch/api/actions/cat/snapshots.rb +3 -1
  19. data/lib/opensearch/api/actions/cat/templates.rb +4 -2
  20. data/lib/opensearch/api/actions/cat/thread_pool.rb +4 -2
  21. data/lib/opensearch/api/actions/cluster/delete_component_template.rb +4 -2
  22. data/lib/opensearch/api/actions/cluster/exists_component_template.rb +4 -2
  23. data/lib/opensearch/api/actions/cluster/get_component_template.rb +4 -2
  24. data/lib/opensearch/api/actions/cluster/get_settings.rb +3 -1
  25. data/lib/opensearch/api/actions/cluster/health.rb +4 -2
  26. data/lib/opensearch/api/actions/cluster/pending_tasks.rb +5 -3
  27. data/lib/opensearch/api/actions/cluster/put_component_template.rb +4 -2
  28. data/lib/opensearch/api/actions/cluster/put_settings.rb +3 -1
  29. data/lib/opensearch/api/actions/cluster/reroute.rb +4 -2
  30. data/lib/opensearch/api/actions/cluster/state.rb +4 -2
  31. data/lib/opensearch/api/actions/count.rb +1 -6
  32. data/lib/opensearch/api/actions/create.rb +0 -1
  33. data/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb +4 -2
  34. data/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb +4 -2
  35. data/lib/opensearch/api/actions/delete.rb +1 -8
  36. data/lib/opensearch/api/actions/delete_by_query.rb +1 -8
  37. data/lib/opensearch/api/actions/delete_script.rb +4 -2
  38. data/lib/opensearch/api/actions/exists.rb +1 -8
  39. data/lib/opensearch/api/actions/exists_source.rb +1 -8
  40. data/lib/opensearch/api/actions/explain.rb +1 -8
  41. data/lib/opensearch/api/actions/features/get_features.rb +4 -2
  42. data/lib/opensearch/api/actions/get.rb +1 -8
  43. data/lib/opensearch/api/actions/get_script.rb +4 -2
  44. data/lib/opensearch/api/actions/get_source.rb +1 -8
  45. data/lib/opensearch/api/actions/index.rb +1 -8
  46. data/lib/opensearch/api/actions/indices/add_block.rb +3 -1
  47. data/lib/opensearch/api/actions/indices/clone.rb +3 -1
  48. data/lib/opensearch/api/actions/indices/close.rb +3 -1
  49. data/lib/opensearch/api/actions/indices/create.rb +4 -4
  50. data/lib/opensearch/api/actions/indices/delete.rb +3 -1
  51. data/lib/opensearch/api/actions/indices/delete_alias.rb +4 -2
  52. data/lib/opensearch/api/actions/indices/delete_index_template.rb +4 -2
  53. data/lib/opensearch/api/actions/indices/delete_template.rb +4 -2
  54. data/lib/opensearch/api/actions/indices/exists_index_template.rb +4 -2
  55. data/lib/opensearch/api/actions/indices/exists_template.rb +4 -2
  56. data/lib/opensearch/api/actions/indices/get.rb +4 -4
  57. data/lib/opensearch/api/actions/indices/get_field_mapping.rb +1 -10
  58. data/lib/opensearch/api/actions/indices/get_index_template.rb +4 -2
  59. data/lib/opensearch/api/actions/indices/get_mapping.rb +5 -12
  60. data/lib/opensearch/api/actions/indices/get_settings.rb +3 -1
  61. data/lib/opensearch/api/actions/indices/get_template.rb +4 -4
  62. data/lib/opensearch/api/actions/indices/open.rb +3 -1
  63. data/lib/opensearch/api/actions/indices/put_alias.rb +4 -2
  64. data/lib/opensearch/api/actions/indices/put_index_template.rb +4 -2
  65. data/lib/opensearch/api/actions/indices/put_mapping.rb +4 -13
  66. data/lib/opensearch/api/actions/indices/put_settings.rb +3 -1
  67. data/lib/opensearch/api/actions/indices/put_template.rb +4 -4
  68. data/lib/opensearch/api/actions/indices/rollover.rb +3 -3
  69. data/lib/opensearch/api/actions/indices/shrink.rb +3 -1
  70. data/lib/opensearch/api/actions/indices/simulate_index_template.rb +4 -2
  71. data/lib/opensearch/api/actions/indices/simulate_template.rb +4 -2
  72. data/lib/opensearch/api/actions/indices/split.rb +3 -1
  73. data/lib/opensearch/api/actions/indices/update_aliases.rb +4 -2
  74. data/lib/opensearch/api/actions/indices/validate_query.rb +1 -6
  75. data/lib/opensearch/api/actions/ingest/delete_pipeline.rb +3 -1
  76. data/lib/opensearch/api/actions/ingest/get_pipeline.rb +4 -2
  77. data/lib/opensearch/api/actions/ingest/put_pipeline.rb +3 -1
  78. data/lib/opensearch/api/actions/mget.rb +2 -7
  79. data/lib/opensearch/api/actions/msearch.rb +1 -6
  80. data/lib/opensearch/api/actions/msearch_template.rb +1 -6
  81. data/lib/opensearch/api/actions/mtermvectors.rb +1 -6
  82. data/lib/opensearch/api/actions/put_script.rb +3 -1
  83. data/lib/opensearch/api/actions/search.rb +1 -7
  84. data/lib/opensearch/api/actions/search_shards.rb +1 -1
  85. data/lib/opensearch/api/actions/search_template.rb +1 -6
  86. data/lib/opensearch/api/actions/snapshot/cleanup_repository.rb +3 -1
  87. data/lib/opensearch/api/actions/snapshot/clone.rb +4 -2
  88. data/lib/opensearch/api/actions/snapshot/create.rb +3 -1
  89. data/lib/opensearch/api/actions/snapshot/create_repository.rb +3 -1
  90. data/lib/opensearch/api/actions/snapshot/delete.rb +4 -2
  91. data/lib/opensearch/api/actions/snapshot/delete_repository.rb +3 -1
  92. data/lib/opensearch/api/actions/snapshot/get.rb +3 -1
  93. data/lib/opensearch/api/actions/snapshot/get_features.rb +4 -2
  94. data/lib/opensearch/api/actions/snapshot/get_repository.rb +3 -2
  95. data/lib/opensearch/api/actions/snapshot/restore.rb +3 -1
  96. data/lib/opensearch/api/actions/snapshot/status.rb +3 -1
  97. data/lib/opensearch/api/actions/snapshot/verify_repository.rb +3 -1
  98. data/lib/opensearch/api/actions/termvectors.rb +1 -8
  99. data/lib/opensearch/api/actions/update.rb +1 -8
  100. data/lib/opensearch/api/actions/update_by_query.rb +1 -8
  101. data/lib/opensearch/api/utils.rb +5 -5
  102. data/lib/opensearch/api/version.rb +1 -1
  103. data/lib/opensearch/api.rb +1 -1
  104. data/opensearch-api.gemspec +0 -1
  105. data/spec/opensearch/api/actions/bulk_spec.rb +10 -21
  106. data/spec/opensearch/api/actions/cat/allocation_spec.rb +6 -7
  107. data/spec/opensearch/api/actions/cat/cluster_manager_spec.rb +26 -0
  108. data/spec/opensearch/api/actions/count_spec.rb +3 -3
  109. data/spec/opensearch/api/actions/create_document_spec.rb +8 -8
  110. data/spec/opensearch/api/actions/delete_by_query_spec.rb +0 -17
  111. data/spec/opensearch/api/actions/delete_document_spec.rb +10 -10
  112. data/spec/opensearch/api/actions/exists_document_spec.rb +10 -10
  113. data/spec/opensearch/api/actions/explain_document_spec.rb +8 -8
  114. data/spec/opensearch/api/actions/get_document_source_spec.rb +6 -6
  115. data/spec/opensearch/api/actions/get_document_spec.rb +8 -8
  116. data/spec/opensearch/api/actions/get_script_spec.rb +2 -2
  117. data/spec/opensearch/api/actions/hashie_spec.rb +0 -2
  118. data/spec/opensearch/api/actions/index_document_spec.rb +12 -12
  119. data/spec/opensearch/api/actions/indices/clone_spec.rb +2 -2
  120. data/spec/opensearch/api/actions/indices/get_field_mapping_spec.rb +0 -11
  121. data/spec/opensearch/api/actions/indices/get_mapping_spec.rb +5 -16
  122. data/spec/opensearch/api/actions/indices/put_mapping_spec.rb +8 -21
  123. data/spec/opensearch/api/actions/indices/validate_query_spec.rb +0 -10
  124. data/spec/opensearch/api/actions/mget_spec.rb +2 -17
  125. data/spec/opensearch/api/actions/mtermvectors_spec.rb +3 -3
  126. data/spec/opensearch/api/actions/search_spec.rb +5 -16
  127. data/spec/opensearch/api/actions/termvectors_spec.rb +5 -5
  128. data/spec/opensearch/api/actions/update_document_spec.rb +11 -11
  129. data/spec/opensearch/api/utils_spec.rb +7 -14
  130. data.tar.gz.sig +0 -0
  131. metadata +14 -31
  132. metadata.gz.sig +0 -0
  133. data/lib/opensearch/api/actions/indices/exists_type.rb +0 -79
  134. data/lib/opensearch/api/actions/indices/flush_synced.rb +0 -79
  135. data/spec/opensearch/api/actions/indices/exists_type_spec.rb +0 -117
  136. data/spec/opensearch/api/actions/indices/flush_synced_spec.rb +0 -99
@@ -30,7 +30,6 @@ module OpenSearch
30
30
  # Allows to use the Mustache language to pre-render a search definition.
31
31
  #
32
32
  # @option arguments [List] :index A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
33
- # @option arguments [List] :type A comma-separated list of document types to search; leave empty to perform the operation on all types
34
33
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
35
34
  # @option arguments [Boolean] :ignore_throttled Whether specified concrete, expanded or aliased indices should be ignored when throttled
36
35
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
@@ -62,12 +61,8 @@ module OpenSearch
62
61
 
63
62
  _index = arguments.delete(:index)
64
63
 
65
- _type = arguments.delete(:type)
66
-
67
64
  method = OpenSearch::API::HTTP_POST
68
- path = if _index && _type
69
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_search/template"
70
- elsif _index
65
+ path = if _index
71
66
  "#{Utils.__listify(_index)}/_search/template"
72
67
  else
73
68
  "_search/template"
@@ -31,7 +31,8 @@ module OpenSearch
31
31
  # Removes stale data from repository.
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
34
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
35
36
  # @option arguments [Time] :timeout Explicit operation timeout
36
37
  # @option arguments [Hash] :headers Custom HTTP headers
37
38
  #
@@ -58,6 +59,7 @@ module OpenSearch
58
59
  # @since 6.2.0
59
60
  ParamsRegistry.register(:cleanup_repository, [
60
61
  :master_timeout,
62
+ :cluster_manager_timeout,
61
63
  :timeout
62
64
  ].freeze)
63
65
  end
@@ -33,7 +33,8 @@ module OpenSearch
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [String] :snapshot The name of the snapshot to clone from
35
35
  # @option arguments [String] :target_snapshot The name of the cloned snapshot to create
36
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
37
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
37
38
  # @option arguments [Hash] :headers Custom HTTP headers
38
39
  # @option arguments [Hash] :body The snapshot clone definition (*Required*)
39
40
  #
@@ -66,7 +67,8 @@ module OpenSearch
66
67
  #
67
68
  # @since 6.2.0
68
69
  ParamsRegistry.register(:clone, [
69
- :master_timeout
70
+ :master_timeout,
71
+ :cluster_manager_timeout
70
72
  ].freeze)
71
73
  end
72
74
  end
@@ -32,7 +32,8 @@ module OpenSearch
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [String] :snapshot A snapshot name
35
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
36
37
  # @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning
37
38
  # @option arguments [Hash] :headers Custom HTTP headers
38
39
  # @option arguments [Hash] :body The snapshot definition
@@ -63,6 +64,7 @@ module OpenSearch
63
64
  # @since 6.2.0
64
65
  ParamsRegistry.register(:create, [
65
66
  :master_timeout,
67
+ :cluster_manager_timeout,
66
68
  :wait_for_completion
67
69
  ].freeze)
68
70
  end
@@ -31,7 +31,8 @@ module OpenSearch
31
31
  # Creates a repository.
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
34
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
35
36
  # @option arguments [Time] :timeout Explicit operation timeout
36
37
  # @option arguments [Boolean] :verify Whether to verify the repository after creation
37
38
  # @option arguments [Hash] :headers Custom HTTP headers
@@ -61,6 +62,7 @@ module OpenSearch
61
62
  # @since 6.2.0
62
63
  ParamsRegistry.register(:create_repository, [
63
64
  :master_timeout,
65
+ :cluster_manager_timeout,
64
66
  :timeout,
65
67
  :verify
66
68
  ].freeze)
@@ -32,7 +32,8 @@ module OpenSearch
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [String] :snapshot A snapshot name
35
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
36
37
  # @option arguments [Hash] :headers Custom HTTP headers
37
38
  #
38
39
  #
@@ -64,7 +65,8 @@ module OpenSearch
64
65
  #
65
66
  # @since 6.2.0
66
67
  ParamsRegistry.register(:delete, [
67
- :master_timeout
68
+ :master_timeout,
69
+ :cluster_manager_timeout
68
70
  ].freeze)
69
71
  end
70
72
  end
@@ -31,7 +31,8 @@ module OpenSearch
31
31
  # Deletes a repository.
32
32
  #
33
33
  # @option arguments [List] :repository Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported.
34
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
34
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
35
36
  # @option arguments [Time] :timeout Explicit operation timeout
36
37
  # @option arguments [Hash] :headers Custom HTTP headers
37
38
  #
@@ -62,6 +63,7 @@ module OpenSearch
62
63
  # @since 6.2.0
63
64
  ParamsRegistry.register(:delete_repository, [
64
65
  :master_timeout,
66
+ :cluster_manager_timeout,
65
67
  :timeout
66
68
  ].freeze)
67
69
  end
@@ -32,7 +32,8 @@ module OpenSearch
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [List] :snapshot A comma-separated list of snapshot names
35
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
36
37
  # @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
37
38
  # @option arguments [Boolean] :index_details Whether to include details of each index in the snapshot, if those details are available. Defaults to false.
38
39
  # @option arguments [Boolean] :include_repository Whether to include the repository name in the snapshot info. Defaults to true.
@@ -69,6 +70,7 @@ module OpenSearch
69
70
  # @since 6.2.0
70
71
  ParamsRegistry.register(:get, [
71
72
  :master_timeout,
73
+ :cluster_manager_timeout,
72
74
  :ignore_unavailable,
73
75
  :index_details,
74
76
  :include_repository,
@@ -30,7 +30,8 @@ module OpenSearch
30
30
  module Actions
31
31
  # Returns a list of features which can be snapshotted in this cluster.
32
32
  #
33
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
33
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
34
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
34
35
  # @option arguments [Hash] :headers Custom HTTP headers
35
36
  #
36
37
  #
@@ -51,7 +52,8 @@ module OpenSearch
51
52
  #
52
53
  # @since 6.2.0
53
54
  ParamsRegistry.register(:get_features, [
54
- :master_timeout
55
+ :master_timeout,
56
+ :cluster_manager_timeout
55
57
  ].freeze)
56
58
  end
57
59
  end
@@ -31,8 +31,8 @@ module OpenSearch
31
31
  # Returns information about a repository.
32
32
  #
33
33
  # @option arguments [List] :repository A comma-separated list of repository names
34
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
- # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
34
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to cluster_manager node
35
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from cluster_manager node (default: false)
36
36
  # @option arguments [Hash] :headers Custom HTTP headers
37
37
  #
38
38
  #
@@ -64,6 +64,7 @@ module OpenSearch
64
64
  # @since 6.2.0
65
65
  ParamsRegistry.register(:get_repository, [
66
66
  :master_timeout,
67
+ :cluster_manager_timeout,
67
68
  :local
68
69
  ].freeze)
69
70
  end
@@ -32,7 +32,8 @@ module OpenSearch
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [String] :snapshot A snapshot name
35
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
36
37
  # @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning
37
38
  # @option arguments [Hash] :headers Custom HTTP headers
38
39
  # @option arguments [Hash] :body Details of what to restore
@@ -63,6 +64,7 @@ module OpenSearch
63
64
  # @since 6.2.0
64
65
  ParamsRegistry.register(:restore, [
65
66
  :master_timeout,
67
+ :cluster_manager_timeout,
66
68
  :wait_for_completion
67
69
  ].freeze)
68
70
  end
@@ -32,7 +32,8 @@ module OpenSearch
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [List] :snapshot A comma-separated list of snapshot names
35
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
36
37
  # @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
37
38
  # @option arguments [Hash] :headers Custom HTTP headers
38
39
  #
@@ -69,6 +70,7 @@ module OpenSearch
69
70
  # @since 6.2.0
70
71
  ParamsRegistry.register(:status, [
71
72
  :master_timeout,
73
+ :cluster_manager_timeout,
72
74
  :ignore_unavailable
73
75
  ].freeze)
74
76
  end
@@ -31,7 +31,8 @@ module OpenSearch
31
31
  # Verifies a repository.
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
34
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
35
36
  # @option arguments [Time] :timeout Explicit operation timeout
36
37
  # @option arguments [Hash] :headers Custom HTTP headers
37
38
  #
@@ -58,6 +59,7 @@ module OpenSearch
58
59
  # @since 6.2.0
59
60
  ParamsRegistry.register(:verify_repository, [
60
61
  :master_timeout,
62
+ :cluster_manager_timeout,
61
63
  :timeout
62
64
  ].freeze)
63
65
  end
@@ -31,7 +31,6 @@ module OpenSearch
31
31
  #
32
32
  # @option arguments [String] :index The index in which the document resides. (*Required*)
33
33
  # @option arguments [String] :id The id of the document, when not specified a doc param should be supplied.
34
- # @option arguments [String] :type The type of the document.
35
34
  # @option arguments [Boolean] :term_statistics Specifies if total term frequency and document frequency should be returned.
36
35
  # @option arguments [Boolean] :field_statistics Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.
37
36
  # @option arguments [List] :fields A comma-separated list of fields to return.
@@ -63,8 +62,6 @@ module OpenSearch
63
62
 
64
63
  _id = arguments.delete(:id)
65
64
 
66
- _type = arguments.delete(:type)
67
-
68
65
  method = if arguments[:body]
69
66
  OpenSearch::API::HTTP_POST
70
67
  else
@@ -72,11 +69,7 @@ module OpenSearch
72
69
  end
73
70
 
74
71
  endpoint = arguments.delete(:endpoint) || '_termvectors'
75
- path = if _index && _type && _id
76
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/#{Utils.__listify(_id)}/#{endpoint}"
77
- elsif _index && _type
78
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/#{endpoint}"
79
- elsif _index && _id
72
+ path = if _index && _id
80
73
  "#{Utils.__listify(_index)}/#{endpoint}/#{Utils.__listify(_id)}"
81
74
  else
82
75
  "#{Utils.__listify(_index)}/#{endpoint}"
@@ -31,7 +31,6 @@ module OpenSearch
31
31
  #
32
32
  # @option arguments [String] :id Document ID
33
33
  # @option arguments [String] :index The name of the index
34
- # @option arguments [String] :type The type of the document *Deprecated*
35
34
  # @option arguments [String] :wait_for_active_shards Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
36
35
  # @option arguments [List] :_source True or false to return the _source field or not, or a list of fields to return
37
36
  # @option arguments [List] :_source_excludes A list of fields to exclude from the returned _source field
@@ -66,14 +65,8 @@ module OpenSearch
66
65
 
67
66
  _index = arguments.delete(:index)
68
67
 
69
- _type = arguments.delete(:type)
70
-
71
68
  method = OpenSearch::API::HTTP_POST
72
- path = if _index && _type && _id
73
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/#{Utils.__listify(_id)}/_update"
74
- else
75
- "#{Utils.__listify(_index)}/_update/#{Utils.__listify(_id)}"
76
- end
69
+ path = "#{Utils.__listify(_index)}/_update/#{Utils.__listify(_id)}"
77
70
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
78
71
 
79
72
  body = arguments[:body]
@@ -31,7 +31,6 @@ module OpenSearch
31
31
  # for example to pick up a mapping change.
32
32
  #
33
33
  # @option arguments [List] :index A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices (*Required*)
34
- # @option arguments [List] :type A comma-separated list of document types to search; leave empty to perform the operation on all types
35
34
  # @option arguments [String] :analyzer The analyzer to use for the query string
36
35
  # @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be analyzed (default: false)
37
36
  # @option arguments [String] :default_operator The default operator for query string query (AND or OR) (options: AND, OR)
@@ -85,14 +84,8 @@ module OpenSearch
85
84
 
86
85
  _index = arguments.delete(:index)
87
86
 
88
- _type = arguments.delete(:type)
89
-
90
87
  method = OpenSearch::API::HTTP_POST
91
- path = if _index && _type
92
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_update_by_query"
93
- else
94
- "#{Utils.__listify(_index)}/_update_by_query"
95
- end
88
+ path = "#{Utils.__listify(_index)}/_update_by_query"
96
89
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
97
90
 
98
91
  body = arguments[:body]
@@ -40,7 +40,7 @@ module OpenSearch
40
40
  # @api private
41
41
  def __escape(string)
42
42
  return string if string == '*'
43
- defined?(EscapeUtils) ? EscapeUtils.escape_url(string.to_s) : CGI.escape(string.to_s)
43
+ CGI.escape(string.to_s)
44
44
  end
45
45
 
46
46
  # Create a "list" of values from arguments, ignoring nil values and encoding special characters.
@@ -97,13 +97,13 @@ module OpenSearch
97
97
  # in a single item.
98
98
  #
99
99
  # OpenSearch::API::Utils.__bulkify [
100
- # { :index => { :_index => 'myindexA', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } },
101
- # { :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } }
100
+ # { :index => { :_index => 'myindexA', :_id => '1', :data => { :title => 'Test' } } },
101
+ # { :update => { :_index => 'myindexB', :_id => '2', :data => { :doc => { :title => 'Update' } } } }
102
102
  # ]
103
103
  #
104
- # # => {"index":{"_index":"myindexA","_type":"mytype","_id":"1"}}
104
+ # # => {"index":{"_index":"myindexA","_id":"1"}}
105
105
  # # => {"title":"Test"}
106
- # # => {"update":{"_index":"myindexB","_type":"mytype","_id":"2"}}
106
+ # # => {"update":{"_index":"myindexB","_id":"2"}}
107
107
  # # => {"doc":{"title":"Update"}}
108
108
  #
109
109
  def __bulkify(payload)
@@ -26,6 +26,6 @@
26
26
 
27
27
  module OpenSearch
28
28
  module API
29
- VERSION = '1.0.0'.freeze
29
+ VERSION = '2.1.0'.freeze
30
30
  end
31
31
  end
@@ -42,7 +42,7 @@ module OpenSearch
42
42
 
43
43
  COMMON_PARAMS = [
44
44
  :ignore, # Client specific parameters
45
- :index, :type, :id, # :index/:type/:id
45
+ :index, :id, # :index/:id
46
46
  :body, # Request body
47
47
  :node_id, # Cluster
48
48
  :name, # Alias, template, settings, warmer, ...
@@ -79,7 +79,6 @@ Gem::Specification.new do |s|
79
79
  s.add_development_dependency 'hashie'
80
80
 
81
81
  s.add_development_dependency 'cane'
82
- s.add_development_dependency 'escape_utils' unless defined? JRUBY_VERSION
83
82
  s.add_development_dependency 'jbuilder'
84
83
  s.add_development_dependency 'require-prof' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
85
84
  s.add_development_dependency 'simplecov'
@@ -47,22 +47,22 @@ describe 'client#bulk' do
47
47
 
48
48
  let(:body) do
49
49
  <<-PAYLOAD.gsub(/^\s+/, '')
50
- {"index":{"_index":"myindexA","_type":"mytype","_id":"1"}}
50
+ {"index":{"_index":"myindexA","_id":"1"}}
51
51
  {"title":"Test"}
52
- {"update":{"_index":"myindexB","_type":"mytype","_id":"2"}}
52
+ {"update":{"_index":"myindexB","_id":"2"}}
53
53
  {"doc":{"title":"Update"}}
54
- {"delete":{"_index":"myindexC","_type":"mytypeC","_id":"3"}}
55
- {"index":{"_index":"myindexD","_type":"mytype","_id":"1"}}
54
+ {"delete":{"_index":"myindexC","_id":"3"}}
55
+ {"index":{"_index":"myindexD","_id":"1"}}
56
56
  {"data":"MYDATA"}
57
57
  PAYLOAD
58
58
  end
59
59
 
60
60
  it 'performs the request' do
61
61
  expect(client_double.bulk(:body => [
62
- { :index => { :_index => 'myindexA', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } },
63
- { :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
64
- { :delete => { :_index => 'myindexC', :_type => 'mytypeC', :_id => '3' } },
65
- { :index => { :_index => 'myindexD', :_type => 'mytype', :_id => '1', :data => { :data => 'MYDATA' } } },
62
+ { :index => { :_index => 'myindexA', :_id => '1', :data => { :title => 'Test' } } },
63
+ { :update => { :_index => 'myindexB', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
64
+ { :delete => { :_index => 'myindexC', :_id => '3' } },
65
+ { :index => { :_index => 'myindexD', :_id => '1', :data => { :data => 'MYDATA' } } },
66
66
  ])).to eq({})
67
67
  end
68
68
  end
@@ -80,13 +80,13 @@ describe 'client#bulk' do
80
80
 
81
81
  let(:body) do
82
82
  <<-PAYLOAD.gsub(/^\s+/, '')
83
- {"update":{"_index":"myindex","_type":"mytype","_id":"1"}}
83
+ {"update":{"_index":"myindex","_id":"1"}}
84
84
  {"doc":{"data":{"title":"Update"}}}
85
85
  PAYLOAD
86
86
  end
87
87
 
88
88
  it 'performs the request' do
89
- expect(client_double.bulk(body:[ { :update => { :_index => 'myindex', :_type => 'mytype', :_id => '1' } },
89
+ expect(client_double.bulk(body:[ { :update => { :_index => 'myindex', :_id => '1' } },
90
90
  { :doc => { :data => { :title => 'Update' } } } ])).to eq({})
91
91
  end
92
92
  end
@@ -134,15 +134,4 @@ describe 'client#bulk' do
134
134
  expect(client_double.bulk(index: 'foo^bar', body: [])).to eq({})
135
135
  end
136
136
  end
137
-
138
- context 'when the type is provided' do
139
-
140
- let(:url) do
141
- 'myindex/mytype/_bulk'
142
- end
143
-
144
- it 'performs the request' do
145
- expect(client_double.bulk(index: 'myindex', type: 'mytype', body: [])).to eq({})
146
- end
147
- end
148
137
  end
@@ -27,18 +27,17 @@
27
27
  require 'spec_helper'
28
28
 
29
29
  describe 'client.cat#allocation' do
30
-
31
30
  let(:expected_args) do
32
31
  [
33
- 'GET',
34
- '_cat/allocation',
35
- {},
36
- nil,
37
- {}
32
+ 'GET',
33
+ '_cat/allocation',
34
+ {cluster_manager_timeout: 2},
35
+ nil,
36
+ {}
38
37
  ]
39
38
  end
40
39
 
41
40
  it 'performs the request' do
42
- expect(client_double.cat.allocation).to eq({})
41
+ expect(client_double.cat.allocation(cluster_manager_timeout: 2)).to eq({})
43
42
  end
44
43
  end
@@ -0,0 +1,26 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+
10
+ require 'spec_helper'
11
+
12
+ describe 'client.cat#cluster_manager' do
13
+ let(:expected_args) do
14
+ [
15
+ 'GET',
16
+ '_cat/cluster_manager',
17
+ {},
18
+ nil,
19
+ {}
20
+ ]
21
+ end
22
+
23
+ it 'performs the request' do
24
+ expect(client_double.cat.cluster_manager).to eq({})
25
+ end
26
+ end
@@ -42,12 +42,12 @@ describe 'client#count' do
42
42
  expect(client_double.count).to eq({})
43
43
  end
44
44
 
45
- context 'when an index and type are specified' do
45
+ context 'when an index is specified' do
46
46
 
47
47
  let(:expected_args) do
48
48
  [
49
49
  'POST',
50
- 'foo,bar/t1,t2/_count',
50
+ 'foo,bar/_count',
51
51
  {},
52
52
  nil,
53
53
  {}
@@ -55,7 +55,7 @@ describe 'client#count' do
55
55
  end
56
56
 
57
57
  it 'performs the request' do
58
- expect(client_double.count(index: ['foo','bar'], type: ['t1','t2'])).to eq({})
58
+ expect(client_double.count(index: ['foo','bar'])).to eq({})
59
59
  end
60
60
  end
61
61
 
@@ -31,7 +31,7 @@ describe 'client#create_document' do
31
31
  let(:expected_args) do
32
32
  [
33
33
  'PUT',
34
- 'foo/bar/123',
34
+ 'foo/_doc/123',
35
35
  { op_type: 'create' },
36
36
  { foo: 'bar' },
37
37
  {}
@@ -39,7 +39,7 @@ describe 'client#create_document' do
39
39
  end
40
40
 
41
41
  it 'performs the request' do
42
- expect(client_double.create(index: 'foo', type: 'bar', id: '123', body: { foo: 'bar'})).to eq({})
42
+ expect(client_double.create(index: 'foo', id: '123', body: { foo: 'bar'})).to eq({})
43
43
  end
44
44
 
45
45
  context 'when the request needs to be URL-escaped' do
@@ -47,7 +47,7 @@ describe 'client#create_document' do
47
47
  let(:expected_args) do
48
48
  [
49
49
  'PUT',
50
- 'foo/bar%2Fbam/123',
50
+ 'foo%5Ebar/_doc/123',
51
51
  { op_type: 'create' },
52
52
  {},
53
53
  {}
@@ -55,7 +55,7 @@ describe 'client#create_document' do
55
55
  end
56
56
 
57
57
  it 'performs the request' do
58
- expect(client_double.create(index: 'foo', type: 'bar/bam', id: '123', body: {})).to eq({})
58
+ expect(client_double.create(index: 'foo^bar', id: '123', body: {})).to eq({})
59
59
  end
60
60
  end
61
61
 
@@ -64,7 +64,7 @@ describe 'client#create_document' do
64
64
  let(:expected_args) do
65
65
  [
66
66
  'PUT',
67
- 'foo/bar/1',
67
+ 'foo/_doc/1',
68
68
  { op_type: 'create' },
69
69
  { foo: 'bar' },
70
70
  {}
@@ -72,7 +72,7 @@ describe 'client#create_document' do
72
72
  end
73
73
 
74
74
  it 'updates the arguments with the `op_type`' do
75
- expect(client_double.create(index: 'foo', type: 'bar', id: 1, body: { foo: 'bar' })).to eq({})
75
+ expect(client_double.create(index: 'foo', id: 1, body: { foo: 'bar' })).to eq({})
76
76
  end
77
77
  end
78
78
 
@@ -81,7 +81,7 @@ describe 'client#create_document' do
81
81
  let(:expected_args) do
82
82
  [
83
83
  'POST',
84
- 'foo/bar',
84
+ 'foo/_doc',
85
85
  { },
86
86
  { foo: 'bar' },
87
87
  {}
@@ -89,7 +89,7 @@ describe 'client#create_document' do
89
89
  end
90
90
 
91
91
  it 'updates the arguments with the `op_type`' do
92
- expect(client_double.create(index: 'foo', type: 'bar', body: { foo: 'bar' })).to eq({})
92
+ expect(client_double.create(index: 'foo', body: { foo: 'bar' })).to eq({})
93
93
  end
94
94
  end
95
95
  end
@@ -48,23 +48,6 @@ describe 'client#delete_by_query' do
48
48
  expect(client_double.delete_by_query(index: 'foo', body: { term: {} })).to eq({})
49
49
  end
50
50
 
51
- context 'when the type argument is provided' do
52
-
53
- let(:expected_args) do
54
- [
55
- 'POST',
56
- 'foo/tweet,post/_delete_by_query',
57
- {},
58
- { term: {} },
59
- {}
60
- ]
61
- end
62
-
63
- it 'performs the request' do
64
- expect(client_double.delete_by_query(index: 'foo', type: ['tweet', 'post'], body: { term: {} })).to eq({})
65
- end
66
- end
67
-
68
51
  context 'when a query is provided' do
69
52
  let(:expected_args) do
70
53
  [