opensearch-ruby 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +80 -46
- data/USER_GUIDE.md +146 -0
- data/bin/opensearch_ruby_console +4 -34
- data/lib/opensearch/api/actions/abort_benchmark.rb +49 -0
- data/lib/opensearch/api/actions/benchmark.rb +88 -0
- data/lib/opensearch/api/actions/bulk.rb +91 -0
- data/lib/opensearch/api/actions/cat/aliases.rb +79 -0
- data/lib/opensearch/api/actions/cat/all_pit_segments.rb +45 -0
- data/lib/opensearch/api/actions/cat/allocation.rb +83 -0
- data/lib/opensearch/api/actions/cat/cluster_manager.rb +54 -0
- data/lib/opensearch/api/actions/cat/count.rb +75 -0
- data/lib/opensearch/api/actions/cat/fielddata.rb +77 -0
- data/lib/opensearch/api/actions/cat/health.rb +72 -0
- data/lib/opensearch/api/actions/cat/help.rb +61 -0
- data/lib/opensearch/api/actions/cat/indices.rb +93 -0
- data/lib/opensearch/api/actions/cat/master.rb +73 -0
- data/lib/opensearch/api/actions/cat/nodeattrs.rb +73 -0
- data/lib/opensearch/api/actions/cat/nodes.rb +82 -0
- data/lib/opensearch/api/actions/cat/params_registry.rb +69 -0
- data/lib/opensearch/api/actions/cat/pending_tasks.rb +76 -0
- data/lib/opensearch/api/actions/cat/pit_segments.rb +48 -0
- data/lib/opensearch/api/actions/cat/plugins.rb +75 -0
- data/lib/opensearch/api/actions/cat/recovery.rb +84 -0
- data/lib/opensearch/api/actions/cat/repositories.rb +73 -0
- data/lib/opensearch/api/actions/cat/segments.rb +76 -0
- data/lib/opensearch/api/actions/cat/shards.rb +85 -0
- data/lib/opensearch/api/actions/cat/snapshots.rb +82 -0
- data/lib/opensearch/api/actions/cat/tasks.rb +77 -0
- data/lib/opensearch/api/actions/cat/templates.rb +80 -0
- data/lib/opensearch/api/actions/cat/thread_pool.rb +84 -0
- data/lib/opensearch/api/actions/clear_scroll.rb +62 -0
- data/lib/opensearch/api/actions/cluster/allocation_explain.rb +67 -0
- data/lib/opensearch/api/actions/cluster/delete_component_template.rb +68 -0
- data/lib/opensearch/api/actions/cluster/delete_voting_config_exclusions.rb +59 -0
- data/lib/opensearch/api/actions/cluster/exists_component_template.rb +70 -0
- data/lib/opensearch/api/actions/cluster/get_component_template.rb +70 -0
- data/lib/opensearch/api/actions/cluster/get_settings.rb +67 -0
- data/lib/opensearch/api/actions/cluster/health.rb +88 -0
- data/lib/opensearch/api/actions/cluster/params_registry.rb +69 -0
- data/lib/opensearch/api/actions/cluster/pending_tasks.rb +64 -0
- data/lib/opensearch/api/actions/cluster/post_voting_config_exclusions.rb +63 -0
- data/lib/opensearch/api/actions/cluster/put_component_template.rb +72 -0
- data/lib/opensearch/api/actions/cluster/put_settings.rb +68 -0
- data/{spec/unit/wrapper_gem_spec.rb → lib/opensearch/api/actions/cluster/remote_info.rb} +20 -17
- data/lib/opensearch/api/actions/cluster/reroute.rb +72 -0
- data/lib/opensearch/api/actions/cluster/state.rb +87 -0
- data/lib/opensearch/api/actions/cluster/stats.rb +68 -0
- data/lib/opensearch/api/actions/count.rb +96 -0
- data/lib/opensearch/api/actions/create.rb +60 -0
- data/lib/opensearch/api/actions/create_pit.rb +45 -0
- data/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb +70 -0
- data/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb +69 -0
- data/lib/opensearch/api/actions/dangling_indices/list_dangling_indices.rb +51 -0
- data/lib/opensearch/api/actions/dangling_indices/params_registry.rb +69 -0
- data/lib/opensearch/api/actions/delete.rb +89 -0
- data/lib/opensearch/api/actions/delete_all_pits.rb +26 -0
- data/lib/opensearch/api/actions/delete_by_query.rb +133 -0
- data/lib/opensearch/api/actions/delete_by_query_rethrottle.rb +62 -0
- data/lib/opensearch/api/actions/delete_by_rethrottle.rb +55 -0
- data/lib/opensearch/api/actions/delete_pit.rb +30 -0
- data/lib/opensearch/api/actions/delete_script.rb +66 -0
- data/lib/opensearch/api/actions/exists.rb +94 -0
- data/lib/opensearch/api/actions/exists_source.rb +89 -0
- data/lib/opensearch/api/actions/explain.rb +99 -0
- data/lib/opensearch/api/actions/features/get_features.rb +61 -0
- data/lib/opensearch/api/actions/features/params_registry.rb +69 -0
- data/lib/opensearch/api/actions/features/reset_features.rb +55 -0
- data/lib/opensearch/api/actions/field_caps.rb +78 -0
- data/lib/opensearch/api/actions/get.rb +93 -0
- data/lib/opensearch/api/actions/get_all_pits.rb +26 -0
- data/lib/opensearch/api/actions/get_script.rb +64 -0
- data/lib/opensearch/api/actions/get_script_context.rb +53 -0
- data/lib/opensearch/api/actions/get_script_languages.rb +53 -0
- data/lib/opensearch/api/actions/get_source.rb +87 -0
- data/lib/opensearch/api/actions/index.rb +96 -0
- data/lib/opensearch/api/actions/indices/add_block.rb +78 -0
- data/lib/opensearch/api/actions/indices/analyze.rb +71 -0
- data/lib/opensearch/api/actions/indices/clear_cache.rb +79 -0
- data/lib/opensearch/api/actions/indices/clone.rb +75 -0
- data/lib/opensearch/api/actions/indices/close.rb +76 -0
- data/lib/opensearch/api/actions/indices/create.rb +71 -0
- data/lib/opensearch/api/actions/indices/delete.rb +78 -0
- data/lib/opensearch/api/actions/indices/delete_alias.rb +72 -0
- data/lib/opensearch/api/actions/indices/delete_index_template.rb +68 -0
- data/lib/opensearch/api/actions/indices/delete_template.rb +72 -0
- data/lib/opensearch/api/actions/indices/disk_usage.rb +76 -0
- data/lib/opensearch/api/actions/indices/exists.rb +79 -0
- data/lib/opensearch/api/actions/indices/exists_alias.rb +82 -0
- data/lib/opensearch/api/actions/indices/exists_index_template.rb +72 -0
- data/lib/opensearch/api/actions/indices/exists_template.rb +75 -0
- data/lib/opensearch/api/actions/indices/field_usage_stats.rb +74 -0
- data/lib/opensearch/api/actions/indices/flush.rb +74 -0
- data/lib/opensearch/api/actions/indices/forcemerge.rb +76 -0
- data/lib/opensearch/api/actions/indices/get.rb +78 -0
- data/lib/opensearch/api/actions/indices/get_alias.rb +79 -0
- data/lib/opensearch/api/actions/indices/get_field_mapping.rb +83 -0
- data/lib/opensearch/api/actions/indices/get_index_template.rb +72 -0
- data/lib/opensearch/api/actions/indices/get_mapping.rb +81 -0
- data/lib/opensearch/api/actions/indices/get_settings.rb +87 -0
- data/lib/opensearch/api/actions/indices/get_template.rb +72 -0
- data/lib/opensearch/api/actions/indices/get_upgrade.rb +75 -0
- data/lib/opensearch/api/actions/indices/open.rb +76 -0
- data/lib/opensearch/api/actions/indices/params_registry.rb +69 -0
- data/lib/opensearch/api/actions/indices/put_alias.rb +73 -0
- data/lib/opensearch/api/actions/indices/put_index_template.rb +72 -0
- data/lib/opensearch/api/actions/indices/put_mapping.rb +82 -0
- data/lib/opensearch/api/actions/indices/put_settings.rb +83 -0
- data/lib/opensearch/api/actions/indices/put_template.rb +72 -0
- data/lib/opensearch/api/actions/indices/recovery.rb +68 -0
- data/lib/opensearch/api/actions/indices/refresh.rb +70 -0
- data/lib/opensearch/api/actions/indices/resolve_index.rb +68 -0
- data/lib/opensearch/api/actions/indices/rollover.rb +81 -0
- data/lib/opensearch/api/actions/indices/segments.rb +72 -0
- data/lib/opensearch/api/actions/indices/shard_stores.rb +72 -0
- data/lib/opensearch/api/actions/indices/shrink.rb +77 -0
- data/lib/opensearch/api/actions/indices/simulate_index_template.rb +71 -0
- data/lib/opensearch/api/actions/indices/simulate_template.rb +73 -0
- data/lib/opensearch/api/actions/indices/split.rb +77 -0
- data/lib/opensearch/api/actions/indices/stats.rb +100 -0
- data/lib/opensearch/api/actions/indices/update_aliases.rb +66 -0
- data/lib/opensearch/api/actions/indices/upgrade.rb +79 -0
- data/lib/opensearch/api/actions/indices/validate_query.rb +99 -0
- data/{Gemfile → lib/opensearch/api/actions/info.rb} +19 -8
- data/lib/opensearch/api/actions/ingest/delete_pipeline.rb +68 -0
- data/lib/opensearch/api/actions/ingest/geo_ip_stats.rb +51 -0
- data/lib/opensearch/api/actions/ingest/get_pipeline.rb +70 -0
- data/lib/opensearch/api/actions/ingest/params_registry.rb +69 -0
- data/lib/opensearch/api/actions/ingest/processor_grok.rb +51 -0
- data/lib/opensearch/api/actions/ingest/put_pipeline.rb +70 -0
- data/lib/opensearch/api/actions/ingest/simulate.rb +69 -0
- data/lib/opensearch/api/actions/mget.rb +86 -0
- data/lib/opensearch/api/actions/msearch.rb +105 -0
- data/lib/opensearch/api/actions/msearch_template.rb +89 -0
- data/lib/opensearch/api/actions/mtermvectors.rb +102 -0
- data/lib/opensearch/api/actions/nodes/hot_threads.rb +81 -0
- data/lib/opensearch/api/actions/nodes/info.rb +75 -0
- data/lib/opensearch/api/actions/nodes/params_registry.rb +69 -0
- data/lib/opensearch/api/actions/nodes/reload_secure_settings.rb +67 -0
- data/lib/opensearch/api/actions/nodes/shutdown.rb +65 -0
- data/lib/opensearch/api/actions/nodes/stats.rb +96 -0
- data/lib/opensearch/api/actions/nodes/usage.rb +73 -0
- data/lib/opensearch/api/actions/params_registry.rb +67 -0
- data/lib/opensearch/api/actions/ping.rb +54 -0
- data/lib/opensearch/api/actions/put_script.rb +76 -0
- data/lib/opensearch/api/actions/rank_eval.rb +77 -0
- data/lib/opensearch/api/actions/reindex.rb +76 -0
- data/lib/opensearch/api/actions/reindex_rethrottle.rb +62 -0
- data/{spec/integration/security_disabled/validation_integration_spec.rb → lib/opensearch/api/actions/remote/info.rb} +17 -11
- data/lib/opensearch/api/actions/remote_store/restore.rb +43 -0
- data/lib/opensearch/api/actions/render_search_template.rb +62 -0
- data/lib/opensearch/api/actions/scripts_painless_execute.rb +59 -0
- data/lib/opensearch/api/actions/scroll.rb +78 -0
- data/lib/opensearch/api/actions/search.rb +159 -0
- data/lib/opensearch/api/actions/search_shards.rb +74 -0
- data/lib/opensearch/api/actions/search_template.rb +96 -0
- data/lib/opensearch/api/actions/security/change_password.rb +39 -0
- data/lib/opensearch/api/actions/security/create_action_group.rb +42 -0
- data/lib/opensearch/api/actions/security/create_role.rb +43 -0
- data/lib/opensearch/api/actions/security/create_role_mapping.rb +43 -0
- data/lib/opensearch/api/actions/security/create_tenant.rb +42 -0
- data/lib/opensearch/api/actions/security/create_user.rb +43 -0
- data/lib/opensearch/api/actions/security/delete_action_group.rb +41 -0
- data/lib/opensearch/api/actions/security/delete_distinguished_names.rb +41 -0
- data/lib/opensearch/api/actions/security/delete_role.rb +41 -0
- data/lib/opensearch/api/actions/security/delete_role_mapping.rb +41 -0
- data/lib/opensearch/api/actions/security/delete_tenant.rb +41 -0
- data/lib/opensearch/api/actions/security/delete_user.rb +41 -0
- data/lib/opensearch/api/actions/security/flush_cache.rb +36 -0
- data/lib/opensearch/api/actions/security/get_account_details.rb +36 -0
- data/lib/opensearch/api/actions/security/get_action_group.rb +41 -0
- data/lib/opensearch/api/actions/security/get_action_groups.rb +36 -0
- data/lib/opensearch/api/actions/security/get_audit_configuration.rb +36 -0
- data/lib/opensearch/api/actions/security/get_certificates.rb +36 -0
- data/lib/opensearch/api/actions/security/get_configuration.rb +36 -0
- data/lib/opensearch/api/actions/security/get_distinguished_names.rb +39 -0
- data/lib/opensearch/api/actions/security/get_role.rb +41 -0
- data/lib/opensearch/api/actions/security/get_role_mapping.rb +41 -0
- data/lib/opensearch/api/actions/security/get_role_mappings.rb +36 -0
- data/lib/opensearch/api/actions/security/get_roles.rb +36 -0
- data/lib/opensearch/api/actions/security/get_tenant.rb +41 -0
- data/lib/opensearch/api/actions/security/get_tenants.rb +36 -0
- data/lib/opensearch/api/actions/security/get_user.rb +41 -0
- data/lib/opensearch/api/actions/security/get_users.rb +36 -0
- data/lib/opensearch/api/actions/security/health.rb +36 -0
- data/lib/opensearch/api/actions/security/patch_action_group.rb +42 -0
- data/lib/opensearch/api/actions/security/patch_action_groups.rb +37 -0
- data/lib/opensearch/api/actions/security/patch_audit_configuration.rb +39 -0
- data/lib/opensearch/api/actions/security/patch_configuration.rb +39 -0
- data/lib/opensearch/api/actions/security/patch_distinguished_names.rb +39 -0
- data/lib/opensearch/api/actions/security/patch_role.rb +43 -0
- data/lib/opensearch/api/actions/security/patch_role_mapping.rb +43 -0
- data/lib/opensearch/api/actions/security/patch_role_mappings.rb +39 -0
- data/lib/opensearch/api/actions/security/patch_roles.rb +39 -0
- data/lib/opensearch/api/actions/security/patch_tenant.rb +43 -0
- data/lib/opensearch/api/actions/security/patch_tenants.rb +39 -0
- data/lib/opensearch/api/actions/security/patch_user.rb +43 -0
- data/lib/opensearch/api/actions/security/patch_users.rb +39 -0
- data/lib/opensearch/api/actions/security/reload_http_certificates.rb +36 -0
- data/lib/opensearch/api/actions/security/reload_transport_certificates.rb +36 -0
- data/lib/opensearch/api/actions/security/update_audit_configuration.rb +39 -0
- data/lib/opensearch/api/actions/security/update_configuration.rb +39 -0
- data/lib/opensearch/api/actions/security/update_distinguished_names.rb +42 -0
- data/lib/opensearch/api/actions/shutdown/delete_node.rb +60 -0
- data/lib/opensearch/api/actions/shutdown/get_node.rb +62 -0
- data/lib/opensearch/api/actions/shutdown/params_registry.rb +69 -0
- data/lib/opensearch/api/actions/shutdown/put_node.rb +62 -0
- data/lib/opensearch/api/actions/snapshot/cleanup_repository.rb +68 -0
- data/lib/opensearch/api/actions/snapshot/clone.rb +76 -0
- data/lib/opensearch/api/actions/snapshot/create.rb +73 -0
- data/lib/opensearch/api/actions/snapshot/create_repository.rb +72 -0
- data/lib/opensearch/api/actions/snapshot/delete.rb +74 -0
- data/lib/opensearch/api/actions/snapshot/delete_repository.rb +72 -0
- data/lib/opensearch/api/actions/snapshot/get.rb +82 -0
- data/lib/opensearch/api/actions/snapshot/get_features.rb +61 -0
- data/lib/opensearch/api/actions/snapshot/get_repository.rb +73 -0
- data/lib/opensearch/api/actions/snapshot/params_registry.rb +69 -0
- data/lib/opensearch/api/actions/snapshot/repository_analyze.rb +84 -0
- data/lib/opensearch/api/actions/snapshot/restore.rb +73 -0
- data/lib/opensearch/api/actions/snapshot/status.rb +79 -0
- data/lib/opensearch/api/actions/snapshot/verify_repository.rb +68 -0
- data/lib/opensearch/api/actions/tasks/cancel.rb +76 -0
- data/lib/opensearch/api/actions/tasks/get.rb +68 -0
- data/lib/opensearch/api/actions/tasks/list.rb +75 -0
- data/lib/opensearch/api/actions/tasks/params_registry.rb +69 -0
- data/lib/opensearch/api/actions/termvectors.rb +108 -0
- data/lib/opensearch/api/actions/update.rb +99 -0
- data/lib/opensearch/api/actions/update_by_query.rb +137 -0
- data/lib/opensearch/api/actions/update_by_query_rethrottle.rb +62 -0
- data/{spec/integration/security_enabled/validation_integration_spec.rb → lib/opensearch/api/namespace/cat.rb} +19 -12
- data/lib/opensearch/api/namespace/cluster.rb +47 -0
- data/lib/opensearch/api/namespace/common.rb +72 -0
- data/lib/opensearch/api/namespace/dangling_indices.rb +47 -0
- data/lib/opensearch/api/namespace/features.rb +47 -0
- data/lib/opensearch/api/namespace/indices.rb +47 -0
- data/lib/opensearch/api/namespace/ingest.rb +47 -0
- data/lib/opensearch/api/namespace/nodes.rb +47 -0
- data/lib/opensearch/api/namespace/remote.rb +47 -0
- data/lib/opensearch/api/namespace/remote_store.rb +30 -0
- data/lib/opensearch/api/namespace/security.rb +30 -0
- data/lib/opensearch/api/namespace/shutdown.rb +47 -0
- data/lib/opensearch/api/namespace/snapshot.rb +47 -0
- data/lib/opensearch/api/namespace/tasks.rb +47 -0
- data/lib/opensearch/api/utils.rb +296 -0
- data/lib/opensearch/api.rb +103 -0
- data/lib/opensearch/dsl/search/aggregation.rb +112 -0
- data/lib/opensearch/dsl/search/aggregations/avg.rb +49 -0
- data/lib/opensearch/dsl/search/aggregations/cardinality.rb +56 -0
- data/lib/opensearch/dsl/search/aggregations/children.rb +63 -0
- data/lib/opensearch/dsl/search/aggregations/composite.rb +68 -0
- data/lib/opensearch/dsl/search/aggregations/date_histogram.rb +64 -0
- data/lib/opensearch/dsl/search/aggregations/date_range.rb +59 -0
- data/lib/opensearch/dsl/search/aggregations/extended_stats.rb +48 -0
- data/lib/opensearch/dsl/search/aggregations/filter.rb +54 -0
- data/lib/opensearch/dsl/search/aggregations/filters.rb +59 -0
- data/lib/opensearch/dsl/search/aggregations/geo_bounds.rb +68 -0
- data/lib/opensearch/dsl/search/aggregations/geo_distance.rb +63 -0
- data/lib/opensearch/dsl/search/aggregations/geohash_grid.rb +59 -0
- data/lib/opensearch/dsl/search/aggregations/global.rb +52 -0
- data/{spec/integration/security_disabled/client_integration_spec.rb → lib/opensearch/dsl/search/aggregations/histogram.rb} +29 -29
- data/lib/opensearch/dsl/search/aggregations/ip_range.rb +55 -0
- data/lib/opensearch/dsl/search/aggregations/max.rb +49 -0
- data/lib/opensearch/dsl/search/aggregations/min.rb +49 -0
- data/lib/opensearch/dsl/search/aggregations/missing.rb +59 -0
- data/lib/opensearch/dsl/search/aggregations/nested.rb +57 -0
- data/lib/opensearch/dsl/search/aggregations/percentile_ranks.rb +58 -0
- data/lib/opensearch/dsl/search/aggregations/percentiles.rb +57 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/avg_bucket.rb +58 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/bucket_script.rb +60 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/bucket_selector.rb +59 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/bucket_sort.rb +111 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/cumulative_sum.rb +57 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/derivative.rb +58 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/extended_stats_bucket.rb +58 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/max_bucket.rb +58 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/min_bucket.rb +58 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/moving_avg.rb +66 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/percentiles_bucket.rb +60 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/serial_diff.rb +60 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/stats_bucket.rb +58 -0
- data/lib/opensearch/dsl/search/aggregations/pipeline/sum_bucket.rb +58 -0
- data/lib/opensearch/dsl/search/aggregations/range.rb +77 -0
- data/lib/opensearch/dsl/search/aggregations/reverse_nested.rb +61 -0
- data/lib/opensearch/dsl/search/aggregations/scripted_metric.rb +63 -0
- data/lib/opensearch/dsl/search/aggregations/significant_terms.rb +69 -0
- data/lib/opensearch/dsl/search/aggregations/stats.rb +61 -0
- data/lib/opensearch/dsl/search/aggregations/sum.rb +49 -0
- data/lib/opensearch/dsl/search/aggregations/terms.rb +66 -0
- data/lib/opensearch/dsl/search/aggregations/top_hits.rb +59 -0
- data/lib/opensearch/dsl/search/aggregations/value_count.rb +49 -0
- data/lib/opensearch/dsl/search/base_aggregation_component.rb +83 -0
- data/lib/opensearch/dsl/search/base_component.rb +191 -0
- data/lib/opensearch/dsl/search/base_compound_filter_component.rb +124 -0
- data/lib/opensearch/dsl/search/filter.rb +82 -0
- data/lib/opensearch/dsl/search/filters/and.rb +70 -0
- data/lib/opensearch/dsl/search/filters/bool.rb +103 -0
- data/lib/opensearch/dsl/search/filters/exists.rb +56 -0
- data/lib/opensearch/dsl/search/filters/geo_bounding_box.rb +69 -0
- data/lib/opensearch/dsl/search/filters/geo_distance.rb +81 -0
- data/lib/opensearch/dsl/search/filters/geo_distance_range.rb +56 -0
- data/lib/opensearch/dsl/search/filters/geo_polygon.rb +65 -0
- data/lib/opensearch/dsl/search/filters/geo_shape.rb +59 -0
- data/lib/opensearch/dsl/search/filters/geohash_cell.rb +71 -0
- data/lib/opensearch/dsl/search/filters/has_child.rb +98 -0
- data/lib/opensearch/dsl/search/filters/has_parent.rb +97 -0
- data/lib/opensearch/dsl/search/filters/ids.rb +56 -0
- data/lib/opensearch/dsl/search/filters/indices.rb +101 -0
- data/lib/opensearch/dsl/search/filters/limit.rb +55 -0
- data/lib/opensearch/dsl/search/filters/match_all.rb +52 -0
- data/lib/opensearch/dsl/search/filters/missing.rb +58 -0
- data/lib/opensearch/dsl/search/filters/nested.rb +91 -0
- data/lib/opensearch/dsl/search/filters/not.rb +98 -0
- data/lib/opensearch/dsl/search/filters/or.rb +70 -0
- data/lib/opensearch/dsl/search/filters/prefix.rb +53 -0
- data/lib/opensearch/dsl/search/filters/query.rb +77 -0
- data/lib/opensearch/dsl/search/filters/range.rb +63 -0
- data/lib/opensearch/dsl/search/filters/regexp.rb +58 -0
- data/lib/opensearch/dsl/search/filters/script.rb +56 -0
- data/lib/opensearch/dsl/search/filters/term.rb +55 -0
- data/lib/opensearch/dsl/search/filters/terms.rb +56 -0
- data/lib/opensearch/dsl/search/filters/type.rb +58 -0
- data/lib/opensearch/dsl/search/highlight.rb +117 -0
- data/lib/opensearch/dsl/search/options.rb +80 -0
- data/lib/opensearch/dsl/search/queries/bool.rb +110 -0
- data/lib/opensearch/dsl/search/queries/boosting.rb +57 -0
- data/lib/opensearch/dsl/search/queries/common.rb +62 -0
- data/lib/opensearch/dsl/search/queries/constant_score.rb +90 -0
- data/lib/opensearch/dsl/search/queries/dis_max.rb +59 -0
- data/lib/opensearch/dsl/search/queries/exists.rb +68 -0
- data/lib/opensearch/dsl/search/queries/filtered.rb +101 -0
- data/lib/opensearch/dsl/search/queries/function_score.rb +122 -0
- data/lib/opensearch/dsl/search/queries/fuzzy.rb +69 -0
- data/lib/opensearch/dsl/search/queries/fuzzy_like_this.rb +61 -0
- data/lib/opensearch/dsl/search/queries/fuzzy_like_this_field.rb +60 -0
- data/lib/opensearch/dsl/search/queries/geo_shape.rb +54 -0
- data/lib/opensearch/dsl/search/queries/has_child.rb +82 -0
- data/lib/opensearch/dsl/search/queries/has_parent.rb +82 -0
- data/lib/opensearch/dsl/search/queries/ids.rb +52 -0
- data/lib/opensearch/dsl/search/queries/indices.rb +58 -0
- data/lib/opensearch/dsl/search/queries/match.rb +67 -0
- data/lib/opensearch/dsl/search/queries/match_all.rb +50 -0
- data/lib/opensearch/dsl/search/queries/match_phrase.rb +56 -0
- data/lib/opensearch/dsl/search/queries/match_phrase_prefix.rb +55 -0
- data/lib/opensearch/dsl/search/queries/more_like_this.rb +88 -0
- data/lib/opensearch/dsl/search/queries/multi_match.rb +69 -0
- data/lib/opensearch/dsl/search/queries/nested.rb +80 -0
- data/lib/opensearch/dsl/search/queries/prefix.rb +54 -0
- data/lib/opensearch/dsl/search/queries/query_string.rb +75 -0
- data/lib/opensearch/dsl/search/queries/range.rb +71 -0
- data/lib/opensearch/dsl/search/queries/regexp.rb +55 -0
- data/lib/opensearch/dsl/search/queries/simple_query_string.rb +64 -0
- data/lib/opensearch/dsl/search/queries/span_first.rb +52 -0
- data/lib/opensearch/dsl/search/queries/span_multi.rb +52 -0
- data/lib/opensearch/dsl/search/queries/span_near.rb +56 -0
- data/lib/opensearch/dsl/search/queries/span_not.rb +57 -0
- data/lib/opensearch/dsl/search/queries/span_or.rb +52 -0
- data/lib/opensearch/dsl/search/queries/span_term.rb +50 -0
- data/lib/opensearch/dsl/search/queries/template.rb +55 -0
- data/lib/opensearch/dsl/search/queries/term.rb +50 -0
- data/lib/opensearch/dsl/search/queries/terms.rb +51 -0
- data/lib/opensearch/dsl/search/queries/top_children.rb +82 -0
- data/lib/opensearch/dsl/search/queries/wildcard.rb +54 -0
- data/lib/opensearch/dsl/search/query.rb +82 -0
- data/lib/opensearch/dsl/search/sort.rb +83 -0
- data/lib/opensearch/dsl/search/suggest.rb +52 -0
- data/lib/opensearch/dsl/search.rb +282 -0
- data/lib/opensearch/dsl/utils.rb +49 -0
- data/lib/opensearch/dsl.rb +69 -0
- data/lib/opensearch/transport/client.rb +362 -0
- data/lib/opensearch/transport/redacted.rb +82 -0
- data/lib/opensearch/transport/transport/base.rb +453 -0
- data/lib/opensearch/transport/transport/connections/collection.rb +134 -0
- data/lib/opensearch/transport/transport/connections/connection.rb +168 -0
- data/lib/opensearch/transport/transport/connections/selector.rb +100 -0
- data/lib/opensearch/transport/transport/errors.rb +97 -0
- data/lib/opensearch/transport/transport/http/curb.rb +139 -0
- data/lib/opensearch/transport/transport/http/faraday.rb +101 -0
- data/lib/opensearch/transport/transport/http/manticore.rb +188 -0
- data/lib/opensearch/transport/transport/loggable.rb +92 -0
- data/lib/opensearch/transport/transport/response.rb +47 -0
- data/lib/opensearch/transport/transport/serializer/multi_json.rb +61 -0
- data/lib/opensearch/transport/transport/sniffer.rb +110 -0
- data/lib/opensearch/transport.rb +44 -0
- data/lib/opensearch/version.rb +1 -1
- data/lib/opensearch-dsl.rb +27 -0
- data/lib/opensearch.rb +12 -13
- data/opensearch-ruby.gemspec +28 -40
- data/spec/spec_helper.rb +95 -4
- data/test/dsl/integration/search_aggregation_children_test.rb +91 -0
- data/test/dsl/integration/search_aggregation_geo_test.rb +112 -0
- data/test/dsl/integration/search_aggregation_nested_test.rb +129 -0
- data/test/dsl/integration/search_aggregations_test.rb +288 -0
- data/test/dsl/integration/search_filters_test.rb +290 -0
- data/test/dsl/integration/search_options_test.rb +54 -0
- data/test/dsl/integration/search_query_test.rb +98 -0
- data/test/dsl/integration/search_size_from_test.rb +71 -0
- data/test/dsl/integration/search_sort_test.rb +57 -0
- data/test/dsl/integration/search_suggest_test.rb +107 -0
- data/test/dsl/integration/search_test.rb +81 -0
- data/test/dsl/test_helper.rb +95 -0
- data/test/dsl/unit/dsl_test.rb +44 -0
- data/test/dsl/unit/search_aggregation_test.rb +96 -0
- data/test/dsl/unit/search_base_aggregation_component_test.rb +66 -0
- data/test/dsl/unit/search_base_component_test.rb +210 -0
- data/test/dsl/unit/search_filter_test.rb +84 -0
- data/test/dsl/unit/search_highlight_test.rb +103 -0
- data/test/dsl/unit/search_options_test.rb +114 -0
- data/test/dsl/unit/search_query_test.rb +88 -0
- data/test/dsl/unit/search_size_from_test.rb +68 -0
- data/test/dsl/unit/search_sort_test.rb +91 -0
- data/test/dsl/unit/search_suggest_test.rb +46 -0
- data/test/dsl/unit/search_test.rb +268 -0
- data/test/dsl/unit/utils_test.rb +47 -0
- data/test/transport/integration/transport_test.rb +117 -0
- data/test/transport/profile/client_benchmark_test.rb +141 -0
- data/test/transport/test_helper.rb +97 -0
- data/test/transport/unit/connection_test.rb +145 -0
- data/test/transport/unit/response_test.rb +41 -0
- data/test/transport/unit/serializer_test.rb +42 -0
- data/test/transport/unit/transport_base_test.rb +673 -0
- data/test/transport/unit/transport_curb_test.rb +143 -0
- data/test/transport/unit/transport_faraday_test.rb +237 -0
- data/test/transport/unit/transport_manticore_test.rb +191 -0
- data.tar.gz.sig +0 -0
- metadata +489 -189
- metadata.gz.sig +0 -0
- data/.gitignore +0 -21
- data/Rakefile +0 -69
- data/spec/integration/security_enabled/client_integration_spec.rb +0 -43
- data/spec/unit/opensearch_product_validation_spec.rb +0 -198
- /data/{LICENSE → LICENSE.txt} +0 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
#
|
10
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
+
# license agreements. See the NOTICE file distributed with
|
12
|
+
# this work for additional information regarding copyright
|
13
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
+
# not use this file except in compliance with the License.
|
16
|
+
# You may obtain a copy of the License at
|
17
|
+
#
|
18
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
#
|
20
|
+
# Unless required by applicable law or agreed to in writing,
|
21
|
+
# software distributed under the License is distributed on an
|
22
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
+
# KIND, either express or implied. See the License for the
|
24
|
+
# specific language governing permissions and limitations
|
25
|
+
# under the License.
|
26
|
+
|
27
|
+
module OpenSearch
|
28
|
+
module API
|
29
|
+
module Indices
|
30
|
+
module Actions; end
|
31
|
+
|
32
|
+
# Client for the "indices" namespace (includes the {Indices::Actions} methods)
|
33
|
+
#
|
34
|
+
class IndicesClient
|
35
|
+
include Indices::Actions
|
36
|
+
include Common::Client::Base
|
37
|
+
include Common::Client
|
38
|
+
end
|
39
|
+
|
40
|
+
# Proxy method for {IndicesClient}, available in the receiving object
|
41
|
+
#
|
42
|
+
def indices
|
43
|
+
@indices ||= IndicesClient.new(self)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
#
|
10
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
+
# license agreements. See the NOTICE file distributed with
|
12
|
+
# this work for additional information regarding copyright
|
13
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
+
# not use this file except in compliance with the License.
|
16
|
+
# You may obtain a copy of the License at
|
17
|
+
#
|
18
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
#
|
20
|
+
# Unless required by applicable law or agreed to in writing,
|
21
|
+
# software distributed under the License is distributed on an
|
22
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
+
# KIND, either express or implied. See the License for the
|
24
|
+
# specific language governing permissions and limitations
|
25
|
+
# under the License.
|
26
|
+
|
27
|
+
module OpenSearch
|
28
|
+
module API
|
29
|
+
module Ingest
|
30
|
+
module Actions; end
|
31
|
+
|
32
|
+
# Client for the "ingest" namespace (includes the {Ingest::Actions} methods)
|
33
|
+
#
|
34
|
+
class IngestClient
|
35
|
+
include Ingest::Actions
|
36
|
+
include Common::Client::Base
|
37
|
+
include Common::Client
|
38
|
+
end
|
39
|
+
|
40
|
+
# Proxy method for {IngestClient}, available in the receiving object
|
41
|
+
#
|
42
|
+
def ingest
|
43
|
+
@ingest ||= IngestClient.new(self)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
#
|
10
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
+
# license agreements. See the NOTICE file distributed with
|
12
|
+
# this work for additional information regarding copyright
|
13
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
+
# not use this file except in compliance with the License.
|
16
|
+
# You may obtain a copy of the License at
|
17
|
+
#
|
18
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
#
|
20
|
+
# Unless required by applicable law or agreed to in writing,
|
21
|
+
# software distributed under the License is distributed on an
|
22
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
+
# KIND, either express or implied. See the License for the
|
24
|
+
# specific language governing permissions and limitations
|
25
|
+
# under the License.
|
26
|
+
|
27
|
+
module OpenSearch
|
28
|
+
module API
|
29
|
+
module Nodes
|
30
|
+
module Actions; end
|
31
|
+
|
32
|
+
# Client for the "nodes" namespace (includes the {Nodes::Actions} methods)
|
33
|
+
#
|
34
|
+
class NodesClient
|
35
|
+
include Nodes::Actions
|
36
|
+
include Common::Client::Base
|
37
|
+
include Common::Client
|
38
|
+
end
|
39
|
+
|
40
|
+
# Proxy method for {NodesClient}, available in the receiving object
|
41
|
+
#
|
42
|
+
def nodes
|
43
|
+
@nodes ||= NodesClient.new(self)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
#
|
10
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
+
# license agreements. See the NOTICE file distributed with
|
12
|
+
# this work for additional information regarding copyright
|
13
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
+
# not use this file except in compliance with the License.
|
16
|
+
# You may obtain a copy of the License at
|
17
|
+
#
|
18
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
#
|
20
|
+
# Unless required by applicable law or agreed to in writing,
|
21
|
+
# software distributed under the License is distributed on an
|
22
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
+
# KIND, either express or implied. See the License for the
|
24
|
+
# specific language governing permissions and limitations
|
25
|
+
# under the License.
|
26
|
+
|
27
|
+
module OpenSearch
|
28
|
+
module API
|
29
|
+
module Remote
|
30
|
+
module Actions; end
|
31
|
+
|
32
|
+
# Client for the "remote" namespace (includes the {Remote::Actions} methods)
|
33
|
+
#
|
34
|
+
class RemoteClient
|
35
|
+
include Remote::Actions
|
36
|
+
include Common::Client::Base
|
37
|
+
include Common::Client
|
38
|
+
end
|
39
|
+
|
40
|
+
# Proxy method for {RemoteClient}, available in the receiving object
|
41
|
+
#
|
42
|
+
def remote
|
43
|
+
@remote ||= RemoteClient.new(self)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
|
7
|
+
# This code was generated from OpenSearch API Spec.
|
8
|
+
# Update the code generation logic instead of modifying this file directly.
|
9
|
+
|
10
|
+
# frozen_string_literal: true
|
11
|
+
|
12
|
+
module OpenSearch
|
13
|
+
module API
|
14
|
+
module RemoteStore
|
15
|
+
module Actions; end
|
16
|
+
|
17
|
+
# Client for the "remote_store" namespace (includes the RemoteStore::Actions methods)
|
18
|
+
class RemoteStoreClient
|
19
|
+
include RemoteStore::Actions
|
20
|
+
include Common::Client
|
21
|
+
include Common::Client::Base
|
22
|
+
end
|
23
|
+
|
24
|
+
# Proxy method for RemoteStoreClient, available in the receiving object
|
25
|
+
def remote_store
|
26
|
+
@remote_store ||= RemoteStoreClient.new(self)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
|
7
|
+
# This code was generated from OpenSearch API Spec.
|
8
|
+
# Update the code generation logic instead of modifying this file directly.
|
9
|
+
|
10
|
+
# frozen_string_literal: true
|
11
|
+
|
12
|
+
module OpenSearch
|
13
|
+
module API
|
14
|
+
module Security
|
15
|
+
module Actions; end
|
16
|
+
|
17
|
+
# Client for the "security" namespace (includes the Security::Actions methods)
|
18
|
+
class SecurityClient
|
19
|
+
include Security::Actions
|
20
|
+
include Common::Client
|
21
|
+
include Common::Client::Base
|
22
|
+
end
|
23
|
+
|
24
|
+
# Proxy method for SecurityClient, available in the receiving object
|
25
|
+
def security
|
26
|
+
@security ||= SecurityClient.new(self)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
#
|
10
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
+
# license agreements. See the NOTICE file distributed with
|
12
|
+
# this work for additional information regarding copyright
|
13
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
+
# not use this file except in compliance with the License.
|
16
|
+
# You may obtain a copy of the License at
|
17
|
+
#
|
18
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
#
|
20
|
+
# Unless required by applicable law or agreed to in writing,
|
21
|
+
# software distributed under the License is distributed on an
|
22
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
+
# KIND, either express or implied. See the License for the
|
24
|
+
# specific language governing permissions and limitations
|
25
|
+
# under the License.
|
26
|
+
|
27
|
+
module OpenSearch
|
28
|
+
module API
|
29
|
+
module Shutdown
|
30
|
+
module Actions; end
|
31
|
+
|
32
|
+
# Client for the "shutdown" namespace (includes the {Shutdown::Actions} methods)
|
33
|
+
#
|
34
|
+
class ShutdownClient
|
35
|
+
include Shutdown::Actions
|
36
|
+
include Common::Client::Base
|
37
|
+
include Common::Client
|
38
|
+
end
|
39
|
+
|
40
|
+
# Proxy method for {ShutdownClient}, available in the receiving object
|
41
|
+
#
|
42
|
+
def shutdown
|
43
|
+
@shutdown ||= ShutdownClient.new(self)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
#
|
10
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
+
# license agreements. See the NOTICE file distributed with
|
12
|
+
# this work for additional information regarding copyright
|
13
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
+
# not use this file except in compliance with the License.
|
16
|
+
# You may obtain a copy of the License at
|
17
|
+
#
|
18
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
#
|
20
|
+
# Unless required by applicable law or agreed to in writing,
|
21
|
+
# software distributed under the License is distributed on an
|
22
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
+
# KIND, either express or implied. See the License for the
|
24
|
+
# specific language governing permissions and limitations
|
25
|
+
# under the License.
|
26
|
+
|
27
|
+
module OpenSearch
|
28
|
+
module API
|
29
|
+
module Snapshot
|
30
|
+
module Actions; end
|
31
|
+
|
32
|
+
# Client for the "snapshot" namespace (includes the {Snapshot::Actions} methods)
|
33
|
+
#
|
34
|
+
class SnapshotClient
|
35
|
+
include Snapshot::Actions
|
36
|
+
include Common::Client::Base
|
37
|
+
include Common::Client
|
38
|
+
end
|
39
|
+
|
40
|
+
# Proxy method for {SnapshotClient}, available in the receiving object
|
41
|
+
#
|
42
|
+
def snapshot
|
43
|
+
@snapshot ||= SnapshotClient.new(self)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
#
|
10
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
+
# license agreements. See the NOTICE file distributed with
|
12
|
+
# this work for additional information regarding copyright
|
13
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
+
# not use this file except in compliance with the License.
|
16
|
+
# You may obtain a copy of the License at
|
17
|
+
#
|
18
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
#
|
20
|
+
# Unless required by applicable law or agreed to in writing,
|
21
|
+
# software distributed under the License is distributed on an
|
22
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
+
# KIND, either express or implied. See the License for the
|
24
|
+
# specific language governing permissions and limitations
|
25
|
+
# under the License.
|
26
|
+
|
27
|
+
module OpenSearch
|
28
|
+
module API
|
29
|
+
module Tasks
|
30
|
+
module Actions; end
|
31
|
+
|
32
|
+
# Client for the "tasks" namespace (includes the {Tasks::Actions} methods)
|
33
|
+
#
|
34
|
+
class TasksClient
|
35
|
+
include Tasks::Actions
|
36
|
+
include Common::Client::Base
|
37
|
+
include Common::Client
|
38
|
+
end
|
39
|
+
|
40
|
+
# Proxy method for {TasksClient}, available in the receiving object
|
41
|
+
#
|
42
|
+
def tasks
|
43
|
+
@tasks ||= TasksClient.new(self)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,296 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
#
|
10
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
+
# license agreements. See the NOTICE file distributed with
|
12
|
+
# this work for additional information regarding copyright
|
13
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
+
# not use this file except in compliance with the License.
|
16
|
+
# You may obtain a copy of the License at
|
17
|
+
#
|
18
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
#
|
20
|
+
# Unless required by applicable law or agreed to in writing,
|
21
|
+
# software distributed under the License is distributed on an
|
22
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
+
# KIND, either express or implied. See the License for the
|
24
|
+
# specific language governing permissions and limitations
|
25
|
+
# under the License.
|
26
|
+
|
27
|
+
module OpenSearch
|
28
|
+
module API
|
29
|
+
# Generic utility methods
|
30
|
+
#
|
31
|
+
module Utils
|
32
|
+
# URL-escape a string
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# __escape('foo/bar') # => 'foo%2Fbar'
|
36
|
+
# __escape('bar^bam') # => 'bar%5Ebam'
|
37
|
+
#
|
38
|
+
# @api private
|
39
|
+
def __escape(string)
|
40
|
+
return string if string == '*'
|
41
|
+
|
42
|
+
CGI.escape(string.to_s)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Create a "list" of values from arguments, ignoring nil values and encoding special characters.
|
46
|
+
#
|
47
|
+
# @example Create a list from array
|
48
|
+
# __listify(['A','B']) # => 'A,B'
|
49
|
+
#
|
50
|
+
# @example Create a list from arguments
|
51
|
+
# __listify('A','B') # => 'A,B'
|
52
|
+
#
|
53
|
+
# @example Escape values
|
54
|
+
# __listify('foo','bar^bam') # => 'foo,bar%5Ebam'
|
55
|
+
#
|
56
|
+
# @example Do not escape the values
|
57
|
+
# __listify('foo','bar^bam', escape: false) # => 'foo,bar^bam'
|
58
|
+
#
|
59
|
+
# @api private
|
60
|
+
def __listify(*list)
|
61
|
+
options = list.last.is_a?(Hash) ? list.pop : {}
|
62
|
+
|
63
|
+
escape = options[:escape]
|
64
|
+
Array(list)
|
65
|
+
.flat_map { |e| e.respond_to?(:split) ? e.split(',') : e }
|
66
|
+
.flatten
|
67
|
+
.compact
|
68
|
+
.map { |e| escape == false ? e : __escape(e) }
|
69
|
+
.join(',')
|
70
|
+
end
|
71
|
+
|
72
|
+
# Create a path (URL part) from arguments, ignoring nil values and empty strings.
|
73
|
+
#
|
74
|
+
# @example Create a path from array
|
75
|
+
# __pathify(['foo', '', nil, 'bar']) # => 'foo/bar'
|
76
|
+
#
|
77
|
+
# @example Create a path from arguments
|
78
|
+
# __pathify('foo', '', nil, 'bar') # => 'foo/bar'
|
79
|
+
#
|
80
|
+
# # @example Encode special characters
|
81
|
+
# __pathify(['foo', 'bar^bam']) # => 'foo/bar%5Ebam'
|
82
|
+
#
|
83
|
+
# @api private
|
84
|
+
def __pathify(*segments)
|
85
|
+
Array(segments).flatten
|
86
|
+
.compact
|
87
|
+
.reject { |s| s.to_s.strip.empty? }
|
88
|
+
.join('/')
|
89
|
+
.squeeze('/')
|
90
|
+
end
|
91
|
+
|
92
|
+
# Convert an array of payloads into OpenSearch `header\ndata` format
|
93
|
+
#
|
94
|
+
# Supports various different formats of the payload: Array of Strings, Header/Data pairs,
|
95
|
+
# or the conveniency "combined" format where data is passed along with the header
|
96
|
+
# in a single item.
|
97
|
+
#
|
98
|
+
# OpenSearch::API::Utils.__bulkify [
|
99
|
+
# { :index => { :_index => 'myindexA', :_id => '1', :data => { :title => 'Test' } } },
|
100
|
+
# { :update => { :_index => 'myindexB', :_id => '2', :data => { :doc => { :title => 'Update' } } } }
|
101
|
+
# ]
|
102
|
+
#
|
103
|
+
# # => {"index":{"_index":"myindexA","_id":"1"}}
|
104
|
+
# # => {"title":"Test"}
|
105
|
+
# # => {"update":{"_index":"myindexB","_id":"2"}}
|
106
|
+
# # => {"doc":{"title":"Update"}}
|
107
|
+
#
|
108
|
+
def __bulkify(payload)
|
109
|
+
operations = %w[index create delete update]
|
110
|
+
|
111
|
+
# Hashes with `:data`
|
112
|
+
if payload.any? do |d|
|
113
|
+
d.is_a?(Hash) && d.values.first.is_a?(Hash) && operations.include?(d.keys.first.to_s) && (d.values.first[:data] || d.values.first['data'])
|
114
|
+
end
|
115
|
+
payload = payload
|
116
|
+
.each_with_object([]) do |item, sum|
|
117
|
+
operation, meta = item.to_a.first
|
118
|
+
meta = meta.clone
|
119
|
+
data = meta.delete(:data) || meta.delete('data')
|
120
|
+
|
121
|
+
sum << { operation => meta }
|
122
|
+
sum << data if data
|
123
|
+
end
|
124
|
+
payload = payload.map { |item| OpenSearch::API.serializer.dump(item) }
|
125
|
+
payload << '' unless payload.empty?
|
126
|
+
|
127
|
+
# Array of strings
|
128
|
+
elsif payload.all? { |d| d.is_a? String }
|
129
|
+
payload << ''
|
130
|
+
|
131
|
+
# Header/Data pairs
|
132
|
+
else
|
133
|
+
payload = payload.map { |item| OpenSearch::API.serializer.dump(item) }
|
134
|
+
payload << ''
|
135
|
+
end
|
136
|
+
|
137
|
+
payload = payload.join("\n")
|
138
|
+
end
|
139
|
+
|
140
|
+
# Validates the argument Hash against common and valid API parameters
|
141
|
+
#
|
142
|
+
# @param arguments [Hash] Hash of arguments to verify and extract, **with symbolized keys**
|
143
|
+
# @param valid_params [Array<Symbol>] An array of symbols with valid keys
|
144
|
+
#
|
145
|
+
# @return [Hash] Return whitelisted Hash
|
146
|
+
# @raise [ArgumentError] If the arguments Hash contains invalid keys
|
147
|
+
#
|
148
|
+
# @example Extract parameters
|
149
|
+
# __validate_and_extract_params( { :foo => 'qux' }, [:foo, :bar] )
|
150
|
+
# # => { :foo => 'qux' }
|
151
|
+
#
|
152
|
+
# @example Raise an exception for invalid parameters
|
153
|
+
# __validate_and_extract_params( { :foo => 'qux', :bam => 'mux' }, [:foo, :bar] )
|
154
|
+
# # ArgumentError: "URL parameter 'bam' is not supported"
|
155
|
+
#
|
156
|
+
# @example Skip validating parameters
|
157
|
+
# __validate_and_extract_params( { :foo => 'q', :bam => 'm' }, [:foo, :bar], { skip_parameter_validation: true } )
|
158
|
+
# # => { :foo => "q", :bam => "m" }
|
159
|
+
#
|
160
|
+
# @example Skip validating parameters when the module setting is set
|
161
|
+
# OpenSearch::API.settings[:skip_parameter_validation] = true
|
162
|
+
# __validate_and_extract_params( { :foo => 'q', :bam => 'm' }, [:foo, :bar] )
|
163
|
+
# # => { :foo => "q", :bam => "m" }
|
164
|
+
#
|
165
|
+
# @api private
|
166
|
+
#
|
167
|
+
def __validate_and_extract_params(arguments, params = [], options = {})
|
168
|
+
if options[:skip_parameter_validation] || OpenSearch::API.settings[:skip_parameter_validation]
|
169
|
+
arguments
|
170
|
+
else
|
171
|
+
__validate_params(arguments, params)
|
172
|
+
__extract_params(arguments, params, options.merge(escape: false))
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def __validate_params(arguments, valid_params = [])
|
177
|
+
arguments.each do |k, _v|
|
178
|
+
raise ArgumentError, "URL parameter '#{k}' is not supported" \
|
179
|
+
unless COMMON_PARAMS.include?(k) || COMMON_QUERY_PARAMS.include?(k) || valid_params.include?(k)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def __extract_params(arguments, params = [], options = {})
|
184
|
+
result = arguments.select { |k, _v| COMMON_QUERY_PARAMS.include?(k) || params.include?(k) }
|
185
|
+
result = result.to_h unless result.is_a?(Hash) # Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
186
|
+
result.map { |k, v| v.is_a?(Array) ? [k, __listify(v, options)] : [k, v] }.to_h # Listify Arrays
|
187
|
+
end
|
188
|
+
|
189
|
+
# Extracts the valid parts of the URL from the arguments
|
190
|
+
#
|
191
|
+
# @note Mutates the `arguments` argument, to prevent failures in `__validate_and_extract_params`.
|
192
|
+
#
|
193
|
+
# @param arguments [Hash] Hash of arguments to verify and extract, **with symbolized keys**
|
194
|
+
# @param valid_parts [Array<Symbol>] An array of symbol with valid keys
|
195
|
+
#
|
196
|
+
# @return [Array<String>] Valid parts of the URL as an array of strings
|
197
|
+
#
|
198
|
+
# @example Extract parts
|
199
|
+
# __extract_parts { :foo => true }, [:foo, :bar]
|
200
|
+
# # => [:foo]
|
201
|
+
#
|
202
|
+
#
|
203
|
+
# @api private
|
204
|
+
#
|
205
|
+
def __extract_parts(arguments, valid_parts = [])
|
206
|
+
parts = arguments.select { |k, _v| valid_parts.include?(k) }.to_h
|
207
|
+
parts = parts.reduce([]) do |sum, item|
|
208
|
+
k, v = item
|
209
|
+
sum << (v.is_a?(TrueClass) ? k.to_s : v)
|
210
|
+
end
|
211
|
+
|
212
|
+
arguments.delete_if { |k, _v| valid_parts.include? k }
|
213
|
+
parts
|
214
|
+
end
|
215
|
+
|
216
|
+
# Calls the given block, rescuing from `StandardError`.
|
217
|
+
#
|
218
|
+
# Primary use case is the `:ignore` parameter for API calls.
|
219
|
+
#
|
220
|
+
# Returns `false` if exception contains NotFound in its class name or message,
|
221
|
+
# else re-raises the exception.
|
222
|
+
#
|
223
|
+
# @yield [block] A block of code to be executed with exception handling.
|
224
|
+
#
|
225
|
+
# @api private
|
226
|
+
#
|
227
|
+
def __rescue_from_not_found
|
228
|
+
yield
|
229
|
+
rescue StandardError => e
|
230
|
+
raise e unless e.class.to_s =~ /NotFound/ || e.message =~ /Not\s*Found/i
|
231
|
+
false
|
232
|
+
end
|
233
|
+
|
234
|
+
def __report_unsupported_parameters(arguments, params = [])
|
235
|
+
messages = []
|
236
|
+
unsupported_params = params.select do |d|
|
237
|
+
d.is_a?(Hash) ? arguments.include?(d.keys.first) : arguments.include?(d)
|
238
|
+
end
|
239
|
+
|
240
|
+
unsupported_params.each do |param|
|
241
|
+
name = case param
|
242
|
+
when Symbol
|
243
|
+
param
|
244
|
+
when Hash
|
245
|
+
param.keys.first
|
246
|
+
else
|
247
|
+
raise ArgumentError, 'The param must be a Symbol or a Hash'
|
248
|
+
end
|
249
|
+
|
250
|
+
explanation = if param.is_a?(Hash)
|
251
|
+
". #{param.values.first[:explanation]}."
|
252
|
+
else
|
253
|
+
". This parameter is not supported in the version you're using: #{OpenSearch::VERSION}, and will be removed in the next release."
|
254
|
+
end
|
255
|
+
|
256
|
+
message = "[!] You are using unsupported parameter [:#{name}]"
|
257
|
+
|
258
|
+
if (source = caller&.last)
|
259
|
+
message += " in `#{source}`"
|
260
|
+
end
|
261
|
+
|
262
|
+
message += explanation
|
263
|
+
|
264
|
+
messages << message
|
265
|
+
end
|
266
|
+
|
267
|
+
return if messages.empty?
|
268
|
+
|
269
|
+
messages << 'Suppress this warning by the `-WO` command line flag.'
|
270
|
+
|
271
|
+
if $stderr.tty?
|
272
|
+
Kernel.warn messages.map { |m| "\e[31;1m#{m}\e[0m" }.join("\n")
|
273
|
+
else
|
274
|
+
Kernel.warn messages.join("\n")
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
def __report_unsupported_method(name)
|
279
|
+
message = "[!] You are using unsupported method [#{name}]"
|
280
|
+
if (source = caller&.last)
|
281
|
+
message += " in `#{source}`"
|
282
|
+
end
|
283
|
+
|
284
|
+
message += ". This method is not supported in the version you're using: #{OpenSearch::VERSION}, and will be removed in the next release. Suppress this warning by the `-WO` command line flag."
|
285
|
+
|
286
|
+
if $stderr.tty?
|
287
|
+
Kernel.warn "\e[31;1m#{message}\e[0m"
|
288
|
+
else
|
289
|
+
Kernel.warn message
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
extend self
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|