elasticsearch-api 7.17.11 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +17 -163
- data/elasticsearch-api.gemspec +19 -33
- data/lib/elasticsearch/api/actions/async_search/delete.rb +63 -0
- data/lib/elasticsearch/api/actions/async_search/get.rb +71 -0
- data/lib/elasticsearch/api/actions/async_search/status.rb +66 -0
- data/lib/elasticsearch/api/actions/async_search/submit.rb +113 -0
- data/lib/elasticsearch/api/actions/bulk.rb +135 -49
- data/lib/elasticsearch/api/actions/cat/aliases.rb +41 -31
- data/lib/elasticsearch/api/actions/cat/allocation.rb +40 -33
- data/lib/elasticsearch/api/actions/cat/component_templates.rb +82 -0
- data/lib/elasticsearch/api/actions/cat/count.rb +38 -27
- data/lib/elasticsearch/api/actions/cat/fielddata.rb +36 -29
- data/lib/elasticsearch/api/actions/cat/health.rb +36 -29
- data/lib/elasticsearch/api/actions/cat/help.rb +16 -18
- data/lib/elasticsearch/api/actions/cat/indices.rb +51 -43
- data/lib/elasticsearch/api/actions/cat/master.rb +31 -28
- data/lib/elasticsearch/api/actions/cat/ml_data_frame_analytics.rb +77 -0
- data/lib/elasticsearch/api/actions/cat/ml_datafeeds.rb +84 -0
- data/lib/elasticsearch/api/actions/cat/ml_jobs.rb +85 -0
- data/lib/elasticsearch/api/actions/cat/ml_trained_models.rb +80 -0
- data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +31 -28
- data/lib/elasticsearch/api/actions/cat/nodes.rb +32 -37
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +33 -31
- data/lib/elasticsearch/api/actions/cat/plugins.rb +31 -29
- data/lib/elasticsearch/api/actions/cat/recovery.rb +41 -36
- data/lib/elasticsearch/api/actions/cat/repositories.rb +31 -28
- data/lib/elasticsearch/api/actions/cat/segments.rb +42 -28
- data/lib/elasticsearch/api/actions/cat/shards.rb +40 -35
- data/lib/elasticsearch/api/actions/cat/snapshots.rb +40 -32
- data/lib/elasticsearch/api/actions/cat/tasks.rb +38 -34
- data/lib/elasticsearch/api/actions/cat/templates.rb +40 -30
- data/lib/elasticsearch/api/actions/cat/thread_pool.rb +42 -34
- data/lib/elasticsearch/api/actions/cat/transforms.rb +80 -0
- data/lib/elasticsearch/api/actions/clear_scroll.rb +28 -14
- data/lib/elasticsearch/api/actions/close_point_in_time.rb +19 -8
- data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +24 -20
- data/lib/elasticsearch/api/actions/cluster/delete_component_template.rb +26 -19
- data/lib/elasticsearch/api/actions/cluster/delete_voting_config_exclusions.rb +23 -16
- data/lib/elasticsearch/api/actions/cluster/exists_component_template.rb +29 -20
- data/lib/elasticsearch/api/actions/cluster/get_component_template.rb +30 -20
- data/lib/elasticsearch/api/actions/cluster/get_settings.rb +22 -22
- data/lib/elasticsearch/api/actions/cluster/health.rb +40 -38
- data/lib/elasticsearch/api/actions/cluster/info.rb +61 -0
- data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +23 -19
- data/lib/elasticsearch/api/actions/cluster/post_voting_config_exclusions.rb +38 -20
- data/lib/elasticsearch/api/actions/cluster/put_component_template.rb +42 -22
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +31 -20
- data/lib/elasticsearch/api/actions/cluster/remote_info.rb +16 -7
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +32 -27
- data/lib/elasticsearch/api/actions/cluster/state.rb +43 -32
- data/lib/elasticsearch/api/actions/cluster/stats.rb +27 -20
- data/lib/elasticsearch/api/actions/connector/check_in.rb +65 -0
- data/lib/elasticsearch/api/actions/connector/delete.rb +70 -0
- data/lib/elasticsearch/api/actions/connector/get.rb +66 -0
- data/lib/elasticsearch/api/actions/connector/list.rb +62 -0
- data/lib/elasticsearch/api/actions/connector/post.rb +58 -0
- data/lib/elasticsearch/api/actions/connector/put.rb +67 -0
- data/lib/elasticsearch/api/actions/connector/sync_job_cancel.rb +69 -0
- data/lib/elasticsearch/api/actions/connector/sync_job_check_in.rb +70 -0
- data/lib/elasticsearch/api/actions/connector/sync_job_claim.rb +76 -0
- data/lib/elasticsearch/api/actions/connector/sync_job_delete.rb +69 -0
- data/lib/elasticsearch/api/actions/connector/sync_job_error.rb +73 -0
- data/lib/elasticsearch/api/actions/connector/sync_job_get.rb +67 -0
- data/lib/elasticsearch/api/actions/connector/sync_job_list.rb +60 -0
- data/lib/elasticsearch/api/actions/connector/sync_job_post.rb +58 -0
- data/lib/elasticsearch/api/actions/connector/sync_job_update_stats.rb +75 -0
- data/lib/elasticsearch/api/actions/connector/update_active_filtering.rb +65 -0
- data/lib/elasticsearch/api/actions/connector/update_api_key_id.rb +70 -0
- data/lib/elasticsearch/api/actions/connector/update_configuration.rb +67 -0
- data/lib/elasticsearch/api/actions/connector/update_error.rb +69 -0
- data/lib/elasticsearch/api/actions/connector/update_features.rb +76 -0
- data/lib/elasticsearch/api/actions/connector/update_filtering.rb +69 -0
- data/lib/elasticsearch/api/actions/connector/update_filtering_validation.rb +67 -0
- data/lib/elasticsearch/api/actions/connector/update_index_name.rb +67 -0
- data/lib/elasticsearch/api/actions/connector/update_name.rb +66 -0
- data/lib/elasticsearch/api/actions/connector/update_native.rb +66 -0
- data/lib/elasticsearch/api/actions/connector/update_pipeline.rb +67 -0
- data/lib/elasticsearch/api/actions/connector/update_scheduling.rb +66 -0
- data/lib/elasticsearch/api/actions/connector/update_service_type.rb +66 -0
- data/lib/elasticsearch/api/actions/connector/update_status.rb +66 -0
- data/lib/elasticsearch/api/actions/count.rb +63 -57
- data/lib/elasticsearch/api/actions/create.rb +117 -25
- data/lib/elasticsearch/api/actions/cross_cluster_replication/delete_auto_follow_pattern.rb +64 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/follow.rb +69 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/follow_info.rb +65 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/follow_stats.rb +64 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/forget_follower.rb +72 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/get_auto_follow_pattern.rb +67 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/pause_auto_follow_pattern.rb +69 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/pause_follow.rb +67 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/put_auto_follow_pattern.rb +68 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/resume_auto_follow_pattern.rb +66 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/resume_follow.rb +66 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/stats.rb +55 -0
- data/lib/elasticsearch/api/actions/cross_cluster_replication/unfollow.rb +66 -0
- data/lib/elasticsearch/api/actions/dangling_indices/delete_dangling_index.rb +25 -20
- data/lib/elasticsearch/api/actions/dangling_indices/import_dangling_index.rb +26 -20
- data/lib/elasticsearch/api/actions/dangling_indices/list_dangling_indices.rb +17 -7
- data/lib/elasticsearch/api/actions/delete.rb +66 -45
- data/lib/elasticsearch/api/actions/delete_by_query.rb +133 -88
- data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +25 -17
- data/lib/elasticsearch/api/actions/delete_script.rb +28 -19
- data/lib/elasticsearch/api/actions/enrich/delete_policy.rb +62 -0
- data/lib/elasticsearch/api/actions/enrich/execute_policy.rb +63 -0
- data/lib/elasticsearch/api/actions/enrich/get_policy.rb +65 -0
- data/lib/elasticsearch/api/actions/enrich/put_policy.rb +64 -0
- data/lib/elasticsearch/api/actions/enrich/stats.rb +52 -0
- data/lib/elasticsearch/api/actions/eql/delete.rb +64 -0
- data/lib/elasticsearch/api/actions/eql/get.rb +65 -0
- data/lib/elasticsearch/api/actions/eql/get_status.rb +61 -0
- data/lib/elasticsearch/api/actions/eql/search.rb +73 -0
- data/lib/elasticsearch/api/actions/esql/async_query.rb +70 -0
- data/lib/elasticsearch/api/actions/esql/async_query_delete.rb +67 -0
- data/lib/elasticsearch/api/actions/esql/async_query_get.rb +72 -0
- data/lib/elasticsearch/api/actions/esql/async_query_stop.rb +66 -0
- data/lib/elasticsearch/api/actions/esql/query.rb +61 -0
- data/lib/elasticsearch/api/actions/exists.rb +58 -51
- data/lib/elasticsearch/api/actions/exists_source.rb +42 -47
- data/lib/elasticsearch/api/actions/explain.rb +50 -54
- data/lib/elasticsearch/api/actions/features/get_features.rb +23 -16
- data/lib/elasticsearch/api/actions/features/reset_features.rb +26 -8
- data/lib/elasticsearch/api/actions/field_caps.rb +40 -28
- data/lib/elasticsearch/api/actions/fleet/global_checkpoints.rb +70 -0
- data/lib/elasticsearch/api/actions/fleet/msearch.rb +110 -0
- data/lib/elasticsearch/api/actions/fleet/search.rb +119 -0
- data/lib/elasticsearch/api/actions/get.rb +94 -49
- data/lib/elasticsearch/api/actions/get_script.rb +25 -17
- data/lib/elasticsearch/api/actions/get_script_context.rb +15 -7
- data/lib/elasticsearch/api/actions/get_script_languages.rb +15 -7
- data/lib/elasticsearch/api/actions/get_source.rb +44 -46
- data/lib/elasticsearch/api/actions/graph/explore.rb +75 -0
- data/lib/elasticsearch/api/actions/health_report.rb +75 -0
- data/lib/elasticsearch/api/actions/index.rb +138 -53
- data/lib/elasticsearch/api/actions/index_lifecycle_management/delete_lifecycle.rb +63 -0
- data/lib/elasticsearch/api/actions/index_lifecycle_management/explain_lifecycle.rb +67 -0
- data/lib/elasticsearch/api/actions/index_lifecycle_management/get_lifecycle.rb +64 -0
- data/lib/elasticsearch/api/actions/index_lifecycle_management/get_status.rb +51 -0
- data/lib/elasticsearch/api/actions/index_lifecycle_management/migrate_to_data_tiers.rb +66 -0
- data/lib/elasticsearch/api/actions/index_lifecycle_management/move_to_step.rb +71 -0
- data/lib/elasticsearch/api/actions/index_lifecycle_management/put_lifecycle.rb +65 -0
- data/lib/elasticsearch/api/actions/index_lifecycle_management/remove_policy.rb +62 -0
- data/lib/elasticsearch/api/actions/index_lifecycle_management/retry.rb +63 -0
- data/lib/elasticsearch/api/actions/index_lifecycle_management/start.rb +55 -0
- data/lib/elasticsearch/api/actions/index_lifecycle_management/stop.rb +56 -0
- data/lib/elasticsearch/api/actions/indices/add_block.rb +40 -26
- data/lib/elasticsearch/api/actions/indices/analyze.rb +31 -19
- data/lib/elasticsearch/api/actions/indices/cancel_migrate_reindex.rb +65 -0
- data/lib/elasticsearch/api/actions/indices/clear_cache.rb +41 -31
- data/lib/elasticsearch/api/actions/indices/clone.rb +59 -23
- data/lib/elasticsearch/api/actions/indices/close.rb +47 -27
- data/lib/elasticsearch/api/actions/indices/create.rb +43 -24
- data/lib/elasticsearch/api/actions/indices/create_data_stream.rb +68 -0
- data/lib/elasticsearch/api/actions/indices/create_from.rb +71 -0
- data/lib/elasticsearch/api/actions/indices/data_streams_stats.rb +67 -0
- data/lib/elasticsearch/api/actions/indices/delete.rb +45 -26
- data/lib/elasticsearch/api/actions/indices/delete_alias.rb +29 -22
- data/lib/elasticsearch/api/actions/indices/delete_data_lifecycle.rb +64 -0
- data/lib/elasticsearch/api/actions/indices/delete_data_stream.rb +63 -0
- data/lib/elasticsearch/api/actions/indices/delete_index_template.rb +26 -23
- data/lib/elasticsearch/api/actions/indices/delete_template.rb +31 -20
- data/lib/elasticsearch/api/actions/indices/disk_usage.rb +39 -25
- data/lib/elasticsearch/api/actions/indices/downsample.rb +76 -0
- data/lib/elasticsearch/api/actions/indices/exists.rb +32 -30
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +34 -28
- data/lib/elasticsearch/api/actions/indices/exists_index_template.rb +26 -25
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +30 -24
- data/lib/elasticsearch/api/actions/indices/explain_data_lifecycle.rb +63 -0
- data/lib/elasticsearch/api/actions/indices/field_usage_stats.rb +34 -23
- data/lib/elasticsearch/api/actions/indices/flush.rb +42 -26
- data/lib/elasticsearch/api/actions/indices/forcemerge.rb +64 -25
- data/lib/elasticsearch/api/actions/indices/get.rb +36 -31
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +39 -27
- data/lib/elasticsearch/api/actions/indices/get_data_lifecycle.rb +68 -0
- data/lib/elasticsearch/api/actions/indices/get_data_lifecycle_stats.rb +51 -0
- data/lib/elasticsearch/api/actions/indices/get_data_stream.rb +69 -0
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +42 -44
- data/lib/elasticsearch/api/actions/indices/get_index_template.rb +27 -22
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +36 -41
- data/lib/elasticsearch/api/actions/indices/get_migrate_reindex_status.rb +65 -0
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +45 -33
- data/lib/elasticsearch/api/actions/indices/get_template.rb +30 -24
- data/lib/elasticsearch/api/actions/indices/migrate_reindex.rb +60 -0
- data/lib/elasticsearch/api/actions/indices/migrate_to_data_stream.rb +72 -0
- data/lib/elasticsearch/api/actions/indices/modify_data_stream.rb +54 -0
- data/lib/elasticsearch/api/actions/indices/open.rb +54 -27
- data/lib/elasticsearch/api/actions/indices/promote_data_stream.rb +69 -0
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +32 -23
- data/lib/elasticsearch/api/actions/indices/put_data_lifecycle.rb +72 -0
- data/lib/elasticsearch/api/actions/indices/put_index_template.rb +45 -21
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +54 -44
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +58 -31
- data/lib/elasticsearch/api/actions/indices/put_template.rb +43 -24
- data/lib/elasticsearch/api/actions/indices/recovery.rb +42 -20
- data/lib/elasticsearch/api/actions/indices/refresh.rb +40 -22
- data/lib/elasticsearch/api/actions/indices/reload_search_analyzers.rb +74 -0
- data/lib/elasticsearch/api/actions/indices/resolve_cluster.rb +115 -0
- data/lib/elasticsearch/api/actions/indices/resolve_index.rb +32 -17
- data/lib/elasticsearch/api/actions/indices/rollover.rb +60 -29
- data/lib/elasticsearch/api/actions/indices/segments.rb +33 -24
- data/lib/elasticsearch/api/actions/indices/shard_stores.rb +37 -24
- data/lib/elasticsearch/api/actions/indices/shrink.rb +51 -25
- data/lib/elasticsearch/api/actions/indices/simulate_index_template.rb +25 -21
- data/lib/elasticsearch/api/actions/indices/simulate_template.rb +28 -22
- data/lib/elasticsearch/api/actions/indices/split.rb +52 -25
- data/lib/elasticsearch/api/actions/indices/stats.rb +53 -58
- data/lib/elasticsearch/api/actions/indices/update_aliases.rb +21 -19
- data/lib/elasticsearch/api/actions/indices/validate_query.rb +46 -53
- data/lib/elasticsearch/api/actions/inference/chat_completion_unified.rb +63 -0
- data/lib/elasticsearch/api/actions/inference/completion.rb +62 -0
- data/lib/elasticsearch/api/actions/inference/delete.rb +69 -0
- data/lib/elasticsearch/api/actions/inference/get.rb +67 -0
- data/lib/elasticsearch/api/actions/inference/inference.rb +73 -0
- data/lib/elasticsearch/api/actions/inference/put.rb +77 -0
- data/lib/elasticsearch/api/actions/inference/put_alibabacloud.rb +75 -0
- data/lib/elasticsearch/api/actions/inference/put_amazonbedrock.rb +70 -0
- data/lib/elasticsearch/api/actions/inference/put_anthropic.rb +76 -0
- data/lib/elasticsearch/api/actions/inference/put_azureaistudio.rb +75 -0
- data/lib/elasticsearch/api/actions/inference/put_azureopenai.rb +80 -0
- data/lib/elasticsearch/api/actions/inference/put_cohere.rb +75 -0
- data/lib/elasticsearch/api/actions/inference/put_elasticsearch.rb +71 -0
- data/lib/elasticsearch/api/actions/inference/put_elser.rb +67 -0
- data/lib/elasticsearch/api/actions/inference/put_googleaistudio.rb +75 -0
- data/lib/elasticsearch/api/actions/inference/put_googlevertexai.rb +75 -0
- data/lib/elasticsearch/api/actions/inference/put_hugging_face.rb +86 -0
- data/lib/elasticsearch/api/actions/inference/put_jinaai.rb +77 -0
- data/lib/elasticsearch/api/actions/inference/put_mistral.rb +76 -0
- data/lib/elasticsearch/api/actions/inference/put_openai.rb +76 -0
- data/lib/elasticsearch/api/actions/inference/put_voyageai.rb +71 -0
- data/lib/elasticsearch/api/actions/inference/put_watsonx.rb +78 -0
- data/lib/elasticsearch/api/actions/inference/rerank.rb +62 -0
- data/lib/elasticsearch/api/actions/inference/sparse_embedding.rb +62 -0
- data/lib/elasticsearch/api/actions/inference/stream_completion.rb +65 -0
- data/lib/elasticsearch/api/actions/inference/text_embedding.rb +62 -0
- data/lib/elasticsearch/api/actions/inference/update.rb +73 -0
- data/lib/elasticsearch/api/actions/info.rb +15 -7
- data/lib/elasticsearch/api/actions/ingest/delete_geoip_database.rb +64 -0
- data/lib/elasticsearch/api/actions/ingest/delete_ip_location_database.rb +66 -0
- data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +27 -19
- data/lib/elasticsearch/api/actions/ingest/geo_ip_stats.rb +15 -7
- data/lib/elasticsearch/api/actions/ingest/get_geoip_database.rb +65 -0
- data/lib/elasticsearch/api/actions/ingest/get_ip_location_database.rb +67 -0
- data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +28 -19
- data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +17 -7
- data/lib/elasticsearch/api/actions/ingest/put_geoip_database.rb +66 -0
- data/lib/elasticsearch/api/actions/ingest/put_ip_location_database.rb +68 -0
- data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +25 -21
- data/lib/elasticsearch/api/actions/ingest/simulate.rb +27 -19
- data/lib/elasticsearch/api/actions/license/delete.rb +54 -0
- data/lib/elasticsearch/api/actions/license/get.rb +54 -0
- data/lib/elasticsearch/api/actions/{shutdown/get_node.rb → license/get_basic_status.rb} +15 -15
- data/lib/elasticsearch/api/actions/{shutdown/delete_node.rb → license/get_trial_status.rb} +16 -14
- data/lib/elasticsearch/api/actions/license/post.rb +60 -0
- data/lib/elasticsearch/api/actions/license/post_start_basic.rb +58 -0
- data/lib/elasticsearch/api/actions/license/post_start_trial.rb +57 -0
- data/lib/elasticsearch/api/actions/logstash/delete_pipeline.rb +62 -0
- data/lib/elasticsearch/api/actions/logstash/get_pipeline.rb +63 -0
- data/lib/elasticsearch/api/actions/logstash/put_pipeline.rb +64 -0
- data/lib/elasticsearch/api/actions/machine_learning/clear_trained_model_deployment_cache.rb +64 -0
- data/lib/elasticsearch/api/actions/machine_learning/close_job.rb +70 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_calendar.rb +61 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_calendar_event.rb +65 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_calendar_job.rb +65 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_data_frame_analytics.rb +62 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_datafeed.rb +65 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_expired_data.rb +75 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_filter.rb +62 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_forecast.rb +80 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_job.rb +73 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_model_snapshot.rb +67 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_trained_model.rb +63 -0
- data/lib/elasticsearch/api/actions/machine_learning/delete_trained_model_alias.rb +67 -0
- data/lib/elasticsearch/api/actions/machine_learning/estimate_model_memory.rb +56 -0
- data/lib/elasticsearch/api/actions/machine_learning/evaluate_data_frame.rb +57 -0
- data/lib/elasticsearch/api/actions/machine_learning/explain_data_frame_analytics.rb +76 -0
- data/lib/elasticsearch/api/actions/machine_learning/flush_job.rb +79 -0
- data/lib/elasticsearch/api/actions/machine_learning/forecast.rb +77 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_buckets.rb +86 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_calendar_events.rb +65 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_calendars.rb +70 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_categories.rb +80 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_data_frame_analytics.rb +81 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_data_frame_analytics_stats.rb +76 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_datafeed_stats.rb +78 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_datafeeds.rb +80 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_filters.rb +65 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_influencers.rb +83 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_job_stats.rb +73 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_jobs.rb +79 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_memory_stats.rb +69 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_model_snapshot_upgrade_stats.rb +73 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_model_snapshots.rb +82 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_overall_buckets.rb +105 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_records.rb +86 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_trained_models.rb +82 -0
- data/lib/elasticsearch/api/actions/machine_learning/get_trained_models_stats.rb +73 -0
- data/lib/elasticsearch/api/actions/machine_learning/infer_trained_model.rb +63 -0
- data/lib/elasticsearch/api/actions/machine_learning/info.rb +57 -0
- data/lib/elasticsearch/api/actions/machine_learning/open_job.rb +68 -0
- data/lib/elasticsearch/api/actions/machine_learning/post_calendar_events.rb +62 -0
- data/lib/elasticsearch/api/actions/machine_learning/post_data.rb +66 -0
- data/lib/elasticsearch/api/actions/machine_learning/preview_data_frame_analytics.rb +69 -0
- data/lib/elasticsearch/api/actions/machine_learning/preview_datafeed.rb +81 -0
- data/lib/elasticsearch/api/actions/machine_learning/put_calendar.rb +61 -0
- data/lib/elasticsearch/api/actions/machine_learning/put_calendar_job.rb +64 -0
- data/lib/elasticsearch/api/actions/machine_learning/put_data_frame_analytics.rb +69 -0
- data/lib/elasticsearch/api/actions/machine_learning/put_datafeed.rb +80 -0
- data/lib/elasticsearch/api/actions/machine_learning/put_filter.rb +64 -0
- data/lib/elasticsearch/api/actions/machine_learning/put_job.rb +75 -0
- data/lib/elasticsearch/api/actions/machine_learning/put_trained_model.rb +68 -0
- data/lib/elasticsearch/api/actions/machine_learning/put_trained_model_alias.rb +83 -0
- data/lib/elasticsearch/api/actions/machine_learning/put_trained_model_definition_part.rb +67 -0
- data/lib/elasticsearch/api/actions/machine_learning/put_trained_model_vocabulary.rb +64 -0
- data/lib/elasticsearch/api/actions/machine_learning/reset_job.rb +69 -0
- data/lib/elasticsearch/api/actions/machine_learning/revert_model_snapshot.rb +80 -0
- data/lib/elasticsearch/api/actions/machine_learning/set_upgrade_mode.rb +66 -0
- data/lib/elasticsearch/api/actions/machine_learning/start_data_frame_analytics.rb +75 -0
- data/lib/elasticsearch/api/actions/machine_learning/start_datafeed.rb +87 -0
- data/lib/elasticsearch/api/actions/machine_learning/start_trained_model_deployment.rb +83 -0
- data/lib/elasticsearch/api/actions/machine_learning/stop_data_frame_analytics.rb +76 -0
- data/lib/elasticsearch/api/actions/machine_learning/stop_datafeed.rb +74 -0
- data/lib/elasticsearch/api/actions/machine_learning/stop_trained_model_deployment.rb +66 -0
- data/lib/elasticsearch/api/actions/machine_learning/update_data_frame_analytics.rb +64 -0
- data/lib/elasticsearch/api/actions/machine_learning/update_datafeed.rb +79 -0
- data/lib/elasticsearch/api/actions/machine_learning/update_filter.rb +63 -0
- data/lib/elasticsearch/api/actions/machine_learning/update_job.rb +63 -0
- data/lib/elasticsearch/api/actions/machine_learning/update_model_snapshot.rb +67 -0
- data/lib/elasticsearch/api/actions/machine_learning/update_trained_model_deployment.rb +67 -0
- data/lib/elasticsearch/api/actions/machine_learning/upgrade_job_snapshot.rb +76 -0
- data/lib/elasticsearch/api/actions/mget.rb +49 -44
- data/lib/elasticsearch/api/actions/migration/deprecations.rb +65 -0
- data/lib/elasticsearch/api/actions/migration/get_feature_upgrade_status.rb +54 -0
- data/lib/elasticsearch/api/actions/migration/post_feature_upgrade.rb +54 -0
- data/lib/elasticsearch/api/actions/msearch.rb +68 -57
- data/lib/elasticsearch/api/actions/msearch_template.rb +49 -44
- data/lib/elasticsearch/api/actions/mtermvectors.rb +47 -58
- data/lib/elasticsearch/api/actions/nodes/clear_repositories_metering_archive.rb +27 -10
- data/lib/elasticsearch/api/actions/nodes/get_repositories_metering_info.rb +23 -8
- data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +33 -35
- data/lib/elasticsearch/api/actions/nodes/info.rb +28 -23
- data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +31 -19
- data/lib/elasticsearch/api/actions/nodes/stats.rb +39 -40
- data/lib/elasticsearch/api/actions/nodes/usage.rb +28 -21
- data/lib/elasticsearch/api/actions/open_point_in_time.rb +59 -25
- data/lib/elasticsearch/api/actions/ping.rb +16 -12
- data/lib/elasticsearch/api/actions/put_script.rb +33 -23
- data/lib/elasticsearch/api/actions/query_rules/delete_rule.rb +66 -0
- data/lib/elasticsearch/api/actions/query_rules/delete_ruleset.rb +70 -0
- data/lib/elasticsearch/api/actions/query_rules/get_rule.rb +65 -0
- data/lib/elasticsearch/api/actions/query_rules/get_ruleset.rb +61 -0
- data/lib/elasticsearch/api/actions/query_rules/list_rulesets.rb +53 -0
- data/lib/elasticsearch/api/actions/query_rules/put_rule.rb +71 -0
- data/lib/elasticsearch/api/actions/query_rules/put_ruleset.rb +68 -0
- data/lib/elasticsearch/api/actions/query_rules/test.rb +63 -0
- data/lib/elasticsearch/api/actions/rank_eval.rb +30 -25
- data/lib/elasticsearch/api/actions/reindex.rb +165 -33
- data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +31 -17
- data/lib/elasticsearch/api/actions/render_search_template.rb +25 -11
- data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +21 -9
- data/lib/elasticsearch/api/actions/scroll.rb +29 -26
- data/lib/elasticsearch/api/actions/search.rb +148 -116
- data/lib/elasticsearch/api/actions/search_application/delete.rb +65 -0
- data/lib/elasticsearch/api/actions/search_application/delete_behavioral_analytics.rb +65 -0
- data/lib/elasticsearch/api/actions/search_application/get.rb +64 -0
- data/lib/elasticsearch/api/actions/search_application/get_behavioral_analytics.rb +66 -0
- data/lib/elasticsearch/api/actions/search_application/list.rb +58 -0
- data/lib/elasticsearch/api/actions/search_application/post_behavioral_analytics_event.rb +71 -0
- data/lib/elasticsearch/api/actions/search_application/put.rb +67 -0
- data/lib/elasticsearch/api/actions/search_application/put_behavioral_analytics.rb +64 -0
- data/lib/elasticsearch/api/actions/search_application/render_query.rb +69 -0
- data/lib/elasticsearch/api/actions/search_application/search.rb +73 -0
- data/lib/elasticsearch/api/actions/search_mvt.rb +167 -35
- data/lib/elasticsearch/api/actions/search_shards.rb +43 -28
- data/lib/elasticsearch/api/actions/search_template.rb +46 -54
- data/lib/elasticsearch/api/actions/searchable_snapshots/cache_stats.rb +68 -0
- data/lib/elasticsearch/api/actions/searchable_snapshots/clear_cache.rb +71 -0
- data/lib/elasticsearch/api/actions/searchable_snapshots/mount.rb +74 -0
- data/lib/elasticsearch/api/actions/searchable_snapshots/stats.rb +63 -0
- data/lib/elasticsearch/api/actions/security/activate_user_profile.rb +62 -0
- data/lib/elasticsearch/api/actions/security/authenticate.rb +54 -0
- data/lib/elasticsearch/api/actions/security/bulk_delete_role.rb +56 -0
- data/lib/elasticsearch/api/actions/security/bulk_put_role.rb +56 -0
- data/lib/elasticsearch/api/actions/security/bulk_update_api_keys.rb +62 -0
- data/lib/elasticsearch/api/actions/security/change_password.rb +68 -0
- data/lib/elasticsearch/api/actions/security/clear_api_key_cache.rb +64 -0
- data/lib/elasticsearch/api/actions/security/clear_cached_privileges.rb +64 -0
- data/lib/elasticsearch/api/actions/security/clear_cached_realms.rb +69 -0
- data/lib/elasticsearch/api/actions/security/clear_cached_roles.rb +63 -0
- data/lib/elasticsearch/api/actions/security/clear_cached_service_tokens.rb +75 -0
- data/lib/elasticsearch/api/actions/security/create_api_key.rb +62 -0
- data/lib/elasticsearch/api/actions/security/create_cross_cluster_api_key.rb +62 -0
- data/lib/elasticsearch/api/actions/security/create_service_token.rb +78 -0
- data/lib/elasticsearch/api/actions/security/delegate_pki.rb +60 -0
- data/lib/elasticsearch/api/actions/security/delete_privileges.rb +69 -0
- data/lib/elasticsearch/api/actions/security/delete_role.rb +64 -0
- data/lib/elasticsearch/api/actions/security/delete_role_mapping.rb +65 -0
- data/lib/elasticsearch/api/actions/security/delete_service_token.rb +70 -0
- data/lib/elasticsearch/api/actions/security/delete_user.rb +62 -0
- data/lib/elasticsearch/api/actions/security/disable_user.rb +64 -0
- data/lib/elasticsearch/api/actions/security/disable_user_profile.rb +69 -0
- data/lib/elasticsearch/api/actions/security/enable_user.rb +63 -0
- data/lib/elasticsearch/api/actions/security/enable_user_profile.rb +70 -0
- data/lib/elasticsearch/api/actions/security/enroll_kibana.rb +53 -0
- data/lib/elasticsearch/api/actions/security/enroll_node.rb +53 -0
- data/lib/elasticsearch/api/actions/security/get_api_key.rb +70 -0
- data/lib/elasticsearch/api/actions/security/get_builtin_privileges.rb +51 -0
- data/lib/elasticsearch/api/actions/security/get_privileges.rb +73 -0
- data/lib/elasticsearch/api/actions/security/get_role.rb +75 -0
- data/lib/elasticsearch/api/actions/security/get_role_mapping.rb +65 -0
- data/lib/elasticsearch/api/actions/security/get_service_accounts.rb +72 -0
- data/lib/elasticsearch/api/actions/security/get_service_credentials.rb +68 -0
- data/lib/elasticsearch/api/actions/security/get_settings.rb +57 -0
- data/lib/elasticsearch/api/actions/security/get_token.rb +62 -0
- data/lib/elasticsearch/api/actions/security/get_user.rb +72 -0
- data/lib/elasticsearch/api/actions/security/get_user_privileges.rb +57 -0
- data/lib/elasticsearch/api/actions/security/get_user_profile.rb +68 -0
- data/lib/elasticsearch/api/actions/security/grant_api_key.rb +68 -0
- data/lib/elasticsearch/api/actions/security/has_privileges.rb +68 -0
- data/lib/elasticsearch/api/actions/security/has_privileges_user_profile.rb +56 -0
- data/lib/elasticsearch/api/actions/security/invalidate_api_key.rb +63 -0
- data/lib/elasticsearch/api/actions/security/invalidate_token.rb +62 -0
- data/lib/elasticsearch/api/actions/security/oidc_authenticate.rb +56 -0
- data/lib/elasticsearch/api/actions/security/oidc_logout.rb +57 -0
- data/lib/elasticsearch/api/actions/security/oidc_prepare_authentication.rb +57 -0
- data/lib/elasticsearch/api/actions/security/put_privileges.rb +66 -0
- data/lib/elasticsearch/api/actions/security/put_role.rb +66 -0
- data/lib/elasticsearch/api/actions/security/put_role_mapping.rb +81 -0
- data/lib/elasticsearch/api/actions/security/put_user.rb +69 -0
- data/lib/elasticsearch/api/actions/security/query_api_keys.rb +67 -0
- data/lib/elasticsearch/api/actions/security/query_role.rb +61 -0
- data/lib/elasticsearch/api/actions/security/query_user.rb +61 -0
- data/lib/elasticsearch/api/actions/security/saml_authenticate.rb +62 -0
- data/lib/elasticsearch/api/actions/security/saml_complete_logout.rb +61 -0
- data/lib/elasticsearch/api/actions/security/saml_invalidate.rb +60 -0
- data/lib/elasticsearch/api/actions/security/saml_logout.rb +58 -0
- data/lib/elasticsearch/api/actions/security/saml_prepare_authentication.rb +63 -0
- data/lib/elasticsearch/api/actions/security/saml_service_provider_metadata.rb +63 -0
- data/lib/elasticsearch/api/actions/security/suggest_user_profiles.rb +65 -0
- data/lib/elasticsearch/api/actions/security/update_api_key.rb +74 -0
- data/lib/elasticsearch/api/actions/security/update_cross_cluster_api_key.rb +72 -0
- data/lib/elasticsearch/api/actions/security/update_settings.rb +61 -0
- data/lib/elasticsearch/api/actions/security/update_user_profile_data.rb +79 -0
- data/lib/elasticsearch/api/actions/simulate/ingest.rb +85 -0
- data/lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb +28 -19
- data/lib/elasticsearch/api/actions/snapshot/clone.rb +28 -20
- data/lib/elasticsearch/api/actions/snapshot/create.rb +30 -21
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +36 -22
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +31 -19
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +35 -20
- data/lib/elasticsearch/api/actions/snapshot/get.rb +58 -41
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +33 -21
- data/lib/elasticsearch/api/actions/snapshot/repository_analyze.rb +113 -37
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +40 -21
- data/lib/elasticsearch/api/actions/snapshot/status.rb +48 -23
- data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +28 -19
- data/lib/elasticsearch/api/actions/snapshot_lifecycle_management/delete_lifecycle.rb +66 -0
- data/lib/elasticsearch/api/actions/snapshot_lifecycle_management/execute_lifecycle.rb +66 -0
- data/lib/elasticsearch/api/actions/snapshot_lifecycle_management/execute_retention.rb +56 -0
- data/lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_lifecycle.rb +67 -0
- data/lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_stats.rb +53 -0
- data/lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_status.rb +56 -0
- data/lib/elasticsearch/api/actions/snapshot_lifecycle_management/put_lifecycle.rb +70 -0
- data/lib/elasticsearch/api/actions/snapshot_lifecycle_management/start.rb +58 -0
- data/lib/elasticsearch/api/actions/snapshot_lifecycle_management/stop.rb +62 -0
- data/lib/elasticsearch/api/actions/{shutdown/put_node.rb → sql/clear_cursor.rb} +18 -15
- data/lib/elasticsearch/api/actions/sql/delete_async.rb +65 -0
- data/lib/elasticsearch/api/actions/sql/get_async.rb +71 -0
- data/lib/elasticsearch/api/actions/sql/get_async_status.rb +61 -0
- data/lib/elasticsearch/api/actions/sql/query.rb +57 -0
- data/lib/elasticsearch/api/actions/sql/translate.rb +55 -0
- data/lib/elasticsearch/api/actions/ssl/certificates.rb +60 -0
- data/lib/elasticsearch/api/actions/synonyms/delete_synonym.rb +72 -0
- data/lib/elasticsearch/api/actions/synonyms/delete_synonym_rule.rb +65 -0
- data/lib/elasticsearch/api/actions/synonyms/get_synonym.rb +62 -0
- data/lib/elasticsearch/api/actions/synonyms/get_synonym_rule.rb +65 -0
- data/lib/elasticsearch/api/actions/synonyms/get_synonyms_sets.rb +53 -0
- data/lib/elasticsearch/api/actions/synonyms/put_synonym.rb +66 -0
- data/lib/elasticsearch/api/actions/synonyms/put_synonym_rule.rb +69 -0
- data/lib/elasticsearch/api/actions/tasks/cancel.rb +34 -24
- data/lib/elasticsearch/api/actions/tasks/get.rb +30 -19
- data/lib/elasticsearch/api/actions/tasks/list.rb +80 -28
- data/lib/elasticsearch/api/actions/terms_enum.rb +68 -0
- data/lib/elasticsearch/api/actions/termvectors.rb +69 -59
- data/lib/elasticsearch/api/actions/text_structure/find_field_structure.rb +127 -0
- data/lib/elasticsearch/api/actions/text_structure/find_message_structure.rb +126 -0
- data/lib/elasticsearch/api/actions/text_structure/find_structure.rb +149 -0
- data/lib/elasticsearch/api/actions/text_structure/test_grok_pattern.rb +58 -0
- data/lib/elasticsearch/api/actions/transform/delete_transform.rb +65 -0
- data/lib/elasticsearch/api/actions/transform/get_node_stats.rb +55 -0
- data/lib/elasticsearch/api/actions/transform/get_transform.rb +77 -0
- data/lib/elasticsearch/api/actions/transform/get_transform_stats.rb +73 -0
- data/lib/elasticsearch/api/actions/transform/preview_transform.rb +75 -0
- data/lib/elasticsearch/api/actions/transform/put_transform.rb +86 -0
- data/lib/elasticsearch/api/actions/transform/reset_transform.rb +66 -0
- data/lib/elasticsearch/api/actions/transform/schedule_now_transform.rb +66 -0
- data/lib/elasticsearch/api/actions/transform/start_transform.rb +75 -0
- data/lib/elasticsearch/api/actions/transform/stop_transform.rb +74 -0
- data/lib/elasticsearch/api/actions/transform/update_transform.rb +73 -0
- data/lib/elasticsearch/api/actions/transform/upgrade_transforms.rb +64 -0
- data/lib/elasticsearch/api/actions/update.rb +61 -54
- data/lib/elasticsearch/api/actions/update_by_query.rb +144 -92
- data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +25 -17
- data/lib/elasticsearch/api/actions/watcher/ack_watch.rb +74 -0
- data/lib/elasticsearch/api/actions/watcher/activate_watch.rb +61 -0
- data/lib/elasticsearch/api/actions/watcher/deactivate_watch.rb +61 -0
- data/lib/elasticsearch/api/actions/watcher/delete_watch.rb +73 -0
- data/lib/elasticsearch/api/actions/watcher/execute_watch.rb +73 -0
- data/lib/elasticsearch/api/actions/watcher/get_settings.rb +54 -0
- data/lib/elasticsearch/api/actions/watcher/get_watch.rb +60 -0
- data/lib/elasticsearch/api/actions/watcher/put_watch.rb +74 -0
- data/lib/elasticsearch/api/actions/watcher/query_watches.rb +58 -0
- data/lib/elasticsearch/api/actions/watcher/start.rb +52 -0
- data/lib/elasticsearch/api/actions/watcher/stats.rb +65 -0
- data/lib/elasticsearch/api/actions/watcher/stop.rb +54 -0
- data/lib/elasticsearch/api/actions/watcher/update_settings.rb +63 -0
- data/lib/elasticsearch/api/actions/xpack/info.rb +59 -0
- data/lib/elasticsearch/api/actions/xpack/usage.rb +55 -0
- data/lib/elasticsearch/api/response.rb +48 -0
- data/lib/elasticsearch/api/utils.rb +34 -143
- data/lib/elasticsearch/api/version.rb +2 -1
- data/lib/elasticsearch/api.rb +81 -47
- metadata +389 -434
- data/Gemfile +0 -43
- data/Rakefile +0 -124
- data/lib/elasticsearch/api/actions/cat/params_registry.rb +0 -60
- data/lib/elasticsearch/api/actions/cluster/params_registry.rb +0 -60
- data/lib/elasticsearch/api/actions/dangling_indices/params_registry.rb +0 -60
- data/lib/elasticsearch/api/actions/features/params_registry.rb +0 -60
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +0 -71
- data/lib/elasticsearch/api/actions/indices/flush_synced.rb +0 -71
- data/lib/elasticsearch/api/actions/indices/get_upgrade.rb +0 -67
- data/lib/elasticsearch/api/actions/indices/params_registry.rb +0 -60
- data/lib/elasticsearch/api/actions/indices/upgrade.rb +0 -71
- data/lib/elasticsearch/api/actions/ingest/params_registry.rb +0 -60
- data/lib/elasticsearch/api/actions/nodes/params_registry.rb +0 -60
- data/lib/elasticsearch/api/actions/params_registry.rb +0 -58
- data/lib/elasticsearch/api/actions/shutdown/params_registry.rb +0 -60
- data/lib/elasticsearch/api/actions/snapshot/params_registry.rb +0 -60
- data/lib/elasticsearch/api/actions/tasks/params_registry.rb +0 -60
- data/lib/elasticsearch/api/namespace/cat.rb +0 -36
- data/lib/elasticsearch/api/namespace/cluster.rb +0 -37
- data/lib/elasticsearch/api/namespace/common.rb +0 -44
- data/lib/elasticsearch/api/namespace/dangling_indices.rb +0 -35
- data/lib/elasticsearch/api/namespace/features.rb +0 -36
- data/lib/elasticsearch/api/namespace/indices.rb +0 -37
- data/lib/elasticsearch/api/namespace/ingest.rb +0 -37
- data/lib/elasticsearch/api/namespace/nodes.rb +0 -37
- data/lib/elasticsearch/api/namespace/remote.rb +0 -37
- data/lib/elasticsearch/api/namespace/security.rb +0 -36
- data/lib/elasticsearch/api/namespace/shutdown.rb +0 -37
- data/lib/elasticsearch/api/namespace/snapshot.rb +0 -37
- data/lib/elasticsearch/api/namespace/tasks.rb +0 -37
- data/spec/elasticsearch/api/actions/bulk_spec.rb +0 -139
- data/spec/elasticsearch/api/actions/cat/aliases_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/allocation_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/count_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/fielddata_spec.rb +0 -52
- data/spec/elasticsearch/api/actions/cat/health_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/help_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/indices_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/master_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/nodeattrs_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/nodes_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/pending_tasks_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/plugins_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/recovery_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/repositories_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/segments_spec.rb +0 -49
- data/spec/elasticsearch/api/actions/cat/shards_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/snapshot_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/tasks_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/templates_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cat/thread_pool_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/clear_scroll_spec.rb +0 -52
- data/spec/elasticsearch/api/actions/close_point_in_time_spec.rb +0 -34
- data/spec/elasticsearch/api/actions/cluster/allocation_explain_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cluster/get_settings_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cluster/health_spec.rb +0 -69
- data/spec/elasticsearch/api/actions/cluster/pending_tasks_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cluster/remote_info_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/cluster/reroute_spec.rb +0 -52
- data/spec/elasticsearch/api/actions/cluster/state_spec.rb +0 -52
- data/spec/elasticsearch/api/actions/cluster/stats_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/count_spec.rb +0 -66
- data/spec/elasticsearch/api/actions/create_document_spec.rb +0 -86
- data/spec/elasticsearch/api/actions/dangling_indices/delete_dangling_indices_spec.rb +0 -48
- data/spec/elasticsearch/api/actions/dangling_indices/import_dangling_indices_spec.rb +0 -48
- data/spec/elasticsearch/api/actions/dangling_indices/list_dangling_indices_spec.rb +0 -36
- data/spec/elasticsearch/api/actions/delete_by_query_spec.rb +0 -80
- data/spec/elasticsearch/api/actions/delete_document_spec.rb +0 -112
- data/spec/elasticsearch/api/actions/delete_script_spec.rb +0 -37
- data/spec/elasticsearch/api/actions/exists_document_spec.rb +0 -127
- data/spec/elasticsearch/api/actions/explain_document_spec.rb +0 -99
- data/spec/elasticsearch/api/actions/features/get_features_spec.rb +0 -34
- data/spec/elasticsearch/api/actions/features/reset_features_spec.rb +0 -34
- data/spec/elasticsearch/api/actions/field_caps_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/get_document_source_spec.rb +0 -101
- data/spec/elasticsearch/api/actions/get_document_spec.rb +0 -124
- data/spec/elasticsearch/api/actions/get_script_spec.rb +0 -50
- data/spec/elasticsearch/api/actions/hashie_spec.rb +0 -89
- data/spec/elasticsearch/api/actions/index_document_spec.rb +0 -137
- data/spec/elasticsearch/api/actions/indices/add_block_spec.rb +0 -63
- data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +0 -68
- data/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb +0 -80
- data/spec/elasticsearch/api/actions/indices/clone_spec.rb +0 -122
- data/spec/elasticsearch/api/actions/indices/close_spec.rb +0 -85
- data/spec/elasticsearch/api/actions/indices/create_spec.rb +0 -85
- data/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb +0 -83
- data/spec/elasticsearch/api/actions/indices/delete_spec.rb +0 -108
- data/spec/elasticsearch/api/actions/indices/delete_template_spec.rb +0 -86
- data/spec/elasticsearch/api/actions/indices/disk_usage_spec.rb +0 -48
- data/spec/elasticsearch/api/actions/indices/exists_alias_spec.rb +0 -108
- data/spec/elasticsearch/api/actions/indices/exists_spec.rb +0 -108
- data/spec/elasticsearch/api/actions/indices/exists_template_spec.rb +0 -93
- data/spec/elasticsearch/api/actions/indices/exists_type_spec.rb +0 -108
- data/spec/elasticsearch/api/actions/indices/field_usage_stats_spec.rb +0 -46
- data/spec/elasticsearch/api/actions/indices/flush_spec.rb +0 -91
- data/spec/elasticsearch/api/actions/indices/flush_synced_spec.rb +0 -90
- data/spec/elasticsearch/api/actions/indices/forcemerge_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/indices/get_alias_spec.rb +0 -61
- data/spec/elasticsearch/api/actions/indices/get_field_mapping_spec.rb +0 -61
- data/spec/elasticsearch/api/actions/indices/get_mapping_spec.rb +0 -83
- data/spec/elasticsearch/api/actions/indices/get_settings_spec.rb +0 -72
- data/spec/elasticsearch/api/actions/indices/get_spec.rb +0 -54
- data/spec/elasticsearch/api/actions/indices/open_spec.rb +0 -65
- data/spec/elasticsearch/api/actions/indices/put_alias_spec.rb +0 -89
- data/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb +0 -102
- data/spec/elasticsearch/api/actions/indices/put_settings_spec.rb +0 -108
- data/spec/elasticsearch/api/actions/indices/put_template_spec.rb +0 -107
- data/spec/elasticsearch/api/actions/indices/recovery_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/indices/refresh_spec.rb +0 -91
- data/spec/elasticsearch/api/actions/indices/rollover_spec.rb +0 -58
- data/spec/elasticsearch/api/actions/indices/segments_spec.rb +0 -91
- data/spec/elasticsearch/api/actions/indices/shard_stores_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/indices/shrink_spec.rb +0 -42
- data/spec/elasticsearch/api/actions/indices/split_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -124
- data/spec/elasticsearch/api/actions/indices/update_aliases_spec.rb +0 -67
- data/spec/elasticsearch/api/actions/indices/upgrade_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/indices/validate_query_spec.rb +0 -122
- data/spec/elasticsearch/api/actions/info_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/ingest/delete_pipeline_spec.rb +0 -60
- data/spec/elasticsearch/api/actions/ingest/geo_ip_stats_spec.rb +0 -34
- data/spec/elasticsearch/api/actions/ingest/get_pipeline_spec.rb +0 -50
- data/spec/elasticsearch/api/actions/ingest/put_pipeline_spec.rb +0 -60
- data/spec/elasticsearch/api/actions/ingest/simulate_spec.rb +0 -49
- data/spec/elasticsearch/api/actions/json_builders_spec.rb +0 -84
- data/spec/elasticsearch/api/actions/mget_spec.rb +0 -102
- data/spec/elasticsearch/api/actions/msearch_spec.rb +0 -151
- data/spec/elasticsearch/api/actions/msearch_template_spec.rb +0 -93
- data/spec/elasticsearch/api/actions/mtermvectors_spec.rb +0 -46
- data/spec/elasticsearch/api/actions/nodes/clear_repositories_metering_archive_spec.rb +0 -51
- data/spec/elasticsearch/api/actions/nodes/get_repositories_metering_info_spec.rb +0 -44
- data/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb +0 -61
- data/spec/elasticsearch/api/actions/nodes/info_spec.rb +0 -102
- data/spec/elasticsearch/api/actions/nodes/reload_secure_settings_spec.rb +0 -84
- data/spec/elasticsearch/api/actions/nodes/stats_spec.rb +0 -76
- data/spec/elasticsearch/api/actions/open_point_in_time_spec.rb +0 -34
- data/spec/elasticsearch/api/actions/ping_spec.rb +0 -76
- data/spec/elasticsearch/api/actions/put_script_spec.rb +0 -56
- data/spec/elasticsearch/api/actions/reindex_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/render_search_template_spec.rb +0 -52
- data/spec/elasticsearch/api/actions/scroll_spec.rb +0 -52
- data/spec/elasticsearch/api/actions/search_mvt_spec.rb +0 -52
- data/spec/elasticsearch/api/actions/search_shards_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/search_spec.rb +0 -134
- data/spec/elasticsearch/api/actions/search_template_spec.rb +0 -34
- data/spec/elasticsearch/api/actions/shutdown/delete_node_spec.rb +0 -44
- data/spec/elasticsearch/api/actions/shutdown/get_node_spec.rb +0 -46
- data/spec/elasticsearch/api/actions/shutdown/put_node_spec.rb +0 -50
- data/spec/elasticsearch/api/actions/snapshot/clone_spec.rb +0 -67
- data/spec/elasticsearch/api/actions/snapshot/create_repository_spec.rb +0 -51
- data/spec/elasticsearch/api/actions/snapshot/create_spec.rb +0 -51
- data/spec/elasticsearch/api/actions/snapshot/delete_repository_spec.rb +0 -50
- data/spec/elasticsearch/api/actions/snapshot/delete_spec.rb +0 -51
- data/spec/elasticsearch/api/actions/snapshot/get_repository_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/snapshot/get_spec.rb +0 -51
- data/spec/elasticsearch/api/actions/snapshot/repository_analize_spec.rb +0 -48
- data/spec/elasticsearch/api/actions/snapshot/restore_spec.rb +0 -51
- data/spec/elasticsearch/api/actions/snapshot/status_spec.rb +0 -50
- data/spec/elasticsearch/api/actions/snapshot/verify_repository_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/tasks/cancel_spec.rb +0 -50
- data/spec/elasticsearch/api/actions/tasks/get_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/tasks/list_spec.rb +0 -39
- data/spec/elasticsearch/api/actions/termvectors_spec.rb +0 -66
- data/spec/elasticsearch/api/actions/update_by_query_spec.rb +0 -35
- data/spec/elasticsearch/api/actions/update_document_spec.rb +0 -122
- data/spec/elasticsearch/api/api_spec.rb +0 -43
- data/spec/elasticsearch/api/client_spec.rb +0 -46
- data/spec/elasticsearch/api/rest_api_yaml_spec.rb +0 -159
- data/spec/elasticsearch/api/utils_spec.rb +0 -418
- data/spec/rest_yaml_tests_helper.rb +0 -135
- data/spec/skipped_tests.yml +0 -29
- data/spec/spec_helper.rb +0 -82
- data/utils/Gemfile +0 -28
- data/utils/README.md +0 -46
- data/utils/Thorfile +0 -6
- data/utils/thor/.rubocop.yml +0 -4
- data/utils/thor/generate_source.rb +0 -307
- data/utils/thor/generator/endpoint_specifics.rb +0 -187
- data/utils/thor/generator/files_helper.rb +0 -78
- data/utils/thor/lister.rb +0 -57
- data/utils/thor/templates/_documentation_top.erb +0 -58
- data/utils/thor/templates/_method_setup.erb +0 -53
- data/utils/thor/templates/_params_registry.erb +0 -31
- data/utils/thor/templates/_perform_request.erb +0 -56
- data/utils/thor/templates/method.erb +0 -73
- data/utils/thor/templates/test.erb +0 -43
- data/utils/thor/templates/test_helper.rb +0 -83
- /data/{LICENSE → LICENSE.txt} +0 -0
    
        data/utils/README.md
    DELETED
    
    | @@ -1,46 +0,0 @@ | |
