diff --git a/api_generator/lib/templates/action.mustache b/api_generator/lib/templates/action.mustache index 2e84d3551..99dc3fb9c 100644 --- a/api_generator/lib/templates/action.mustache +++ b/api_generator/lib/templates/action.mustache @@ -44,7 +44,7 @@ module OpenSearch headers = args.delete('headers') || {} body = args.delete('body') {{/bulk_body}} - url = [{{{url_components}}}].reject(&:nil?).join('/') + url = [{{{url_components}}}].filter(&:present?).join('/').squeeze('/') method = {{{http_verb}}} Utils.validate_query_params args, {{valid_params_constant_name}} diff --git a/lib/opensearch.rb b/lib/opensearch.rb index fbf035acc..243d0b649 100644 --- a/lib/opensearch.rb +++ b/lib/opensearch.rb @@ -7,7 +7,6 @@ # This file is generated from the OpenSearch REST API spec. # Do not modify it by hand. Instead, modify the generator or the spec. -require 'active_support/all' require 'opensearch/transport' require 'opensearch/api' Dir[File.expand_path('opensearch/api/**/*.rb', __dir__)].sort.each { |f| require f } diff --git a/lib/opensearch/api/actions/asynchronous_search/delete.rb b/lib/opensearch/api/actions/asynchronous_search/delete.rb index 731ac3c13..d82d63689 100644 --- a/lib/opensearch/api/actions/asynchronous_search/delete.rb +++ b/lib/opensearch/api/actions/asynchronous_search/delete.rb @@ -26,7 +26,7 @@ def delete(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_asynchronous_search', _id].reject(&:nil?).join('/') + url = ['_plugins', '_asynchronous_search', _id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/asynchronous_search/get.rb b/lib/opensearch/api/actions/asynchronous_search/get.rb index 89013400e..ccd69e3ae 100644 --- a/lib/opensearch/api/actions/asynchronous_search/get.rb +++ b/lib/opensearch/api/actions/asynchronous_search/get.rb @@ -24,7 +24,7 @@ def get(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_asynchronous_search', _id].reject(&:nil?).join('/') + url = ['_plugins', '_asynchronous_search', _id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/asynchronous_search/search.rb b/lib/opensearch/api/actions/asynchronous_search/search.rb index 1a503e81e..4476c7538 100644 --- a/lib/opensearch/api/actions/asynchronous_search/search.rb +++ b/lib/opensearch/api/actions/asynchronous_search/search.rb @@ -24,7 +24,7 @@ def search(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_asynchronous_search'].reject(&:nil?).join('/') + url = ['_plugins', '_asynchronous_search'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, SEARCH_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/asynchronous_search/stats.rb b/lib/opensearch/api/actions/asynchronous_search/stats.rb index be8c90a9f..6b29346dc 100644 --- a/lib/opensearch/api/actions/asynchronous_search/stats.rb +++ b/lib/opensearch/api/actions/asynchronous_search/stats.rb @@ -19,7 +19,7 @@ def stats(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_asynchronous_search', 'stats'].reject(&:nil?).join('/') + url = ['_plugins', '_asynchronous_search', 'stats'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/bulk.rb b/lib/opensearch/api/actions/bulk.rb index d30188e2d..573d9f07f 100644 --- a/lib/opensearch/api/actions/bulk.rb +++ b/lib/opensearch/api/actions/bulk.rb @@ -35,7 +35,7 @@ def bulk(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = [_index, '_bulk'].reject(&:nil?).join('/') + url = [_index, '_bulk'].filter(&:present?).join('/').squeeze('/') method = _index.present? ? 'PUT' : 'POST' Utils.validate_query_params args, BULK_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/bulk_stream.rb b/lib/opensearch/api/actions/bulk_stream.rb index e8d2e0d4d..d3cefbdb0 100644 --- a/lib/opensearch/api/actions/bulk_stream.rb +++ b/lib/opensearch/api/actions/bulk_stream.rb @@ -37,7 +37,7 @@ def bulk_stream(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = [_index, '_bulk', 'stream'].reject(&:nil?).join('/') + url = [_index, '_bulk', 'stream'].filter(&:present?).join('/').squeeze('/') method = _index.present? ? 'PUT' : 'POST' Utils.validate_query_params args, BULK_STREAM_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/aliases.rb b/lib/opensearch/api/actions/cat/aliases.rb index d0ee1182a..da422b6a5 100644 --- a/lib/opensearch/api/actions/cat/aliases.rb +++ b/lib/opensearch/api/actions/cat/aliases.rb @@ -29,7 +29,7 @@ def aliases(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'aliases', _name].reject(&:nil?).join('/') + url = ['_cat', 'aliases', _name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, ALIASES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/all_pit_segments.rb b/lib/opensearch/api/actions/cat/all_pit_segments.rb index 041404cfb..825ee2cec 100644 --- a/lib/opensearch/api/actions/cat/all_pit_segments.rb +++ b/lib/opensearch/api/actions/cat/all_pit_segments.rb @@ -25,7 +25,7 @@ def all_pit_segments(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'pit_segments', '_all'].reject(&:nil?).join('/') + url = ['_cat', 'pit_segments', '_all'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, ALL_PIT_SEGMENTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/allocation.rb b/lib/opensearch/api/actions/cat/allocation.rb index 64cbc3bdc..3ffd4c37e 100644 --- a/lib/opensearch/api/actions/cat/allocation.rb +++ b/lib/opensearch/api/actions/cat/allocation.rb @@ -31,7 +31,7 @@ def allocation(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'allocation', _node_id].reject(&:nil?).join('/') + url = ['_cat', 'allocation', _node_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, ALLOCATION_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/cluster_manager.rb b/lib/opensearch/api/actions/cat/cluster_manager.rb index 2d3657bd9..fa0b48ce7 100644 --- a/lib/opensearch/api/actions/cat/cluster_manager.rb +++ b/lib/opensearch/api/actions/cat/cluster_manager.rb @@ -27,7 +27,7 @@ def cluster_manager(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'cluster_manager'].reject(&:nil?).join('/') + url = ['_cat', 'cluster_manager'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, CLUSTER_MANAGER_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/count.rb b/lib/opensearch/api/actions/cat/count.rb index a4afdda6e..dfcb46884 100644 --- a/lib/opensearch/api/actions/cat/count.rb +++ b/lib/opensearch/api/actions/cat/count.rb @@ -27,7 +27,7 @@ def count(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'count', _index].reject(&:nil?).join('/') + url = ['_cat', 'count', _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, COUNT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/fielddata.rb b/lib/opensearch/api/actions/cat/fielddata.rb index d37aa83e6..085665d7d 100644 --- a/lib/opensearch/api/actions/cat/fielddata.rb +++ b/lib/opensearch/api/actions/cat/fielddata.rb @@ -28,7 +28,7 @@ def fielddata(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'fielddata', _fields].reject(&:nil?).join('/') + url = ['_cat', 'fielddata', _fields].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, FIELDDATA_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/health.rb b/lib/opensearch/api/actions/cat/health.rb index 0ebf0f6a9..3fc871fba 100644 --- a/lib/opensearch/api/actions/cat/health.rb +++ b/lib/opensearch/api/actions/cat/health.rb @@ -26,7 +26,7 @@ def health(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'health'].reject(&:nil?).join('/') + url = ['_cat', 'health'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, HEALTH_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/help.rb b/lib/opensearch/api/actions/cat/help.rb index fe7382e8b..1827f90cb 100644 --- a/lib/opensearch/api/actions/cat/help.rb +++ b/lib/opensearch/api/actions/cat/help.rb @@ -19,7 +19,7 @@ def help(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat'].reject(&:nil?).join('/') + url = ['_cat'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, HELP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/indices.rb b/lib/opensearch/api/actions/cat/indices.rb index 5598a4fb2..533464b3a 100644 --- a/lib/opensearch/api/actions/cat/indices.rb +++ b/lib/opensearch/api/actions/cat/indices.rb @@ -36,7 +36,7 @@ def indices(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'indices', _index].reject(&:nil?).join('/') + url = ['_cat', 'indices', _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, INDICES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/master.rb b/lib/opensearch/api/actions/cat/master.rb index 83e3331b0..2d2c5eb68 100644 --- a/lib/opensearch/api/actions/cat/master.rb +++ b/lib/opensearch/api/actions/cat/master.rb @@ -27,7 +27,7 @@ def master(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'master'].reject(&:nil?).join('/') + url = ['_cat', 'master'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, MASTER_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/nodeattrs.rb b/lib/opensearch/api/actions/cat/nodeattrs.rb index c72b6af55..e37011ae5 100644 --- a/lib/opensearch/api/actions/cat/nodeattrs.rb +++ b/lib/opensearch/api/actions/cat/nodeattrs.rb @@ -27,7 +27,7 @@ def nodeattrs(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'nodeattrs'].reject(&:nil?).join('/') + url = ['_cat', 'nodeattrs'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, NODEATTRS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/nodes.rb b/lib/opensearch/api/actions/cat/nodes.rb index ce18e0ffd..c64933f5c 100644 --- a/lib/opensearch/api/actions/cat/nodes.rb +++ b/lib/opensearch/api/actions/cat/nodes.rb @@ -30,7 +30,7 @@ def nodes(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'nodes'].reject(&:nil?).join('/') + url = ['_cat', 'nodes'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, NODES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/pending_tasks.rb b/lib/opensearch/api/actions/cat/pending_tasks.rb index bfe95a6e4..390ceb1bc 100644 --- a/lib/opensearch/api/actions/cat/pending_tasks.rb +++ b/lib/opensearch/api/actions/cat/pending_tasks.rb @@ -28,7 +28,7 @@ def pending_tasks(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'pending_tasks'].reject(&:nil?).join('/') + url = ['_cat', 'pending_tasks'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, PENDING_TASKS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/pit_segments.rb b/lib/opensearch/api/actions/cat/pit_segments.rb index bfe0005a4..f463dd02a 100644 --- a/lib/opensearch/api/actions/cat/pit_segments.rb +++ b/lib/opensearch/api/actions/cat/pit_segments.rb @@ -26,7 +26,7 @@ def pit_segments(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'pit_segments'].reject(&:nil?).join('/') + url = ['_cat', 'pit_segments'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, PIT_SEGMENTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/plugins.rb b/lib/opensearch/api/actions/cat/plugins.rb index ce26292e9..486495470 100644 --- a/lib/opensearch/api/actions/cat/plugins.rb +++ b/lib/opensearch/api/actions/cat/plugins.rb @@ -27,7 +27,7 @@ def plugins(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'plugins'].reject(&:nil?).join('/') + url = ['_cat', 'plugins'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, PLUGINS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/recovery.rb b/lib/opensearch/api/actions/cat/recovery.rb index 019ee78bc..95cd8e4c0 100644 --- a/lib/opensearch/api/actions/cat/recovery.rb +++ b/lib/opensearch/api/actions/cat/recovery.rb @@ -31,7 +31,7 @@ def recovery(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'recovery', _index].reject(&:nil?).join('/') + url = ['_cat', 'recovery', _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, RECOVERY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/repositories.rb b/lib/opensearch/api/actions/cat/repositories.rb index 3d83c23ba..041285a7d 100644 --- a/lib/opensearch/api/actions/cat/repositories.rb +++ b/lib/opensearch/api/actions/cat/repositories.rb @@ -27,7 +27,7 @@ def repositories(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'repositories'].reject(&:nil?).join('/') + url = ['_cat', 'repositories'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, REPOSITORIES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/segment_replication.rb b/lib/opensearch/api/actions/cat/segment_replication.rb index fd15a6b6c..efe84e45f 100644 --- a/lib/opensearch/api/actions/cat/segment_replication.rb +++ b/lib/opensearch/api/actions/cat/segment_replication.rb @@ -38,7 +38,7 @@ def segment_replication(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'segment_replication', _index].reject(&:nil?).join('/') + url = ['_cat', 'segment_replication', _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, SEGMENT_REPLICATION_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/segments.rb b/lib/opensearch/api/actions/cat/segments.rb index 7506fb4eb..4c443fd2a 100644 --- a/lib/opensearch/api/actions/cat/segments.rb +++ b/lib/opensearch/api/actions/cat/segments.rb @@ -30,7 +30,7 @@ def segments(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'segments', _index].reject(&:nil?).join('/') + url = ['_cat', 'segments', _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, SEGMENTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/shards.rb b/lib/opensearch/api/actions/cat/shards.rb index b0190b740..f6e1ebfef 100644 --- a/lib/opensearch/api/actions/cat/shards.rb +++ b/lib/opensearch/api/actions/cat/shards.rb @@ -32,7 +32,7 @@ def shards(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'shards', _index].reject(&:nil?).join('/') + url = ['_cat', 'shards', _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, SHARDS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/snapshots.rb b/lib/opensearch/api/actions/cat/snapshots.rb index f4d6c61c9..97900e885 100644 --- a/lib/opensearch/api/actions/cat/snapshots.rb +++ b/lib/opensearch/api/actions/cat/snapshots.rb @@ -33,7 +33,7 @@ def snapshots(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'snapshots', _repository].reject(&:nil?).join('/') + url = ['_cat', 'snapshots', _repository].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, SNAPSHOTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/tasks.rb b/lib/opensearch/api/actions/cat/tasks.rb index d3d3c6254..f99e2a82b 100644 --- a/lib/opensearch/api/actions/cat/tasks.rb +++ b/lib/opensearch/api/actions/cat/tasks.rb @@ -29,7 +29,7 @@ def tasks(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'tasks'].reject(&:nil?).join('/') + url = ['_cat', 'tasks'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, TASKS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/templates.rb b/lib/opensearch/api/actions/cat/templates.rb index 02a2c695a..aef5dfefc 100644 --- a/lib/opensearch/api/actions/cat/templates.rb +++ b/lib/opensearch/api/actions/cat/templates.rb @@ -30,7 +30,7 @@ def templates(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'templates', _name].reject(&:nil?).join('/') + url = ['_cat', 'templates', _name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, TEMPLATES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cat/thread_pool.rb b/lib/opensearch/api/actions/cat/thread_pool.rb index af394a0a0..4c1c3c3d8 100644 --- a/lib/opensearch/api/actions/cat/thread_pool.rb +++ b/lib/opensearch/api/actions/cat/thread_pool.rb @@ -32,7 +32,7 @@ def thread_pool(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cat', 'thread_pool', _thread_pool_patterns].reject(&:nil?).join('/') + url = ['_cat', 'thread_pool', _thread_pool_patterns].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, THREAD_POOL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/clear_scroll.rb b/lib/opensearch/api/actions/clear_scroll.rb index 8602ad6f4..aecb4eb63 100644 --- a/lib/opensearch/api/actions/clear_scroll.rb +++ b/lib/opensearch/api/actions/clear_scroll.rb @@ -25,7 +25,7 @@ def clear_scroll(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_search', 'scroll', _scroll_id].reject(&:nil?).join('/') + url = ['_search', 'scroll', _scroll_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, CLEAR_SCROLL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/allocation_explain.rb b/lib/opensearch/api/actions/cluster/allocation_explain.rb index eeb2a85ea..1fb8e79be 100644 --- a/lib/opensearch/api/actions/cluster/allocation_explain.rb +++ b/lib/opensearch/api/actions/cluster/allocation_explain.rb @@ -22,7 +22,7 @@ def allocation_explain(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'allocation', 'explain'].reject(&:nil?).join('/') + url = ['_cluster', 'allocation', 'explain'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, ALLOCATION_EXPLAIN_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/delete_component_template.rb b/lib/opensearch/api/actions/cluster/delete_component_template.rb index 925fcac31..a44e4e65e 100644 --- a/lib/opensearch/api/actions/cluster/delete_component_template.rb +++ b/lib/opensearch/api/actions/cluster/delete_component_template.rb @@ -29,7 +29,7 @@ def delete_component_template(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_component_template', _name].reject(&:nil?).join('/') + url = ['_component_template', _name].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_COMPONENT_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/delete_decommission_awareness.rb b/lib/opensearch/api/actions/cluster/delete_decommission_awareness.rb index 1aa4ca824..b6d139f2e 100644 --- a/lib/opensearch/api/actions/cluster/delete_decommission_awareness.rb +++ b/lib/opensearch/api/actions/cluster/delete_decommission_awareness.rb @@ -21,7 +21,7 @@ def delete_decommission_awareness(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'decommission', 'awareness'].reject(&:nil?).join('/') + url = ['_cluster', 'decommission', 'awareness'].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_DECOMMISSION_AWARENESS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/delete_voting_config_exclusions.rb b/lib/opensearch/api/actions/cluster/delete_voting_config_exclusions.rb index 190699a17..5ec48e97d 100644 --- a/lib/opensearch/api/actions/cluster/delete_voting_config_exclusions.rb +++ b/lib/opensearch/api/actions/cluster/delete_voting_config_exclusions.rb @@ -22,7 +22,7 @@ def delete_voting_config_exclusions(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'voting_config_exclusions'].reject(&:nil?).join('/') + url = ['_cluster', 'voting_config_exclusions'].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_VOTING_CONFIG_EXCLUSIONS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/delete_weighted_routing.rb b/lib/opensearch/api/actions/cluster/delete_weighted_routing.rb index 91a2cf6b9..14a27c015 100644 --- a/lib/opensearch/api/actions/cluster/delete_weighted_routing.rb +++ b/lib/opensearch/api/actions/cluster/delete_weighted_routing.rb @@ -22,7 +22,7 @@ def delete_weighted_routing(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'routing', 'awareness', 'weights'].reject(&:nil?).join('/') + url = ['_cluster', 'routing', 'awareness', 'weights'].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_WEIGHTED_ROUTING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/exists_component_template.rb b/lib/opensearch/api/actions/cluster/exists_component_template.rb index e016cc17b..6ed4b0867 100644 --- a/lib/opensearch/api/actions/cluster/exists_component_template.rb +++ b/lib/opensearch/api/actions/cluster/exists_component_template.rb @@ -27,7 +27,7 @@ def exists_component_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_component_template', _name].reject(&:nil?).join('/') + url = ['_component_template', _name].filter(&:present?).join('/').squeeze('/') method = 'HEAD' Utils.validate_query_params args, EXISTS_COMPONENT_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/get_component_template.rb b/lib/opensearch/api/actions/cluster/get_component_template.rb index bc2c25467..e3a0784f9 100644 --- a/lib/opensearch/api/actions/cluster/get_component_template.rb +++ b/lib/opensearch/api/actions/cluster/get_component_template.rb @@ -25,7 +25,7 @@ def get_component_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_component_template', _name].reject(&:nil?).join('/') + url = ['_component_template', _name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_COMPONENT_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/get_decommission_awareness.rb b/lib/opensearch/api/actions/cluster/get_decommission_awareness.rb index 326d0e7cd..614bdf3ad 100644 --- a/lib/opensearch/api/actions/cluster/get_decommission_awareness.rb +++ b/lib/opensearch/api/actions/cluster/get_decommission_awareness.rb @@ -24,7 +24,7 @@ def get_decommission_awareness(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'decommission', 'awareness', _awareness_attribute_name, '_status'].reject(&:nil?).join('/') + url = ['_cluster', 'decommission', 'awareness', _awareness_attribute_name, '_status'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_DECOMMISSION_AWARENESS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/get_settings.rb b/lib/opensearch/api/actions/cluster/get_settings.rb index 61fcdad35..3e670dc87 100644 --- a/lib/opensearch/api/actions/cluster/get_settings.rb +++ b/lib/opensearch/api/actions/cluster/get_settings.rb @@ -24,7 +24,7 @@ def get_settings(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'settings'].reject(&:nil?).join('/') + url = ['_cluster', 'settings'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_SETTINGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/get_weighted_routing.rb b/lib/opensearch/api/actions/cluster/get_weighted_routing.rb index b1adde3d0..6a3ce4804 100644 --- a/lib/opensearch/api/actions/cluster/get_weighted_routing.rb +++ b/lib/opensearch/api/actions/cluster/get_weighted_routing.rb @@ -24,7 +24,7 @@ def get_weighted_routing(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'routing', 'awareness', _attribute, 'weights'].reject(&:nil?).join('/') + url = ['_cluster', 'routing', 'awareness', _attribute, 'weights'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_WEIGHTED_ROUTING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/health.rb b/lib/opensearch/api/actions/cluster/health.rb index c1b799e1f..4e4ec7af9 100644 --- a/lib/opensearch/api/actions/cluster/health.rb +++ b/lib/opensearch/api/actions/cluster/health.rb @@ -35,7 +35,7 @@ def health(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'health', _index].reject(&:nil?).join('/') + url = ['_cluster', 'health', _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, HEALTH_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/pending_tasks.rb b/lib/opensearch/api/actions/cluster/pending_tasks.rb index 04007627f..21dec5c82 100644 --- a/lib/opensearch/api/actions/cluster/pending_tasks.rb +++ b/lib/opensearch/api/actions/cluster/pending_tasks.rb @@ -23,7 +23,7 @@ def pending_tasks(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'pending_tasks'].reject(&:nil?).join('/') + url = ['_cluster', 'pending_tasks'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, PENDING_TASKS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/post_voting_config_exclusions.rb b/lib/opensearch/api/actions/cluster/post_voting_config_exclusions.rb index 0412e6cfd..1c1fb7f8a 100644 --- a/lib/opensearch/api/actions/cluster/post_voting_config_exclusions.rb +++ b/lib/opensearch/api/actions/cluster/post_voting_config_exclusions.rb @@ -22,7 +22,7 @@ def post_voting_config_exclusions(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'voting_config_exclusions'].reject(&:nil?).join('/') + url = ['_cluster', 'voting_config_exclusions'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, POST_VOTING_CONFIG_EXCLUSIONS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/put_component_template.rb b/lib/opensearch/api/actions/cluster/put_component_template.rb index e601269dc..49c611fb4 100644 --- a/lib/opensearch/api/actions/cluster/put_component_template.rb +++ b/lib/opensearch/api/actions/cluster/put_component_template.rb @@ -30,7 +30,7 @@ def put_component_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_component_template', _name].reject(&:nil?).join('/') + url = ['_component_template', _name].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, PUT_COMPONENT_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/put_decommission_awareness.rb b/lib/opensearch/api/actions/cluster/put_decommission_awareness.rb index e716542f8..493971f4d 100644 --- a/lib/opensearch/api/actions/cluster/put_decommission_awareness.rb +++ b/lib/opensearch/api/actions/cluster/put_decommission_awareness.rb @@ -27,7 +27,7 @@ def put_decommission_awareness(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'decommission', 'awareness', _awareness_attribute_name, _awareness_attribute_value].reject(&:nil?).join('/') + url = ['_cluster', 'decommission', 'awareness', _awareness_attribute_name, _awareness_attribute_value].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, PUT_DECOMMISSION_AWARENESS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/put_settings.rb b/lib/opensearch/api/actions/cluster/put_settings.rb index da4761fba..47e418a7a 100644 --- a/lib/opensearch/api/actions/cluster/put_settings.rb +++ b/lib/opensearch/api/actions/cluster/put_settings.rb @@ -26,7 +26,7 @@ def put_settings(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'settings'].reject(&:nil?).join('/') + url = ['_cluster', 'settings'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, PUT_SETTINGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/put_weighted_routing.rb b/lib/opensearch/api/actions/cluster/put_weighted_routing.rb index 804343a66..ee066f2b1 100644 --- a/lib/opensearch/api/actions/cluster/put_weighted_routing.rb +++ b/lib/opensearch/api/actions/cluster/put_weighted_routing.rb @@ -25,7 +25,7 @@ def put_weighted_routing(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'routing', 'awareness', _attribute, 'weights'].reject(&:nil?).join('/') + url = ['_cluster', 'routing', 'awareness', _attribute, 'weights'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, PUT_WEIGHTED_ROUTING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/remote_info.rb b/lib/opensearch/api/actions/cluster/remote_info.rb index 62038bdc1..c06330435 100644 --- a/lib/opensearch/api/actions/cluster/remote_info.rb +++ b/lib/opensearch/api/actions/cluster/remote_info.rb @@ -19,7 +19,7 @@ def remote_info(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_remote', 'info'].reject(&:nil?).join('/') + url = ['_remote', 'info'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, REMOTE_INFO_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/reroute.rb b/lib/opensearch/api/actions/cluster/reroute.rb index 9218d8440..c22b8b730 100644 --- a/lib/opensearch/api/actions/cluster/reroute.rb +++ b/lib/opensearch/api/actions/cluster/reroute.rb @@ -27,7 +27,7 @@ def reroute(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'reroute'].reject(&:nil?).join('/') + url = ['_cluster', 'reroute'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, REROUTE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/state.rb b/lib/opensearch/api/actions/cluster/state.rb index 01ee7628e..807ea1888 100644 --- a/lib/opensearch/api/actions/cluster/state.rb +++ b/lib/opensearch/api/actions/cluster/state.rb @@ -33,7 +33,7 @@ def state(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'state', _metric, _index].reject(&:nil?).join('/') + url = ['_cluster', 'state', _metric, _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, STATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/cluster/stats.rb b/lib/opensearch/api/actions/cluster/stats.rb index 5c959e29c..8941b7d64 100644 --- a/lib/opensearch/api/actions/cluster/stats.rb +++ b/lib/opensearch/api/actions/cluster/stats.rb @@ -28,7 +28,7 @@ def stats(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_cluster', 'stats', _metric, _index_metric, 'nodes', _node_id].reject(&:nil?).join('/') + url = ['_cluster', 'stats', _metric, _index_metric, 'nodes', _node_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/count.rb b/lib/opensearch/api/actions/count.rb index bec254e12..9718b0caa 100644 --- a/lib/opensearch/api/actions/count.rb +++ b/lib/opensearch/api/actions/count.rb @@ -37,7 +37,7 @@ def count(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_count'].reject(&:nil?).join('/') + url = [_index, '_count'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, COUNT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/create.rb b/lib/opensearch/api/actions/create.rb index c802cb236..8d9aedc12 100644 --- a/lib/opensearch/api/actions/create.rb +++ b/lib/opensearch/api/actions/create.rb @@ -38,7 +38,7 @@ def create(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_create', _id].reject(&:nil?).join('/') + url = [_index, '_create', _id].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CREATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/create_pit.rb b/lib/opensearch/api/actions/create_pit.rb index c5512b702..bbd01b874 100644 --- a/lib/opensearch/api/actions/create_pit.rb +++ b/lib/opensearch/api/actions/create_pit.rb @@ -29,7 +29,7 @@ def create_pit(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_search', 'point_in_time'].reject(&:nil?).join('/') + url = [_index, '_search', 'point_in_time'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CREATE_PIT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb b/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb index b796ddb4b..94aeda680 100644 --- a/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb +++ b/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb @@ -31,7 +31,7 @@ def delete_dangling_index(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_dangling', _index_uuid].reject(&:nil?).join('/') + url = ['_dangling', _index_uuid].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_DANGLING_INDEX_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb b/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb index 758a732e6..e873af958 100644 --- a/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb +++ b/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb @@ -29,7 +29,7 @@ def import_dangling_index(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_dangling', _index_uuid].reject(&:nil?).join('/') + url = ['_dangling', _index_uuid].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, IMPORT_DANGLING_INDEX_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/dangling_indices/list_dangling_indices.rb b/lib/opensearch/api/actions/dangling_indices/list_dangling_indices.rb index 29205ab8e..87b9f5de2 100644 --- a/lib/opensearch/api/actions/dangling_indices/list_dangling_indices.rb +++ b/lib/opensearch/api/actions/dangling_indices/list_dangling_indices.rb @@ -19,7 +19,7 @@ def list_dangling_indices(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_dangling'].reject(&:nil?).join('/') + url = ['_dangling'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, LIST_DANGLING_INDICES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/delete.rb b/lib/opensearch/api/actions/delete.rb index 9d1e1d619..f51c006f1 100644 --- a/lib/opensearch/api/actions/delete.rb +++ b/lib/opensearch/api/actions/delete.rb @@ -37,7 +37,7 @@ def delete(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_doc', _id].reject(&:nil?).join('/') + url = [_index, '_doc', _id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/delete_all_pits.rb b/lib/opensearch/api/actions/delete_all_pits.rb index eb0c8a232..85852e580 100644 --- a/lib/opensearch/api/actions/delete_all_pits.rb +++ b/lib/opensearch/api/actions/delete_all_pits.rb @@ -21,7 +21,7 @@ def delete_all_pits(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_search', 'point_in_time', '_all'].reject(&:nil?).join('/') + url = ['_search', 'point_in_time', '_all'].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_ALL_PITS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/delete_by_query.rb b/lib/opensearch/api/actions/delete_by_query.rb index 192e9ea51..5c39136e6 100644 --- a/lib/opensearch/api/actions/delete_by_query.rb +++ b/lib/opensearch/api/actions/delete_by_query.rb @@ -59,7 +59,7 @@ def delete_by_query(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_delete_by_query'].reject(&:nil?).join('/') + url = [_index, '_delete_by_query'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, DELETE_BY_QUERY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/delete_by_query_rethrottle.rb b/lib/opensearch/api/actions/delete_by_query_rethrottle.rb index f051dffbd..0cf48b02a 100644 --- a/lib/opensearch/api/actions/delete_by_query_rethrottle.rb +++ b/lib/opensearch/api/actions/delete_by_query_rethrottle.rb @@ -25,7 +25,7 @@ def delete_by_query_rethrottle(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_delete_by_query', _task_id, '_rethrottle'].reject(&:nil?).join('/') + url = ['_delete_by_query', _task_id, '_rethrottle'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, DELETE_BY_QUERY_RETHROTTLE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/delete_pit.rb b/lib/opensearch/api/actions/delete_pit.rb index 36fb73b5a..ece8c0184 100644 --- a/lib/opensearch/api/actions/delete_pit.rb +++ b/lib/opensearch/api/actions/delete_pit.rb @@ -22,7 +22,7 @@ def delete_pit(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_search', 'point_in_time'].reject(&:nil?).join('/') + url = ['_search', 'point_in_time'].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_PIT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/delete_script.rb b/lib/opensearch/api/actions/delete_script.rb index 9c0b0dc1b..8159cf3e4 100644 --- a/lib/opensearch/api/actions/delete_script.rb +++ b/lib/opensearch/api/actions/delete_script.rb @@ -29,7 +29,7 @@ def delete_script(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_scripts', _id].reject(&:nil?).join('/') + url = ['_scripts', _id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_SCRIPT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/exists.rb b/lib/opensearch/api/actions/exists.rb index 917e78344..cc478c1ea 100644 --- a/lib/opensearch/api/actions/exists.rb +++ b/lib/opensearch/api/actions/exists.rb @@ -37,7 +37,7 @@ def exists(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_doc', _id].reject(&:nil?).join('/') + url = [_index, '_doc', _id].filter(&:present?).join('/').squeeze('/') method = 'HEAD' Utils.validate_query_params args, EXISTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/exists_source.rb b/lib/opensearch/api/actions/exists_source.rb index 96d9e2995..b42557c94 100644 --- a/lib/opensearch/api/actions/exists_source.rb +++ b/lib/opensearch/api/actions/exists_source.rb @@ -36,7 +36,7 @@ def exists_source(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_source', _id].reject(&:nil?).join('/') + url = [_index, '_source', _id].filter(&:present?).join('/').squeeze('/') method = 'HEAD' Utils.validate_query_params args, EXISTS_SOURCE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/explain.rb b/lib/opensearch/api/actions/explain.rb index c60786997..f16eac7ad 100644 --- a/lib/opensearch/api/actions/explain.rb +++ b/lib/opensearch/api/actions/explain.rb @@ -40,7 +40,7 @@ def explain(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_explain', _id].reject(&:nil?).join('/') + url = [_index, '_explain', _id].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, EXPLAIN_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/field_caps.rb b/lib/opensearch/api/actions/field_caps.rb index 66976051c..0d41b6ebb 100644 --- a/lib/opensearch/api/actions/field_caps.rb +++ b/lib/opensearch/api/actions/field_caps.rb @@ -28,7 +28,7 @@ def field_caps(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_field_caps'].reject(&:nil?).join('/') + url = [_index, '_field_caps'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, FIELD_CAPS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/flow_framework/create.rb b/lib/opensearch/api/actions/flow_framework/create.rb index 2af039268..3fa718a12 100644 --- a/lib/opensearch/api/actions/flow_framework/create.rb +++ b/lib/opensearch/api/actions/flow_framework/create.rb @@ -25,7 +25,7 @@ def create(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_flow_framework', 'workflow'].reject(&:nil?).join('/') + url = ['_plugins', '_flow_framework', 'workflow'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CREATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/flow_framework/delete.rb b/lib/opensearch/api/actions/flow_framework/delete.rb index f3fe29f77..206a856ea 100644 --- a/lib/opensearch/api/actions/flow_framework/delete.rb +++ b/lib/opensearch/api/actions/flow_framework/delete.rb @@ -27,7 +27,7 @@ def delete(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_flow_framework', 'workflow', _workflow_id].reject(&:nil?).join('/') + url = ['_plugins', '_flow_framework', 'workflow', _workflow_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/flow_framework/deprovision.rb b/lib/opensearch/api/actions/flow_framework/deprovision.rb index a610b7ec7..5b443d5fc 100644 --- a/lib/opensearch/api/actions/flow_framework/deprovision.rb +++ b/lib/opensearch/api/actions/flow_framework/deprovision.rb @@ -25,7 +25,7 @@ def deprovision(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_flow_framework', 'workflow', _workflow_id, '_deprovision'].reject(&:nil?).join('/') + url = ['_plugins', '_flow_framework', 'workflow', _workflow_id, '_deprovision'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, DEPROVISION_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/flow_framework/get.rb b/lib/opensearch/api/actions/flow_framework/get.rb index 3d316dafd..f3b4be6d6 100644 --- a/lib/opensearch/api/actions/flow_framework/get.rb +++ b/lib/opensearch/api/actions/flow_framework/get.rb @@ -24,7 +24,7 @@ def get(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_flow_framework', 'workflow', _workflow_id].reject(&:nil?).join('/') + url = ['_plugins', '_flow_framework', 'workflow', _workflow_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/flow_framework/get_status.rb b/lib/opensearch/api/actions/flow_framework/get_status.rb index d6a84b846..94bcc4ef7 100644 --- a/lib/opensearch/api/actions/flow_framework/get_status.rb +++ b/lib/opensearch/api/actions/flow_framework/get_status.rb @@ -25,7 +25,7 @@ def get_status(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_flow_framework', 'workflow', _workflow_id, '_status'].reject(&:nil?).join('/') + url = ['_plugins', '_flow_framework', 'workflow', _workflow_id, '_status'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_STATUS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/flow_framework/get_steps.rb b/lib/opensearch/api/actions/flow_framework/get_steps.rb index 5e4b79553..6c3658dd7 100644 --- a/lib/opensearch/api/actions/flow_framework/get_steps.rb +++ b/lib/opensearch/api/actions/flow_framework/get_steps.rb @@ -20,7 +20,7 @@ def get_steps(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_flow_framework', 'workflow', '_steps'].reject(&:nil?).join('/') + url = ['_plugins', '_flow_framework', 'workflow', '_steps'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_STEPS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/flow_framework/provision.rb b/lib/opensearch/api/actions/flow_framework/provision.rb index b1b9af04a..e6e0e953f 100644 --- a/lib/opensearch/api/actions/flow_framework/provision.rb +++ b/lib/opensearch/api/actions/flow_framework/provision.rb @@ -25,7 +25,7 @@ def provision(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_flow_framework', 'workflow', _workflow_id, '_provision'].reject(&:nil?).join('/') + url = ['_plugins', '_flow_framework', 'workflow', _workflow_id, '_provision'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, PROVISION_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/flow_framework/search.rb b/lib/opensearch/api/actions/flow_framework/search.rb index e2aa015db..6dfe029ec 100644 --- a/lib/opensearch/api/actions/flow_framework/search.rb +++ b/lib/opensearch/api/actions/flow_framework/search.rb @@ -22,7 +22,7 @@ def search(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_flow_framework', 'workflow', '_search'].reject(&:nil?).join('/') + url = ['_plugins', '_flow_framework', 'workflow', '_search'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, SEARCH_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/flow_framework/search_state.rb b/lib/opensearch/api/actions/flow_framework/search_state.rb index 2bbb185fe..5b875f417 100644 --- a/lib/opensearch/api/actions/flow_framework/search_state.rb +++ b/lib/opensearch/api/actions/flow_framework/search_state.rb @@ -22,7 +22,7 @@ def search_state(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_flow_framework', 'workflow', 'state', '_search'].reject(&:nil?).join('/') + url = ['_plugins', '_flow_framework', 'workflow', 'state', '_search'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, SEARCH_STATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/flow_framework/update.rb b/lib/opensearch/api/actions/flow_framework/update.rb index 3891849b7..dcc32d255 100644 --- a/lib/opensearch/api/actions/flow_framework/update.rb +++ b/lib/opensearch/api/actions/flow_framework/update.rb @@ -30,7 +30,7 @@ def update(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_flow_framework', 'workflow', _workflow_id].reject(&:nil?).join('/') + url = ['_plugins', '_flow_framework', 'workflow', _workflow_id].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, UPDATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/get.rb b/lib/opensearch/api/actions/get.rb index a407c613f..833448017 100644 --- a/lib/opensearch/api/actions/get.rb +++ b/lib/opensearch/api/actions/get.rb @@ -37,7 +37,7 @@ def get(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_doc', _id].reject(&:nil?).join('/') + url = [_index, '_doc', _id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/get_all_pits.rb b/lib/opensearch/api/actions/get_all_pits.rb index d4b2224af..32fe0b068 100644 --- a/lib/opensearch/api/actions/get_all_pits.rb +++ b/lib/opensearch/api/actions/get_all_pits.rb @@ -19,7 +19,7 @@ def get_all_pits(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_search', 'point_in_time', '_all'].reject(&:nil?).join('/') + url = ['_search', 'point_in_time', '_all'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ALL_PITS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/get_script.rb b/lib/opensearch/api/actions/get_script.rb index bd4c109ad..cfc0e9293 100644 --- a/lib/opensearch/api/actions/get_script.rb +++ b/lib/opensearch/api/actions/get_script.rb @@ -26,7 +26,7 @@ def get_script(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_scripts', _id].reject(&:nil?).join('/') + url = ['_scripts', _id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_SCRIPT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/get_script_context.rb b/lib/opensearch/api/actions/get_script_context.rb index 1d23859e1..3d9593d70 100644 --- a/lib/opensearch/api/actions/get_script_context.rb +++ b/lib/opensearch/api/actions/get_script_context.rb @@ -19,7 +19,7 @@ def get_script_context(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_script_context'].reject(&:nil?).join('/') + url = ['_script_context'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_SCRIPT_CONTEXT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/get_script_languages.rb b/lib/opensearch/api/actions/get_script_languages.rb index ffc297adb..428e82ffa 100644 --- a/lib/opensearch/api/actions/get_script_languages.rb +++ b/lib/opensearch/api/actions/get_script_languages.rb @@ -19,7 +19,7 @@ def get_script_languages(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_script_language'].reject(&:nil?).join('/') + url = ['_script_language'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_SCRIPT_LANGUAGES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/get_source.rb b/lib/opensearch/api/actions/get_source.rb index 810fd51c5..2b7108fb0 100644 --- a/lib/opensearch/api/actions/get_source.rb +++ b/lib/opensearch/api/actions/get_source.rb @@ -36,7 +36,7 @@ def get_source(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_source', _id].reject(&:nil?).join('/') + url = [_index, '_source', _id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_SOURCE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/index.rb b/lib/opensearch/api/actions/index.rb index 5b47df88e..2ff37ea24 100644 --- a/lib/opensearch/api/actions/index.rb +++ b/lib/opensearch/api/actions/index.rb @@ -39,7 +39,7 @@ def index(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_doc', _id].reject(&:nil?).join('/') + url = [_index, '_doc', _id].filter(&:present?).join('/').squeeze('/') method = _id.present? ? 'PUT' : 'POST' Utils.validate_query_params args, INDEX_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/add_block.rb b/lib/opensearch/api/actions/indices/add_block.rb index 8d2b6eb43..5510826a2 100644 --- a/lib/opensearch/api/actions/indices/add_block.rb +++ b/lib/opensearch/api/actions/indices/add_block.rb @@ -33,7 +33,7 @@ def add_block(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_block', _block].reject(&:nil?).join('/') + url = [_index, '_block', _block].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, ADD_BLOCK_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/analyze.rb b/lib/opensearch/api/actions/indices/analyze.rb index 1351650d9..ca30d6930 100644 --- a/lib/opensearch/api/actions/indices/analyze.rb +++ b/lib/opensearch/api/actions/indices/analyze.rb @@ -23,7 +23,7 @@ def analyze(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_analyze'].reject(&:nil?).join('/') + url = [_index, '_analyze'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, ANALYZE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/clear_cache.rb b/lib/opensearch/api/actions/indices/clear_cache.rb index ef1c1bed3..3e317c428 100644 --- a/lib/opensearch/api/actions/indices/clear_cache.rb +++ b/lib/opensearch/api/actions/indices/clear_cache.rb @@ -30,7 +30,7 @@ def clear_cache(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_cache', 'clear'].reject(&:nil?).join('/') + url = [_index, '_cache', 'clear'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CLEAR_CACHE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/clone.rb b/lib/opensearch/api/actions/indices/clone.rb index 0e4bfc1f2..178f309eb 100644 --- a/lib/opensearch/api/actions/indices/clone.rb +++ b/lib/opensearch/api/actions/indices/clone.rb @@ -34,7 +34,7 @@ def clone(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_clone', _target].reject(&:nil?).join('/') + url = [_index, '_clone', _target].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CLONE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/close.rb b/lib/opensearch/api/actions/indices/close.rb index 62a9feeaa..019ab56e5 100644 --- a/lib/opensearch/api/actions/indices/close.rb +++ b/lib/opensearch/api/actions/indices/close.rb @@ -31,7 +31,7 @@ def close(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_close'].reject(&:nil?).join('/') + url = [_index, '_close'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CLOSE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/create.rb b/lib/opensearch/api/actions/indices/create.rb index 793cbb394..fe7ac50ca 100644 --- a/lib/opensearch/api/actions/indices/create.rb +++ b/lib/opensearch/api/actions/indices/create.rb @@ -29,7 +29,7 @@ def create(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index].reject(&:nil?).join('/') + url = [_index].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/create_data_stream.rb b/lib/opensearch/api/actions/indices/create_data_stream.rb index 2946ab777..384d2715f 100644 --- a/lib/opensearch/api/actions/indices/create_data_stream.rb +++ b/lib/opensearch/api/actions/indices/create_data_stream.rb @@ -25,7 +25,7 @@ def create_data_stream(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_data_stream', _name].reject(&:nil?).join('/') + url = ['_data_stream', _name].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_DATA_STREAM_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/data_streams_stats.rb b/lib/opensearch/api/actions/indices/data_streams_stats.rb index eae58c754..c17d61a95 100644 --- a/lib/opensearch/api/actions/indices/data_streams_stats.rb +++ b/lib/opensearch/api/actions/indices/data_streams_stats.rb @@ -22,7 +22,7 @@ def data_streams_stats(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_data_stream', _name, '_stats'].reject(&:nil?).join('/') + url = ['_data_stream', _name, '_stats'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, DATA_STREAMS_STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/delete.rb b/lib/opensearch/api/actions/indices/delete.rb index ca74cc401..dc5eb6fee 100644 --- a/lib/opensearch/api/actions/indices/delete.rb +++ b/lib/opensearch/api/actions/indices/delete.rb @@ -32,7 +32,7 @@ def delete(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = [_index].reject(&:nil?).join('/') + url = [_index].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/delete_alias.rb b/lib/opensearch/api/actions/indices/delete_alias.rb index 328658f2e..1959afefd 100644 --- a/lib/opensearch/api/actions/indices/delete_alias.rb +++ b/lib/opensearch/api/actions/indices/delete_alias.rb @@ -32,7 +32,7 @@ def delete_alias(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_alias', _name].reject(&:nil?).join('/') + url = [_index, '_alias', _name].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_ALIAS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/delete_data_stream.rb b/lib/opensearch/api/actions/indices/delete_data_stream.rb index 809dcd936..222964138 100644 --- a/lib/opensearch/api/actions/indices/delete_data_stream.rb +++ b/lib/opensearch/api/actions/indices/delete_data_stream.rb @@ -26,7 +26,7 @@ def delete_data_stream(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_data_stream', _name].reject(&:nil?).join('/') + url = ['_data_stream', _name].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_DATA_STREAM_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/delete_index_template.rb b/lib/opensearch/api/actions/indices/delete_index_template.rb index 6eaa2e12c..c080f2ea1 100644 --- a/lib/opensearch/api/actions/indices/delete_index_template.rb +++ b/lib/opensearch/api/actions/indices/delete_index_template.rb @@ -29,7 +29,7 @@ def delete_index_template(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_index_template', _name].reject(&:nil?).join('/') + url = ['_index_template', _name].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_INDEX_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/delete_template.rb b/lib/opensearch/api/actions/indices/delete_template.rb index 96830d2b5..05db76fef 100644 --- a/lib/opensearch/api/actions/indices/delete_template.rb +++ b/lib/opensearch/api/actions/indices/delete_template.rb @@ -29,7 +29,7 @@ def delete_template(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_template', _name].reject(&:nil?).join('/') + url = ['_template', _name].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/exists.rb b/lib/opensearch/api/actions/indices/exists.rb index 2f37d049f..b5da063ec 100644 --- a/lib/opensearch/api/actions/indices/exists.rb +++ b/lib/opensearch/api/actions/indices/exists.rb @@ -31,7 +31,7 @@ def exists(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index].reject(&:nil?).join('/') + url = [_index].filter(&:present?).join('/').squeeze('/') method = 'HEAD' Utils.validate_query_params args, EXISTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/exists_alias.rb b/lib/opensearch/api/actions/indices/exists_alias.rb index 281784bb4..db0bf1d56 100644 --- a/lib/opensearch/api/actions/indices/exists_alias.rb +++ b/lib/opensearch/api/actions/indices/exists_alias.rb @@ -30,7 +30,7 @@ def exists_alias(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_alias', _name].reject(&:nil?).join('/') + url = [_index, '_alias', _name].filter(&:present?).join('/').squeeze('/') method = 'HEAD' Utils.validate_query_params args, EXISTS_ALIAS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/exists_index_template.rb b/lib/opensearch/api/actions/indices/exists_index_template.rb index 4f308df50..0fe872c73 100644 --- a/lib/opensearch/api/actions/indices/exists_index_template.rb +++ b/lib/opensearch/api/actions/indices/exists_index_template.rb @@ -28,7 +28,7 @@ def exists_index_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_index_template', _name].reject(&:nil?).join('/') + url = ['_index_template', _name].filter(&:present?).join('/').squeeze('/') method = 'HEAD' Utils.validate_query_params args, EXISTS_INDEX_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/exists_template.rb b/lib/opensearch/api/actions/indices/exists_template.rb index 07ac1cb8a..46aa9646b 100644 --- a/lib/opensearch/api/actions/indices/exists_template.rb +++ b/lib/opensearch/api/actions/indices/exists_template.rb @@ -28,7 +28,7 @@ def exists_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_template', _name].reject(&:nil?).join('/') + url = ['_template', _name].filter(&:present?).join('/').squeeze('/') method = 'HEAD' Utils.validate_query_params args, EXISTS_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/flush.rb b/lib/opensearch/api/actions/indices/flush.rb index 0e9092e82..316f069b8 100644 --- a/lib/opensearch/api/actions/indices/flush.rb +++ b/lib/opensearch/api/actions/indices/flush.rb @@ -27,7 +27,7 @@ def flush(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_flush'].reject(&:nil?).join('/') + url = [_index, '_flush'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, FLUSH_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/forcemerge.rb b/lib/opensearch/api/actions/indices/forcemerge.rb index 83204b0e1..92b661759 100644 --- a/lib/opensearch/api/actions/indices/forcemerge.rb +++ b/lib/opensearch/api/actions/indices/forcemerge.rb @@ -30,7 +30,7 @@ def forcemerge(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_forcemerge'].reject(&:nil?).join('/') + url = [_index, '_forcemerge'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, FORCEMERGE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/get.rb b/lib/opensearch/api/actions/indices/get.rb index 7d72aed98..6f21d71e8 100644 --- a/lib/opensearch/api/actions/indices/get.rb +++ b/lib/opensearch/api/actions/indices/get.rb @@ -32,7 +32,7 @@ def get(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index].reject(&:nil?).join('/') + url = [_index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/get_alias.rb b/lib/opensearch/api/actions/indices/get_alias.rb index 84f3b9a74..e4358dd6b 100644 --- a/lib/opensearch/api/actions/indices/get_alias.rb +++ b/lib/opensearch/api/actions/indices/get_alias.rb @@ -28,7 +28,7 @@ def get_alias(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_alias', _name].reject(&:nil?).join('/') + url = [_index, '_alias', _name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ALIAS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/get_data_stream.rb b/lib/opensearch/api/actions/indices/get_data_stream.rb index 8424aa4ea..bdf078310 100644 --- a/lib/opensearch/api/actions/indices/get_data_stream.rb +++ b/lib/opensearch/api/actions/indices/get_data_stream.rb @@ -22,7 +22,7 @@ def get_data_stream(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_data_stream', _name].reject(&:nil?).join('/') + url = ['_data_stream', _name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_DATA_STREAM_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/get_field_mapping.rb b/lib/opensearch/api/actions/indices/get_field_mapping.rb index 89e451f91..9c5a3fd41 100644 --- a/lib/opensearch/api/actions/indices/get_field_mapping.rb +++ b/lib/opensearch/api/actions/indices/get_field_mapping.rb @@ -31,7 +31,7 @@ def get_field_mapping(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_mapping', 'field', _fields].reject(&:nil?).join('/') + url = [_index, '_mapping', 'field', _fields].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_FIELD_MAPPING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/get_index_template.rb b/lib/opensearch/api/actions/indices/get_index_template.rb index 7533bf5f6..7b59cb002 100644 --- a/lib/opensearch/api/actions/indices/get_index_template.rb +++ b/lib/opensearch/api/actions/indices/get_index_template.rb @@ -26,7 +26,7 @@ def get_index_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_index_template', _name].reject(&:nil?).join('/') + url = ['_index_template', _name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_INDEX_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/get_mapping.rb b/lib/opensearch/api/actions/indices/get_mapping.rb index ff386d597..66d2842c0 100644 --- a/lib/opensearch/api/actions/indices/get_mapping.rb +++ b/lib/opensearch/api/actions/indices/get_mapping.rb @@ -28,7 +28,7 @@ def get_mapping(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_mapping'].reject(&:nil?).join('/') + url = [_index, '_mapping'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_MAPPING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/get_settings.rb b/lib/opensearch/api/actions/indices/get_settings.rb index 57508068a..399aa51c4 100644 --- a/lib/opensearch/api/actions/indices/get_settings.rb +++ b/lib/opensearch/api/actions/indices/get_settings.rb @@ -32,7 +32,7 @@ def get_settings(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_settings', _name].reject(&:nil?).join('/') + url = [_index, '_settings', _name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_SETTINGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/get_template.rb b/lib/opensearch/api/actions/indices/get_template.rb index 2e6a3ceca..e353ca3d9 100644 --- a/lib/opensearch/api/actions/indices/get_template.rb +++ b/lib/opensearch/api/actions/indices/get_template.rb @@ -26,7 +26,7 @@ def get_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_template', _name].reject(&:nil?).join('/') + url = ['_template', _name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/get_upgrade.rb b/lib/opensearch/api/actions/indices/get_upgrade.rb index 8d06dfb8d..409827eb8 100644 --- a/lib/opensearch/api/actions/indices/get_upgrade.rb +++ b/lib/opensearch/api/actions/indices/get_upgrade.rb @@ -25,7 +25,7 @@ def get_upgrade(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_upgrade'].reject(&:nil?).join('/') + url = [_index, '_upgrade'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_UPGRADE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/open.rb b/lib/opensearch/api/actions/indices/open.rb index 6344dd923..95e68af75 100644 --- a/lib/opensearch/api/actions/indices/open.rb +++ b/lib/opensearch/api/actions/indices/open.rb @@ -33,7 +33,7 @@ def open(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_open'].reject(&:nil?).join('/') + url = [_index, '_open'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, OPEN_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/put_alias.rb b/lib/opensearch/api/actions/indices/put_alias.rb index 1974d9cb3..c8e7171e6 100644 --- a/lib/opensearch/api/actions/indices/put_alias.rb +++ b/lib/opensearch/api/actions/indices/put_alias.rb @@ -28,7 +28,7 @@ def put_alias(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_alias', _name].reject(&:nil?).join('/') + url = [_index, '_alias', _name].filter(&:present?).join('/').squeeze('/') method = _name.present? ? 'PUT' : 'POST' Utils.validate_query_params args, PUT_ALIAS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/put_index_template.rb b/lib/opensearch/api/actions/indices/put_index_template.rb index 51f38ef2b..9d192299c 100644 --- a/lib/opensearch/api/actions/indices/put_index_template.rb +++ b/lib/opensearch/api/actions/indices/put_index_template.rb @@ -30,7 +30,7 @@ def put_index_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_index_template', _name].reject(&:nil?).join('/') + url = ['_index_template', _name].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, PUT_INDEX_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/put_mapping.rb b/lib/opensearch/api/actions/indices/put_mapping.rb index 5f994b87f..2f06541b9 100644 --- a/lib/opensearch/api/actions/indices/put_mapping.rb +++ b/lib/opensearch/api/actions/indices/put_mapping.rb @@ -33,7 +33,7 @@ def put_mapping(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_mapping'].reject(&:nil?).join('/') + url = [_index, '_mapping'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, PUT_MAPPING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/put_settings.rb b/lib/opensearch/api/actions/indices/put_settings.rb index 91e4e5ee9..34c77134d 100644 --- a/lib/opensearch/api/actions/indices/put_settings.rb +++ b/lib/opensearch/api/actions/indices/put_settings.rb @@ -33,7 +33,7 @@ def put_settings(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_settings'].reject(&:nil?).join('/') + url = [_index, '_settings'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, PUT_SETTINGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/put_template.rb b/lib/opensearch/api/actions/indices/put_template.rb index cefe6d42c..7f3ad70bf 100644 --- a/lib/opensearch/api/actions/indices/put_template.rb +++ b/lib/opensearch/api/actions/indices/put_template.rb @@ -30,7 +30,7 @@ def put_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_template', _name].reject(&:nil?).join('/') + url = ['_template', _name].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, PUT_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/recovery.rb b/lib/opensearch/api/actions/indices/recovery.rb index 94a98bac2..2a3991e96 100644 --- a/lib/opensearch/api/actions/indices/recovery.rb +++ b/lib/opensearch/api/actions/indices/recovery.rb @@ -24,7 +24,7 @@ def recovery(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_recovery'].reject(&:nil?).join('/') + url = [_index, '_recovery'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, RECOVERY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/refresh.rb b/lib/opensearch/api/actions/indices/refresh.rb index 7f0ec2473..f67cb8716 100644 --- a/lib/opensearch/api/actions/indices/refresh.rb +++ b/lib/opensearch/api/actions/indices/refresh.rb @@ -25,7 +25,7 @@ def refresh(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_refresh'].reject(&:nil?).join('/') + url = [_index, '_refresh'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, REFRESH_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/resolve_index.rb b/lib/opensearch/api/actions/indices/resolve_index.rb index d4a316b38..68d3cc5ea 100644 --- a/lib/opensearch/api/actions/indices/resolve_index.rb +++ b/lib/opensearch/api/actions/indices/resolve_index.rb @@ -25,7 +25,7 @@ def resolve_index(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_resolve', 'index', _name].reject(&:nil?).join('/') + url = ['_resolve', 'index', _name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, RESOLVE_INDEX_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/rollover.rb b/lib/opensearch/api/actions/indices/rollover.rb index 3329129b6..d23b8c4f3 100644 --- a/lib/opensearch/api/actions/indices/rollover.rb +++ b/lib/opensearch/api/actions/indices/rollover.rb @@ -33,7 +33,7 @@ def rollover(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_alias, '_rollover', _new_index].reject(&:nil?).join('/') + url = [_alias, '_rollover', _new_index].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, ROLLOVER_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/segments.rb b/lib/opensearch/api/actions/indices/segments.rb index e38265d74..968ea1af2 100644 --- a/lib/opensearch/api/actions/indices/segments.rb +++ b/lib/opensearch/api/actions/indices/segments.rb @@ -26,7 +26,7 @@ def segments(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_segments'].reject(&:nil?).join('/') + url = [_index, '_segments'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, SEGMENTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/shard_stores.rb b/lib/opensearch/api/actions/indices/shard_stores.rb index 6c84645e6..9c89631c0 100644 --- a/lib/opensearch/api/actions/indices/shard_stores.rb +++ b/lib/opensearch/api/actions/indices/shard_stores.rb @@ -26,7 +26,7 @@ def shard_stores(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_shard_stores'].reject(&:nil?).join('/') + url = [_index, '_shard_stores'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, SHARD_STORES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/shrink.rb b/lib/opensearch/api/actions/indices/shrink.rb index a56a87fd4..03e854fb5 100644 --- a/lib/opensearch/api/actions/indices/shrink.rb +++ b/lib/opensearch/api/actions/indices/shrink.rb @@ -35,7 +35,7 @@ def shrink(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_shrink', _target].reject(&:nil?).join('/') + url = [_index, '_shrink', _target].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, SHRINK_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/simulate_index_template.rb b/lib/opensearch/api/actions/indices/simulate_index_template.rb index 5dcda83d8..a97ce338b 100644 --- a/lib/opensearch/api/actions/indices/simulate_index_template.rb +++ b/lib/opensearch/api/actions/indices/simulate_index_template.rb @@ -27,7 +27,7 @@ def simulate_index_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_index_template', '_simulate_index', _name].reject(&:nil?).join('/') + url = ['_index_template', '_simulate_index', _name].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, SIMULATE_INDEX_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/simulate_template.rb b/lib/opensearch/api/actions/indices/simulate_template.rb index 1f2618d23..69c7e5465 100644 --- a/lib/opensearch/api/actions/indices/simulate_template.rb +++ b/lib/opensearch/api/actions/indices/simulate_template.rb @@ -27,7 +27,7 @@ def simulate_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_index_template', '_simulate', _name].reject(&:nil?).join('/') + url = ['_index_template', '_simulate', _name].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, SIMULATE_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/split.rb b/lib/opensearch/api/actions/indices/split.rb index 1d522319c..73f913f59 100644 --- a/lib/opensearch/api/actions/indices/split.rb +++ b/lib/opensearch/api/actions/indices/split.rb @@ -35,7 +35,7 @@ def split(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_split', _target].reject(&:nil?).join('/') + url = [_index, '_split', _target].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, SPLIT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/stats.rb b/lib/opensearch/api/actions/indices/stats.rb index 2f6e9516a..0caf7d1c3 100644 --- a/lib/opensearch/api/actions/indices/stats.rb +++ b/lib/opensearch/api/actions/indices/stats.rb @@ -33,7 +33,7 @@ def stats(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_stats', _metric].reject(&:nil?).join('/') + url = [_index, '_stats', _metric].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/update_aliases.rb b/lib/opensearch/api/actions/indices/update_aliases.rb index 8229c118e..35d75d6e6 100644 --- a/lib/opensearch/api/actions/indices/update_aliases.rb +++ b/lib/opensearch/api/actions/indices/update_aliases.rb @@ -25,7 +25,7 @@ def update_aliases(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_aliases'].reject(&:nil?).join('/') + url = ['_aliases'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, UPDATE_ALIASES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/upgrade.rb b/lib/opensearch/api/actions/indices/upgrade.rb index c08e0b82a..209af675b 100644 --- a/lib/opensearch/api/actions/indices/upgrade.rb +++ b/lib/opensearch/api/actions/indices/upgrade.rb @@ -28,7 +28,7 @@ def upgrade(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_upgrade'].reject(&:nil?).join('/') + url = [_index, '_upgrade'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, UPGRADE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/indices/validate_query.rb b/lib/opensearch/api/actions/indices/validate_query.rb index da79fbb09..0ef55cbed 100644 --- a/lib/opensearch/api/actions/indices/validate_query.rb +++ b/lib/opensearch/api/actions/indices/validate_query.rb @@ -35,7 +35,7 @@ def validate_query(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_validate', 'query'].reject(&:nil?).join('/') + url = [_index, '_validate', 'query'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, VALIDATE_QUERY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/info.rb b/lib/opensearch/api/actions/info.rb index 0a5e9392d..f8036871d 100644 --- a/lib/opensearch/api/actions/info.rb +++ b/lib/opensearch/api/actions/info.rb @@ -19,7 +19,7 @@ def info(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = [].reject(&:nil?).join('/') + url = [].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, INFO_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ingest/delete_pipeline.rb b/lib/opensearch/api/actions/ingest/delete_pipeline.rb index b15e40402..4c881a1ce 100644 --- a/lib/opensearch/api/actions/ingest/delete_pipeline.rb +++ b/lib/opensearch/api/actions/ingest/delete_pipeline.rb @@ -29,7 +29,7 @@ def delete_pipeline(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_ingest', 'pipeline', _id].reject(&:nil?).join('/') + url = ['_ingest', 'pipeline', _id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_PIPELINE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ingest/get_pipeline.rb b/lib/opensearch/api/actions/ingest/get_pipeline.rb index 53e15c9a7..0d122d1a9 100644 --- a/lib/opensearch/api/actions/ingest/get_pipeline.rb +++ b/lib/opensearch/api/actions/ingest/get_pipeline.rb @@ -24,7 +24,7 @@ def get_pipeline(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_ingest', 'pipeline', _id].reject(&:nil?).join('/') + url = ['_ingest', 'pipeline', _id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_PIPELINE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ingest/processor_grok.rb b/lib/opensearch/api/actions/ingest/processor_grok.rb index af9f9238d..0448db521 100644 --- a/lib/opensearch/api/actions/ingest/processor_grok.rb +++ b/lib/opensearch/api/actions/ingest/processor_grok.rb @@ -20,7 +20,7 @@ def processor_grok(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_ingest', 'processor', 'grok'].reject(&:nil?).join('/') + url = ['_ingest', 'processor', 'grok'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, PROCESSOR_GROK_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ingest/put_pipeline.rb b/lib/opensearch/api/actions/ingest/put_pipeline.rb index 4f0afd16a..8e038b9ba 100644 --- a/lib/opensearch/api/actions/ingest/put_pipeline.rb +++ b/lib/opensearch/api/actions/ingest/put_pipeline.rb @@ -29,7 +29,7 @@ def put_pipeline(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_ingest', 'pipeline', _id].reject(&:nil?).join('/') + url = ['_ingest', 'pipeline', _id].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, PUT_PIPELINE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ingest/simulate.rb b/lib/opensearch/api/actions/ingest/simulate.rb index 10ab81377..a49115be6 100644 --- a/lib/opensearch/api/actions/ingest/simulate.rb +++ b/lib/opensearch/api/actions/ingest/simulate.rb @@ -26,7 +26,7 @@ def simulate(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_ingest', 'pipeline', _id, '_simulate'].reject(&:nil?).join('/') + url = ['_ingest', 'pipeline', _id, '_simulate'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, SIMULATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/insights/top_queries.rb b/lib/opensearch/api/actions/insights/top_queries.rb index d9942c2a3..0a99c246a 100644 --- a/lib/opensearch/api/actions/insights/top_queries.rb +++ b/lib/opensearch/api/actions/insights/top_queries.rb @@ -22,7 +22,7 @@ def top_queries(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_insights', 'top_queries'].reject(&:nil?).join('/') + url = ['_insights', 'top_queries'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, TOP_QUERIES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/add_policy.rb b/lib/opensearch/api/actions/ism/add_policy.rb index 2da4dca5c..e05cd5d97 100644 --- a/lib/opensearch/api/actions/ism/add_policy.rb +++ b/lib/opensearch/api/actions/ism/add_policy.rb @@ -25,7 +25,7 @@ def add_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'add', _index].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'add', _index].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, ADD_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/change_policy.rb b/lib/opensearch/api/actions/ism/change_policy.rb index 53d2bf4c5..3f064a20e 100644 --- a/lib/opensearch/api/actions/ism/change_policy.rb +++ b/lib/opensearch/api/actions/ism/change_policy.rb @@ -25,7 +25,7 @@ def change_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'change_policy', _index].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'change_policy', _index].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CHANGE_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/delete_policy.rb b/lib/opensearch/api/actions/ism/delete_policy.rb index b7dd62ca9..3005aedfb 100644 --- a/lib/opensearch/api/actions/ism/delete_policy.rb +++ b/lib/opensearch/api/actions/ism/delete_policy.rb @@ -26,7 +26,7 @@ def delete_policy(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'policies', _policy_id].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'policies', _policy_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/exists_policy.rb b/lib/opensearch/api/actions/ism/exists_policy.rb index 799c03809..70457bede 100644 --- a/lib/opensearch/api/actions/ism/exists_policy.rb +++ b/lib/opensearch/api/actions/ism/exists_policy.rb @@ -24,7 +24,7 @@ def exists_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'policies', _policy_id].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'policies', _policy_id].filter(&:present?).join('/').squeeze('/') method = 'HEAD' Utils.validate_query_params args, EXISTS_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/explain_policy.rb b/lib/opensearch/api/actions/ism/explain_policy.rb index 546e77d47..9eadf88b8 100644 --- a/lib/opensearch/api/actions/ism/explain_policy.rb +++ b/lib/opensearch/api/actions/ism/explain_policy.rb @@ -23,7 +23,7 @@ def explain_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'explain', _index].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'explain', _index].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, EXPLAIN_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/get_policies.rb b/lib/opensearch/api/actions/ism/get_policies.rb index b0c4ae4ee..c60183059 100644 --- a/lib/opensearch/api/actions/ism/get_policies.rb +++ b/lib/opensearch/api/actions/ism/get_policies.rb @@ -19,7 +19,7 @@ def get_policies(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'policies'].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'policies'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_POLICIES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/get_policy.rb b/lib/opensearch/api/actions/ism/get_policy.rb index 7476ca766..edf1ecb77 100644 --- a/lib/opensearch/api/actions/ism/get_policy.rb +++ b/lib/opensearch/api/actions/ism/get_policy.rb @@ -24,7 +24,7 @@ def get_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'policies', _policy_id].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'policies', _policy_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/put_policies.rb b/lib/opensearch/api/actions/ism/put_policies.rb index 18da3038b..df4360dcd 100644 --- a/lib/opensearch/api/actions/ism/put_policies.rb +++ b/lib/opensearch/api/actions/ism/put_policies.rb @@ -25,7 +25,7 @@ def put_policies(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'policies'].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'policies'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, PUT_POLICIES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/put_policy.rb b/lib/opensearch/api/actions/ism/put_policy.rb index 64f41c2f3..8818eccc5 100644 --- a/lib/opensearch/api/actions/ism/put_policy.rb +++ b/lib/opensearch/api/actions/ism/put_policy.rb @@ -27,7 +27,7 @@ def put_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'policies', _policy_id].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'policies', _policy_id].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, PUT_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/refresh_search_analyzers.rb b/lib/opensearch/api/actions/ism/refresh_search_analyzers.rb index 00fc0bd4b..17c344d7f 100644 --- a/lib/opensearch/api/actions/ism/refresh_search_analyzers.rb +++ b/lib/opensearch/api/actions/ism/refresh_search_analyzers.rb @@ -24,7 +24,7 @@ def refresh_search_analyzers(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_refresh_search_analyzers', _index].reject(&:nil?).join('/') + url = ['_plugins', '_refresh_search_analyzers', _index].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, REFRESH_SEARCH_ANALYZERS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/remove_policy.rb b/lib/opensearch/api/actions/ism/remove_policy.rb index 8929ccb53..25c4b286d 100644 --- a/lib/opensearch/api/actions/ism/remove_policy.rb +++ b/lib/opensearch/api/actions/ism/remove_policy.rb @@ -24,7 +24,7 @@ def remove_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'remove', _index].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'remove', _index].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, REMOVE_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ism/retry_index.rb b/lib/opensearch/api/actions/ism/retry_index.rb index 70a381293..4a45d838a 100644 --- a/lib/opensearch/api/actions/ism/retry_index.rb +++ b/lib/opensearch/api/actions/ism/retry_index.rb @@ -25,7 +25,7 @@ def retry_index(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ism', 'retry', _index].reject(&:nil?).join('/') + url = ['_plugins', '_ism', 'retry', _index].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, RETRY_INDEX_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/knn/delete_model.rb b/lib/opensearch/api/actions/knn/delete_model.rb index 9c162975d..dfa1a680c 100644 --- a/lib/opensearch/api/actions/knn/delete_model.rb +++ b/lib/opensearch/api/actions/knn/delete_model.rb @@ -26,7 +26,7 @@ def delete_model(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_knn', 'models', _model_id].reject(&:nil?).join('/') + url = ['_plugins', '_knn', 'models', _model_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_MODEL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/knn/get_model.rb b/lib/opensearch/api/actions/knn/get_model.rb index a8af15428..b78c37a29 100644 --- a/lib/opensearch/api/actions/knn/get_model.rb +++ b/lib/opensearch/api/actions/knn/get_model.rb @@ -24,7 +24,7 @@ def get_model(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_knn', 'models', _model_id].reject(&:nil?).join('/') + url = ['_plugins', '_knn', 'models', _model_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_MODEL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/knn/search_models.rb b/lib/opensearch/api/actions/knn/search_models.rb index 72a307c50..21e63dd82 100644 --- a/lib/opensearch/api/actions/knn/search_models.rb +++ b/lib/opensearch/api/actions/knn/search_models.rb @@ -62,7 +62,7 @@ def search_models(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_knn', 'models', '_search'].reject(&:nil?).join('/') + url = ['_plugins', '_knn', 'models', '_search'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, SEARCH_MODELS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/knn/stats.rb b/lib/opensearch/api/actions/knn/stats.rb index f40945529..6ff1ac2ec 100644 --- a/lib/opensearch/api/actions/knn/stats.rb +++ b/lib/opensearch/api/actions/knn/stats.rb @@ -25,7 +25,7 @@ def stats(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_knn', _node_id, 'stats', _stat].reject(&:nil?).join('/') + url = ['_plugins', '_knn', _node_id, 'stats', _stat].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/knn/train_model.rb b/lib/opensearch/api/actions/knn/train_model.rb index 0eccb054f..e8c3959af 100644 --- a/lib/opensearch/api/actions/knn/train_model.rb +++ b/lib/opensearch/api/actions/knn/train_model.rb @@ -24,7 +24,7 @@ def train_model(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_knn', 'models', _model_id, '_train'].reject(&:nil?).join('/') + url = ['_plugins', '_knn', 'models', _model_id, '_train'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, TRAIN_MODEL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/knn/warmup.rb b/lib/opensearch/api/actions/knn/warmup.rb index a020c22c4..e015022ff 100644 --- a/lib/opensearch/api/actions/knn/warmup.rb +++ b/lib/opensearch/api/actions/knn/warmup.rb @@ -24,7 +24,7 @@ def warmup(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_knn', 'warmup', _index].reject(&:nil?).join('/') + url = ['_plugins', '_knn', 'warmup', _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, WARMUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/list/help.rb b/lib/opensearch/api/actions/list/help.rb index 463cc341f..229615335 100644 --- a/lib/opensearch/api/actions/list/help.rb +++ b/lib/opensearch/api/actions/list/help.rb @@ -19,7 +19,7 @@ def help(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_list'].reject(&:nil?).join('/') + url = ['_list'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, HELP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/list/indices.rb b/lib/opensearch/api/actions/list/indices.rb index fc766b73c..795837fbf 100644 --- a/lib/opensearch/api/actions/list/indices.rb +++ b/lib/opensearch/api/actions/list/indices.rb @@ -39,7 +39,7 @@ def indices(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_list', 'indices', _index].reject(&:nil?).join('/') + url = ['_list', 'indices', _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, INDICES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/list/shards.rb b/lib/opensearch/api/actions/list/shards.rb index 3e9257a35..c208ebe2e 100644 --- a/lib/opensearch/api/actions/list/shards.rb +++ b/lib/opensearch/api/actions/list/shards.rb @@ -35,7 +35,7 @@ def shards(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_list', 'shards', _index].reject(&:nil?).join('/') + url = ['_list', 'shards', _index].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, SHARDS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/mget.rb b/lib/opensearch/api/actions/mget.rb index 83c2d780a..049249a6f 100644 --- a/lib/opensearch/api/actions/mget.rb +++ b/lib/opensearch/api/actions/mget.rb @@ -33,7 +33,7 @@ def mget(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_mget'].reject(&:nil?).join('/') + url = [_index, '_mget'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, MGET_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/create_connector.rb b/lib/opensearch/api/actions/ml/create_connector.rb index 77cffd821..79ac3f4e9 100644 --- a/lib/opensearch/api/actions/ml/create_connector.rb +++ b/lib/opensearch/api/actions/ml/create_connector.rb @@ -20,7 +20,7 @@ def create_connector(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'connectors', '_create'].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'connectors', '_create'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CREATE_CONNECTOR_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/delete_agent.rb b/lib/opensearch/api/actions/ml/delete_agent.rb index fff7774d6..3c30adc2c 100644 --- a/lib/opensearch/api/actions/ml/delete_agent.rb +++ b/lib/opensearch/api/actions/ml/delete_agent.rb @@ -26,7 +26,7 @@ def delete_agent(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'agents', _agent_id].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'agents', _agent_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_AGENT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/delete_connector.rb b/lib/opensearch/api/actions/ml/delete_connector.rb index 2b68f25b5..915bcd9ad 100644 --- a/lib/opensearch/api/actions/ml/delete_connector.rb +++ b/lib/opensearch/api/actions/ml/delete_connector.rb @@ -26,7 +26,7 @@ def delete_connector(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'connectors', _connector_id].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'connectors', _connector_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_CONNECTOR_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/delete_model.rb b/lib/opensearch/api/actions/ml/delete_model.rb index e4a5fefc7..b97a2a080 100644 --- a/lib/opensearch/api/actions/ml/delete_model.rb +++ b/lib/opensearch/api/actions/ml/delete_model.rb @@ -26,7 +26,7 @@ def delete_model(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'models', _model_id].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'models', _model_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_MODEL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/delete_model_group.rb b/lib/opensearch/api/actions/ml/delete_model_group.rb index e649a0362..cac366115 100644 --- a/lib/opensearch/api/actions/ml/delete_model_group.rb +++ b/lib/opensearch/api/actions/ml/delete_model_group.rb @@ -26,7 +26,7 @@ def delete_model_group(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'model_groups', _model_group_id].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'model_groups', _model_group_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_MODEL_GROUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/delete_task.rb b/lib/opensearch/api/actions/ml/delete_task.rb index 6cf345549..082070c4a 100644 --- a/lib/opensearch/api/actions/ml/delete_task.rb +++ b/lib/opensearch/api/actions/ml/delete_task.rb @@ -26,7 +26,7 @@ def delete_task(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'tasks', _task_id].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'tasks', _task_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_TASK_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/deploy_model.rb b/lib/opensearch/api/actions/ml/deploy_model.rb index bb28abcd1..8a8465e54 100644 --- a/lib/opensearch/api/actions/ml/deploy_model.rb +++ b/lib/opensearch/api/actions/ml/deploy_model.rb @@ -24,7 +24,7 @@ def deploy_model(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'models', _model_id, '_deploy'].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'models', _model_id, '_deploy'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, DEPLOY_MODEL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/get_model_group.rb b/lib/opensearch/api/actions/ml/get_model_group.rb index 7f8ed5f19..ce193681d 100644 --- a/lib/opensearch/api/actions/ml/get_model_group.rb +++ b/lib/opensearch/api/actions/ml/get_model_group.rb @@ -24,7 +24,7 @@ def get_model_group(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'model_groups', _model_group_id].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'model_groups', _model_group_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_MODEL_GROUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/get_task.rb b/lib/opensearch/api/actions/ml/get_task.rb index 9e7c34d6b..ba2e76af9 100644 --- a/lib/opensearch/api/actions/ml/get_task.rb +++ b/lib/opensearch/api/actions/ml/get_task.rb @@ -24,7 +24,7 @@ def get_task(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'tasks', _task_id].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'tasks', _task_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_TASK_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/register_agents.rb b/lib/opensearch/api/actions/ml/register_agents.rb index 8235f9a4f..806114cf6 100644 --- a/lib/opensearch/api/actions/ml/register_agents.rb +++ b/lib/opensearch/api/actions/ml/register_agents.rb @@ -20,7 +20,7 @@ def register_agents(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'agents', '_register'].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'agents', '_register'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, REGISTER_AGENTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/register_model.rb b/lib/opensearch/api/actions/ml/register_model.rb index 9a95e1030..5af3178d2 100644 --- a/lib/opensearch/api/actions/ml/register_model.rb +++ b/lib/opensearch/api/actions/ml/register_model.rb @@ -20,7 +20,7 @@ def register_model(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'models', '_register'].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'models', '_register'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, REGISTER_MODEL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/register_model_group.rb b/lib/opensearch/api/actions/ml/register_model_group.rb index 934525fd1..034e43333 100644 --- a/lib/opensearch/api/actions/ml/register_model_group.rb +++ b/lib/opensearch/api/actions/ml/register_model_group.rb @@ -20,7 +20,7 @@ def register_model_group(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'model_groups', '_register'].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'model_groups', '_register'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, REGISTER_MODEL_GROUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/search_models.rb b/lib/opensearch/api/actions/ml/search_models.rb index 3a48a5cb7..40fd7e4d9 100644 --- a/lib/opensearch/api/actions/ml/search_models.rb +++ b/lib/opensearch/api/actions/ml/search_models.rb @@ -20,7 +20,7 @@ def search_models(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'models', '_search'].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'models', '_search'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, SEARCH_MODELS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ml/undeploy_model.rb b/lib/opensearch/api/actions/ml/undeploy_model.rb index 16f6c7e21..709add9fc 100644 --- a/lib/opensearch/api/actions/ml/undeploy_model.rb +++ b/lib/opensearch/api/actions/ml/undeploy_model.rb @@ -24,7 +24,7 @@ def undeploy_model(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ml', 'models', _model_id, '_undeploy'].reject(&:nil?).join('/') + url = ['_plugins', '_ml', 'models', _model_id, '_undeploy'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, UNDEPLOY_MODEL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/msearch.rb b/lib/opensearch/api/actions/msearch.rb index 7f7ee9504..72244cd83 100644 --- a/lib/opensearch/api/actions/msearch.rb +++ b/lib/opensearch/api/actions/msearch.rb @@ -32,7 +32,7 @@ def msearch(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = [_index, '_msearch'].reject(&:nil?).join('/') + url = [_index, '_msearch'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, MSEARCH_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/msearch_template.rb b/lib/opensearch/api/actions/msearch_template.rb index 0bda2d425..f4faed0ae 100644 --- a/lib/opensearch/api/actions/msearch_template.rb +++ b/lib/opensearch/api/actions/msearch_template.rb @@ -30,7 +30,7 @@ def msearch_template(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = [_index, '_msearch', 'template'].reject(&:nil?).join('/') + url = [_index, '_msearch', 'template'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, MSEARCH_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/mtermvectors.rb b/lib/opensearch/api/actions/mtermvectors.rb index c1c106d23..79ffe513f 100644 --- a/lib/opensearch/api/actions/mtermvectors.rb +++ b/lib/opensearch/api/actions/mtermvectors.rb @@ -35,7 +35,7 @@ def mtermvectors(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_mtermvectors'].reject(&:nil?).join('/') + url = [_index, '_mtermvectors'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, MTERMVECTORS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/nodes/hot_threads.rb b/lib/opensearch/api/actions/nodes/hot_threads.rb index 194dbb81b..a25ec348f 100644 --- a/lib/opensearch/api/actions/nodes/hot_threads.rb +++ b/lib/opensearch/api/actions/nodes/hot_threads.rb @@ -28,7 +28,7 @@ def hot_threads(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_nodes', _node_id, 'hot_threads'].reject(&:nil?).join('/') + url = ['_nodes', _node_id, 'hot_threads'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, HOT_THREADS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/nodes/info.rb b/lib/opensearch/api/actions/nodes/info.rb index c02f89b0e..17fb79908 100644 --- a/lib/opensearch/api/actions/nodes/info.rb +++ b/lib/opensearch/api/actions/nodes/info.rb @@ -28,7 +28,7 @@ def info(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_nodes', _node_id, _metric].reject(&:nil?).join('/') + url = ['_nodes', _node_id, _metric].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, INFO_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/nodes/reload_secure_settings.rb b/lib/opensearch/api/actions/nodes/reload_secure_settings.rb index de6960c36..448047c58 100644 --- a/lib/opensearch/api/actions/nodes/reload_secure_settings.rb +++ b/lib/opensearch/api/actions/nodes/reload_secure_settings.rb @@ -24,7 +24,7 @@ def reload_secure_settings(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_nodes', _node_id, 'reload_secure_settings'].reject(&:nil?).join('/') + url = ['_nodes', _node_id, 'reload_secure_settings'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, RELOAD_SECURE_SETTINGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/nodes/stats.rb b/lib/opensearch/api/actions/nodes/stats.rb index 7a841ddb1..ae575cfda 100644 --- a/lib/opensearch/api/actions/nodes/stats.rb +++ b/lib/opensearch/api/actions/nodes/stats.rb @@ -34,7 +34,7 @@ def stats(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_nodes', _node_id, 'stats', _metric, _index_metric].reject(&:nil?).join('/') + url = ['_nodes', _node_id, 'stats', _metric, _index_metric].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/nodes/usage.rb b/lib/opensearch/api/actions/nodes/usage.rb index 1b9afc5da..5d2a5325f 100644 --- a/lib/opensearch/api/actions/nodes/usage.rb +++ b/lib/opensearch/api/actions/nodes/usage.rb @@ -25,7 +25,7 @@ def usage(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_nodes', _node_id, 'usage', _metric].reject(&:nil?).join('/') + url = ['_nodes', _node_id, 'usage', _metric].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, USAGE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/notifications/create_config.rb b/lib/opensearch/api/actions/notifications/create_config.rb index a09355dd8..cf3d00b29 100644 --- a/lib/opensearch/api/actions/notifications/create_config.rb +++ b/lib/opensearch/api/actions/notifications/create_config.rb @@ -22,7 +22,7 @@ def create_config(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_notifications', 'configs'].reject(&:nil?).join('/') + url = ['_plugins', '_notifications', 'configs'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CREATE_CONFIG_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/notifications/delete_config.rb b/lib/opensearch/api/actions/notifications/delete_config.rb index 21f92ed69..383b0b506 100644 --- a/lib/opensearch/api/actions/notifications/delete_config.rb +++ b/lib/opensearch/api/actions/notifications/delete_config.rb @@ -26,7 +26,7 @@ def delete_config(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_notifications', 'configs', _config_id].reject(&:nil?).join('/') + url = ['_plugins', '_notifications', 'configs', _config_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_CONFIG_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/notifications/delete_configs.rb b/lib/opensearch/api/actions/notifications/delete_configs.rb index 7d51b1f48..0ce8b8622 100644 --- a/lib/opensearch/api/actions/notifications/delete_configs.rb +++ b/lib/opensearch/api/actions/notifications/delete_configs.rb @@ -25,7 +25,7 @@ def delete_configs(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_notifications', 'configs'].reject(&:nil?).join('/') + url = ['_plugins', '_notifications', 'configs'].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_CONFIGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/notifications/get_config.rb b/lib/opensearch/api/actions/notifications/get_config.rb index 91d171a4d..0a8e5f936 100644 --- a/lib/opensearch/api/actions/notifications/get_config.rb +++ b/lib/opensearch/api/actions/notifications/get_config.rb @@ -24,7 +24,7 @@ def get_config(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_notifications', 'configs', _config_id].reject(&:nil?).join('/') + url = ['_plugins', '_notifications', 'configs', _config_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_CONFIG_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/notifications/get_configs.rb b/lib/opensearch/api/actions/notifications/get_configs.rb index aa1f88215..da792ba3d 100644 --- a/lib/opensearch/api/actions/notifications/get_configs.rb +++ b/lib/opensearch/api/actions/notifications/get_configs.rb @@ -60,7 +60,7 @@ def get_configs(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_notifications', 'configs'].reject(&:nil?).join('/') + url = ['_plugins', '_notifications', 'configs'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_CONFIGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/notifications/list_channels.rb b/lib/opensearch/api/actions/notifications/list_channels.rb index 09fc32d40..f3712abdd 100644 --- a/lib/opensearch/api/actions/notifications/list_channels.rb +++ b/lib/opensearch/api/actions/notifications/list_channels.rb @@ -19,7 +19,7 @@ def list_channels(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_notifications', 'channels'].reject(&:nil?).join('/') + url = ['_plugins', '_notifications', 'channels'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, LIST_CHANNELS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/notifications/list_features.rb b/lib/opensearch/api/actions/notifications/list_features.rb index c78953c1c..d1c1a03c2 100644 --- a/lib/opensearch/api/actions/notifications/list_features.rb +++ b/lib/opensearch/api/actions/notifications/list_features.rb @@ -19,7 +19,7 @@ def list_features(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_notifications', 'features'].reject(&:nil?).join('/') + url = ['_plugins', '_notifications', 'features'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, LIST_FEATURES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/notifications/send_test.rb b/lib/opensearch/api/actions/notifications/send_test.rb index b9a4bca67..9930f2fe1 100644 --- a/lib/opensearch/api/actions/notifications/send_test.rb +++ b/lib/opensearch/api/actions/notifications/send_test.rb @@ -24,7 +24,7 @@ def send_test(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_notifications', 'feature', 'test', _config_id].reject(&:nil?).join('/') + url = ['_plugins', '_notifications', 'feature', 'test', _config_id].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, SEND_TEST_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/notifications/update_config.rb b/lib/opensearch/api/actions/notifications/update_config.rb index 640a2bfe0..941b1daa4 100644 --- a/lib/opensearch/api/actions/notifications/update_config.rb +++ b/lib/opensearch/api/actions/notifications/update_config.rb @@ -26,7 +26,7 @@ def update_config(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_notifications', 'configs', _config_id].reject(&:nil?).join('/') + url = ['_plugins', '_notifications', 'configs', _config_id].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, UPDATE_CONFIG_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/observability/create_object.rb b/lib/opensearch/api/actions/observability/create_object.rb index 03aabef46..495eb4b9b 100644 --- a/lib/opensearch/api/actions/observability/create_object.rb +++ b/lib/opensearch/api/actions/observability/create_object.rb @@ -20,7 +20,7 @@ def create_object(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_observability', 'object'].reject(&:nil?).join('/') + url = ['_plugins', '_observability', 'object'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CREATE_OBJECT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/observability/delete_object.rb b/lib/opensearch/api/actions/observability/delete_object.rb index 81ff940da..ecf8d6b07 100644 --- a/lib/opensearch/api/actions/observability/delete_object.rb +++ b/lib/opensearch/api/actions/observability/delete_object.rb @@ -26,7 +26,7 @@ def delete_object(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_observability', 'object', _object_id].reject(&:nil?).join('/') + url = ['_plugins', '_observability', 'object', _object_id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_OBJECT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/observability/delete_objects.rb b/lib/opensearch/api/actions/observability/delete_objects.rb index 86eb20400..a4ac265b2 100644 --- a/lib/opensearch/api/actions/observability/delete_objects.rb +++ b/lib/opensearch/api/actions/observability/delete_objects.rb @@ -23,7 +23,7 @@ def delete_objects(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_observability', 'object'].reject(&:nil?).join('/') + url = ['_plugins', '_observability', 'object'].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_OBJECTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/observability/get_localstats.rb b/lib/opensearch/api/actions/observability/get_localstats.rb index e5ae515ac..bf96ba78f 100644 --- a/lib/opensearch/api/actions/observability/get_localstats.rb +++ b/lib/opensearch/api/actions/observability/get_localstats.rb @@ -19,7 +19,7 @@ def get_localstats(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_observability', '_local', 'stats'].reject(&:nil?).join('/') + url = ['_plugins', '_observability', '_local', 'stats'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_LOCALSTATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/observability/get_object.rb b/lib/opensearch/api/actions/observability/get_object.rb index a07b31785..fae46507a 100644 --- a/lib/opensearch/api/actions/observability/get_object.rb +++ b/lib/opensearch/api/actions/observability/get_object.rb @@ -24,7 +24,7 @@ def get_object(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_observability', 'object', _object_id].reject(&:nil?).join('/') + url = ['_plugins', '_observability', 'object', _object_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_OBJECT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/observability/list_objects.rb b/lib/opensearch/api/actions/observability/list_objects.rb index 6dfb7a958..72083ce4d 100644 --- a/lib/opensearch/api/actions/observability/list_objects.rb +++ b/lib/opensearch/api/actions/observability/list_objects.rb @@ -19,7 +19,7 @@ def list_objects(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_observability', 'object'].reject(&:nil?).join('/') + url = ['_plugins', '_observability', 'object'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, LIST_OBJECTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/observability/update_object.rb b/lib/opensearch/api/actions/observability/update_object.rb index df2b846b1..71514f522 100644 --- a/lib/opensearch/api/actions/observability/update_object.rb +++ b/lib/opensearch/api/actions/observability/update_object.rb @@ -25,7 +25,7 @@ def update_object(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_observability', 'object', _object_id].reject(&:nil?).join('/') + url = ['_plugins', '_observability', 'object', _object_id].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, UPDATE_OBJECT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ping.rb b/lib/opensearch/api/actions/ping.rb index a4520dce0..2cade5ae8 100644 --- a/lib/opensearch/api/actions/ping.rb +++ b/lib/opensearch/api/actions/ping.rb @@ -19,7 +19,7 @@ def ping(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = [].reject(&:nil?).join('/') + url = [].filter(&:present?).join('/').squeeze('/') method = 'HEAD' Utils.validate_query_params args, PING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ppl/explain.rb b/lib/opensearch/api/actions/ppl/explain.rb index 0039a1ef1..c01436047 100644 --- a/lib/opensearch/api/actions/ppl/explain.rb +++ b/lib/opensearch/api/actions/ppl/explain.rb @@ -24,7 +24,7 @@ def explain(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ppl', '_explain'].reject(&:nil?).join('/') + url = ['_plugins', '_ppl', '_explain'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, EXPLAIN_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ppl/get_stats.rb b/lib/opensearch/api/actions/ppl/get_stats.rb index e7aac8add..e0587e66b 100644 --- a/lib/opensearch/api/actions/ppl/get_stats.rb +++ b/lib/opensearch/api/actions/ppl/get_stats.rb @@ -21,7 +21,7 @@ def get_stats(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ppl', 'stats'].reject(&:nil?).join('/') + url = ['_plugins', '_ppl', 'stats'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ppl/post_stats.rb b/lib/opensearch/api/actions/ppl/post_stats.rb index 8d9e3c643..4b17e9dc0 100644 --- a/lib/opensearch/api/actions/ppl/post_stats.rb +++ b/lib/opensearch/api/actions/ppl/post_stats.rb @@ -24,7 +24,7 @@ def post_stats(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ppl', 'stats'].reject(&:nil?).join('/') + url = ['_plugins', '_ppl', 'stats'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, POST_STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/ppl/query.rb b/lib/opensearch/api/actions/ppl/query.rb index 5623401ed..537c64f3e 100644 --- a/lib/opensearch/api/actions/ppl/query.rb +++ b/lib/opensearch/api/actions/ppl/query.rb @@ -24,7 +24,7 @@ def query(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_ppl'].reject(&:nil?).join('/') + url = ['_plugins', '_ppl'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, QUERY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/put_script.rb b/lib/opensearch/api/actions/put_script.rb index af3d75833..a8c9e1575 100644 --- a/lib/opensearch/api/actions/put_script.rb +++ b/lib/opensearch/api/actions/put_script.rb @@ -31,7 +31,7 @@ def put_script(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_scripts', _id, _context].reject(&:nil?).join('/') + url = ['_scripts', _id, _context].filter(&:present?).join('/').squeeze('/') method = _context.present? ? 'PUT' : 'POST' Utils.validate_query_params args, PUT_SCRIPT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/query/datasource_delete.rb b/lib/opensearch/api/actions/query/datasource_delete.rb index c96eb002d..5649bcac4 100644 --- a/lib/opensearch/api/actions/query/datasource_delete.rb +++ b/lib/opensearch/api/actions/query/datasource_delete.rb @@ -26,7 +26,7 @@ def datasource_delete(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_query', '_datasources', _datasource_name].reject(&:nil?).join('/') + url = ['_plugins', '_query', '_datasources', _datasource_name].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DATASOURCE_DELETE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/query/datasource_retrieve.rb b/lib/opensearch/api/actions/query/datasource_retrieve.rb index 65d5d20fb..29bfe04f6 100644 --- a/lib/opensearch/api/actions/query/datasource_retrieve.rb +++ b/lib/opensearch/api/actions/query/datasource_retrieve.rb @@ -24,7 +24,7 @@ def datasource_retrieve(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_query', '_datasources', _datasource_name].reject(&:nil?).join('/') + url = ['_plugins', '_query', '_datasources', _datasource_name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, DATASOURCE_RETRIEVE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/query/datasources_create.rb b/lib/opensearch/api/actions/query/datasources_create.rb index 55551e794..83441da76 100644 --- a/lib/opensearch/api/actions/query/datasources_create.rb +++ b/lib/opensearch/api/actions/query/datasources_create.rb @@ -20,7 +20,7 @@ def datasources_create(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_query', '_datasources'].reject(&:nil?).join('/') + url = ['_plugins', '_query', '_datasources'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, DATASOURCES_CREATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/query/datasources_list.rb b/lib/opensearch/api/actions/query/datasources_list.rb index 3cddca1ec..2bc1e6208 100644 --- a/lib/opensearch/api/actions/query/datasources_list.rb +++ b/lib/opensearch/api/actions/query/datasources_list.rb @@ -19,7 +19,7 @@ def datasources_list(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_query', '_datasources'].reject(&:nil?).join('/') + url = ['_plugins', '_query', '_datasources'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, DATASOURCES_LIST_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/query/datasources_update.rb b/lib/opensearch/api/actions/query/datasources_update.rb index acfee7340..019a01afe 100644 --- a/lib/opensearch/api/actions/query/datasources_update.rb +++ b/lib/opensearch/api/actions/query/datasources_update.rb @@ -20,7 +20,7 @@ def datasources_update(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_query', '_datasources'].reject(&:nil?).join('/') + url = ['_plugins', '_query', '_datasources'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, DATASOURCES_UPDATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/rank_eval.rb b/lib/opensearch/api/actions/rank_eval.rb index d7d415ee9..46c1c042f 100644 --- a/lib/opensearch/api/actions/rank_eval.rb +++ b/lib/opensearch/api/actions/rank_eval.rb @@ -29,7 +29,7 @@ def rank_eval(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_rank_eval'].reject(&:nil?).join('/') + url = [_index, '_rank_eval'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, RANK_EVAL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/reindex.rb b/lib/opensearch/api/actions/reindex.rb index 276f9ab77..ca53ddc08 100644 --- a/lib/opensearch/api/actions/reindex.rb +++ b/lib/opensearch/api/actions/reindex.rb @@ -32,7 +32,7 @@ def reindex(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_reindex'].reject(&:nil?).join('/') + url = ['_reindex'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, REINDEX_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/reindex_rethrottle.rb b/lib/opensearch/api/actions/reindex_rethrottle.rb index 08bdcfcca..b7692351c 100644 --- a/lib/opensearch/api/actions/reindex_rethrottle.rb +++ b/lib/opensearch/api/actions/reindex_rethrottle.rb @@ -25,7 +25,7 @@ def reindex_rethrottle(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_reindex', _task_id, '_rethrottle'].reject(&:nil?).join('/') + url = ['_reindex', _task_id, '_rethrottle'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, REINDEX_RETHROTTLE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/remote_store/restore.rb b/lib/opensearch/api/actions/remote_store/restore.rb index 3a6815d23..cbbce3191 100644 --- a/lib/opensearch/api/actions/remote_store/restore.rb +++ b/lib/opensearch/api/actions/remote_store/restore.rb @@ -24,7 +24,7 @@ def restore(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_remotestore', '_restore'].reject(&:nil?).join('/') + url = ['_remotestore', '_restore'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, RESTORE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/render_search_template.rb b/lib/opensearch/api/actions/render_search_template.rb index 4a97b88fc..102ff865d 100644 --- a/lib/opensearch/api/actions/render_search_template.rb +++ b/lib/opensearch/api/actions/render_search_template.rb @@ -23,7 +23,7 @@ def render_search_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_render', 'template', _id].reject(&:nil?).join('/') + url = ['_render', 'template', _id].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, RENDER_SEARCH_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/autofollow_stats.rb b/lib/opensearch/api/actions/replication/autofollow_stats.rb index afcd93b21..84f3c7e0e 100644 --- a/lib/opensearch/api/actions/replication/autofollow_stats.rb +++ b/lib/opensearch/api/actions/replication/autofollow_stats.rb @@ -19,7 +19,7 @@ def autofollow_stats(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', 'autofollow_stats'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', 'autofollow_stats'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, AUTOFOLLOW_STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/create_replication_rule.rb b/lib/opensearch/api/actions/replication/create_replication_rule.rb index 67cfa8180..385599121 100644 --- a/lib/opensearch/api/actions/replication/create_replication_rule.rb +++ b/lib/opensearch/api/actions/replication/create_replication_rule.rb @@ -22,7 +22,7 @@ def create_replication_rule(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', '_autofollow'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', '_autofollow'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CREATE_REPLICATION_RULE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/delete_replication_rule.rb b/lib/opensearch/api/actions/replication/delete_replication_rule.rb index c6caa1daa..2ea4cfa6d 100644 --- a/lib/opensearch/api/actions/replication/delete_replication_rule.rb +++ b/lib/opensearch/api/actions/replication/delete_replication_rule.rb @@ -24,7 +24,7 @@ def delete_replication_rule(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', '_autofollow'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', '_autofollow'].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_REPLICATION_RULE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/follower_stats.rb b/lib/opensearch/api/actions/replication/follower_stats.rb index 076c463a4..aa121ff5d 100644 --- a/lib/opensearch/api/actions/replication/follower_stats.rb +++ b/lib/opensearch/api/actions/replication/follower_stats.rb @@ -19,7 +19,7 @@ def follower_stats(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', 'follower_stats'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', 'follower_stats'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, FOLLOWER_STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/leader_stats.rb b/lib/opensearch/api/actions/replication/leader_stats.rb index f260b57e7..5ea283268 100644 --- a/lib/opensearch/api/actions/replication/leader_stats.rb +++ b/lib/opensearch/api/actions/replication/leader_stats.rb @@ -19,7 +19,7 @@ def leader_stats(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', 'leader_stats'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', 'leader_stats'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, LEADER_STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/pause.rb b/lib/opensearch/api/actions/replication/pause.rb index 21203a5ea..d01aaab2d 100644 --- a/lib/opensearch/api/actions/replication/pause.rb +++ b/lib/opensearch/api/actions/replication/pause.rb @@ -26,7 +26,7 @@ def pause(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', _index, '_pause'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', _index, '_pause'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, PAUSE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/resume.rb b/lib/opensearch/api/actions/replication/resume.rb index 50ed7777c..35bf5ab1d 100644 --- a/lib/opensearch/api/actions/replication/resume.rb +++ b/lib/opensearch/api/actions/replication/resume.rb @@ -26,7 +26,7 @@ def resume(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', _index, '_resume'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', _index, '_resume'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, RESUME_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/start.rb b/lib/opensearch/api/actions/replication/start.rb index 430eb2b1d..f5ae37182 100644 --- a/lib/opensearch/api/actions/replication/start.rb +++ b/lib/opensearch/api/actions/replication/start.rb @@ -26,7 +26,7 @@ def start(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', _index, '_start'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', _index, '_start'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, START_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/status.rb b/lib/opensearch/api/actions/replication/status.rb index 86335e3d3..715e1819b 100644 --- a/lib/opensearch/api/actions/replication/status.rb +++ b/lib/opensearch/api/actions/replication/status.rb @@ -24,7 +24,7 @@ def status(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', _index, '_status'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', _index, '_status'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, STATUS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/stop.rb b/lib/opensearch/api/actions/replication/stop.rb index 02b1ddf9c..8ead07a88 100644 --- a/lib/opensearch/api/actions/replication/stop.rb +++ b/lib/opensearch/api/actions/replication/stop.rb @@ -26,7 +26,7 @@ def stop(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', _index, '_stop'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', _index, '_stop'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, STOP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/replication/update_settings.rb b/lib/opensearch/api/actions/replication/update_settings.rb index e4426c7df..e8b636cd2 100644 --- a/lib/opensearch/api/actions/replication/update_settings.rb +++ b/lib/opensearch/api/actions/replication/update_settings.rb @@ -26,7 +26,7 @@ def update_settings(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_replication', _index, '_update'].reject(&:nil?).join('/') + url = ['_plugins', '_replication', _index, '_update'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, UPDATE_SETTINGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/rollups/delete.rb b/lib/opensearch/api/actions/rollups/delete.rb index b4adcd96f..c6872817b 100644 --- a/lib/opensearch/api/actions/rollups/delete.rb +++ b/lib/opensearch/api/actions/rollups/delete.rb @@ -26,7 +26,7 @@ def delete(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_rollup', 'jobs', _id].reject(&:nil?).join('/') + url = ['_plugins', '_rollup', 'jobs', _id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/rollups/explain.rb b/lib/opensearch/api/actions/rollups/explain.rb index 698008a0e..7d0d2632c 100644 --- a/lib/opensearch/api/actions/rollups/explain.rb +++ b/lib/opensearch/api/actions/rollups/explain.rb @@ -24,7 +24,7 @@ def explain(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_rollup', 'jobs', _id, '_explain'].reject(&:nil?).join('/') + url = ['_plugins', '_rollup', 'jobs', _id, '_explain'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, EXPLAIN_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/rollups/get.rb b/lib/opensearch/api/actions/rollups/get.rb index d00cfeba9..7e73301d0 100644 --- a/lib/opensearch/api/actions/rollups/get.rb +++ b/lib/opensearch/api/actions/rollups/get.rb @@ -24,7 +24,7 @@ def get(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_rollup', 'jobs', _id].reject(&:nil?).join('/') + url = ['_plugins', '_rollup', 'jobs', _id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/rollups/put.rb b/lib/opensearch/api/actions/rollups/put.rb index 3012cdd31..98ceaf0f9 100644 --- a/lib/opensearch/api/actions/rollups/put.rb +++ b/lib/opensearch/api/actions/rollups/put.rb @@ -27,7 +27,7 @@ def put(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_rollup', 'jobs', _id].reject(&:nil?).join('/') + url = ['_plugins', '_rollup', 'jobs', _id].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, PUT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/rollups/start.rb b/lib/opensearch/api/actions/rollups/start.rb index e6ed7a266..ba5734ddc 100644 --- a/lib/opensearch/api/actions/rollups/start.rb +++ b/lib/opensearch/api/actions/rollups/start.rb @@ -24,7 +24,7 @@ def start(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_rollup', 'jobs', _id, '_start'].reject(&:nil?).join('/') + url = ['_plugins', '_rollup', 'jobs', _id, '_start'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, START_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/rollups/stop.rb b/lib/opensearch/api/actions/rollups/stop.rb index a93f3748d..d7423250d 100644 --- a/lib/opensearch/api/actions/rollups/stop.rb +++ b/lib/opensearch/api/actions/rollups/stop.rb @@ -24,7 +24,7 @@ def stop(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_rollup', 'jobs', _id, '_stop'].reject(&:nil?).join('/') + url = ['_plugins', '_rollup', 'jobs', _id, '_stop'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, STOP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/scripts_painless_execute.rb b/lib/opensearch/api/actions/scripts_painless_execute.rb index 4f20e1627..a4e5d8072 100644 --- a/lib/opensearch/api/actions/scripts_painless_execute.rb +++ b/lib/opensearch/api/actions/scripts_painless_execute.rb @@ -20,7 +20,7 @@ def scripts_painless_execute(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_scripts', 'painless', '_execute'].reject(&:nil?).join('/') + url = ['_scripts', 'painless', '_execute'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, SCRIPTS_PAINLESS_EXECUTE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/scroll.rb b/lib/opensearch/api/actions/scroll.rb index e3ef72d16..6cb1419a9 100644 --- a/lib/opensearch/api/actions/scroll.rb +++ b/lib/opensearch/api/actions/scroll.rb @@ -25,7 +25,7 @@ def scroll(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_search', 'scroll', _scroll_id].reject(&:nil?).join('/') + url = ['_search', 'scroll', _scroll_id].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, SCROLL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/search.rb b/lib/opensearch/api/actions/search.rb index 401f75daa..087847c2d 100644 --- a/lib/opensearch/api/actions/search.rb +++ b/lib/opensearch/api/actions/search.rb @@ -69,7 +69,7 @@ def search(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_search'].reject(&:nil?).join('/') + url = [_index, '_search'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, SEARCH_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/search_pipeline/delete.rb b/lib/opensearch/api/actions/search_pipeline/delete.rb index 97f794194..5ecdf30fb 100644 --- a/lib/opensearch/api/actions/search_pipeline/delete.rb +++ b/lib/opensearch/api/actions/search_pipeline/delete.rb @@ -28,7 +28,7 @@ def delete(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_search', 'pipeline', _id].reject(&:nil?).join('/') + url = ['_search', 'pipeline', _id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/search_pipeline/get.rb b/lib/opensearch/api/actions/search_pipeline/get.rb index 452ad7147..a681255ee 100644 --- a/lib/opensearch/api/actions/search_pipeline/get.rb +++ b/lib/opensearch/api/actions/search_pipeline/get.rb @@ -23,7 +23,7 @@ def get(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_search', 'pipeline', _id].reject(&:nil?).join('/') + url = ['_search', 'pipeline', _id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/search_pipeline/put.rb b/lib/opensearch/api/actions/search_pipeline/put.rb index a59ea60de..e84772a84 100644 --- a/lib/opensearch/api/actions/search_pipeline/put.rb +++ b/lib/opensearch/api/actions/search_pipeline/put.rb @@ -28,7 +28,7 @@ def put(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_search', 'pipeline', _id].reject(&:nil?).join('/') + url = ['_search', 'pipeline', _id].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, PUT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/search_shards.rb b/lib/opensearch/api/actions/search_shards.rb index b8401e479..a4f85364a 100644 --- a/lib/opensearch/api/actions/search_shards.rb +++ b/lib/opensearch/api/actions/search_shards.rb @@ -29,7 +29,7 @@ def search_shards(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_search_shards'].reject(&:nil?).join('/') + url = [_index, '_search_shards'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, SEARCH_SHARDS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/search_template.rb b/lib/opensearch/api/actions/search_template.rb index c5ef95916..927c8a205 100644 --- a/lib/opensearch/api/actions/search_template.rb +++ b/lib/opensearch/api/actions/search_template.rb @@ -38,7 +38,7 @@ def search_template(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_search', 'template'].reject(&:nil?).join('/') + url = [_index, '_search', 'template'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, SEARCH_TEMPLATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/authinfo.rb b/lib/opensearch/api/actions/security/authinfo.rb index 3c11f6544..7ce02a9ab 100644 --- a/lib/opensearch/api/actions/security/authinfo.rb +++ b/lib/opensearch/api/actions/security/authinfo.rb @@ -21,7 +21,7 @@ def authinfo(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'authinfo'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'authinfo'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, AUTHINFO_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/authtoken.rb b/lib/opensearch/api/actions/security/authtoken.rb index fd4a9417e..d2d743952 100644 --- a/lib/opensearch/api/actions/security/authtoken.rb +++ b/lib/opensearch/api/actions/security/authtoken.rb @@ -19,7 +19,7 @@ def authtoken(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'authtoken'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'authtoken'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, AUTHTOKEN_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/change_password.rb b/lib/opensearch/api/actions/security/change_password.rb index 182fd8e8d..437241054 100644 --- a/lib/opensearch/api/actions/security/change_password.rb +++ b/lib/opensearch/api/actions/security/change_password.rb @@ -22,7 +22,7 @@ def change_password(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'account'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'account'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CHANGE_PASSWORD_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/config_upgrade_check.rb b/lib/opensearch/api/actions/security/config_upgrade_check.rb index dbb40d3f0..8c585b119 100644 --- a/lib/opensearch/api/actions/security/config_upgrade_check.rb +++ b/lib/opensearch/api/actions/security/config_upgrade_check.rb @@ -19,7 +19,7 @@ def config_upgrade_check(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', '_upgrade_check'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', '_upgrade_check'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, CONFIG_UPGRADE_CHECK_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/config_upgrade_perform.rb b/lib/opensearch/api/actions/security/config_upgrade_perform.rb index c31fdbf16..08edd34ec 100644 --- a/lib/opensearch/api/actions/security/config_upgrade_perform.rb +++ b/lib/opensearch/api/actions/security/config_upgrade_perform.rb @@ -20,7 +20,7 @@ def config_upgrade_perform(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', '_upgrade_perform'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', '_upgrade_perform'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CONFIG_UPGRADE_PERFORM_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/create_action_group.rb b/lib/opensearch/api/actions/security/create_action_group.rb index 51b78d497..adc1f3471 100644 --- a/lib/opensearch/api/actions/security/create_action_group.rb +++ b/lib/opensearch/api/actions/security/create_action_group.rb @@ -26,7 +26,7 @@ def create_action_group(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'actiongroups', _action_group].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'actiongroups', _action_group].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_ACTION_GROUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/create_allowlist.rb b/lib/opensearch/api/actions/security/create_allowlist.rb index 4421a60aa..8c016e86e 100644 --- a/lib/opensearch/api/actions/security/create_allowlist.rb +++ b/lib/opensearch/api/actions/security/create_allowlist.rb @@ -22,7 +22,7 @@ def create_allowlist(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'allowlist'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'allowlist'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_ALLOWLIST_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/create_role.rb b/lib/opensearch/api/actions/security/create_role.rb index b4ef33928..495863225 100644 --- a/lib/opensearch/api/actions/security/create_role.rb +++ b/lib/opensearch/api/actions/security/create_role.rb @@ -26,7 +26,7 @@ def create_role(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'roles', _role].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'roles', _role].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_ROLE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/create_role_mapping.rb b/lib/opensearch/api/actions/security/create_role_mapping.rb index 83ed9a321..37b1de5fb 100644 --- a/lib/opensearch/api/actions/security/create_role_mapping.rb +++ b/lib/opensearch/api/actions/security/create_role_mapping.rb @@ -26,7 +26,7 @@ def create_role_mapping(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'rolesmapping', _role].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'rolesmapping', _role].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_ROLE_MAPPING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/create_tenant.rb b/lib/opensearch/api/actions/security/create_tenant.rb index 2570603b9..e7543547c 100644 --- a/lib/opensearch/api/actions/security/create_tenant.rb +++ b/lib/opensearch/api/actions/security/create_tenant.rb @@ -26,7 +26,7 @@ def create_tenant(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'tenants', _tenant].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'tenants', _tenant].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_TENANT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/create_update_tenancy_config.rb b/lib/opensearch/api/actions/security/create_update_tenancy_config.rb index eeb712a5d..3f96e2694 100644 --- a/lib/opensearch/api/actions/security/create_update_tenancy_config.rb +++ b/lib/opensearch/api/actions/security/create_update_tenancy_config.rb @@ -22,7 +22,7 @@ def create_update_tenancy_config(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'tenancy', 'config'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'tenancy', 'config'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_UPDATE_TENANCY_CONFIG_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/create_user.rb b/lib/opensearch/api/actions/security/create_user.rb index 9f4b2b152..83520cf3e 100644 --- a/lib/opensearch/api/actions/security/create_user.rb +++ b/lib/opensearch/api/actions/security/create_user.rb @@ -26,7 +26,7 @@ def create_user(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'internalusers', _username].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'internalusers', _username].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_USER_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/create_user_legacy.rb b/lib/opensearch/api/actions/security/create_user_legacy.rb index d3a9fc8ce..f8e73c66f 100644 --- a/lib/opensearch/api/actions/security/create_user_legacy.rb +++ b/lib/opensearch/api/actions/security/create_user_legacy.rb @@ -26,7 +26,7 @@ def create_user_legacy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'user', _username].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'user', _username].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_USER_LEGACY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/delete_action_group.rb b/lib/opensearch/api/actions/security/delete_action_group.rb index a796db010..b612ef8c8 100644 --- a/lib/opensearch/api/actions/security/delete_action_group.rb +++ b/lib/opensearch/api/actions/security/delete_action_group.rb @@ -26,7 +26,7 @@ def delete_action_group(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'actiongroups', _action_group].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'actiongroups', _action_group].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_ACTION_GROUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/delete_distinguished_name.rb b/lib/opensearch/api/actions/security/delete_distinguished_name.rb index d52fa74e3..fce28d2d7 100644 --- a/lib/opensearch/api/actions/security/delete_distinguished_name.rb +++ b/lib/opensearch/api/actions/security/delete_distinguished_name.rb @@ -26,7 +26,7 @@ def delete_distinguished_name(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'nodesdn', _cluster_name].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'nodesdn', _cluster_name].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_DISTINGUISHED_NAME_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/delete_role.rb b/lib/opensearch/api/actions/security/delete_role.rb index 491ddef48..0277dc6b7 100644 --- a/lib/opensearch/api/actions/security/delete_role.rb +++ b/lib/opensearch/api/actions/security/delete_role.rb @@ -26,7 +26,7 @@ def delete_role(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'roles', _role].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'roles', _role].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_ROLE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/delete_role_mapping.rb b/lib/opensearch/api/actions/security/delete_role_mapping.rb index a38a86d6f..a0094287a 100644 --- a/lib/opensearch/api/actions/security/delete_role_mapping.rb +++ b/lib/opensearch/api/actions/security/delete_role_mapping.rb @@ -26,7 +26,7 @@ def delete_role_mapping(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'rolesmapping', _role].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'rolesmapping', _role].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_ROLE_MAPPING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/delete_tenant.rb b/lib/opensearch/api/actions/security/delete_tenant.rb index 2e6b4cb16..45e4bcb3a 100644 --- a/lib/opensearch/api/actions/security/delete_tenant.rb +++ b/lib/opensearch/api/actions/security/delete_tenant.rb @@ -26,7 +26,7 @@ def delete_tenant(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'tenants', _tenant].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'tenants', _tenant].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_TENANT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/delete_user.rb b/lib/opensearch/api/actions/security/delete_user.rb index 8331bed89..686458e73 100644 --- a/lib/opensearch/api/actions/security/delete_user.rb +++ b/lib/opensearch/api/actions/security/delete_user.rb @@ -26,7 +26,7 @@ def delete_user(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'internalusers', _username].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'internalusers', _username].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_USER_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/delete_user_legacy.rb b/lib/opensearch/api/actions/security/delete_user_legacy.rb index 8f881edf3..30890a637 100644 --- a/lib/opensearch/api/actions/security/delete_user_legacy.rb +++ b/lib/opensearch/api/actions/security/delete_user_legacy.rb @@ -26,7 +26,7 @@ def delete_user_legacy(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'user', _username].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'user', _username].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_USER_LEGACY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/flush_cache.rb b/lib/opensearch/api/actions/security/flush_cache.rb index ac55c93f8..1e81dc6b9 100644 --- a/lib/opensearch/api/actions/security/flush_cache.rb +++ b/lib/opensearch/api/actions/security/flush_cache.rb @@ -21,7 +21,7 @@ def flush_cache(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'cache'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'cache'].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, FLUSH_CACHE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/generate_obo_token.rb b/lib/opensearch/api/actions/security/generate_obo_token.rb index 83d0c1996..0b2abbfdc 100644 --- a/lib/opensearch/api/actions/security/generate_obo_token.rb +++ b/lib/opensearch/api/actions/security/generate_obo_token.rb @@ -22,7 +22,7 @@ def generate_obo_token(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'generateonbehalfoftoken'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'generateonbehalfoftoken'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, GENERATE_OBO_TOKEN_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/generate_user_token.rb b/lib/opensearch/api/actions/security/generate_user_token.rb index 7f4fe9f00..d9acea0a7 100644 --- a/lib/opensearch/api/actions/security/generate_user_token.rb +++ b/lib/opensearch/api/actions/security/generate_user_token.rb @@ -24,7 +24,7 @@ def generate_user_token(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'internalusers', _username, 'authtoken'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'internalusers', _username, 'authtoken'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, GENERATE_USER_TOKEN_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/generate_user_token_legacy.rb b/lib/opensearch/api/actions/security/generate_user_token_legacy.rb index b6f4b0696..ec4ae9a54 100644 --- a/lib/opensearch/api/actions/security/generate_user_token_legacy.rb +++ b/lib/opensearch/api/actions/security/generate_user_token_legacy.rb @@ -24,7 +24,7 @@ def generate_user_token_legacy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'user', _username, 'authtoken'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'user', _username, 'authtoken'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, GENERATE_USER_TOKEN_LEGACY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_account_details.rb b/lib/opensearch/api/actions/security/get_account_details.rb index f8bfe75e3..7de457f0f 100644 --- a/lib/opensearch/api/actions/security/get_account_details.rb +++ b/lib/opensearch/api/actions/security/get_account_details.rb @@ -19,7 +19,7 @@ def get_account_details(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'account'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'account'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ACCOUNT_DETAILS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_action_group.rb b/lib/opensearch/api/actions/security/get_action_group.rb index 93df82eaa..f93e5fc9c 100644 --- a/lib/opensearch/api/actions/security/get_action_group.rb +++ b/lib/opensearch/api/actions/security/get_action_group.rb @@ -24,7 +24,7 @@ def get_action_group(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'actiongroups', _action_group].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'actiongroups', _action_group].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ACTION_GROUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_action_groups.rb b/lib/opensearch/api/actions/security/get_action_groups.rb index 4da124dd0..d27ae809e 100644 --- a/lib/opensearch/api/actions/security/get_action_groups.rb +++ b/lib/opensearch/api/actions/security/get_action_groups.rb @@ -19,7 +19,7 @@ def get_action_groups(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'actiongroups'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'actiongroups'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ACTION_GROUPS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_all_certificates.rb b/lib/opensearch/api/actions/security/get_all_certificates.rb index 09d50ed83..890939302 100644 --- a/lib/opensearch/api/actions/security/get_all_certificates.rb +++ b/lib/opensearch/api/actions/security/get_all_certificates.rb @@ -21,7 +21,7 @@ def get_all_certificates(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'certificates'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'certificates'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ALL_CERTIFICATES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_allowlist.rb b/lib/opensearch/api/actions/security/get_allowlist.rb index 465ef462e..67cae1495 100644 --- a/lib/opensearch/api/actions/security/get_allowlist.rb +++ b/lib/opensearch/api/actions/security/get_allowlist.rb @@ -19,7 +19,7 @@ def get_allowlist(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'allowlist'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'allowlist'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ALLOWLIST_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_audit_configuration.rb b/lib/opensearch/api/actions/security/get_audit_configuration.rb index 9088966e5..3258bca1b 100644 --- a/lib/opensearch/api/actions/security/get_audit_configuration.rb +++ b/lib/opensearch/api/actions/security/get_audit_configuration.rb @@ -19,7 +19,7 @@ def get_audit_configuration(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'audit'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'audit'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_AUDIT_CONFIGURATION_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_certificates.rb b/lib/opensearch/api/actions/security/get_certificates.rb index 6b273bb95..7102d2381 100644 --- a/lib/opensearch/api/actions/security/get_certificates.rb +++ b/lib/opensearch/api/actions/security/get_certificates.rb @@ -19,7 +19,7 @@ def get_certificates(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'ssl', 'certs'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'ssl', 'certs'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_CERTIFICATES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_configuration.rb b/lib/opensearch/api/actions/security/get_configuration.rb index 2e63a3eb9..f7d7e5e3c 100644 --- a/lib/opensearch/api/actions/security/get_configuration.rb +++ b/lib/opensearch/api/actions/security/get_configuration.rb @@ -19,7 +19,7 @@ def get_configuration(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'securityconfig'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'securityconfig'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_CONFIGURATION_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_dashboards_info.rb b/lib/opensearch/api/actions/security/get_dashboards_info.rb index 01cd81ecb..8a18a6441 100644 --- a/lib/opensearch/api/actions/security/get_dashboards_info.rb +++ b/lib/opensearch/api/actions/security/get_dashboards_info.rb @@ -19,7 +19,7 @@ def get_dashboards_info(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'dashboardsinfo'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'dashboardsinfo'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_DASHBOARDS_INFO_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_distinguished_name.rb b/lib/opensearch/api/actions/security/get_distinguished_name.rb index 38ab5b99c..feb54a146 100644 --- a/lib/opensearch/api/actions/security/get_distinguished_name.rb +++ b/lib/opensearch/api/actions/security/get_distinguished_name.rb @@ -25,7 +25,7 @@ def get_distinguished_name(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'nodesdn', _cluster_name].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'nodesdn', _cluster_name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_DISTINGUISHED_NAME_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_distinguished_names.rb b/lib/opensearch/api/actions/security/get_distinguished_names.rb index 12aa1366d..258abfc31 100644 --- a/lib/opensearch/api/actions/security/get_distinguished_names.rb +++ b/lib/opensearch/api/actions/security/get_distinguished_names.rb @@ -20,7 +20,7 @@ def get_distinguished_names(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'nodesdn'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'nodesdn'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_DISTINGUISHED_NAMES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_node_certificates.rb b/lib/opensearch/api/actions/security/get_node_certificates.rb index 8fc8270fd..cee9e0016 100644 --- a/lib/opensearch/api/actions/security/get_node_certificates.rb +++ b/lib/opensearch/api/actions/security/get_node_certificates.rb @@ -26,7 +26,7 @@ def get_node_certificates(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'certificates', _node_id].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'certificates', _node_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_NODE_CERTIFICATES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_permissions_info.rb b/lib/opensearch/api/actions/security/get_permissions_info.rb index d186c979a..30083868d 100644 --- a/lib/opensearch/api/actions/security/get_permissions_info.rb +++ b/lib/opensearch/api/actions/security/get_permissions_info.rb @@ -19,7 +19,7 @@ def get_permissions_info(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'permissionsinfo'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'permissionsinfo'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_PERMISSIONS_INFO_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_role.rb b/lib/opensearch/api/actions/security/get_role.rb index 4c39c0dfd..589077241 100644 --- a/lib/opensearch/api/actions/security/get_role.rb +++ b/lib/opensearch/api/actions/security/get_role.rb @@ -24,7 +24,7 @@ def get_role(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'roles', _role].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'roles', _role].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ROLE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_role_mapping.rb b/lib/opensearch/api/actions/security/get_role_mapping.rb index f237949dc..5dd808407 100644 --- a/lib/opensearch/api/actions/security/get_role_mapping.rb +++ b/lib/opensearch/api/actions/security/get_role_mapping.rb @@ -24,7 +24,7 @@ def get_role_mapping(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'rolesmapping', _role].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'rolesmapping', _role].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ROLE_MAPPING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_role_mappings.rb b/lib/opensearch/api/actions/security/get_role_mappings.rb index 89bb8aa85..7c8777328 100644 --- a/lib/opensearch/api/actions/security/get_role_mappings.rb +++ b/lib/opensearch/api/actions/security/get_role_mappings.rb @@ -19,7 +19,7 @@ def get_role_mappings(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'rolesmapping'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'rolesmapping'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ROLE_MAPPINGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_roles.rb b/lib/opensearch/api/actions/security/get_roles.rb index 2c293043a..8c653a3c8 100644 --- a/lib/opensearch/api/actions/security/get_roles.rb +++ b/lib/opensearch/api/actions/security/get_roles.rb @@ -19,7 +19,7 @@ def get_roles(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'roles'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'roles'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_ROLES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_sslinfo.rb b/lib/opensearch/api/actions/security/get_sslinfo.rb index a7cbaedc1..e9b67f76b 100644 --- a/lib/opensearch/api/actions/security/get_sslinfo.rb +++ b/lib/opensearch/api/actions/security/get_sslinfo.rb @@ -20,7 +20,7 @@ def get_sslinfo(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_opendistro', '_security', 'sslinfo'].reject(&:nil?).join('/') + url = ['_opendistro', '_security', 'sslinfo'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_SSLINFO_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_tenancy_config.rb b/lib/opensearch/api/actions/security/get_tenancy_config.rb index cc201855b..ef6c6ea86 100644 --- a/lib/opensearch/api/actions/security/get_tenancy_config.rb +++ b/lib/opensearch/api/actions/security/get_tenancy_config.rb @@ -19,7 +19,7 @@ def get_tenancy_config(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'tenancy', 'config'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'tenancy', 'config'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_TENANCY_CONFIG_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_tenant.rb b/lib/opensearch/api/actions/security/get_tenant.rb index 1e3921a52..ce00094ac 100644 --- a/lib/opensearch/api/actions/security/get_tenant.rb +++ b/lib/opensearch/api/actions/security/get_tenant.rb @@ -24,7 +24,7 @@ def get_tenant(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'tenants', _tenant].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'tenants', _tenant].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_TENANT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_tenants.rb b/lib/opensearch/api/actions/security/get_tenants.rb index 3820962b3..5aef1a778 100644 --- a/lib/opensearch/api/actions/security/get_tenants.rb +++ b/lib/opensearch/api/actions/security/get_tenants.rb @@ -19,7 +19,7 @@ def get_tenants(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'tenants'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'tenants'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_TENANTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_user.rb b/lib/opensearch/api/actions/security/get_user.rb index f593c6cd4..21e15cd48 100644 --- a/lib/opensearch/api/actions/security/get_user.rb +++ b/lib/opensearch/api/actions/security/get_user.rb @@ -24,7 +24,7 @@ def get_user(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'internalusers', _username].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'internalusers', _username].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_USER_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_user_legacy.rb b/lib/opensearch/api/actions/security/get_user_legacy.rb index 9077ebbe0..8e1256aa5 100644 --- a/lib/opensearch/api/actions/security/get_user_legacy.rb +++ b/lib/opensearch/api/actions/security/get_user_legacy.rb @@ -24,7 +24,7 @@ def get_user_legacy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'user', _username].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'user', _username].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_USER_LEGACY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_users.rb b/lib/opensearch/api/actions/security/get_users.rb index e269eba5a..915462e9d 100644 --- a/lib/opensearch/api/actions/security/get_users.rb +++ b/lib/opensearch/api/actions/security/get_users.rb @@ -19,7 +19,7 @@ def get_users(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'internalusers'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'internalusers'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_USERS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/get_users_legacy.rb b/lib/opensearch/api/actions/security/get_users_legacy.rb index a4d6dd5e2..810f0cad5 100644 --- a/lib/opensearch/api/actions/security/get_users_legacy.rb +++ b/lib/opensearch/api/actions/security/get_users_legacy.rb @@ -19,7 +19,7 @@ def get_users_legacy(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'user'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'user'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_USERS_LEGACY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/health.rb b/lib/opensearch/api/actions/security/health.rb index 461bf9b12..8da2e0122 100644 --- a/lib/opensearch/api/actions/security/health.rb +++ b/lib/opensearch/api/actions/security/health.rb @@ -20,7 +20,7 @@ def health(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'health'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'health'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, HEALTH_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/migrate.rb b/lib/opensearch/api/actions/security/migrate.rb index e5169538a..d4befc8b2 100644 --- a/lib/opensearch/api/actions/security/migrate.rb +++ b/lib/opensearch/api/actions/security/migrate.rb @@ -19,7 +19,7 @@ def migrate(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'migrate'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'migrate'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, MIGRATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_action_group.rb b/lib/opensearch/api/actions/security/patch_action_group.rb index 930faebd8..9cd948661 100644 --- a/lib/opensearch/api/actions/security/patch_action_group.rb +++ b/lib/opensearch/api/actions/security/patch_action_group.rb @@ -26,7 +26,7 @@ def patch_action_group(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'actiongroups', _action_group].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'actiongroups', _action_group].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_ACTION_GROUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_action_groups.rb b/lib/opensearch/api/actions/security/patch_action_groups.rb index bedf2695b..f7a2a928b 100644 --- a/lib/opensearch/api/actions/security/patch_action_groups.rb +++ b/lib/opensearch/api/actions/security/patch_action_groups.rb @@ -22,7 +22,7 @@ def patch_action_groups(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'actiongroups'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'actiongroups'].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_ACTION_GROUPS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_allowlist.rb b/lib/opensearch/api/actions/security/patch_allowlist.rb index 93a4ce56c..e0fd7bdac 100644 --- a/lib/opensearch/api/actions/security/patch_allowlist.rb +++ b/lib/opensearch/api/actions/security/patch_allowlist.rb @@ -22,7 +22,7 @@ def patch_allowlist(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'allowlist'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'allowlist'].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_ALLOWLIST_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_audit_configuration.rb b/lib/opensearch/api/actions/security/patch_audit_configuration.rb index 99801d8bd..75fc60fcf 100644 --- a/lib/opensearch/api/actions/security/patch_audit_configuration.rb +++ b/lib/opensearch/api/actions/security/patch_audit_configuration.rb @@ -22,7 +22,7 @@ def patch_audit_configuration(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'audit'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'audit'].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_AUDIT_CONFIGURATION_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_configuration.rb b/lib/opensearch/api/actions/security/patch_configuration.rb index 03144edee..3bbfed40b 100644 --- a/lib/opensearch/api/actions/security/patch_configuration.rb +++ b/lib/opensearch/api/actions/security/patch_configuration.rb @@ -22,7 +22,7 @@ def patch_configuration(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'securityconfig'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'securityconfig'].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_CONFIGURATION_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_distinguished_name.rb b/lib/opensearch/api/actions/security/patch_distinguished_name.rb index 5bd545b17..097698fc8 100644 --- a/lib/opensearch/api/actions/security/patch_distinguished_name.rb +++ b/lib/opensearch/api/actions/security/patch_distinguished_name.rb @@ -25,7 +25,7 @@ def patch_distinguished_name(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'nodesdn', _cluster_name].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'nodesdn', _cluster_name].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_DISTINGUISHED_NAME_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_distinguished_names.rb b/lib/opensearch/api/actions/security/patch_distinguished_names.rb index f6f860c90..e3f5b9e84 100644 --- a/lib/opensearch/api/actions/security/patch_distinguished_names.rb +++ b/lib/opensearch/api/actions/security/patch_distinguished_names.rb @@ -22,7 +22,7 @@ def patch_distinguished_names(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'nodesdn'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'nodesdn'].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_DISTINGUISHED_NAMES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_role.rb b/lib/opensearch/api/actions/security/patch_role.rb index f09663dd8..716d9ed10 100644 --- a/lib/opensearch/api/actions/security/patch_role.rb +++ b/lib/opensearch/api/actions/security/patch_role.rb @@ -26,7 +26,7 @@ def patch_role(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'roles', _role].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'roles', _role].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_ROLE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_role_mapping.rb b/lib/opensearch/api/actions/security/patch_role_mapping.rb index 22c570ea4..9fd381068 100644 --- a/lib/opensearch/api/actions/security/patch_role_mapping.rb +++ b/lib/opensearch/api/actions/security/patch_role_mapping.rb @@ -26,7 +26,7 @@ def patch_role_mapping(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'rolesmapping', _role].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'rolesmapping', _role].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_ROLE_MAPPING_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_role_mappings.rb b/lib/opensearch/api/actions/security/patch_role_mappings.rb index 46bfb0369..e7e1a09a5 100644 --- a/lib/opensearch/api/actions/security/patch_role_mappings.rb +++ b/lib/opensearch/api/actions/security/patch_role_mappings.rb @@ -22,7 +22,7 @@ def patch_role_mappings(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'rolesmapping'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'rolesmapping'].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_ROLE_MAPPINGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_roles.rb b/lib/opensearch/api/actions/security/patch_roles.rb index 409e9bfc3..4a21a1c2d 100644 --- a/lib/opensearch/api/actions/security/patch_roles.rb +++ b/lib/opensearch/api/actions/security/patch_roles.rb @@ -22,7 +22,7 @@ def patch_roles(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'roles'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'roles'].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_ROLES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_tenant.rb b/lib/opensearch/api/actions/security/patch_tenant.rb index 701c55df3..5324e4250 100644 --- a/lib/opensearch/api/actions/security/patch_tenant.rb +++ b/lib/opensearch/api/actions/security/patch_tenant.rb @@ -26,7 +26,7 @@ def patch_tenant(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'tenants', _tenant].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'tenants', _tenant].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_TENANT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_tenants.rb b/lib/opensearch/api/actions/security/patch_tenants.rb index e36f830ea..2b3121001 100644 --- a/lib/opensearch/api/actions/security/patch_tenants.rb +++ b/lib/opensearch/api/actions/security/patch_tenants.rb @@ -22,7 +22,7 @@ def patch_tenants(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'tenants'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'tenants'].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_TENANTS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_user.rb b/lib/opensearch/api/actions/security/patch_user.rb index 70a3537e0..d548a5938 100644 --- a/lib/opensearch/api/actions/security/patch_user.rb +++ b/lib/opensearch/api/actions/security/patch_user.rb @@ -26,7 +26,7 @@ def patch_user(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'internalusers', _username].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'internalusers', _username].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_USER_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/patch_users.rb b/lib/opensearch/api/actions/security/patch_users.rb index 83b70da8c..9f8ff6d8c 100644 --- a/lib/opensearch/api/actions/security/patch_users.rb +++ b/lib/opensearch/api/actions/security/patch_users.rb @@ -22,7 +22,7 @@ def patch_users(args = {}) headers = (args.delete('headers') || {}).merge('Content-Type' => 'application/x-ndjson') body = Utils.bulkify(args.delete('body')) - url = ['_plugins', '_security', 'api', 'internalusers'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'internalusers'].filter(&:present?).join('/').squeeze('/') method = 'PATCH' Utils.validate_query_params args, PATCH_USERS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/post_dashboards_info.rb b/lib/opensearch/api/actions/security/post_dashboards_info.rb index e7b8be006..83ef4be32 100644 --- a/lib/opensearch/api/actions/security/post_dashboards_info.rb +++ b/lib/opensearch/api/actions/security/post_dashboards_info.rb @@ -19,7 +19,7 @@ def post_dashboards_info(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'dashboardsinfo'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'dashboardsinfo'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, POST_DASHBOARDS_INFO_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/reload_http_certificates.rb b/lib/opensearch/api/actions/security/reload_http_certificates.rb index f95eaa894..7aba2e2ce 100644 --- a/lib/opensearch/api/actions/security/reload_http_certificates.rb +++ b/lib/opensearch/api/actions/security/reload_http_certificates.rb @@ -19,7 +19,7 @@ def reload_http_certificates(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'ssl', 'http', 'reloadcerts'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'ssl', 'http', 'reloadcerts'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, RELOAD_HTTP_CERTIFICATES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/reload_transport_certificates.rb b/lib/opensearch/api/actions/security/reload_transport_certificates.rb index c397a42b8..b01681dd0 100644 --- a/lib/opensearch/api/actions/security/reload_transport_certificates.rb +++ b/lib/opensearch/api/actions/security/reload_transport_certificates.rb @@ -19,7 +19,7 @@ def reload_transport_certificates(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'ssl', 'transport', 'reloadcerts'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'ssl', 'transport', 'reloadcerts'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, RELOAD_TRANSPORT_CERTIFICATES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/tenant_info.rb b/lib/opensearch/api/actions/security/tenant_info.rb index 9e30e9122..cf5861424 100644 --- a/lib/opensearch/api/actions/security/tenant_info.rb +++ b/lib/opensearch/api/actions/security/tenant_info.rb @@ -19,7 +19,7 @@ def tenant_info(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'tenantinfo'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'tenantinfo'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, TENANT_INFO_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/update_audit_configuration.rb b/lib/opensearch/api/actions/security/update_audit_configuration.rb index c805e7a05..20bba6b71 100644 --- a/lib/opensearch/api/actions/security/update_audit_configuration.rb +++ b/lib/opensearch/api/actions/security/update_audit_configuration.rb @@ -22,7 +22,7 @@ def update_audit_configuration(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'audit', 'config'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'audit', 'config'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, UPDATE_AUDIT_CONFIGURATION_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/update_configuration.rb b/lib/opensearch/api/actions/security/update_configuration.rb index c8ac5e76d..3bae06c4c 100644 --- a/lib/opensearch/api/actions/security/update_configuration.rb +++ b/lib/opensearch/api/actions/security/update_configuration.rb @@ -22,7 +22,7 @@ def update_configuration(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'securityconfig', 'config'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'securityconfig', 'config'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, UPDATE_CONFIGURATION_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/update_distinguished_name.rb b/lib/opensearch/api/actions/security/update_distinguished_name.rb index b607a8ee3..4c748eb5a 100644 --- a/lib/opensearch/api/actions/security/update_distinguished_name.rb +++ b/lib/opensearch/api/actions/security/update_distinguished_name.rb @@ -25,7 +25,7 @@ def update_distinguished_name(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'nodesdn', _cluster_name].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'nodesdn', _cluster_name].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, UPDATE_DISTINGUISHED_NAME_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/validate.rb b/lib/opensearch/api/actions/security/validate.rb index a8dfc50f2..c63d075a1 100644 --- a/lib/opensearch/api/actions/security/validate.rb +++ b/lib/opensearch/api/actions/security/validate.rb @@ -20,7 +20,7 @@ def validate(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'api', 'validate'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'api', 'validate'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, VALIDATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/who_am_i.rb b/lib/opensearch/api/actions/security/who_am_i.rb index 4d96b356f..f8b2d6d38 100644 --- a/lib/opensearch/api/actions/security/who_am_i.rb +++ b/lib/opensearch/api/actions/security/who_am_i.rb @@ -19,7 +19,7 @@ def who_am_i(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'whoami'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'whoami'].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, WHO_AM_I_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/security/who_am_i_protected.rb b/lib/opensearch/api/actions/security/who_am_i_protected.rb index 2d686de7e..9a184bdb4 100644 --- a/lib/opensearch/api/actions/security/who_am_i_protected.rb +++ b/lib/opensearch/api/actions/security/who_am_i_protected.rb @@ -19,7 +19,7 @@ def who_am_i_protected(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_security', 'whoamiprotected'].reject(&:nil?).join('/') + url = ['_plugins', '_security', 'whoamiprotected'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, WHO_AM_I_PROTECTED_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sm/create_policy.rb b/lib/opensearch/api/actions/sm/create_policy.rb index b2ac63e33..4fcb20d05 100644 --- a/lib/opensearch/api/actions/sm/create_policy.rb +++ b/lib/opensearch/api/actions/sm/create_policy.rb @@ -25,7 +25,7 @@ def create_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sm', 'policies', _policy_name].reject(&:nil?).join('/') + url = ['_plugins', '_sm', 'policies', _policy_name].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CREATE_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sm/delete_policy.rb b/lib/opensearch/api/actions/sm/delete_policy.rb index aec7a6c68..caeb816da 100644 --- a/lib/opensearch/api/actions/sm/delete_policy.rb +++ b/lib/opensearch/api/actions/sm/delete_policy.rb @@ -26,7 +26,7 @@ def delete_policy(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sm', 'policies', _policy_name].reject(&:nil?).join('/') + url = ['_plugins', '_sm', 'policies', _policy_name].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sm/explain_policy.rb b/lib/opensearch/api/actions/sm/explain_policy.rb index c13ad422c..621ee8236 100644 --- a/lib/opensearch/api/actions/sm/explain_policy.rb +++ b/lib/opensearch/api/actions/sm/explain_policy.rb @@ -24,7 +24,7 @@ def explain_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sm', 'policies', _policy_name, '_explain'].reject(&:nil?).join('/') + url = ['_plugins', '_sm', 'policies', _policy_name, '_explain'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, EXPLAIN_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sm/get_policies.rb b/lib/opensearch/api/actions/sm/get_policies.rb index aec5c33e5..63c4accda 100644 --- a/lib/opensearch/api/actions/sm/get_policies.rb +++ b/lib/opensearch/api/actions/sm/get_policies.rb @@ -24,7 +24,7 @@ def get_policies(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sm', 'policies'].reject(&:nil?).join('/') + url = ['_plugins', '_sm', 'policies'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_POLICIES_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sm/get_policy.rb b/lib/opensearch/api/actions/sm/get_policy.rb index 13760bdb3..442f452fc 100644 --- a/lib/opensearch/api/actions/sm/get_policy.rb +++ b/lib/opensearch/api/actions/sm/get_policy.rb @@ -24,7 +24,7 @@ def get_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sm', 'policies', _policy_name].reject(&:nil?).join('/') + url = ['_plugins', '_sm', 'policies', _policy_name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sm/start_policy.rb b/lib/opensearch/api/actions/sm/start_policy.rb index d6f01d97e..540416d0d 100644 --- a/lib/opensearch/api/actions/sm/start_policy.rb +++ b/lib/opensearch/api/actions/sm/start_policy.rb @@ -24,7 +24,7 @@ def start_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sm', 'policies', _policy_name, '_start'].reject(&:nil?).join('/') + url = ['_plugins', '_sm', 'policies', _policy_name, '_start'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, START_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sm/stop_policy.rb b/lib/opensearch/api/actions/sm/stop_policy.rb index 707d478f9..886672035 100644 --- a/lib/opensearch/api/actions/sm/stop_policy.rb +++ b/lib/opensearch/api/actions/sm/stop_policy.rb @@ -24,7 +24,7 @@ def stop_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sm', 'policies', _policy_name, '_stop'].reject(&:nil?).join('/') + url = ['_plugins', '_sm', 'policies', _policy_name, '_stop'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, STOP_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sm/update_policy.rb b/lib/opensearch/api/actions/sm/update_policy.rb index 45d445e9f..7f9c420d8 100644 --- a/lib/opensearch/api/actions/sm/update_policy.rb +++ b/lib/opensearch/api/actions/sm/update_policy.rb @@ -29,7 +29,7 @@ def update_policy(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sm', 'policies', _policy_name].reject(&:nil?).join('/') + url = ['_plugins', '_sm', 'policies', _policy_name].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, UPDATE_POLICY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/cleanup_repository.rb b/lib/opensearch/api/actions/snapshot/cleanup_repository.rb index 9987de102..f37a8f992 100644 --- a/lib/opensearch/api/actions/snapshot/cleanup_repository.rb +++ b/lib/opensearch/api/actions/snapshot/cleanup_repository.rb @@ -27,7 +27,7 @@ def cleanup_repository(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository, '_cleanup'].reject(&:nil?).join('/') + url = ['_snapshot', _repository, '_cleanup'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CLEANUP_REPOSITORY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/clone.rb b/lib/opensearch/api/actions/snapshot/clone.rb index 6b35ec272..7e03a0c42 100644 --- a/lib/opensearch/api/actions/snapshot/clone.rb +++ b/lib/opensearch/api/actions/snapshot/clone.rb @@ -34,7 +34,7 @@ def clone(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository, _snapshot, '_clone', _target_snapshot].reject(&:nil?).join('/') + url = ['_snapshot', _repository, _snapshot, '_clone', _target_snapshot].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CLONE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/create.rb b/lib/opensearch/api/actions/snapshot/create.rb index 5ba47b8d1..7401d9bdd 100644 --- a/lib/opensearch/api/actions/snapshot/create.rb +++ b/lib/opensearch/api/actions/snapshot/create.rb @@ -31,7 +31,7 @@ def create(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository, _snapshot].reject(&:nil?).join('/') + url = ['_snapshot', _repository, _snapshot].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CREATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/create_repository.rb b/lib/opensearch/api/actions/snapshot/create_repository.rb index 98b21fbba..d57c1fb8b 100644 --- a/lib/opensearch/api/actions/snapshot/create_repository.rb +++ b/lib/opensearch/api/actions/snapshot/create_repository.rb @@ -30,7 +30,7 @@ def create_repository(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository].reject(&:nil?).join('/') + url = ['_snapshot', _repository].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CREATE_REPOSITORY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/delete.rb b/lib/opensearch/api/actions/snapshot/delete.rb index a7db96508..6bf36ed5f 100644 --- a/lib/opensearch/api/actions/snapshot/delete.rb +++ b/lib/opensearch/api/actions/snapshot/delete.rb @@ -31,7 +31,7 @@ def delete(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository, _snapshot].reject(&:nil?).join('/') + url = ['_snapshot', _repository, _snapshot].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/delete_repository.rb b/lib/opensearch/api/actions/snapshot/delete_repository.rb index e1bbe69b5..4750c4e00 100644 --- a/lib/opensearch/api/actions/snapshot/delete_repository.rb +++ b/lib/opensearch/api/actions/snapshot/delete_repository.rb @@ -29,7 +29,7 @@ def delete_repository(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository].reject(&:nil?).join('/') + url = ['_snapshot', _repository].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_REPOSITORY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/get.rb b/lib/opensearch/api/actions/snapshot/get.rb index 604ca5cc6..8c444223d 100644 --- a/lib/opensearch/api/actions/snapshot/get.rb +++ b/lib/opensearch/api/actions/snapshot/get.rb @@ -31,7 +31,7 @@ def get(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository, _snapshot].reject(&:nil?).join('/') + url = ['_snapshot', _repository, _snapshot].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/get_repository.rb b/lib/opensearch/api/actions/snapshot/get_repository.rb index bf288e371..05bff437f 100644 --- a/lib/opensearch/api/actions/snapshot/get_repository.rb +++ b/lib/opensearch/api/actions/snapshot/get_repository.rb @@ -25,7 +25,7 @@ def get_repository(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository].reject(&:nil?).join('/') + url = ['_snapshot', _repository].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_REPOSITORY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/restore.rb b/lib/opensearch/api/actions/snapshot/restore.rb index 4f5b412d4..3e863697c 100644 --- a/lib/opensearch/api/actions/snapshot/restore.rb +++ b/lib/opensearch/api/actions/snapshot/restore.rb @@ -31,7 +31,7 @@ def restore(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository, _snapshot, '_restore'].reject(&:nil?).join('/') + url = ['_snapshot', _repository, _snapshot, '_restore'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, RESTORE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/status.rb b/lib/opensearch/api/actions/snapshot/status.rb index 218bbadd7..f3e1f24e9 100644 --- a/lib/opensearch/api/actions/snapshot/status.rb +++ b/lib/opensearch/api/actions/snapshot/status.rb @@ -27,7 +27,7 @@ def status(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository, _snapshot, '_status'].reject(&:nil?).join('/') + url = ['_snapshot', _repository, _snapshot, '_status'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, STATUS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/snapshot/verify_repository.rb b/lib/opensearch/api/actions/snapshot/verify_repository.rb index 1e6611851..c45fa1d22 100644 --- a/lib/opensearch/api/actions/snapshot/verify_repository.rb +++ b/lib/opensearch/api/actions/snapshot/verify_repository.rb @@ -27,7 +27,7 @@ def verify_repository(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_snapshot', _repository, '_verify'].reject(&:nil?).join('/') + url = ['_snapshot', _repository, '_verify'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, VERIFY_REPOSITORY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sql/close.rb b/lib/opensearch/api/actions/sql/close.rb index a4e46eef7..6a38f78e8 100644 --- a/lib/opensearch/api/actions/sql/close.rb +++ b/lib/opensearch/api/actions/sql/close.rb @@ -22,7 +22,7 @@ def close(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sql', 'close'].reject(&:nil?).join('/') + url = ['_plugins', '_sql', 'close'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CLOSE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sql/explain.rb b/lib/opensearch/api/actions/sql/explain.rb index 598fe2b21..04d05779f 100644 --- a/lib/opensearch/api/actions/sql/explain.rb +++ b/lib/opensearch/api/actions/sql/explain.rb @@ -22,7 +22,7 @@ def explain(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sql', '_explain'].reject(&:nil?).join('/') + url = ['_plugins', '_sql', '_explain'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, EXPLAIN_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sql/get_stats.rb b/lib/opensearch/api/actions/sql/get_stats.rb index be563f320..6dad97c88 100644 --- a/lib/opensearch/api/actions/sql/get_stats.rb +++ b/lib/opensearch/api/actions/sql/get_stats.rb @@ -21,7 +21,7 @@ def get_stats(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sql', 'stats'].reject(&:nil?).join('/') + url = ['_plugins', '_sql', 'stats'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sql/post_stats.rb b/lib/opensearch/api/actions/sql/post_stats.rb index 747f907af..496cb9465 100644 --- a/lib/opensearch/api/actions/sql/post_stats.rb +++ b/lib/opensearch/api/actions/sql/post_stats.rb @@ -22,7 +22,7 @@ def post_stats(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sql', 'stats'].reject(&:nil?).join('/') + url = ['_plugins', '_sql', 'stats'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, POST_STATS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sql/query.rb b/lib/opensearch/api/actions/sql/query.rb index 7ac6faabb..4b32b0449 100644 --- a/lib/opensearch/api/actions/sql/query.rb +++ b/lib/opensearch/api/actions/sql/query.rb @@ -22,7 +22,7 @@ def query(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_sql'].reject(&:nil?).join('/') + url = ['_plugins', '_sql'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, QUERY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/sql/settings.rb b/lib/opensearch/api/actions/sql/settings.rb index a525a3583..3d400062a 100644 --- a/lib/opensearch/api/actions/sql/settings.rb +++ b/lib/opensearch/api/actions/sql/settings.rb @@ -21,7 +21,7 @@ def settings(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_query', 'settings'].reject(&:nil?).join('/') + url = ['_plugins', '_query', 'settings'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, SETTINGS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/tasks/cancel.rb b/lib/opensearch/api/actions/tasks/cancel.rb index 7c4af1dec..3d29c40c0 100644 --- a/lib/opensearch/api/actions/tasks/cancel.rb +++ b/lib/opensearch/api/actions/tasks/cancel.rb @@ -26,7 +26,7 @@ def cancel(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_tasks', _task_id, '_cancel'].reject(&:nil?).join('/') + url = ['_tasks', _task_id, '_cancel'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, CANCEL_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/tasks/get.rb b/lib/opensearch/api/actions/tasks/get.rb index c7c17de31..e6833826b 100644 --- a/lib/opensearch/api/actions/tasks/get.rb +++ b/lib/opensearch/api/actions/tasks/get.rb @@ -26,7 +26,7 @@ def get(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_tasks', _task_id].reject(&:nil?).join('/') + url = ['_tasks', _task_id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/tasks/list.rb b/lib/opensearch/api/actions/tasks/list.rb index 9ea173f4a..39bbdf1c0 100644 --- a/lib/opensearch/api/actions/tasks/list.rb +++ b/lib/opensearch/api/actions/tasks/list.rb @@ -26,7 +26,7 @@ def list(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_tasks'].reject(&:nil?).join('/') + url = ['_tasks'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, LIST_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/termvectors.rb b/lib/opensearch/api/actions/termvectors.rb index 35b18dfd3..3c4b49726 100644 --- a/lib/opensearch/api/actions/termvectors.rb +++ b/lib/opensearch/api/actions/termvectors.rb @@ -38,7 +38,7 @@ def termvectors(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_termvectors', _id].reject(&:nil?).join('/') + url = [_index, '_termvectors', _id].filter(&:present?).join('/').squeeze('/') method = body ? 'POST' : 'GET' Utils.validate_query_params args, TERMVECTORS_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/transforms/delete.rb b/lib/opensearch/api/actions/transforms/delete.rb index 5f746ae78..506d34bf7 100644 --- a/lib/opensearch/api/actions/transforms/delete.rb +++ b/lib/opensearch/api/actions/transforms/delete.rb @@ -26,7 +26,7 @@ def delete(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_transform', _id].reject(&:nil?).join('/') + url = ['_plugins', '_transform', _id].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/transforms/explain.rb b/lib/opensearch/api/actions/transforms/explain.rb index f0784eec6..02ba65fd9 100644 --- a/lib/opensearch/api/actions/transforms/explain.rb +++ b/lib/opensearch/api/actions/transforms/explain.rb @@ -24,7 +24,7 @@ def explain(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_transform', _id, '_explain'].reject(&:nil?).join('/') + url = ['_plugins', '_transform', _id, '_explain'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, EXPLAIN_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/transforms/get.rb b/lib/opensearch/api/actions/transforms/get.rb index db0c52a74..22f193236 100644 --- a/lib/opensearch/api/actions/transforms/get.rb +++ b/lib/opensearch/api/actions/transforms/get.rb @@ -24,7 +24,7 @@ def get(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_transform', _id].reject(&:nil?).join('/') + url = ['_plugins', '_transform', _id].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/transforms/preview.rb b/lib/opensearch/api/actions/transforms/preview.rb index 902963b93..292ddff83 100644 --- a/lib/opensearch/api/actions/transforms/preview.rb +++ b/lib/opensearch/api/actions/transforms/preview.rb @@ -20,7 +20,7 @@ def preview(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_transform', '_preview'].reject(&:nil?).join('/') + url = ['_plugins', '_transform', '_preview'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, PREVIEW_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/transforms/put.rb b/lib/opensearch/api/actions/transforms/put.rb index 845461e45..4d90e4a6b 100644 --- a/lib/opensearch/api/actions/transforms/put.rb +++ b/lib/opensearch/api/actions/transforms/put.rb @@ -27,7 +27,7 @@ def put(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_transform', _id].reject(&:nil?).join('/') + url = ['_plugins', '_transform', _id].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, PUT_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/transforms/search.rb b/lib/opensearch/api/actions/transforms/search.rb index 4eac80f93..597291fb4 100644 --- a/lib/opensearch/api/actions/transforms/search.rb +++ b/lib/opensearch/api/actions/transforms/search.rb @@ -24,7 +24,7 @@ def search(args = {}) args = Utils.normalize_arguments(args) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_transform'].reject(&:nil?).join('/') + url = ['_plugins', '_transform'].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, SEARCH_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/transforms/start.rb b/lib/opensearch/api/actions/transforms/start.rb index 1b131a76a..c7b1b4b5b 100644 --- a/lib/opensearch/api/actions/transforms/start.rb +++ b/lib/opensearch/api/actions/transforms/start.rb @@ -24,7 +24,7 @@ def start(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_transform', _id, '_start'].reject(&:nil?).join('/') + url = ['_plugins', '_transform', _id, '_start'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, START_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/transforms/stop.rb b/lib/opensearch/api/actions/transforms/stop.rb index 1d463dd49..665e24b8c 100644 --- a/lib/opensearch/api/actions/transforms/stop.rb +++ b/lib/opensearch/api/actions/transforms/stop.rb @@ -24,7 +24,7 @@ def stop(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_plugins', '_transform', _id, '_stop'].reject(&:nil?).join('/') + url = ['_plugins', '_transform', _id, '_stop'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, STOP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/update.rb b/lib/opensearch/api/actions/update.rb index 774b06b2e..011e3b73b 100644 --- a/lib/opensearch/api/actions/update.rb +++ b/lib/opensearch/api/actions/update.rb @@ -41,7 +41,7 @@ def update(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_update', _id].reject(&:nil?).join('/') + url = [_index, '_update', _id].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, UPDATE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/update_by_query.rb b/lib/opensearch/api/actions/update_by_query.rb index 4b673fb58..2d8d9ba61 100644 --- a/lib/opensearch/api/actions/update_by_query.rb +++ b/lib/opensearch/api/actions/update_by_query.rb @@ -60,7 +60,7 @@ def update_by_query(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = [_index, '_update_by_query'].reject(&:nil?).join('/') + url = [_index, '_update_by_query'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, UPDATE_BY_QUERY_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/update_by_query_rethrottle.rb b/lib/opensearch/api/actions/update_by_query_rethrottle.rb index 228a10e61..c765d4001 100644 --- a/lib/opensearch/api/actions/update_by_query_rethrottle.rb +++ b/lib/opensearch/api/actions/update_by_query_rethrottle.rb @@ -25,7 +25,7 @@ def update_by_query_rethrottle(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_update_by_query', _task_id, '_rethrottle'].reject(&:nil?).join('/') + url = ['_update_by_query', _task_id, '_rethrottle'].filter(&:present?).join('/').squeeze('/') method = 'POST' Utils.validate_query_params args, UPDATE_BY_QUERY_RETHROTTLE_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/wlm/create_query_group.rb b/lib/opensearch/api/actions/wlm/create_query_group.rb index 15122b0ea..f1a6f6e4a 100644 --- a/lib/opensearch/api/actions/wlm/create_query_group.rb +++ b/lib/opensearch/api/actions/wlm/create_query_group.rb @@ -22,7 +22,7 @@ def create_query_group(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_wlm', 'query_group'].reject(&:nil?).join('/') + url = ['_wlm', 'query_group'].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, CREATE_QUERY_GROUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/wlm/delete_query_group.rb b/lib/opensearch/api/actions/wlm/delete_query_group.rb index 7c6bc741a..4c428018d 100644 --- a/lib/opensearch/api/actions/wlm/delete_query_group.rb +++ b/lib/opensearch/api/actions/wlm/delete_query_group.rb @@ -26,7 +26,7 @@ def delete_query_group(args = {}) ignore = args.delete('ignore') || [] headers = args.delete('headers') || {} body = args.delete('body') - url = ['_wlm', 'query_group', _name].reject(&:nil?).join('/') + url = ['_wlm', 'query_group', _name].filter(&:present?).join('/').squeeze('/') method = 'DELETE' Utils.validate_query_params args, DELETE_QUERY_GROUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/wlm/get_query_group.rb b/lib/opensearch/api/actions/wlm/get_query_group.rb index d1dbf211c..f63f263b1 100644 --- a/lib/opensearch/api/actions/wlm/get_query_group.rb +++ b/lib/opensearch/api/actions/wlm/get_query_group.rb @@ -22,7 +22,7 @@ def get_query_group(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_wlm', 'query_group', _name].reject(&:nil?).join('/') + url = ['_wlm', 'query_group', _name].filter(&:present?).join('/').squeeze('/') method = 'GET' Utils.validate_query_params args, GET_QUERY_GROUP_QUERY_PARAMS diff --git a/lib/opensearch/api/actions/wlm/update_query_group.rb b/lib/opensearch/api/actions/wlm/update_query_group.rb index 506f215a3..f5b7a4e5a 100644 --- a/lib/opensearch/api/actions/wlm/update_query_group.rb +++ b/lib/opensearch/api/actions/wlm/update_query_group.rb @@ -26,7 +26,7 @@ def update_query_group(args = {}) headers = args.delete('headers') || {} body = args.delete('body') - url = ['_wlm', 'query_group', _name].reject(&:nil?).join('/') + url = ['_wlm', 'query_group', _name].filter(&:present?).join('/').squeeze('/') method = 'PUT' Utils.validate_query_params args, UPDATE_QUERY_GROUP_QUERY_PARAMS