| 1 | 
            -
            # Utils
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            ## The Generator
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            This directory hosts The Generator, a tool that generates the classes for each API endpoint from the [Elasticsearch REST API JSON Specification](https://github.com/elastic/elasticsearch/tree/master/rest-api-spec).
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            ### Generate
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            To generate the code, you need to have the Elasticsearch REST API spec files in `tmp/rest-api-spec` in the root of the project. You can run a rake task from the root of the project to download the specs corresponding to the current running cluster:
         | 
| 10 | 
            -
            ```bash
         | 
| 11 | 
            -
            $ rake elasticsearch:download_artifacts
         | 
| 12 | 
            -
            ```
         | 
| 13 | 
            -
             | 
| 14 | 
            -
            Once the JSON files have been downloaded, you need to run (from this folder):
         | 
| 15 | 
            -
            ```bash
         | 
| 16 | 
            -
            $ thor api:code:generate
         | 
| 17 | 
            -
            ```
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            - The oss Ruby code will be generated in `elasticsearch-api/lib/elasticsearch/api/actions`.  
         | 
| 20 | 
            -
            - The xpack Ruby code will be generated in `elasticsearch-xpack/lib/elasticsearch/xpack/api/actions`.
         | 
| 21 | 
            -
            - The generator runs Rubocop to autolint and clean up the generated files.
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            Alternatively, you can pass in `oss` or `xpack` as parameters to generate only one of the 2 sets of endpoints:
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            ```bash
         | 
| 26 | 
            -
            $ thor api:code:generate --api=xpack
         | 
| 27 | 
            -
            $ thor api:code:generate --api=oss
         | 
| 28 | 
            -
            ```
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            ### Development
         | 
| 31 | 
            -
             | 
| 32 | 
            -
            The main entry point is `generate_source.rb`, which contains a class that implements a Thor task: `generate`:
         | 
| 33 | 
            -
             | 
| 34 | 
            -
            ```
         | 
| 35 | 
            -
            $ thor api:code:generate
         | 
| 36 | 
            -
            ```
         | 
| 37 | 
            -
             | 
| 38 | 
            -
            It uses [Thor::Actions](https://github.com/erikhuda/thor/wiki/Actions)' `template` method and `templates/method.erb` to generate the final code. The `generator` directory contains some helpers used to generate the code. The ERB template is split into partials and you can find all ERB files in the `templates` directory.
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            There's also a lister task:
         | 
| 41 | 
            -
             | 
| 42 | 
            -
            ```
         | 
| 43 | 
            -
            $ thor api:list
         | 
| 44 | 
            -
            ```
         | 
| 45 | 
            -
             | 
| 46 | 
            -
            It's implemented in `lister.rb` and it lists all the REST API endpoints from the JSON specification.
         | 
    
        data/utils/Thorfile
    DELETED
    
    | @@ -1,6 +0,0 @@ | |
| 1 | 
            -
            # Licensed to Elasticsearch B.V under one or more agreements.
         | 
| 2 | 
            -
            # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
         | 
| 3 | 
            -
            # See the LICENSE file in the project root for more information
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            require File.expand_path('./thor/generate_source')
         | 
| 6 | 
            -
            require File.expand_path('./thor/lister')
         | 
    
        data/utils/thor/.rubocop.yml
    DELETED
    
    
| @@ -1,307 +0,0 @@ | |
| 1 | 
            -
            # Licensed to Elasticsearch B.V. under one or more contributor
         | 
| 2 | 
            -
            # license agreements. See the NOTICE file distributed with
         | 
| 3 | 
            -
            # this work for additional information regarding copyright
         | 
| 4 | 
            -
            # ownership. Elasticsearch B.V. licenses this file to you under
         | 
| 5 | 
            -
            # the Apache License, Version 2.0 (the "License"); you may
         | 
| 6 | 
            -
            # not use this file except in compliance with the License.
         | 
| 7 | 
            -
            # You may obtain a copy of the License at
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            #   http://www.apache.org/licenses/LICENSE-2.0
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # Unless required by applicable law or agreed to in writing,
         | 
| 12 | 
            -
            # software distributed under the License is distributed on an
         | 
| 13 | 
            -
            # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         | 
| 14 | 
            -
            # KIND, either express or implied.  See the License for the
         | 
| 15 | 
            -
            # specific language governing permissions and limitations
         | 
| 16 | 
            -
            # under the License.
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            # encoding: UTF-8
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            require 'thor'
         | 
| 21 | 
            -
            require 'pathname'
         | 
| 22 | 
            -
            require 'active_support/core_ext/hash/deep_merge'
         | 
| 23 | 
            -
            require 'active_support/inflector'
         | 
| 24 | 
            -
            require 'multi_json'
         | 
| 25 | 
            -
            require 'coderay'
         | 
| 26 | 
            -
            require 'pry'
         | 
| 27 | 
            -
            require_relative 'generator/files_helper'
         | 
| 28 | 
            -
            require_relative 'generator/endpoint_specifics'
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            module Elasticsearch
         | 
| 31 | 
            -
              module API
         | 
| 32 | 
            -
                # A command line application based on [Thor](https://github.com/wycats/thor),
         | 
| 33 | 
            -
                # which will read the JSON API spec file(s), and generate
         | 
| 34 | 
            -
                # the Ruby source code (one file per API endpoint) with correct
         | 
| 35 | 
            -
                # module namespace, method names, and RDoc documentation,
         | 
| 36 | 
            -
                # as well as test files for each endpoint.
         | 
| 37 | 
            -
                #
         | 
| 38 | 
            -
                # Specific exceptions and code snippets that need to be included are written
         | 
| 39 | 
            -
                # in EndpointSpecifics (generator/endpoint_specifics) and the module is included
         | 
| 40 | 
            -
                # here.
         | 
| 41 | 
            -
                #
         | 
| 42 | 
            -
                class SourceGenerator < Thor
         | 
| 43 | 
            -
                  namespace 'api:code'
         | 
| 44 | 
            -
                  include Thor::Actions
         | 
| 45 | 
            -
                  include EndpointSpecifics
         | 
| 46 | 
            -
             | 
| 47 | 
            -
                  __root = Pathname(File.expand_path('../../..', __FILE__))
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                  desc 'generate', 'Generate source code and tests from the REST API JSON specification'
         | 
| 50 | 
            -
                  method_option :verbose, type: :boolean, default: false,  desc: 'Output more information'
         | 
| 51 | 
            -
                  method_option :tests,   type: :boolean, default: false,  desc: 'Generate test files'
         | 
| 52 | 
            -
                  method_option :api,     type: :array,   default: %w[oss xpack], desc: 'APIs to generate (oss, x-pack)'
         | 
| 53 | 
            -
             | 
| 54 | 
            -
                  def generate
         | 
| 55 | 
            -
                    self.class.source_root File.expand_path(__dir__)
         | 
| 56 | 
            -
                    @xpack = options[:api].include? 'xpack'
         | 
| 57 | 
            -
                    @oss   = options[:api].include? 'oss'
         | 
| 58 | 
            -
             | 
| 59 | 
            -
                    __generate_source(:xpack) if @xpack
         | 
| 60 | 
            -
                    __generate_source(:oss) if @oss
         | 
| 61 | 
            -
                    # -- Tree output
         | 
| 62 | 
            -
                    print_tree if options[:verbose]
         | 
| 63 | 
            -
                  end
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                  private
         | 
| 66 | 
            -
             | 
| 67 | 
            -
                  def __generate_source(api)
         | 
| 68 | 
            -
                    @current_api = api
         | 
| 69 | 
            -
                    @output = FilesHelper.output_dir(api)
         | 
| 70 | 
            -
             | 
| 71 | 
            -
                    FilesHelper.files(api).each do |filepath|
         | 
| 72 | 
            -
                      @path = Pathname(filepath)
         | 
| 73 | 
            -
                      @json = MultiJson.load(File.read(@path))
         | 
| 74 | 
            -
                      @spec = @json.values.first
         | 
| 75 | 
            -
                      say_status 'json', @path, :yellow
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                      @spec['url'] ||= {}
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                      @endpoint_name    = @json.keys.first
         | 
| 80 | 
            -
                      @full_namespace   = __full_namespace
         | 
| 81 | 
            -
                      @namespace_depth  = @full_namespace.size > 0 ? @full_namespace.size - 1 : 0
         | 
| 82 | 
            -
                      @module_namespace = @full_namespace[0, @namespace_depth]
         | 
| 83 | 
            -
                      @method_name      = @full_namespace.last
         | 
| 84 | 
            -
                      @parts            = __endpoint_parts
         | 
| 85 | 
            -
                      @params           = @spec['params'] || {}
         | 
| 86 | 
            -
                      @specific_params  = specific_params(@module_namespace.first) # See EndpointSpecifics
         | 
| 87 | 
            -
                      @http_method      = __http_method
         | 
| 88 | 
            -
                      @paths            = @spec['url']['paths'].map { |b| b['path'] }
         | 
| 89 | 
            -
                      # Using Ruby's safe operator on array:
         | 
| 90 | 
            -
                      @deprecation_note = @spec['url']['paths'].last&.[]('deprecated')
         | 
| 91 | 
            -
                      @http_path        = __http_path
         | 
| 92 | 
            -
                      @required_parts   = __required_parts
         | 
| 93 | 
            -
             | 
| 94 | 
            -
                      @module_namespace.shift if @module_namespace.first == 'xpack'
         | 
| 95 | 
            -
                      @path_to_file = @output.join(@module_namespace.join('/')).join("#{@method_name}.rb")
         | 
| 96 | 
            -
                      dir = @output.join(@module_namespace.join('/'))
         | 
| 97 | 
            -
                      empty_directory(dir, verbose: false)
         | 
| 98 | 
            -
             | 
| 99 | 
            -
                      # Write the file with the ERB template:
         | 
| 100 | 
            -
                      template('templates/method.erb', @path_to_file, force: true)
         | 
| 101 | 
            -
             | 
| 102 | 
            -
                      print_source_code(@path_to_file) if options[:verbose]
         | 
| 103 | 
            -
             | 
| 104 | 
            -
                      generate_tests if options[:tests]
         | 
| 105 | 
            -
             | 
| 106 | 
            -
                      puts
         | 
| 107 | 
            -
                    end
         | 
| 108 | 
            -
             | 
| 109 | 
            -
                    run_rubocop(api)
         | 
| 110 | 
            -
                  end
         | 
| 111 | 
            -
             | 
| 112 | 
            -
                  def __full_namespace
         | 
| 113 | 
            -
                    names = @endpoint_name.split('.')
         | 
| 114 | 
            -
                    if @current_api == :xpack
         | 
| 115 | 
            -
                      names = (names.first == 'xpack' ? names : ['xpack', names].flatten)
         | 
| 116 | 
            -
                      # Return an array to expand 'ccr', 'ilm', 'ml' and 'slm'
         | 
| 117 | 
            -
                      names.map do |name|
         | 
| 118 | 
            -
                        name
         | 
| 119 | 
            -
                          .gsub(/^ml$/, 'machine_learning')
         | 
| 120 | 
            -
                          .gsub(/^ilm$/, 'index_lifecycle_management')
         | 
| 121 | 
            -
                          .gsub(/^ccr/, 'cross_cluster_replication')
         | 
| 122 | 
            -
                          .gsub(/^slm/, 'snapshot_lifecycle_management')
         | 
| 123 | 
            -
                      end
         | 
| 124 | 
            -
                    else
         | 
| 125 | 
            -
                      names
         | 
| 126 | 
            -
                    end
         | 
| 127 | 
            -
                  end
         | 
| 128 | 
            -
             | 
| 129 | 
            -
                  # Create the hierarchy of directories based on API namespaces
         | 
| 130 | 
            -
                  #
         | 
| 131 | 
            -
                  def __create_directories(key, value)
         | 
| 132 | 
            -
                    return if value['documentation']
         | 
| 133 | 
            -
             | 
| 134 | 
            -
                    empty_directory @output.join(key)
         | 
| 135 | 
            -
                    create_directory_hierarchy * value.to_a.first
         | 
| 136 | 
            -
                  end
         | 
| 137 | 
            -
             | 
| 138 | 
            -
                  # Extract parts from each path
         | 
| 139 | 
            -
                  #
         | 
| 140 | 
            -
                  def __endpoint_parts
         | 
| 141 | 
            -
                    parts = @spec['url']['paths'].select do |a|
         | 
| 142 | 
            -
                      a.keys.include?('parts')
         | 
| 143 | 
            -
                    end.map do |path|
         | 
| 144 | 
            -
                      path&.[]('parts')
         | 
| 145 | 
            -
                    end
         | 
| 146 | 
            -
                    (parts.inject(&:merge) || [])
         | 
| 147 | 
            -
                  end
         | 
| 148 | 
            -
             | 
| 149 | 
            -
                  def __http_method
         | 
| 150 | 
            -
                    return '_id ? Elasticsearch::API::HTTP_PUT : Elasticsearch::API::HTTP_POST' if @endpoint_name == 'index'
         | 
| 151 | 
            -
                    return post_and_get if @endpoint_name == 'count'
         | 
| 152 | 
            -
             | 
| 153 | 
            -
                    default_method = @spec['url']['paths'].map { |a| a['methods'] }.flatten.first
         | 
| 154 | 
            -
                    if @spec['body'] && default_method == 'GET'
         | 
| 155 | 
            -
                      # When default method is GET and body is required, we should always use POST
         | 
| 156 | 
            -
                      if @spec['body']['required']
         | 
| 157 | 
            -
                        'Elasticsearch::API::HTTP_POST'
         | 
| 158 | 
            -
                      else
         | 
| 159 | 
            -
                        post_and_get
         | 
| 160 | 
            -
                      end
         | 
| 161 | 
            -
                    else
         | 
| 162 | 
            -
                      "Elasticsearch::API::HTTP_#{default_method}"
         | 
| 163 | 
            -
                    end
         | 
| 164 | 
            -
                  end
         | 
| 165 | 
            -
             | 
| 166 | 
            -
                  def post_and_get
         | 
| 167 | 
            -
                    <<~SRC
         | 
| 168 | 
            -
                      if arguments[:body]
         | 
| 169 | 
            -
                        Elasticsearch::API::HTTP_POST
         | 
| 170 | 
            -
                      else
         | 
| 171 | 
            -
                        Elasticsearch::API::HTTP_GET
         | 
| 172 | 
            -
                      end
         | 
| 173 | 
            -
                    SRC
         | 
| 174 | 
            -
                  end
         | 
| 175 | 
            -
             | 
| 176 | 
            -
                  def __http_path
         | 
| 177 | 
            -
                    return "\"#{__parse_path(@paths.first)}\"" if @paths.size == 1
         | 
| 178 | 
            -
                    return termvectors_path if @method_name == 'termvectors'
         | 
| 179 | 
            -
             | 
| 180 | 
            -
                    result = ''
         | 
| 181 | 
            -
                    anchor_string = []
         | 
| 182 | 
            -
                    @paths.sort { |a, b| b.length <=> a.length }.each_with_index do |path, i|
         | 
| 183 | 
            -
                      var_string = __extract_path_variables(path).map { |var| "_#{var}" }.join(' && ')
         | 
| 184 | 
            -
                      next if anchor_string.include? var_string
         | 
| 185 | 
            -
             | 
| 186 | 
            -
                      anchor_string << var_string
         | 
| 187 | 
            -
                      result += if i.zero?
         | 
| 188 | 
            -
                                  "if #{var_string}\n"
         | 
| 189 | 
            -
                                elsif (i == @paths.size - 1) || var_string.empty?
         | 
| 190 | 
            -
                                  "else\n"
         | 
| 191 | 
            -
                                else
         | 
| 192 | 
            -
                                  "elsif #{var_string}\n"
         | 
| 193 | 
            -
                                end
         | 
| 194 | 
            -
                      result += "\"#{__parse_path(path)}\"\n"
         | 
| 195 | 
            -
                    end
         | 
| 196 | 
            -
                    result += 'end'
         | 
| 197 | 
            -
                    result
         | 
| 198 | 
            -
                  end
         | 
| 199 | 
            -
             | 
| 200 | 
            -
                  def __parse_path(path)
         | 
| 201 | 
            -
                    path.gsub(/^\//, '')
         | 
| 202 | 
            -
                      .gsub(/\/$/, '')
         | 
| 203 | 
            -
                      .gsub('{', "\#{#{__utils}.__listify(_")
         | 
| 204 | 
            -
                      .gsub('}', ')}')
         | 
| 205 | 
            -
                  end
         | 
| 206 | 
            -
             | 
| 207 | 
            -
                  def __path_variables
         | 
| 208 | 
            -
                    @paths.map do |path|
         | 
| 209 | 
            -
                      __extract_path_variables(path)
         | 
| 210 | 
            -
                    end
         | 
| 211 | 
            -
                  end
         | 
| 212 | 
            -
             | 
| 213 | 
            -
                  # extract values that are in the {var} format:
         | 
| 214 | 
            -
                  def __extract_path_variables(path)
         | 
| 215 | 
            -
                    path.scan(/{(\w+)}/).flatten
         | 
| 216 | 
            -
                  end
         | 
| 217 | 
            -
             | 
| 218 | 
            -
                  # Find parts that are definitely required and should raise an error if
         | 
| 219 | 
            -
                  # they're not present
         | 
| 220 | 
            -
                  #
         | 
| 221 | 
            -
                  def __required_parts
         | 
| 222 | 
            -
                    required = []
         | 
| 223 | 
            -
                    return required if @endpoint_name == 'tasks.get'
         | 
| 224 | 
            -
             | 
| 225 | 
            -
                    required << 'body' if (@spec['body'] && @spec['body']['required'])
         | 
| 226 | 
            -
                    # Get required variables from paths:
         | 
| 227 | 
            -
                    req_variables = __path_variables.inject(:&) # find intersection
         | 
| 228 | 
            -
                    required << req_variables unless req_variables.empty?
         | 
| 229 | 
            -
                    required.flatten
         | 
| 230 | 
            -
                  end
         | 
| 231 | 
            -
             | 
| 232 | 
            -
                  def docs_helper(name, info)
         | 
| 233 | 
            -
                    info['type'] = 'String' if info['type'] == 'enum' # Rename 'enums' to 'strings'
         | 
| 234 | 
            -
                    info['type'] = 'Integer' if info['type'] == 'int' # Rename 'int' to 'Integer'
         | 
| 235 | 
            -
                    tipo = info['type'] ? info['type'].capitalize : 'String'
         | 
| 236 | 
            -
                    description = info['description'] ? info['description'].strip : '[TODO]'
         | 
| 237 | 
            -
                    options = info['options'] ? "(options: #{info['options'].join(', ').strip})" : nil
         | 
| 238 | 
            -
                    required = info['required'] ? '(*Required*)' : ''
         | 
| 239 | 
            -
                    deprecated = info['deprecated'] ? '*Deprecated*' : ''
         | 
| 240 | 
            -
                    optionals = [required, deprecated, options].join(' ').strip
         | 
| 241 | 
            -
             | 
| 242 | 
            -
                    "# @option arguments [#{tipo}] :#{name} #{description} #{optionals}\n"
         | 
| 243 | 
            -
                  end
         | 
| 244 | 
            -
             | 
| 245 | 
            -
                  def stability_doc_helper(stability)
         | 
| 246 | 
            -
                    return if stability == 'stable'
         | 
| 247 | 
            -
             | 
| 248 | 
            -
                    if stability == 'experimental'
         | 
| 249 | 
            -
                      <<~MSG
         | 
| 250 | 
            -
                        # This functionality is Experimental and may be changed or removed
         | 
| 251 | 
            -
                        # completely in a future release. Elastic will take a best effort approach
         | 
| 252 | 
            -
                        # to fix any issues, but experimental features are not subject to the
         | 
| 253 | 
            -
                        # support SLA of official GA features.
         | 
| 254 | 
            -
                      MSG
         | 
| 255 | 
            -
                    elsif stability == 'beta'
         | 
| 256 | 
            -
                      <<~MSG
         | 
| 257 | 
            -
                        # This functionality is in Beta and is subject to change. The design and
         | 
| 258 | 
            -
                        # code is less mature than official GA features and is being provided
         | 
| 259 | 
            -
                        # as-is with no warranties. Beta features are not subject to the support
         | 
| 260 | 
            -
                        # SLA of official GA features.
         | 
| 261 | 
            -
                      MSG
         | 
| 262 | 
            -
                    else
         | 
| 263 | 
            -
                      <<~MSG
         | 
| 264 | 
            -
                        # This functionality is subject to potential breaking changes within a
         | 
| 265 | 
            -
                        # minor version, meaning that your referencing code may break when this
         | 
| 266 | 
            -
                        # library is upgraded.
         | 
| 267 | 
            -
                      MSG
         | 
| 268 | 
            -
                    end
         | 
| 269 | 
            -
                  end
         | 
| 270 | 
            -
             | 
| 271 | 
            -
                  def generate_tests
         | 
| 272 | 
            -
                    copy_file 'templates/test_helper.rb', @output.join('test').join('test_helper.rb')
         | 
| 273 | 
            -
             | 
| 274 | 
            -
                    @test_directory = @output.join('test/api').join(@module_namespace.join('/'))
         | 
| 275 | 
            -
                    @test_file      = @test_directory.join("#{@method_name}_test.rb")
         | 
| 276 | 
            -
             | 
| 277 | 
            -
                    empty_directory @test_directory
         | 
| 278 | 
            -
                    template 'templates/test.erb', @test_file
         | 
| 279 | 
            -
             | 
| 280 | 
            -
                    print_source_code(@test_file) if options[:verbose]
         | 
| 281 | 
            -
                  end
         | 
| 282 | 
            -
             | 
| 283 | 
            -
                  def print_source_code(path_to_file)
         | 
| 284 | 
            -
                    colorized_output = CodeRay.scan_file(path_to_file, :ruby).terminal
         | 
| 285 | 
            -
                    lines            = colorized_output.split("\n")
         | 
| 286 | 
            -
                    formatted        = lines.first + "\n" + lines[1, lines.size].map { |l| ' ' * 14 + l }.join("\n")
         | 
| 287 | 
            -
             | 
| 288 | 
            -
                    say_status('ruby', formatted, :yellow)
         | 
| 289 | 
            -
                  end
         | 
| 290 | 
            -
             | 
| 291 | 
            -
                  def print_tree
         | 
| 292 | 
            -
                    return unless `which tree > /dev/null 2>&1; echo $?`.to_i < 1
         | 
| 293 | 
            -
             | 
| 294 | 
            -
                    lines = `tree #{@output}`.split("\n")
         | 
| 295 | 
            -
                    say_status('tree', lines.first + "\n" + lines[1, lines.size].map { |l| ' ' * 14 + l }.join("\n"))
         | 
| 296 | 
            -
                  end
         | 
| 297 | 
            -
             | 
| 298 | 
            -
                  def __utils
         | 
| 299 | 
            -
                    @current_api == :xpack ? 'Elasticsearch::API::Utils' : 'Utils'
         | 
| 300 | 
            -
                  end
         | 
| 301 | 
            -
             | 
| 302 | 
            -
                  def run_rubocop(api)
         | 
| 303 | 
            -
                    system("rubocop -c ./thor/.rubocop.yml --format autogenconf -x #{FilesHelper::output_dir(api)}")
         | 
| 304 | 
            -
                  end
         | 
| 305 | 
            -
                end
         | 
| 306 | 
            -
              end
         | 
| 307 | 
            -
            end
         | 
| @@ -1,187 +0,0 @@ | |
| 1 | 
            -
            # Licensed to Elasticsearch B.V. under one or more contributor
         | 
| 2 | 
            -
            # license agreements. See the NOTICE file distributed with
         | 
| 3 | 
            -
            # this work for additional information regarding copyright
         | 
| 4 | 
            -
            # ownership. Elasticsearch B.V. licenses this file to you under
         | 
| 5 | 
            -
            # the Apache License, Version 2.0 (the "License"); you may
         | 
| 6 | 
            -
            # not use this file except in compliance with the License.
         | 
| 7 | 
            -
            # You may obtain a copy of the License at
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            #   http://www.apache.org/licenses/LICENSE-2.0
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # Unless required by applicable law or agreed to in writing,
         | 
| 12 | 
            -
            # software distributed under the License is distributed on an
         | 
| 13 | 
            -
            # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         | 
| 14 | 
            -
            # KIND, either express or implied.  See the License for the
         | 
| 15 | 
            -
            # specific language governing permissions and limitations
         | 
| 16 | 
            -
            # under the License.
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            module Elasticsearch
         | 
| 19 | 
            -
              module API
         | 
| 20 | 
            -
                # Handles specific exceptional parameters and code snippets that need to be
         | 
| 21 | 
            -
                # included in the generated code. This module is included in SourceGenerator
         | 
| 22 | 
            -
                # so its methods can be used from the ERB template (method.erb). This will
         | 
| 23 | 
            -
                # potentially be refactored into different templates.
         | 
| 24 | 
            -
                module EndpointSpecifics
         | 
| 25 | 
            -
                  # Endpoints that need Utils.__rescue_from_not_found
         | 
| 26 | 
            -
                  IGNORE_404 = %w[
         | 
| 27 | 
            -
                    exists
         | 
| 28 | 
            -
                    indices.exists
         | 
| 29 | 
            -
                    indices.exists_alias
         | 
| 30 | 
            -
                    indices.exists_index_template
         | 
| 31 | 
            -
                    indices.exists_template
         | 
| 32 | 
            -
                    indices.exists_type
         | 
| 33 | 
            -
                  ].freeze
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                  # Endpoints that need Utils.__rescue_from_not_found if the ignore
         | 
| 36 | 
            -
                  # parameter is included
         | 
| 37 | 
            -
                  COMPLEX_IGNORE_404 = %w[
         | 
| 38 | 
            -
                    delete
         | 
| 39 | 
            -
                    get
         | 
| 40 | 
            -
                    indices.flush_synced
         | 
| 41 | 
            -
                    indices.delete
         | 
| 42 | 
            -
                    indices.delete_index_template
         | 
| 43 | 
            -
                    indices.delete_template
         | 
| 44 | 
            -
                    security.get_role
         | 
| 45 | 
            -
                    security.get_user
         | 
| 46 | 
            -
                    snapshot.status
         | 
| 47 | 
            -
                    snapshot.get
         | 
| 48 | 
            -
                    snapshot.get_repository
         | 
| 49 | 
            -
                    snapshot.delete_repository
         | 
| 50 | 
            -
                    snapshot.delete
         | 
| 51 | 
            -
                    update
         | 
| 52 | 
            -
                    watcher.delete_watch
         | 
| 53 | 
            -
                  ].freeze
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                  # Endpoints that need params[:h] listified
         | 
| 56 | 
            -
                  H_PARAMS = %w[aliases allocation count health indices nodes pending_tasks
         | 
| 57 | 
            -
                                recovery shards thread_pool].freeze
         | 
| 58 | 
            -
             | 
| 59 | 
            -
                  # Function that adds the listified h param code
         | 
| 60 | 
            -
                  def specific_params(namespace)
         | 
| 61 | 
            -
                    params = []
         | 
| 62 | 
            -
                    if H_PARAMS.include?(@method_name) && namespace == 'cat'
         | 
| 63 | 
            -
                      if @method_name == 'nodes'
         | 
| 64 | 
            -
                        params << 'params[:h] = Utils.__listify(params[:h], escape: false) if params[:h]'
         | 
| 65 | 
            -
                      else
         | 
| 66 | 
            -
                        params << 'params[:h] = Utils.__listify(params[:h]) if params[:h]'
         | 
| 67 | 
            -
                      end
         | 
| 68 | 
            -
                    end
         | 
| 69 | 
            -
                    params
         | 
| 70 | 
            -
                  end
         | 
| 71 | 
            -
             | 
| 72 | 
            -
                  def needs_ignore_404?(endpoint)
         | 
| 73 | 
            -
                    IGNORE_404.include? endpoint
         | 
| 74 | 
            -
                  end
         | 
| 75 | 
            -
             | 
| 76 | 
            -
                  def needs_complex_ignore_404?(endpoint)
         | 
| 77 | 
            -
                    COMPLEX_IGNORE_404.include? endpoint
         | 
| 78 | 
            -
                  end
         | 
| 79 | 
            -
             | 
| 80 | 
            -
                  def module_name_helper(name)
         | 
| 81 | 
            -
                    return name.upcase if %w[sql ssl].include? name
         | 
| 82 | 
            -
             | 
| 83 | 
            -
                    name.split('_').map(&:capitalize).join
         | 
| 84 | 
            -
                  end
         | 
| 85 | 
            -
             | 
| 86 | 
            -
                  def termvectors_path
         | 
| 87 | 
            -
                    <<~SRC
         | 
| 88 | 
            -
                      if _index && _type && _id
         | 
| 89 | 
            -
                        "\#{Utils.__listify(_index)}/\#{Utils.__listify(_type)}/\#{Utils.__listify(_id)}/\#{endpoint}"
         | 
| 90 | 
            -
                      elsif _index && _type
         | 
| 91 | 
            -
                        "\#{Utils.__listify(_index)}/\#{Utils.__listify(_type)}/\#{endpoint}"
         | 
| 92 | 
            -
                      elsif _index && _id
         | 
| 93 | 
            -
                        "\#{Utils.__listify(_index)}/\#{endpoint}/\#{Utils.__listify(_id)}"
         | 
| 94 | 
            -
                      else
         | 
| 95 | 
            -
                        "\#{Utils.__listify(_index)}/\#{endpoint}"
         | 
| 96 | 
            -
                      end
         | 
| 97 | 
            -
                    SRC
         | 
| 98 | 
            -
                  end
         | 
| 99 | 
            -
             | 
| 100 | 
            -
                  def ping_perform_request
         | 
| 101 | 
            -
                    <<~SRC
         | 
| 102 | 
            -
                      begin
         | 
| 103 | 
            -
                        perform_request(method, path, params, body, headers).status == 200 ? true : false
         | 
| 104 | 
            -
                      rescue Exception => e
         | 
| 105 | 
            -
                        if e.class.to_s =~ /NotFound|ConnectionFailed/ || e.message =~ /Not\s*Found|404|ConnectionFailed/i
         | 
| 106 | 
            -
                          false
         | 
| 107 | 
            -
                        else
         | 
| 108 | 
            -
                          raise e
         | 
| 109 | 
            -
                        end
         | 
| 110 | 
            -
                      end
         | 
| 111 | 
            -
                    SRC
         | 
| 112 | 
            -
                  end
         | 
| 113 | 
            -
             | 
| 114 | 
            -
                  def indices_stats_params_registry
         | 
| 115 | 
            -
                    <<~SRC
         | 
| 116 | 
            -
                      ParamsRegistry.register(:stats_params, [
         | 
| 117 | 
            -
                        #{@spec['params'].keys.map { |k| ":#{k}" }.join(",\n")}
         | 
| 118 | 
            -
                      ].freeze)
         | 
| 119 | 
            -
             | 
| 120 | 
            -
                      ParamsRegistry.register(:stats_parts, [
         | 
| 121 | 
            -
                        #{@parts['metric']['options'].push('metric').map { |k| ":#{k}" }.join(",\n")}
         | 
| 122 | 
            -
                      ].freeze)
         | 
| 123 | 
            -
                    SRC
         | 
| 124 | 
            -
                  end
         | 
| 125 | 
            -
             | 
| 126 | 
            -
                  def msearch_body_helper
         | 
| 127 | 
            -
                    <<~SRC
         | 
| 128 | 
            -
                      case
         | 
| 129 | 
            -
                      when body.is_a?(Array) && body.any? { |d| d.has_key? :search }
         | 
| 130 | 
            -
                        payload = body.
         | 
| 131 | 
            -
                          inject([]) do |sum, item|
         | 
| 132 | 
            -
                            meta = item
         | 
| 133 | 
            -
                            data = meta.delete(:search)
         | 
| 134 | 
            -
             | 
| 135 | 
            -
                            sum << meta
         | 
| 136 | 
            -
                            sum << data
         | 
| 137 | 
            -
                            sum
         | 
| 138 | 
            -
                          end.
         | 
| 139 | 
            -
                          map { |item| Elasticsearch::API.serializer.dump(item) }
         | 
| 140 | 
            -
                        payload << "" unless payload.empty?
         | 
| 141 | 
            -
                        payload = payload.join("\\n")
         | 
| 142 | 
            -
                      when body.is_a?(Array)
         | 
| 143 | 
            -
                        payload = body.map { |d| d.is_a?(String) ? d : Elasticsearch::API.serializer.dump(d) }
         | 
| 144 | 
            -
                        payload << "" unless payload.empty?
         | 
| 145 | 
            -
                        payload = payload.join("\\n")
         | 
| 146 | 
            -
                      else
         | 
| 147 | 
            -
                        payload = body
         | 
| 148 | 
            -
                      end
         | 
| 149 | 
            -
                    SRC
         | 
| 150 | 
            -
                  end
         | 
| 151 | 
            -
             | 
| 152 | 
            -
                  def msearch_template_body_helper
         | 
| 153 | 
            -
                    <<~SRC
         | 
| 154 | 
            -
                      case
         | 
| 155 | 
            -
                      when body.is_a?(Array)
         | 
| 156 | 
            -
                        payload = body.map { |d| d.is_a?(String) ? d : Elasticsearch::API.serializer.dump(d) }
         | 
| 157 | 
            -
                        payload << "" unless payload.empty?
         | 
| 158 | 
            -
                        payload = payload.join("\n")
         | 
| 159 | 
            -
                      else
         | 
| 160 | 
            -
                        payload = body
         | 
| 161 | 
            -
                      end
         | 
| 162 | 
            -
                    SRC
         | 
| 163 | 
            -
                  end
         | 
| 164 | 
            -
             | 
| 165 | 
            -
                  def bulk_body_helper
         | 
| 166 | 
            -
                    <<~SRC
         | 
| 167 | 
            -
                      if body.is_a? Array
         | 
| 168 | 
            -
                        payload = Elasticsearch::API::Utils.__bulkify(body)
         | 
| 169 | 
            -
                      else
         | 
| 170 | 
            -
                        payload = body
         | 
| 171 | 
            -
                      end
         | 
| 172 | 
            -
                    SRC
         | 
| 173 | 
            -
                  end
         | 
| 174 | 
            -
             | 
| 175 | 
            -
                  def find_structure_body_helper
         | 
| 176 | 
            -
                    bulk_body_helper
         | 
| 177 | 
            -
                  end
         | 
| 178 | 
            -
             | 
| 179 | 
            -
                  def bulk_doc_helper(info)
         | 
| 180 | 
            -
                    <<~SRC
         | 
| 181 | 
            -
                      # @option arguments [String|Array] :body #{info}. Array of Strings, Header/Data pairs,
         | 
| 182 | 
            -
                      # or the conveniency "combined" format can be passed, refer to Elasticsearch::API::Utils.__bulkify documentation.
         | 
| 183 | 
            -
                    SRC
         | 
| 184 | 
            -
                  end
         | 
| 185 | 
            -
                end
         | 
| 186 | 
            -
              end
         | 
| 187 | 
            -
            end
         | 
| @@ -1,78 +0,0 @@ | |
| 1 | 
            -
            # Licensed to Elasticsearch B.V. under one or more contributor
         | 
| 2 | 
            -
            # license agreements. See the NOTICE file distributed with
         | 
| 3 | 
            -
            # this work for additional information regarding copyright
         | 
| 4 | 
            -
            # ownership. Elasticsearch B.V. licenses this file to you under
         | 
| 5 | 
            -
            # the Apache License, Version 2.0 (the "License"); you may
         | 
| 6 | 
            -
            # not use this file except in compliance with the License.
         | 
| 7 | 
            -
            # You may obtain a copy of the License at
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            #   http://www.apache.org/licenses/LICENSE-2.0
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # Unless required by applicable law or agreed to in writing,
         | 
| 12 | 
            -
            # software distributed under the License is distributed on an
         | 
| 13 | 
            -
            # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         | 
| 14 | 
            -
            # KIND, either express or implied.  See the License for the
         | 
| 15 | 
            -
            # specific language governing permissions and limitations
         | 
| 16 | 
            -
            # under the License.
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            require 'pathname'
         | 
| 19 | 
            -
            require_relative '../../../lib/elasticsearch/api/version.rb'
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            module Elasticsearch
         | 
| 22 | 
            -
              module API
         | 
| 23 | 
            -
                module FilesHelper
         | 
| 24 | 
            -
                  PROJECT_PATH = File.join(File.dirname(__FILE__), '..')
         | 
| 25 | 
            -
                  SRC_PATH   = File.join(PROJECT_PATH, '..', '..', '..', 'tmp/rest-api-spec/api/')
         | 
| 26 | 
            -
                  OSS_OUTPUT_DIR = '../../elasticsearch-api/lib/elasticsearch/api/actions'.freeze
         | 
| 27 | 
            -
                  XPACK_OUTPUT_DIR = '../../elasticsearch-xpack/lib/elasticsearch/xpack/api/actions'.freeze
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                  TESTS_DIRECTORIES = {
         | 
| 30 | 
            -
                    oss: "#{PROJECT_PATH}/../../../tmp/rest-api-spec/test/free",
         | 
| 31 | 
            -
                    xpack: "#{PROJECT_PATH}/../../../tmp/rest-api-spec/test/platinum"
         | 
| 32 | 
            -
                  }.freeze
         | 
| 33 | 
            -
             | 
| 34 | 
            -
                  # Only get JSON files and remove hidden files
         | 
| 35 | 
            -
                  def self.files(api)
         | 
| 36 | 
            -
                    json_files = if api == :xpack
         | 
| 37 | 
            -
                                   xpack_files
         | 
| 38 | 
            -
                                 else
         | 
| 39 | 
            -
                                   Dir.entries(SRC_PATH) - xpack_files
         | 
| 40 | 
            -
                                 end
         | 
| 41 | 
            -
                    json_files.reject do |file|
         | 
| 42 | 
            -
                      File.extname(file) != '.json' ||
         | 
| 43 | 
            -
                        File.basename(file) == '_common.json'
         | 
| 44 | 
            -
                    end.map { |file| "#{SRC_PATH}#{file}" }
         | 
| 45 | 
            -
                  end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
                  XPACK_ENDPOINTS = [
         | 
| 48 | 
            -
                    'autoscaling', 'cross_cluster_replication', 'ccr', 'data_frame_transform_deprecated',
         | 
| 49 | 
            -
                    'enrich', 'eql', 'fleet', 'ilm', 'logstash', 'migration', 'watcher', 'slm'
         | 
| 50 | 
            -
                  ]
         | 
| 51 | 
            -
                  XPACK_ENDPOINTS_REGEXP = /data_stream|ml_|reload_search_analyzers|transform|freeze|unfreeze/
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                  def self.xpack_files
         | 
| 54 | 
            -
                    xpack_tests = Dir.entries(TESTS_DIRECTORIES[:xpack])
         | 
| 55 | 
            -
                    Dir.entries(SRC_PATH).map do |entry|
         | 
| 56 | 
            -
                      filename = entry.split('.').first
         | 
| 57 | 
            -
                      next if filename == 'snapshot'
         | 
| 58 | 
            -
             | 
| 59 | 
            -
                      if xpack_tests.include?(filename) ||
         | 
| 60 | 
            -
                                              XPACK_ENDPOINTS.include?(filename) ||
         | 
| 61 | 
            -
                                              entry.match?(XPACK_ENDPOINTS_REGEXP)
         | 
| 62 | 
            -
                        entry
         | 
| 63 | 
            -
                      end
         | 
| 64 | 
            -
                    end.compact
         | 
| 65 | 
            -
                  end
         | 
| 66 | 
            -
             | 
| 67 | 
            -
                  # Path to directory to copy generated files
         | 
| 68 | 
            -
                  def self.output_dir(api)
         | 
| 69 | 
            -
                    api == :xpack ? Pathname(XPACK_OUTPUT_DIR) : Pathname(OSS_OUTPUT_DIR)
         | 
| 70 | 
            -
                  end
         | 
| 71 | 
            -
             | 
| 72 | 
            -
                  def self.gem_version
         | 
| 73 | 
            -
                    regex = /([0-9]{1,2}\.[0-9x]{1,2})/
         | 
| 74 | 
            -
                    Elasticsearch::API::VERSION.match(regex)[0]
         | 
| 75 | 
            -
                  end
         | 
| 76 | 
            -
                end
         | 
| 77 | 
            -
              end
         | 
| 78 | 
            -
            end
         | 
    
        data/utils/thor/lister.rb
    DELETED
    
    | @@ -1,57 +0,0 @@ | |
| 1 | 
            -
            # Licensed to Elasticsearch B.V. under one or more contributor
         | 
| 2 | 
            -
            # license agreements. See the NOTICE file distributed with
         | 
| 3 | 
            -
            # this work for additional information regarding copyright
         | 
| 4 | 
            -
            # ownership. Elasticsearch B.V. licenses this file to you under
         | 
| 5 | 
            -
            # the Apache License, Version 2.0 (the "License"); you may
         | 
| 6 | 
            -
            # not use this file except in compliance with the License.
         | 
| 7 | 
            -
            # You may obtain a copy of the License at
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            #   http://www.apache.org/licenses/LICENSE-2.0
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # Unless required by applicable law or agreed to in writing,
         | 
| 12 | 
            -
            # software distributed under the License is distributed on an
         | 
| 13 | 
            -
            # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         | 
| 14 | 
            -
            # KIND, either express or implied.  See the License for the
         | 
| 15 | 
            -
            # specific language governing permissions and limitations
         | 
| 16 | 
            -
            # under the License.
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            # encoding: UTF-8
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            require 'thor'
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            require 'pathname'
         | 
| 23 | 
            -
             | 
| 24 | 
            -
            module Elasticsearch
         | 
| 25 | 
            -
              module API
         | 
| 26 | 
            -
                class Lister < Thor
         | 
| 27 | 
            -
                  namespace 'api'
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                  DEFAULT_PATH = '../../tmp/elasticsearch/rest-api-spec/src/main/resources/rest-api-spec/api/'.freeze
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                  desc "list <PATH DIRECTORY WITH JSON SPEC FILES>", "List all the REST API endpoints from the JSON specification"
         | 
| 32 | 
            -
                  method_option :verbose,  type: :boolean, default: false, desc: 'Output more information'
         | 
| 33 | 
            -
                  method_option :format,   default: 'text', desc: 'Output format (text, json)'
         | 
| 34 | 
            -
                  def list(directory = DEFAULT_PATH)
         | 
| 35 | 
            -
                    input = Pathname(directory).join('*.json')
         | 
| 36 | 
            -
                    apis = Dir[input.to_s].map do |f|
         | 
| 37 | 
            -
                      File.basename(f, '.json')
         | 
| 38 | 
            -
                    end.sort
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                    if options[:verbose]
         | 
| 41 | 
            -
                      say_status 'Count', apis.size
         | 
| 42 | 
            -
                      say '▬'*terminal_width
         | 
| 43 | 
            -
                    end
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                    case options[:format]
         | 
| 46 | 
            -
                      when 'text'
         | 
| 47 | 
            -
                        apis.each { |a| puts "* #{a}" }
         | 
| 48 | 
            -
                      when 'json'
         | 
| 49 | 
            -
                        puts apis.inspect
         | 
| 50 | 
            -
                      else
         | 
| 51 | 
            -
                        puts "[!] ERROR: Unknown output format '#{options[:format]}'"
         | 
| 52 | 
            -
                        exit(1)
         | 
| 53 | 
            -
                    end
         | 
| 54 | 
            -
                  end
         | 
| 55 | 
            -
                end
         | 
| 56 | 
            -
              end
         | 
| 57 | 
            -
            end
         |