From 05a53bc0476ab48e8706d8153db54d2d8c27f722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Saint-F=C3=A9lix?= Date: Thu, 21 Dec 2023 15:29:11 +0100 Subject: [PATCH] Add instrumentation API usage and native OpenTelemetry implementation (#771) * Initial otel instrumentation implementation * add otel integration into esapi * add tests for instrumentation integration within both APIs * query persistence logic is embedded in otel instrumentation * regroup cluster id and node name test in AfterResponse * bump go.mod to 1.20, add opentelemetry dependency * rename RecordQuery to RecordRequestBody * add esapi integration for otel traces * add typedapi integration for otel traces * pin transport to commit 903383c until release * update internal dependencies * replace nilcheck in typedapi with type assertion * add changelog for 8.12.0 with otel * fix naming to please linting * update examples dependencies * go mod tidy for xkcdsearch --- CHANGELOG.md | 47 ++ _examples/bulk/benchmarks/go.sum | 24 + _examples/bulk/go.mod | 1 - _examples/bulk/go.sum | 41 +- _examples/bulk/kafka/go.sum | 18 + _examples/cloudfunction/go.sum | 39 + _examples/encoding/go.sum | 39 + _examples/fasthttp/go.sum | 45 ++ _examples/instrumentation/go.mod | 2 +- _examples/instrumentation/go.sum | 61 ++ _examples/logging/go.mod | 1 - _examples/logging/go.sum | 52 ++ _examples/security/go.sum | 39 + _examples/xkcdsearch/go.mod | 9 +- _examples/xkcdsearch/go.sum | 38 +- elasticsearch.go | 56 +- elasticsearch_internal_test.go | 299 +++++++ esapi/api._.go | 46 +- esapi/api.bulk.go | 36 +- esapi/api.cat.aliases.go | 33 +- esapi/api.cat.allocation.go | 33 +- esapi/api.cat.component_templates.go | 33 +- esapi/api.cat.count.go | 33 +- esapi/api.cat.fielddata.go | 33 +- esapi/api.cat.health.go | 30 +- esapi/api.cat.help.go | 30 +- esapi/api.cat.indices.go | 33 +- esapi/api.cat.master.go | 30 +- esapi/api.cat.nodeattrs.go | 30 +- esapi/api.cat.nodes.go | 30 +- esapi/api.cat.pending_tasks.go | 30 +- esapi/api.cat.plugins.go | 30 +- esapi/api.cat.recovery.go | 33 +- esapi/api.cat.repositories.go | 30 +- esapi/api.cat.segments.go | 33 +- esapi/api.cat.shards.go | 33 +- esapi/api.cat.snapshots.go | 33 +- esapi/api.cat.tasks.go | 30 +- esapi/api.cat.templates.go | 33 +- esapi/api.cat.thread_pool.go | 33 +- esapi/api.clear_scroll.go | 36 +- esapi/api.cluster.allocation_explain.go | 33 +- .../api.cluster.delete_component_template.go | 33 +- ...cluster.delete_voting_config_exclusions.go | 30 +- .../api.cluster.exists_component_template.go | 33 +- esapi/api.cluster.get_component_template.go | 33 +- esapi/api.cluster.get_settings.go | 30 +- esapi/api.cluster.health.go | 33 +- esapi/api.cluster.info.go | 33 +- esapi/api.cluster.pending_tasks.go | 30 +- ...i.cluster.post_voting_config_exclusions.go | 30 +- esapi/api.cluster.put_component_template.go | 36 +- esapi/api.cluster.put_settings.go | 33 +- esapi/api.cluster.remote_info.go | 30 +- esapi/api.cluster.reroute.go | 33 +- esapi/api.cluster.state.go | 36 +- esapi/api.cluster.stats.go | 30 +- esapi/api.connector.check_in.go | 227 ++++++ esapi/api.connector.delete.go | 225 ++++++ esapi/api.connector.get.go | 225 ++++++ esapi/api.connector.last_sync.go | 237 ++++++ esapi/api.connector.list.go | 243 ++++++ esapi/api.connector.post.go | 227 ++++++ esapi/api.connector.put.go | 235 ++++++ esapi/api.connector.update_configuration.go | 237 ++++++ esapi/api.connector.update_error.go | 237 ++++++ esapi/api.connector.update_filtering.go | 237 ++++++ esapi/api.connector.update_name.go | 237 ++++++ esapi/api.connector.update_pipeline.go | 237 ++++++ esapi/api.connector.update_scheduling.go | 237 ++++++ esapi/api.connector_sync_job.cancel.go | 229 ++++++ esapi/api.connector_sync_job.check_in.go | 229 ++++++ esapi/api.connector_sync_job.delete.go | 227 ++++++ esapi/api.connector_sync_job.error.go | 239 ++++++ esapi/api.connector_sync_job.get.go | 227 ++++++ esapi/api.connector_sync_job.list.go | 267 +++++++ esapi/api.connector_sync_job.post.go | 227 ++++++ esapi/api.connector_sync_job.update_stats.go | 239 ++++++ esapi/api.count.go | 36 +- esapi/api.create.go | 39 +- ....dangling_indices.delete_dangling_index.go | 33 +- ....dangling_indices.import_dangling_index.go | 33 +- ....dangling_indices.list_dangling_indices.go | 30 +- esapi/api.delete.go | 36 +- esapi/api.delete_by_query.go | 36 +- esapi/api.delete_by_query_rethrottle.go | 33 +- esapi/api.delete_script.go | 33 +- esapi/api.exists.go | 36 +- esapi/api.exists_source.go | 36 +- esapi/api.explain.go | 39 +- esapi/api.features.get_features.go | 30 +- esapi/api.features.reset_features.go | 30 +- esapi/api.field_caps.go | 36 +- esapi/api.fleet.delete_secret.go | 33 +- esapi/api.fleet.get_secret.go | 33 +- esapi/api.fleet.global_checkpoints.go | 33 +- esapi/api.fleet.msearch.go | 36 +- esapi/api.fleet.post_secret.go | 33 +- esapi/api.fleet.search.go | 36 +- esapi/api.get.go | 36 +- esapi/api.get_script.go | 33 +- esapi/api.get_script_context.go | 30 +- esapi/api.get_script_languages.go | 30 +- esapi/api.get_source.go | 36 +- esapi/api.health_report.go | 33 +- esapi/api.index.go | 39 +- esapi/api.indices.add_block.go | 36 +- esapi/api.indices.analyze.go | 36 +- esapi/api.indices.clear_cache.go | 33 +- esapi/api.indices.clone.go | 39 +- esapi/api.indices.close.go | 33 +- esapi/api.indices.create.go | 36 +- esapi/api.indices.delete.go | 33 +- esapi/api.indices.delete_alias.go | 36 +- esapi/api.indices.delete_data_lifecycle.go | 33 +- esapi/api.indices.delete_index_template.go | 33 +- esapi/api.indices.delete_template.go | 33 +- esapi/api.indices.disk_usage.go | 33 +- esapi/api.indices.downsample.go | 39 +- esapi/api.indices.exists.go | 33 +- esapi/api.indices.exists_alias.go | 36 +- esapi/api.indices.exists_index_template.go | 33 +- esapi/api.indices.exists_template.go | 33 +- esapi/api.indices.explain_data_lifecycle.go | 33 +- esapi/api.indices.field_usage_stats.go | 33 +- esapi/api.indices.flush.go | 33 +- esapi/api.indices.forcemerge.go | 33 +- esapi/api.indices.get.go | 33 +- esapi/api.indices.get_alias.go | 36 +- esapi/api.indices.get_data_lifecycle.go | 33 +- esapi/api.indices.get_field_mapping.go | 36 +- esapi/api.indices.get_index_template.go | 33 +- esapi/api.indices.get_mapping.go | 33 +- esapi/api.indices.get_settings.go | 36 +- esapi/api.indices.get_template.go | 33 +- esapi/api.indices.modify_data_stream.go | 33 +- esapi/api.indices.open.go | 33 +- esapi/api.indices.put_alias.go | 39 +- esapi/api.indices.put_data_lifecycle.go | 36 +- esapi/api.indices.put_index_template.go | 36 +- esapi/api.indices.put_mapping.go | 33 +- esapi/api.indices.put_settings.go | 48 +- esapi/api.indices.put_template.go | 36 +- esapi/api.indices.recovery.go | 33 +- esapi/api.indices.refresh.go | 33 +- esapi/api.indices.resolve_index.go | 33 +- esapi/api.indices.rollover.go | 39 +- esapi/api.indices.segments.go | 33 +- esapi/api.indices.shard_stores.go | 33 +- esapi/api.indices.shrink.go | 39 +- esapi/api.indices.simulate_index_template.go | 36 +- esapi/api.indices.simulate_template.go | 36 +- esapi/api.indices.split.go | 39 +- esapi/api.indices.stats.go | 36 +- esapi/api.indices.update_aliases.go | 33 +- esapi/api.indices.validate_query.go | 36 +- esapi/api.inference.delete_model.go | 36 +- esapi/api.inference.get_model.go | 36 +- esapi/api.inference.inference.go | 39 +- esapi/api.inference.put_model.go | 39 +- esapi/api.info.go | 30 +- esapi/api.ingest.delete_pipeline.go | 33 +- esapi/api.ingest.geo_ip_stats.go | 30 +- esapi/api.ingest.get_pipeline.go | 33 +- esapi/api.ingest.processor_grok.go | 30 +- esapi/api.ingest.put_pipeline.go | 36 +- esapi/api.ingest.simulate.go | 36 +- esapi/api.knn_search.go | 36 +- esapi/api.mget.go | 36 +- esapi/api.msearch.go | 36 +- esapi/api.msearch_template.go | 36 +- esapi/api.mtermvectors.go | 36 +- ...des.clear_repositories_metering_archive.go | 36 +- ...pi.nodes.get_repositories_metering_info.go | 33 +- esapi/api.nodes.hot_threads.go | 33 +- esapi/api.nodes.info.go | 36 +- esapi/api.nodes.reload_secure_settings.go | 36 +- esapi/api.nodes.stats.go | 39 +- esapi/api.nodes.usage.go | 36 +- esapi/api.ping.go | 30 +- esapi/api.profiling.status.go | 30 +- esapi/api.put_script.go | 39 +- esapi/api.query_ruleset.delete.go | 33 +- esapi/api.query_ruleset.get.go | 33 +- esapi/api.query_ruleset.list.go | 30 +- esapi/api.query_ruleset.put.go | 36 +- esapi/api.rank_eval.go | 36 +- esapi/api.reindex.go | 33 +- esapi/api.reindex_rethrottle.go | 33 +- esapi/api.render_search_template.go | 36 +- esapi/api.scripts_painless_execute.go | 33 +- esapi/api.scroll.go | 33 +- esapi/api.search.go | 36 +- esapi/api.search_application.delete.go | 33 +- ...application.delete_behavioral_analytics.go | 33 +- esapi/api.search_application.get.go | 33 +- ...ch_application.get_behavioral_analytics.go | 33 +- esapi/api.search_application.list.go | 30 +- ...ication.post_behavioral_analytics_event.go | 39 +- esapi/api.search_application.put.go | 36 +- ...ch_application.put_behavioral_analytics.go | 33 +- esapi/api.search_application.render_query.go | 36 +- esapi/api.search_application.search.go | 36 +- esapi/api.search_mvt.go | 48 +- esapi/api.search_shards.go | 33 +- esapi/api.search_template.go | 36 +- esapi/api.shutdown.delete_node.go | 33 +- esapi/api.shutdown.get_node.go | 33 +- esapi/api.shutdown.put_node.go | 36 +- esapi/api.simulate.ingest.go | 259 ++++++ esapi/api.snapshot.cleanup_repository.go | 33 +- esapi/api.snapshot.clone.go | 42 +- esapi/api.snapshot.create.go | 39 +- esapi/api.snapshot.create_repository.go | 36 +- esapi/api.snapshot.delete.go | 36 +- esapi/api.snapshot.delete_repository.go | 33 +- esapi/api.snapshot.get.go | 36 +- esapi/api.snapshot.get_repository.go | 33 +- esapi/api.snapshot.repository_analyze.go | 33 +- esapi/api.snapshot.restore.go | 39 +- esapi/api.snapshot.status.go | 36 +- esapi/api.snapshot.verify_repository.go | 33 +- esapi/api.synonyms.delete_synonym.go | 33 +- esapi/api.synonyms.delete_synonym_rule.go | 36 +- esapi/api.synonyms.get_synonym.go | 33 +- esapi/api.synonyms.get_synonym_rule.go | 36 +- esapi/api.synonyms.get_synonyms_sets.go | 30 +- esapi/api.synonyms.put_synonym.go | 36 +- esapi/api.synonyms.put_synonym_rule.go | 39 +- esapi/api.tasks.cancel.go | 33 +- esapi/api.tasks.get.go | 33 +- esapi/api.tasks.list.go | 30 +- esapi/api.terms_enum.go | 36 +- esapi/api.termvectors.go | 39 +- esapi/api.update.go | 39 +- esapi/api.update_by_query.go | 36 +- esapi/api.update_by_query_rethrottle.go | 33 +- esapi/api.xpack.async_search.delete.go | 33 +- esapi/api.xpack.async_search.get.go | 33 +- esapi/api.xpack.async_search.status.go | 33 +- esapi/api.xpack.async_search.submit.go | 36 +- ...k.autoscaling.delete_autoscaling_policy.go | 33 +- ...ck.autoscaling.get_autoscaling_capacity.go | 30 +- ...pack.autoscaling.get_autoscaling_policy.go | 33 +- ...pack.autoscaling.put_autoscaling_policy.go | 36 +- .../api.xpack.cat.ml_data_frame_analytics.go | 33 +- esapi/api.xpack.cat.ml_datafeeds.go | 33 +- esapi/api.xpack.cat.ml_jobs.go | 33 +- esapi/api.xpack.cat.ml_trained_models.go | 33 +- esapi/api.xpack.cat.transforms.go | 33 +- ...pi.xpack.ccr.delete_auto_follow_pattern.go | 33 +- esapi/api.xpack.ccr.follow.go | 36 +- esapi/api.xpack.ccr.follow_info.go | 33 +- esapi/api.xpack.ccr.follow_stats.go | 33 +- esapi/api.xpack.ccr.forget_follower.go | 36 +- .../api.xpack.ccr.get_auto_follow_pattern.go | 33 +- ...api.xpack.ccr.pause_auto_follow_pattern.go | 33 +- esapi/api.xpack.ccr.pause_follow.go | 33 +- .../api.xpack.ccr.put_auto_follow_pattern.go | 36 +- ...pi.xpack.ccr.resume_auto_follow_pattern.go | 33 +- esapi/api.xpack.ccr.resume_follow.go | 36 +- esapi/api.xpack.ccr.stats.go | 30 +- esapi/api.xpack.ccr.unfollow.go | 33 +- esapi/api.xpack.close_point_in_time.go | 33 +- esapi/api.xpack.enrich.delete_policy.go | 33 +- esapi/api.xpack.enrich.execute_policy.go | 33 +- esapi/api.xpack.enrich.get_policy.go | 33 +- esapi/api.xpack.enrich.put_policy.go | 36 +- esapi/api.xpack.enrich.stats.go | 30 +- esapi/api.xpack.eql.delete.go | 33 +- esapi/api.xpack.eql.get.go | 33 +- esapi/api.xpack.eql.get_status.go | 33 +- esapi/api.xpack.eql.search.go | 36 +- esapi/api.xpack.esql.query.go | 33 +- esapi/api.xpack.graph.explore.go | 36 +- esapi/api.xpack.ilm.delete_lifecycle.go | 33 +- esapi/api.xpack.ilm.explain_lifecycle.go | 33 +- esapi/api.xpack.ilm.get_lifecycle.go | 33 +- esapi/api.xpack.ilm.get_status.go | 30 +- esapi/api.xpack.ilm.migrate_to_data_tiers.go | 33 +- esapi/api.xpack.ilm.move_to_step.go | 36 +- esapi/api.xpack.ilm.put_lifecycle.go | 36 +- esapi/api.xpack.ilm.remove_policy.go | 33 +- esapi/api.xpack.ilm.retry.go | 33 +- esapi/api.xpack.ilm.start.go | 30 +- esapi/api.xpack.ilm.stop.go | 30 +- esapi/api.xpack.indices.create_data_stream.go | 33 +- esapi/api.xpack.indices.data_streams_stats.go | 33 +- esapi/api.xpack.indices.delete_data_stream.go | 33 +- esapi/api.xpack.indices.get_data_stream.go | 33 +- ...pi.xpack.indices.migrate_to_data_stream.go | 33 +- .../api.xpack.indices.promote_data_stream.go | 33 +- ...i.xpack.indices.reload_search_analyzers.go | 33 +- esapi/api.xpack.indices.unfreeze.go | 33 +- esapi/api.xpack.license.delete.go | 30 +- esapi/api.xpack.license.get.go | 30 +- esapi/api.xpack.license.get_basic_status.go | 30 +- esapi/api.xpack.license.get_trial_status.go | 30 +- esapi/api.xpack.license.post.go | 33 +- esapi/api.xpack.license.post_start_basic.go | 30 +- esapi/api.xpack.license.post_start_trial.go | 30 +- esapi/api.xpack.logstash.delete_pipeline.go | 33 +- esapi/api.xpack.logstash.get_pipeline.go | 33 +- esapi/api.xpack.logstash.put_pipeline.go | 36 +- esapi/api.xpack.migration.deprecations.go | 33 +- ...ck.migration.get_feature_upgrade_status.go | 30 +- ...pi.xpack.migration.post_feature_upgrade.go | 30 +- ...ml.clear_trained_model_deployment_cache.go | 33 +- esapi/api.xpack.ml.close_job.go | 36 +- esapi/api.xpack.ml.delete_calendar.go | 33 +- esapi/api.xpack.ml.delete_calendar_event.go | 36 +- esapi/api.xpack.ml.delete_calendar_job.go | 36 +- ...pi.xpack.ml.delete_data_frame_analytics.go | 33 +- esapi/api.xpack.ml.delete_datafeed.go | 33 +- esapi/api.xpack.ml.delete_expired_data.go | 36 +- esapi/api.xpack.ml.delete_filter.go | 33 +- esapi/api.xpack.ml.delete_forecast.go | 36 +- esapi/api.xpack.ml.delete_job.go | 33 +- esapi/api.xpack.ml.delete_model_snapshot.go | 36 +- esapi/api.xpack.ml.delete_trained_model.go | 33 +- ...api.xpack.ml.delete_trained_model_alias.go | 36 +- esapi/api.xpack.ml.estimate_model_memory.go | 33 +- esapi/api.xpack.ml.evaluate_data_frame.go | 33 +- ...i.xpack.ml.explain_data_frame_analytics.go | 36 +- esapi/api.xpack.ml.flush_job.go | 36 +- esapi/api.xpack.ml.forecast.go | 36 +- esapi/api.xpack.ml.get_buckets.go | 39 +- esapi/api.xpack.ml.get_calendar_events.go | 33 +- esapi/api.xpack.ml.get_calendars.go | 36 +- esapi/api.xpack.ml.get_categories.go | 39 +- .../api.xpack.ml.get_data_frame_analytics.go | 33 +- ...xpack.ml.get_data_frame_analytics_stats.go | 33 +- esapi/api.xpack.ml.get_datafeed_stats.go | 33 +- esapi/api.xpack.ml.get_datafeeds.go | 33 +- esapi/api.xpack.ml.get_filters.go | 33 +- esapi/api.xpack.ml.get_influencers.go | 36 +- esapi/api.xpack.ml.get_job_stats.go | 33 +- esapi/api.xpack.ml.get_jobs.go | 33 +- esapi/api.xpack.ml.get_memory_stats.go | 33 +- ...ack.ml.get_model_snapshot_upgrade_stats.go | 36 +- esapi/api.xpack.ml.get_model_snapshots.go | 39 +- esapi/api.xpack.ml.get_overall_buckets.go | 36 +- esapi/api.xpack.ml.get_records.go | 36 +- esapi/api.xpack.ml.get_trained_models.go | 33 +- .../api.xpack.ml.get_trained_models_stats.go | 33 +- esapi/api.xpack.ml.infer_trained_model.go | 36 +- esapi/api.xpack.ml.info.go | 30 +- esapi/api.xpack.ml.open_job.go | 36 +- esapi/api.xpack.ml.post_calendar_events.go | 36 +- esapi/api.xpack.ml.post_data.go | 36 +- ...i.xpack.ml.preview_data_frame_analytics.go | 36 +- esapi/api.xpack.ml.preview_datafeed.go | 36 +- esapi/api.xpack.ml.put_calendar.go | 36 +- esapi/api.xpack.ml.put_calendar_job.go | 36 +- .../api.xpack.ml.put_data_frame_analytics.go | 36 +- esapi/api.xpack.ml.put_datafeed.go | 36 +- esapi/api.xpack.ml.put_filter.go | 36 +- esapi/api.xpack.ml.put_job.go | 36 +- esapi/api.xpack.ml.put_trained_model.go | 36 +- esapi/api.xpack.ml.put_trained_model_alias.go | 36 +- ...ck.ml.put_trained_model_definition_part.go | 39 +- ...i.xpack.ml.put_trained_model_vocabulary.go | 36 +- esapi/api.xpack.ml.reset_job.go | 33 +- esapi/api.xpack.ml.revert_model_snapshot.go | 39 +- esapi/api.xpack.ml.set_upgrade_mode.go | 30 +- ...api.xpack.ml.start_data_frame_analytics.go | 36 +- esapi/api.xpack.ml.start_datafeed.go | 36 +- ...xpack.ml.start_trained_model_deployment.go | 33 +- .../api.xpack.ml.stop_data_frame_analytics.go | 36 +- esapi/api.xpack.ml.stop_datafeed.go | 36 +- ....xpack.ml.stop_trained_model_deployment.go | 36 +- ...pi.xpack.ml.update_data_frame_analytics.go | 36 +- esapi/api.xpack.ml.update_datafeed.go | 36 +- esapi/api.xpack.ml.update_filter.go | 36 +- esapi/api.xpack.ml.update_job.go | 36 +- esapi/api.xpack.ml.update_model_snapshot.go | 39 +- ...pack.ml.update_trained_model_deployment.go | 36 +- esapi/api.xpack.ml.upgrade_job_snapshot.go | 36 +- esapi/api.xpack.ml.validate.go | 33 +- esapi/api.xpack.ml.validate_detector.go | 33 +- esapi/api.xpack.monitoring.bulk.go | 36 +- esapi/api.xpack.open_point_in_time.go | 52 +- esapi/api.xpack.rollup.delete_job.go | 33 +- esapi/api.xpack.rollup.get_jobs.go | 33 +- esapi/api.xpack.rollup.get_rollup_caps.go | 33 +- .../api.xpack.rollup.get_rollup_index_caps.go | 33 +- esapi/api.xpack.rollup.put_job.go | 36 +- esapi/api.xpack.rollup.rollup_search.go | 36 +- esapi/api.xpack.rollup.start_job.go | 33 +- esapi/api.xpack.rollup.stop_job.go | 33 +- ....xpack.searchable_snapshots.cache_stats.go | 33 +- ....xpack.searchable_snapshots.clear_cache.go | 33 +- esapi/api.xpack.searchable_snapshots.mount.go | 39 +- esapi/api.xpack.searchable_snapshots.stats.go | 33 +- ...pi.xpack.security.activate_user_profile.go | 33 +- esapi/api.xpack.security.authenticate.go | 30 +- ...api.xpack.security.bulk_update_api_keys.go | 33 +- esapi/api.xpack.security.change_password.go | 36 +- .../api.xpack.security.clear_api_key_cache.go | 33 +- ....xpack.security.clear_cached_privileges.go | 33 +- .../api.xpack.security.clear_cached_realms.go | 33 +- .../api.xpack.security.clear_cached_roles.go | 33 +- ...ck.security.clear_cached_service_tokens.go | 39 +- esapi/api.xpack.security.create_api_key.go | 33 +- ...k.security.create_cross_cluster_api_key.go | 33 +- ...api.xpack.security.create_service_token.go | 39 +- esapi/api.xpack.security.delete_privileges.go | 36 +- esapi/api.xpack.security.delete_role.go | 33 +- .../api.xpack.security.delete_role_mapping.go | 33 +- ...api.xpack.security.delete_service_token.go | 39 +- esapi/api.xpack.security.delete_user.go | 33 +- esapi/api.xpack.security.disable_user.go | 33 +- ...api.xpack.security.disable_user_profile.go | 33 +- esapi/api.xpack.security.enable_user.go | 33 +- .../api.xpack.security.enable_user_profile.go | 33 +- esapi/api.xpack.security.enroll_kibana.go | 30 +- esapi/api.xpack.security.enroll_node.go | 30 +- esapi/api.xpack.security.get_api_key.go | 30 +- ...i.xpack.security.get_builtin_privileges.go | 30 +- esapi/api.xpack.security.get_privileges.go | 36 +- esapi/api.xpack.security.get_role.go | 33 +- esapi/api.xpack.security.get_role_mapping.go | 33 +- ...api.xpack.security.get_service_accounts.go | 36 +- ....xpack.security.get_service_credentials.go | 36 +- esapi/api.xpack.security.get_settings.go | 30 +- esapi/api.xpack.security.get_token.go | 33 +- esapi/api.xpack.security.get_user.go | 33 +- .../api.xpack.security.get_user_privileges.go | 30 +- esapi/api.xpack.security.get_user_profile.go | 33 +- esapi/api.xpack.security.grant_api_key.go | 33 +- esapi/api.xpack.security.has_privileges.go | 36 +- ...ck.security.has_privileges_user_profile.go | 33 +- .../api.xpack.security.invalidate_api_key.go | 33 +- esapi/api.xpack.security.invalidate_token.go | 33 +- esapi/api.xpack.security.oidc_authenticate.go | 33 +- esapi/api.xpack.security.oidc_logout.go | 33 +- ...ck.security.oidc_prepare_authentication.go | 33 +- esapi/api.xpack.security.put_privileges.go | 33 +- esapi/api.xpack.security.put_role.go | 36 +- esapi/api.xpack.security.put_role_mapping.go | 36 +- esapi/api.xpack.security.put_user.go | 36 +- esapi/api.xpack.security.query_api_keys.go | 33 +- esapi/api.xpack.security.saml_authenticate.go | 33 +- ...api.xpack.security.saml_complete_logout.go | 33 +- esapi/api.xpack.security.saml_invalidate.go | 33 +- esapi/api.xpack.security.saml_logout.go | 33 +- ...ck.security.saml_prepare_authentication.go | 33 +- ...security.saml_service_provider_metadata.go | 33 +- ...pi.xpack.security.suggest_user_profiles.go | 33 +- esapi/api.xpack.security.update_api_key.go | 36 +- ...k.security.update_cross_cluster_api_key.go | 36 +- esapi/api.xpack.security.update_settings.go | 33 +- ...xpack.security.update_user_profile_data.go | 36 +- esapi/api.xpack.slm.delete_lifecycle.go | 33 +- esapi/api.xpack.slm.execute_lifecycle.go | 33 +- esapi/api.xpack.slm.execute_retention.go | 30 +- esapi/api.xpack.slm.get_lifecycle.go | 33 +- esapi/api.xpack.slm.get_stats.go | 30 +- esapi/api.xpack.slm.get_status.go | 30 +- esapi/api.xpack.slm.put_lifecycle.go | 36 +- esapi/api.xpack.slm.start.go | 30 +- esapi/api.xpack.slm.stop.go | 30 +- esapi/api.xpack.sql.clear_cursor.go | 33 +- esapi/api.xpack.sql.delete_async.go | 33 +- esapi/api.xpack.sql.get_async.go | 33 +- esapi/api.xpack.sql.get_async_status.go | 33 +- esapi/api.xpack.sql.query.go | 33 +- esapi/api.xpack.sql.translate.go | 33 +- esapi/api.xpack.ssl.certificates.go | 30 +- ...api.xpack.text_structure.find_structure.go | 33 +- esapi/api.xpack.transform.delete_transform.go | 33 +- esapi/api.xpack.transform.get_transform.go | 33 +- ...api.xpack.transform.get_transform_stats.go | 33 +- .../api.xpack.transform.preview_transform.go | 36 +- esapi/api.xpack.transform.put_transform.go | 36 +- esapi/api.xpack.transform.reset_transform.go | 33 +- ....xpack.transform.schedule_now_transform.go | 33 +- esapi/api.xpack.transform.start_transform.go | 33 +- esapi/api.xpack.transform.stop_transform.go | 33 +- esapi/api.xpack.transform.update_transform.go | 36 +- .../api.xpack.transform.upgrade_transforms.go | 30 +- esapi/api.xpack.watcher.ack_watch.go | 36 +- esapi/api.xpack.watcher.activate_watch.go | 33 +- esapi/api.xpack.watcher.deactivate_watch.go | 33 +- esapi/api.xpack.watcher.delete_watch.go | 33 +- esapi/api.xpack.watcher.execute_watch.go | 36 +- esapi/api.xpack.watcher.get_settings.go | 30 +- esapi/api.xpack.watcher.get_watch.go | 33 +- esapi/api.xpack.watcher.put_watch.go | 36 +- esapi/api.xpack.watcher.query_watches.go | 33 +- esapi/api.xpack.watcher.start.go | 30 +- esapi/api.xpack.watcher.stats.go | 33 +- esapi/api.xpack.watcher.stop.go | 30 +- esapi/api.xpack.watcher.update_settings.go | 33 +- esapi/api.xpack.xpack.info.go | 30 +- esapi/api.xpack.xpack.usage.go | 30 +- esapi/esapi.go | 12 +- go.mod | 14 +- go.sum | 22 +- .../generate/commands/gensource/generator.go | 61 +- internal/build/go.mod | 13 +- internal/build/go.sum | 35 +- typedapi/api._.go | 84 +- typedapi/asyncsearch/delete/delete.go | 99 ++- typedapi/asyncsearch/delete/response.go | 5 +- typedapi/asyncsearch/get/get.go | 99 ++- typedapi/asyncsearch/get/response.go | 5 +- typedapi/asyncsearch/status/response.go | 5 +- typedapi/asyncsearch/status/status.go | 99 ++- typedapi/asyncsearch/submit/request.go | 4 +- typedapi/asyncsearch/submit/response.go | 5 +- typedapi/asyncsearch/submit/submit.go | 92 ++- .../delete_autoscaling_policy.go | 99 ++- .../deleteautoscalingpolicy/response.go | 5 +- .../get_autoscaling_capacity.go | 96 ++- .../getautoscalingcapacity/response.go | 5 +- .../get_autoscaling_policy.go | 99 ++- .../getautoscalingpolicy/response.go | 5 +- .../put_autoscaling_policy.go | 92 ++- .../putautoscalingpolicy/request.go | 4 +- .../putautoscalingpolicy/response.go | 5 +- typedapi/cat/aliases/aliases.go | 99 ++- typedapi/cat/aliases/response.go | 4 +- typedapi/cat/allocation/allocation.go | 99 ++- typedapi/cat/allocation/response.go | 4 +- .../componenttemplates/component_templates.go | 99 ++- typedapi/cat/componenttemplates/response.go | 4 +- typedapi/cat/count/count.go | 99 ++- typedapi/cat/count/response.go | 4 +- typedapi/cat/fielddata/fielddata.go | 99 ++- typedapi/cat/fielddata/response.go | 4 +- typedapi/cat/health/health.go | 96 ++- typedapi/cat/health/response.go | 4 +- typedapi/cat/help/help.go | 96 ++- typedapi/cat/help/response.go | 4 +- typedapi/cat/indices/indices.go | 99 ++- typedapi/cat/indices/response.go | 4 +- typedapi/cat/master/master.go | 96 ++- typedapi/cat/master/response.go | 4 +- typedapi/cat/mldatafeeds/ml_datafeeds.go | 99 ++- typedapi/cat/mldatafeeds/response.go | 4 +- .../ml_data_frame_analytics.go | 99 ++- typedapi/cat/mldataframeanalytics/response.go | 4 +- typedapi/cat/mljobs/ml_jobs.go | 99 ++- typedapi/cat/mljobs/response.go | 4 +- .../cat/mltrainedmodels/ml_trained_models.go | 99 ++- typedapi/cat/mltrainedmodels/response.go | 4 +- typedapi/cat/nodeattrs/nodeattrs.go | 96 ++- typedapi/cat/nodeattrs/response.go | 4 +- typedapi/cat/nodes/nodes.go | 96 ++- typedapi/cat/nodes/response.go | 4 +- typedapi/cat/pendingtasks/pending_tasks.go | 96 ++- typedapi/cat/pendingtasks/response.go | 4 +- typedapi/cat/plugins/plugins.go | 96 ++- typedapi/cat/plugins/response.go | 4 +- typedapi/cat/recovery/recovery.go | 99 ++- typedapi/cat/recovery/response.go | 4 +- typedapi/cat/repositories/repositories.go | 96 ++- typedapi/cat/repositories/response.go | 4 +- typedapi/cat/segments/response.go | 4 +- typedapi/cat/segments/segments.go | 99 ++- typedapi/cat/shards/response.go | 4 +- typedapi/cat/shards/shards.go | 99 ++- typedapi/cat/snapshots/response.go | 4 +- typedapi/cat/snapshots/snapshots.go | 99 ++- typedapi/cat/tasks/response.go | 4 +- typedapi/cat/tasks/tasks.go | 96 ++- typedapi/cat/templates/response.go | 4 +- typedapi/cat/templates/templates.go | 99 ++- typedapi/cat/threadpool/response.go | 4 +- typedapi/cat/threadpool/thread_pool.go | 99 ++- typedapi/cat/transforms/response.go | 4 +- typedapi/cat/transforms/transforms.go | 99 ++- .../delete_auto_follow_pattern.go | 99 ++- .../ccr/deleteautofollowpattern/response.go | 5 +- typedapi/ccr/follow/follow.go | 92 ++- typedapi/ccr/follow/request.go | 4 +- typedapi/ccr/follow/response.go | 5 +- typedapi/ccr/followinfo/follow_info.go | 99 ++- typedapi/ccr/followinfo/response.go | 5 +- typedapi/ccr/followstats/follow_stats.go | 99 ++- typedapi/ccr/followstats/response.go | 5 +- .../ccr/forgetfollower/forget_follower.go | 92 ++- typedapi/ccr/forgetfollower/request.go | 4 +- typedapi/ccr/forgetfollower/response.go | 5 +- .../get_auto_follow_pattern.go | 99 ++- typedapi/ccr/getautofollowpattern/response.go | 5 +- .../pause_auto_follow_pattern.go | 99 ++- .../ccr/pauseautofollowpattern/response.go | 5 +- typedapi/ccr/pausefollow/pause_follow.go | 99 ++- typedapi/ccr/pausefollow/response.go | 5 +- .../put_auto_follow_pattern.go | 92 ++- typedapi/ccr/putautofollowpattern/request.go | 4 +- typedapi/ccr/putautofollowpattern/response.go | 5 +- .../ccr/resumeautofollowpattern/response.go | 5 +- .../resume_auto_follow_pattern.go | 99 ++- typedapi/ccr/resumefollow/request.go | 4 +- typedapi/ccr/resumefollow/response.go | 5 +- typedapi/ccr/resumefollow/resume_follow.go | 92 ++- typedapi/ccr/stats/response.go | 5 +- typedapi/ccr/stats/stats.go | 96 ++- typedapi/ccr/unfollow/response.go | 5 +- typedapi/ccr/unfollow/unfollow.go | 99 ++- .../allocationexplain/allocation_explain.go | 89 ++- typedapi/cluster/allocationexplain/request.go | 4 +- .../cluster/allocationexplain/response.go | 5 +- .../delete_component_template.go | 99 ++- .../deletecomponenttemplate/response.go | 5 +- .../delete_voting_config_exclusions.go | 73 +- .../exists_component_template.go | 76 +- .../get_component_template.go | 99 ++- .../cluster/getcomponenttemplate/response.go | 5 +- typedapi/cluster/getsettings/get_settings.go | 96 ++- typedapi/cluster/getsettings/response.go | 5 +- typedapi/cluster/health/health.go | 110 ++- typedapi/cluster/health/response.go | 5 +- typedapi/cluster/info/info.go | 99 ++- typedapi/cluster/info/response.go | 5 +- .../cluster/pendingtasks/pending_tasks.go | 96 ++- typedapi/cluster/pendingtasks/response.go | 5 +- .../post_voting_config_exclusions.go | 73 +- .../put_component_template.go | 92 ++- .../cluster/putcomponenttemplate/request.go | 4 +- .../cluster/putcomponenttemplate/response.go | 5 +- typedapi/cluster/putsettings/put_settings.go | 89 ++- typedapi/cluster/putsettings/request.go | 4 +- typedapi/cluster/putsettings/response.go | 5 +- typedapi/cluster/remoteinfo/remote_info.go | 96 ++- typedapi/cluster/remoteinfo/response.go | 4 +- typedapi/cluster/reroute/request.go | 4 +- typedapi/cluster/reroute/reroute.go | 89 ++- typedapi/cluster/reroute/response.go | 5 +- typedapi/cluster/state/response.go | 4 +- typedapi/cluster/state/state.go | 105 ++- typedapi/cluster/stats/response.go | 5 +- typedapi/cluster/stats/stats.go | 99 ++- typedapi/core/bulk/bulk.go | 92 ++- typedapi/core/bulk/request.go | 4 +- typedapi/core/bulk/response.go | 5 +- typedapi/core/clearscroll/clear_scroll.go | 104 ++- typedapi/core/clearscroll/request.go | 4 +- typedapi/core/clearscroll/response.go | 5 +- .../closepointintime/close_point_in_time.go | 101 ++- typedapi/core/closepointintime/request.go | 4 +- typedapi/core/closepointintime/response.go | 5 +- typedapi/core/count/count.go | 92 ++- typedapi/core/count/request.go | 4 +- typedapi/core/count/response.go | 5 +- typedapi/core/create/create.go | 95 ++- typedapi/core/create/request.go | 4 +- typedapi/core/create/response.go | 5 +- typedapi/core/delete/delete.go | 113 ++- typedapi/core/delete/response.go | 5 +- .../core/deletebyquery/delete_by_query.go | 92 ++- typedapi/core/deletebyquery/request.go | 4 +- typedapi/core/deletebyquery/response.go | 5 +- .../delete_by_query_rethrottle.go | 97 ++- .../core/deletebyqueryrethrottle/response.go | 5 +- typedapi/core/deletescript/delete_script.go | 99 ++- typedapi/core/deletescript/response.go | 5 +- typedapi/core/exists/exists.go | 79 +- typedapi/core/existssource/exists_source.go | 79 +- typedapi/core/explain/explain.go | 95 ++- typedapi/core/explain/request.go | 4 +- typedapi/core/explain/response.go | 5 +- typedapi/core/fieldcaps/field_caps.go | 92 ++- typedapi/core/fieldcaps/request.go | 4 +- typedapi/core/fieldcaps/response.go | 5 +- typedapi/core/get/get.go | 113 ++- typedapi/core/get/response.go | 5 +- typedapi/core/getscript/get_script.go | 99 ++- typedapi/core/getscript/response.go | 5 +- .../getscriptcontext/get_script_context.go | 96 ++- typedapi/core/getscriptcontext/response.go | 5 +- .../get_script_languages.go | 96 ++- typedapi/core/getscriptlanguages/response.go | 5 +- typedapi/core/getsource/get_source.go | 102 ++- typedapi/core/getsource/response.go | 4 +- typedapi/core/healthreport/health_report.go | 97 ++- typedapi/core/healthreport/response.go | 5 +- typedapi/core/index/index.go | 98 ++- typedapi/core/index/request.go | 4 +- typedapi/core/index/response.go | 5 +- typedapi/core/info/info.go | 94 ++- typedapi/core/info/response.go | 5 +- typedapi/core/knnsearch/knn_search.go | 92 ++- typedapi/core/knnsearch/request.go | 4 +- typedapi/core/knnsearch/response.go | 5 +- typedapi/core/mget/mget.go | 92 ++- typedapi/core/mget/request.go | 4 +- typedapi/core/mget/response.go | 5 +- typedapi/core/msearch/msearch.go | 92 ++- typedapi/core/msearch/request.go | 4 +- typedapi/core/msearch/response.go | 5 +- .../core/msearchtemplate/msearch_template.go | 90 ++- typedapi/core/msearchtemplate/request.go | 4 +- typedapi/core/msearchtemplate/response.go | 5 +- typedapi/core/mtermvectors/mtermvectors.go | 92 ++- typedapi/core/mtermvectors/request.go | 4 +- typedapi/core/mtermvectors/response.go | 5 +- .../openpointintime/open_point_in_time.go | 99 ++- typedapi/core/openpointintime/response.go | 5 +- typedapi/core/ping/ping.go | 71 +- typedapi/core/putscript/put_script.go | 98 ++- typedapi/core/putscript/request.go | 4 +- typedapi/core/putscript/response.go | 5 +- typedapi/core/rankeval/rank_eval.go | 92 ++- typedapi/core/rankeval/request.go | 4 +- typedapi/core/rankeval/response.go | 5 +- typedapi/core/reindex/reindex.go | 89 ++- typedapi/core/reindex/request.go | 4 +- typedapi/core/reindex/response.go | 5 +- .../reindexrethrottle/reindex_rethrottle.go | 99 ++- typedapi/core/reindexrethrottle/response.go | 5 +- .../render_search_template.go | 90 ++- typedapi/core/rendersearchtemplate/request.go | 4 +- .../core/rendersearchtemplate/response.go | 5 +- .../core/scriptspainlessexecute/request.go | 4 +- .../core/scriptspainlessexecute/response.go | 5 +- .../scripts_painless_execute.go | 89 ++- typedapi/core/scroll/request.go | 4 +- typedapi/core/scroll/response.go | 5 +- typedapi/core/scroll/scroll.go | 92 ++- typedapi/core/search/request.go | 4 +- typedapi/core/search/response.go | 5 +- typedapi/core/search/search.go | 92 ++- typedapi/core/searchmvt/request.go | 4 +- typedapi/core/searchmvt/response.go | 4 +- typedapi/core/searchmvt/search_mvt.go | 104 ++- typedapi/core/searchshards/response.go | 5 +- typedapi/core/searchshards/search_shards.go | 99 ++- typedapi/core/searchtemplate/request.go | 4 +- typedapi/core/searchtemplate/response.go | 5 +- .../core/searchtemplate/search_template.go | 90 ++- typedapi/core/termsenum/request.go | 4 +- typedapi/core/termsenum/response.go | 5 +- typedapi/core/termsenum/terms_enum.go | 90 ++- typedapi/core/termvectors/request.go | 4 +- typedapi/core/termvectors/response.go | 5 +- typedapi/core/termvectors/termvectors.go | 98 ++- typedapi/core/update/request.go | 4 +- typedapi/core/update/response.go | 5 +- typedapi/core/update/update.go | 95 ++- typedapi/core/updatebyquery/request.go | 4 +- typedapi/core/updatebyquery/response.go | 5 +- .../core/updatebyquery/update_by_query.go | 92 ++- .../core/updatebyqueryrethrottle/response.go | 5 +- .../update_by_query_rethrottle.go | 97 ++- .../delete_dangling_index.go | 99 ++- .../deletedanglingindex/response.go | 5 +- .../import_dangling_index.go | 99 ++- .../importdanglingindex/response.go | 5 +- .../list_dangling_indices.go | 96 ++- .../listdanglingindices/response.go | 5 +- typedapi/enrich/deletepolicy/delete_policy.go | 97 ++- typedapi/enrich/deletepolicy/response.go | 5 +- .../enrich/executepolicy/execute_policy.go | 99 ++- typedapi/enrich/executepolicy/response.go | 5 +- typedapi/enrich/getpolicy/get_policy.go | 97 ++- typedapi/enrich/getpolicy/response.go | 5 +- typedapi/enrich/putpolicy/put_policy.go | 92 ++- typedapi/enrich/putpolicy/request.go | 4 +- typedapi/enrich/putpolicy/response.go | 5 +- typedapi/enrich/stats/response.go | 5 +- typedapi/enrich/stats/stats.go | 94 ++- typedapi/eql/delete/delete.go | 97 ++- typedapi/eql/delete/response.go | 5 +- typedapi/eql/get/get.go | 99 ++- typedapi/eql/get/response.go | 5 +- typedapi/eql/getstatus/get_status.go | 99 ++- typedapi/eql/getstatus/response.go | 5 +- typedapi/eql/search/request.go | 4 +- typedapi/eql/search/response.go | 5 +- typedapi/eql/search/search.go | 90 ++- typedapi/esql/query/query.go | 356 +++++++++ typedapi/esql/query/request.go | 69 ++ typedapi/esql/query/response.go | 33 + typedapi/features/getfeatures/get_features.go | 96 ++- typedapi/features/getfeatures/response.go | 5 +- .../features/resetfeatures/reset_features.go | 96 ++- typedapi/features/resetfeatures/response.go | 5 +- .../globalcheckpoints/global_checkpoints.go | 99 ++- typedapi/fleet/globalcheckpoints/response.go | 5 +- typedapi/fleet/msearch/msearch.go | 90 ++- typedapi/fleet/msearch/request.go | 4 +- typedapi/fleet/msearch/response.go | 5 +- typedapi/fleet/postsecret/post_secret.go | 226 ++++++ typedapi/fleet/search/request.go | 4 +- typedapi/fleet/search/response.go | 5 +- typedapi/fleet/search/search.go | 90 ++- typedapi/graph/explore/explore.go | 92 ++- typedapi/graph/explore/request.go | 4 +- typedapi/graph/explore/response.go | 5 +- .../ilm/deletelifecycle/delete_lifecycle.go | 97 ++- typedapi/ilm/deletelifecycle/response.go | 5 +- .../ilm/explainlifecycle/explain_lifecycle.go | 97 ++- typedapi/ilm/explainlifecycle/response.go | 5 +- typedapi/ilm/getlifecycle/get_lifecycle.go | 97 ++- typedapi/ilm/getlifecycle/response.go | 4 +- typedapi/ilm/getstatus/get_status.go | 94 ++- typedapi/ilm/getstatus/response.go | 5 +- .../migrate_to_data_tiers.go | 87 +- typedapi/ilm/migratetodatatiers/request.go | 4 +- typedapi/ilm/migratetodatatiers/response.go | 5 +- typedapi/ilm/movetostep/move_to_step.go | 90 ++- typedapi/ilm/movetostep/request.go | 4 +- typedapi/ilm/movetostep/response.go | 5 +- typedapi/ilm/putlifecycle/put_lifecycle.go | 90 ++- typedapi/ilm/putlifecycle/request.go | 4 +- typedapi/ilm/putlifecycle/response.go | 5 +- typedapi/ilm/removepolicy/remove_policy.go | 97 ++- typedapi/ilm/removepolicy/response.go | 5 +- typedapi/ilm/retry/response.go | 5 +- typedapi/ilm/retry/retry.go | 97 ++- typedapi/ilm/start/response.go | 5 +- typedapi/ilm/start/start.go | 94 ++- typedapi/ilm/stop/response.go | 5 +- typedapi/ilm/stop/stop.go | 94 ++- typedapi/indices/addblock/add_block.go | 102 ++- typedapi/indices/addblock/response.go | 5 +- typedapi/indices/analyze/analyze.go | 92 ++- typedapi/indices/analyze/request.go | 4 +- typedapi/indices/analyze/response.go | 5 +- typedapi/indices/clearcache/clear_cache.go | 99 ++- typedapi/indices/clearcache/response.go | 5 +- typedapi/indices/clone/clone.go | 95 ++- typedapi/indices/clone/request.go | 4 +- typedapi/indices/clone/response.go | 5 +- typedapi/indices/close/close.go | 99 ++- typedapi/indices/close/response.go | 5 +- typedapi/indices/create/create.go | 92 ++- typedapi/indices/create/request.go | 4 +- typedapi/indices/create/response.go | 5 +- .../createdatastream/create_data_stream.go | 99 ++- typedapi/indices/createdatastream/response.go | 5 +- .../datastreamsstats/data_streams_stats.go | 99 ++- typedapi/indices/datastreamsstats/response.go | 5 +- typedapi/indices/delete/delete.go | 99 ++- typedapi/indices/delete/response.go | 5 +- typedapi/indices/deletealias/delete_alias.go | 108 ++- typedapi/indices/deletealias/response.go | 5 +- .../delete_data_lifecycle.go | 99 ++- .../indices/deletedatalifecycle/response.go | 5 +- .../deletedatastream/delete_data_stream.go | 99 ++- typedapi/indices/deletedatastream/response.go | 5 +- .../delete_index_template.go | 99 ++- .../indices/deleteindextemplate/response.go | 5 +- .../indices/deletetemplate/delete_template.go | 99 ++- typedapi/indices/deletetemplate/response.go | 5 +- typedapi/indices/diskusage/disk_usage.go | 99 ++- typedapi/indices/diskusage/response.go | 4 +- typedapi/indices/downsample/downsample.go | 95 ++- typedapi/indices/downsample/request.go | 4 +- typedapi/indices/downsample/response.go | 4 +- typedapi/indices/exists/exists.go | 76 +- typedapi/indices/existsalias/exists_alias.go | 82 +- .../exists_index_template.go | 76 +- .../indices/existstemplate/exists_template.go | 76 +- .../explain_data_lifecycle.go | 97 ++- .../indices/explaindatalifecycle/response.go | 5 +- .../fieldusagestats/field_usage_stats.go | 99 ++- typedapi/indices/fieldusagestats/response.go | 5 +- typedapi/indices/flush/flush.go | 99 ++- typedapi/indices/flush/response.go | 5 +- typedapi/indices/forcemerge/forcemerge.go | 99 ++- typedapi/indices/forcemerge/response.go | 5 +- typedapi/indices/get/get.go | 99 ++- typedapi/indices/get/response.go | 4 +- typedapi/indices/getalias/get_alias.go | 119 ++- typedapi/indices/getalias/response.go | 4 +- .../getdatalifecycle/get_data_lifecycle.go | 99 ++- typedapi/indices/getdatalifecycle/response.go | 5 +- .../indices/getdatastream/get_data_stream.go | 99 ++- typedapi/indices/getdatastream/response.go | 5 +- .../getfieldmapping/get_field_mapping.go | 105 ++- typedapi/indices/getfieldmapping/response.go | 4 +- .../getindextemplate/get_index_template.go | 99 ++- typedapi/indices/getindextemplate/response.go | 5 +- typedapi/indices/getmapping/get_mapping.go | 99 ++- typedapi/indices/getmapping/response.go | 4 +- typedapi/indices/getsettings/get_settings.go | 108 ++- typedapi/indices/getsettings/response.go | 4 +- typedapi/indices/gettemplate/get_template.go | 99 ++- typedapi/indices/gettemplate/response.go | 4 +- .../migrate_to_data_stream.go | 99 ++- .../indices/migratetodatastream/response.go | 5 +- .../modifydatastream/modify_data_stream.go | 89 ++- typedapi/indices/modifydatastream/request.go | 4 +- typedapi/indices/modifydatastream/response.go | 5 +- typedapi/indices/open/open.go | 99 ++- typedapi/indices/open/response.go | 5 +- .../promotedatastream/promote_data_stream.go | 99 ++- .../indices/promotedatastream/response.go | 4 +- typedapi/indices/putalias/put_alias.go | 101 ++- typedapi/indices/putalias/request.go | 4 +- typedapi/indices/putalias/response.go | 5 +- .../putdatalifecycle/put_data_lifecycle.go | 90 ++- typedapi/indices/putdatalifecycle/request.go | 4 +- typedapi/indices/putdatalifecycle/response.go | 5 +- .../putindextemplate/put_index_template.go | 92 ++- typedapi/indices/putindextemplate/request.go | 4 +- typedapi/indices/putindextemplate/response.go | 5 +- typedapi/indices/putmapping/put_mapping.go | 92 ++- typedapi/indices/putmapping/request.go | 4 +- typedapi/indices/putmapping/response.go | 5 +- typedapi/indices/putsettings/put_settings.go | 103 ++- typedapi/indices/putsettings/request.go | 4 +- typedapi/indices/putsettings/response.go | 5 +- typedapi/indices/puttemplate/put_template.go | 92 ++- typedapi/indices/puttemplate/request.go | 4 +- typedapi/indices/puttemplate/response.go | 5 +- typedapi/indices/recovery/recovery.go | 99 ++- typedapi/indices/recovery/response.go | 4 +- typedapi/indices/refresh/refresh.go | 99 ++- typedapi/indices/refresh/response.go | 5 +- .../reload_search_analyzers.go | 99 ++- .../indices/reloadsearchanalyzers/response.go | 5 +- .../indices/resolveindex/resolve_index.go | 99 ++- typedapi/indices/resolveindex/response.go | 5 +- typedapi/indices/rollover/request.go | 4 +- typedapi/indices/rollover/response.go | 5 +- typedapi/indices/rollover/rollover.go | 98 ++- typedapi/indices/segments/response.go | 5 +- typedapi/indices/segments/segments.go | 99 ++- typedapi/indices/shardstores/response.go | 5 +- typedapi/indices/shardstores/shard_stores.go | 99 ++- typedapi/indices/shrink/request.go | 4 +- typedapi/indices/shrink/response.go | 5 +- typedapi/indices/shrink/shrink.go | 95 ++- .../indices/simulateindextemplate/request.go | 4 +- .../indices/simulateindextemplate/response.go | 5 +- .../simulate_index_template.go | 92 ++- typedapi/indices/simulatetemplate/request.go | 4 +- typedapi/indices/simulatetemplate/response.go | 5 +- .../simulatetemplate/simulate_template.go | 92 ++- typedapi/indices/split/request.go | 4 +- typedapi/indices/split/response.go | 5 +- typedapi/indices/split/split.go | 95 ++- typedapi/indices/stats/response.go | 5 +- typedapi/indices/stats/stats.go | 108 ++- typedapi/indices/unfreeze/response.go | 5 +- typedapi/indices/unfreeze/unfreeze.go | 97 ++- typedapi/indices/updatealiases/request.go | 4 +- typedapi/indices/updatealiases/response.go | 5 +- .../indices/updatealiases/update_aliases.go | 89 ++- typedapi/indices/validatequery/request.go | 4 +- typedapi/indices/validatequery/response.go | 5 +- .../indices/validatequery/validate_query.go | 92 ++- .../inference/deletemodel/delete_model.go | 318 ++++++++ typedapi/inference/deletemodel/response.go | 37 + typedapi/inference/getmodel/get_model.go | 318 ++++++++ typedapi/inference/getmodel/response.go | 38 + typedapi/inference/inference/inference.go | 344 ++++++++ typedapi/inference/inference/request.go | 56 ++ typedapi/inference/inference/response.go | 39 + typedapi/inference/putmodel/put_model.go | 350 +++++++++ typedapi/inference/putmodel/request.go | 30 + typedapi/inference/putmodel/response.go | 50 ++ .../ingest/deletepipeline/delete_pipeline.go | 99 ++- typedapi/ingest/deletepipeline/response.go | 5 +- typedapi/ingest/geoipstats/geo_ip_stats.go | 96 ++- typedapi/ingest/geoipstats/response.go | 5 +- typedapi/ingest/getpipeline/get_pipeline.go | 99 ++- typedapi/ingest/getpipeline/response.go | 4 +- .../ingest/processorgrok/processor_grok.go | 96 ++- typedapi/ingest/processorgrok/response.go | 5 +- typedapi/ingest/putpipeline/put_pipeline.go | 92 ++- typedapi/ingest/putpipeline/request.go | 4 +- typedapi/ingest/putpipeline/response.go | 5 +- typedapi/ingest/simulate/request.go | 4 +- typedapi/ingest/simulate/response.go | 5 +- typedapi/ingest/simulate/simulate.go | 92 ++- typedapi/license/delete/delete.go | 96 ++- typedapi/license/delete/response.go | 5 +- typedapi/license/get/get.go | 96 ++- typedapi/license/get/response.go | 5 +- .../getbasicstatus/get_basic_status.go | 96 ++- typedapi/license/getbasicstatus/response.go | 5 +- .../gettrialstatus/get_trial_status.go | 96 ++- typedapi/license/gettrialstatus/response.go | 5 +- typedapi/license/post/post.go | 89 ++- typedapi/license/post/request.go | 4 +- typedapi/license/post/response.go | 5 +- .../poststartbasic/post_start_basic.go | 96 ++- typedapi/license/poststartbasic/response.go | 5 +- .../poststarttrial/post_start_trial.go | 96 ++- typedapi/license/poststarttrial/response.go | 5 +- .../deletepipeline/delete_pipeline.go | 74 +- typedapi/logstash/getpipeline/get_pipeline.go | 97 ++- typedapi/logstash/getpipeline/response.go | 4 +- typedapi/logstash/putpipeline/put_pipeline.go | 67 +- typedapi/logstash/putpipeline/request.go | 4 +- .../migration/deprecations/deprecations.go | 97 ++- typedapi/migration/deprecations/response.go | 5 +- .../get_feature_upgrade_status.go | 94 ++- .../getfeatureupgradestatus/response.go | 5 +- .../post_feature_upgrade.go | 94 ++- .../migration/postfeatureupgrade/response.go | 5 +- .../clear_trained_model_deployment_cache.go | 101 ++- .../response.go | 5 +- typedapi/ml/closejob/close_job.go | 92 ++- typedapi/ml/closejob/request.go | 4 +- typedapi/ml/closejob/response.go | 5 +- typedapi/ml/deletecalendar/delete_calendar.go | 99 ++- typedapi/ml/deletecalendar/response.go | 5 +- .../delete_calendar_event.go | 102 ++- typedapi/ml/deletecalendarevent/response.go | 5 +- .../deletecalendarjob/delete_calendar_job.go | 102 ++- typedapi/ml/deletecalendarjob/response.go | 5 +- typedapi/ml/deletedatafeed/delete_datafeed.go | 99 ++- typedapi/ml/deletedatafeed/response.go | 5 +- .../delete_data_frame_analytics.go | 99 ++- .../ml/deletedataframeanalytics/response.go | 5 +- .../deleteexpireddata/delete_expired_data.go | 90 ++- typedapi/ml/deleteexpireddata/request.go | 4 +- typedapi/ml/deleteexpireddata/response.go | 5 +- typedapi/ml/deletefilter/delete_filter.go | 97 ++- typedapi/ml/deletefilter/response.go | 5 +- typedapi/ml/deleteforecast/delete_forecast.go | 103 ++- typedapi/ml/deleteforecast/response.go | 5 +- typedapi/ml/deletejob/delete_job.go | 97 ++- typedapi/ml/deletejob/response.go | 5 +- .../delete_model_snapshot.go | 100 ++- typedapi/ml/deletemodelsnapshot/response.go | 5 +- .../delete_trained_model.go | 97 ++- typedapi/ml/deletetrainedmodel/response.go | 5 +- .../delete_trained_model_alias.go | 102 ++- .../ml/deletetrainedmodelalias/response.go | 5 +- .../estimate_model_memory.go | 87 +- typedapi/ml/estimatemodelmemory/request.go | 4 +- typedapi/ml/estimatemodelmemory/response.go | 5 +- .../evaluatedataframe/evaluate_data_frame.go | 87 +- typedapi/ml/evaluatedataframe/request.go | 4 +- typedapi/ml/evaluatedataframe/response.go | 5 +- .../explain_data_frame_analytics.go | 90 ++- .../ml/explaindataframeanalytics/request.go | 4 +- .../ml/explaindataframeanalytics/response.go | 5 +- typedapi/ml/flushjob/flush_job.go | 90 ++- typedapi/ml/flushjob/request.go | 4 +- typedapi/ml/flushjob/response.go | 5 +- typedapi/ml/forecast/forecast.go | 90 ++- typedapi/ml/forecast/request.go | 4 +- typedapi/ml/forecast/response.go | 5 +- typedapi/ml/getbuckets/get_buckets.go | 96 ++- typedapi/ml/getbuckets/request.go | 4 +- typedapi/ml/getbuckets/response.go | 5 +- .../getcalendarevents/get_calendar_events.go | 97 ++- typedapi/ml/getcalendarevents/response.go | 5 +- typedapi/ml/getcalendars/get_calendars.go | 90 ++- typedapi/ml/getcalendars/request.go | 4 +- typedapi/ml/getcalendars/response.go | 5 +- typedapi/ml/getcategories/get_categories.go | 96 ++- typedapi/ml/getcategories/request.go | 4 +- typedapi/ml/getcategories/response.go | 5 +- typedapi/ml/getdatafeeds/get_datafeeds.go | 97 ++- typedapi/ml/getdatafeeds/response.go | 5 +- .../ml/getdatafeedstats/get_datafeed_stats.go | 97 ++- typedapi/ml/getdatafeedstats/response.go | 5 +- .../get_data_frame_analytics.go | 97 ++- typedapi/ml/getdataframeanalytics/response.go | 5 +- .../get_data_frame_analytics_stats.go | 97 ++- .../ml/getdataframeanalyticsstats/response.go | 5 +- typedapi/ml/getfilters/get_filters.go | 97 ++- typedapi/ml/getfilters/response.go | 5 +- typedapi/ml/getinfluencers/get_influencers.go | 90 ++- typedapi/ml/getinfluencers/request.go | 4 +- typedapi/ml/getinfluencers/response.go | 5 +- typedapi/ml/getjobs/get_jobs.go | 97 ++- typedapi/ml/getjobs/response.go | 5 +- typedapi/ml/getjobstats/get_job_stats.go | 97 ++- typedapi/ml/getjobstats/response.go | 5 +- .../ml/getmemorystats/get_memory_stats.go | 97 ++- typedapi/ml/getmemorystats/response.go | 5 +- .../getmodelsnapshots/get_model_snapshots.go | 96 ++- typedapi/ml/getmodelsnapshots/request.go | 4 +- typedapi/ml/getmodelsnapshots/response.go | 5 +- .../get_model_snapshot_upgrade_stats.go | 100 ++- .../getmodelsnapshotupgradestats/response.go | 5 +- .../getoverallbuckets/get_overall_buckets.go | 90 ++- typedapi/ml/getoverallbuckets/request.go | 4 +- typedapi/ml/getoverallbuckets/response.go | 5 +- typedapi/ml/getrecords/get_records.go | 90 ++- typedapi/ml/getrecords/request.go | 4 +- typedapi/ml/getrecords/response.go | 5 +- .../ml/gettrainedmodels/get_trained_models.go | 97 ++- typedapi/ml/gettrainedmodels/response.go | 5 +- .../get_trained_models_stats.go | 97 ++- typedapi/ml/gettrainedmodelsstats/response.go | 5 +- .../infertrainedmodel/infer_trained_model.go | 95 ++- typedapi/ml/infertrainedmodel/request.go | 4 +- typedapi/ml/infertrainedmodel/response.go | 5 +- typedapi/ml/info/info.go | 94 ++- typedapi/ml/info/response.go | 5 +- typedapi/ml/openjob/open_job.go | 90 ++- typedapi/ml/openjob/request.go | 4 +- typedapi/ml/openjob/response.go | 5 +- .../post_calendar_events.go | 90 ++- typedapi/ml/postcalendarevents/request.go | 4 +- typedapi/ml/postcalendarevents/response.go | 5 +- typedapi/ml/postdata/post_data.go | 90 ++- typedapi/ml/postdata/request.go | 4 +- typedapi/ml/postdata/response.go | 5 +- .../ml/previewdatafeed/preview_datafeed.go | 90 ++- typedapi/ml/previewdatafeed/request.go | 4 +- typedapi/ml/previewdatafeed/response.go | 4 +- .../preview_data_frame_analytics.go | 90 ++- .../ml/previewdataframeanalytics/request.go | 4 +- .../ml/previewdataframeanalytics/response.go | 5 +- typedapi/ml/putcalendar/put_calendar.go | 90 ++- typedapi/ml/putcalendar/request.go | 4 +- typedapi/ml/putcalendar/response.go | 5 +- .../ml/putcalendarjob/put_calendar_job.go | 100 ++- typedapi/ml/putcalendarjob/response.go | 5 +- typedapi/ml/putdatafeed/put_datafeed.go | 90 ++- typedapi/ml/putdatafeed/request.go | 4 +- typedapi/ml/putdatafeed/response.go | 5 +- .../put_data_frame_analytics.go | 92 ++- typedapi/ml/putdataframeanalytics/request.go | 4 +- typedapi/ml/putdataframeanalytics/response.go | 5 +- typedapi/ml/putfilter/put_filter.go | 90 ++- typedapi/ml/putfilter/request.go | 4 +- typedapi/ml/putfilter/response.go | 5 +- typedapi/ml/putjob/put_job.go | 90 ++- typedapi/ml/putjob/request.go | 4 +- typedapi/ml/putjob/response.go | 5 +- .../ml/puttrainedmodel/put_trained_model.go | 90 ++- typedapi/ml/puttrainedmodel/request.go | 4 +- typedapi/ml/puttrainedmodel/response.go | 5 +- .../put_trained_model_alias.go | 102 ++- typedapi/ml/puttrainedmodelalias/response.go | 5 +- .../put_trained_model_definition_part.go | 93 ++- .../puttrainedmodeldefinitionpart/request.go | 4 +- .../puttrainedmodeldefinitionpart/response.go | 5 +- .../put_trained_model_vocabulary.go | 90 ++- .../ml/puttrainedmodelvocabulary/request.go | 4 +- .../ml/puttrainedmodelvocabulary/response.go | 5 +- typedapi/ml/resetjob/reset_job.go | 97 ++- typedapi/ml/resetjob/response.go | 5 +- typedapi/ml/revertmodelsnapshot/request.go | 4 +- typedapi/ml/revertmodelsnapshot/response.go | 5 +- .../revert_model_snapshot.go | 93 ++- typedapi/ml/setupgrademode/response.go | 5 +- .../ml/setupgrademode/set_upgrade_mode.go | 94 ++- typedapi/ml/startdatafeed/request.go | 4 +- typedapi/ml/startdatafeed/response.go | 5 +- typedapi/ml/startdatafeed/start_datafeed.go | 90 ++- .../ml/startdataframeanalytics/response.go | 5 +- .../start_data_frame_analytics.go | 99 ++- .../starttrainedmodeldeployment/response.go | 5 +- .../start_trained_model_deployment.go | 109 ++- typedapi/ml/stopdatafeed/request.go | 4 +- typedapi/ml/stopdatafeed/response.go | 5 +- typedapi/ml/stopdatafeed/stop_datafeed.go | 90 ++- .../ml/stopdataframeanalytics/response.go | 5 +- .../stop_data_frame_analytics.go | 99 ++- .../ml/stoptrainedmodeldeployment/response.go | 5 +- .../stop_trained_model_deployment.go | 101 ++- typedapi/ml/updatedatafeed/request.go | 4 +- typedapi/ml/updatedatafeed/response.go | 5 +- typedapi/ml/updatedatafeed/update_datafeed.go | 90 ++- .../ml/updatedataframeanalytics/request.go | 4 +- .../ml/updatedataframeanalytics/response.go | 5 +- .../update_data_frame_analytics.go | 90 ++- typedapi/ml/updatefilter/request.go | 4 +- typedapi/ml/updatefilter/response.go | 5 +- typedapi/ml/updatefilter/update_filter.go | 90 ++- typedapi/ml/updatejob/request.go | 4 +- typedapi/ml/updatejob/response.go | 5 +- typedapi/ml/updatejob/update_job.go | 90 ++- typedapi/ml/updatemodelsnapshot/request.go | 4 +- typedapi/ml/updatemodelsnapshot/response.go | 5 +- .../update_model_snapshot.go | 93 ++- typedapi/ml/upgradejobsnapshot/response.go | 5 +- .../upgrade_job_snapshot.go | 100 ++- typedapi/ml/validate/request.go | 4 +- typedapi/ml/validate/response.go | 5 +- typedapi/ml/validate/validate.go | 87 +- typedapi/ml/validatedetector/request.go | 4 +- typedapi/ml/validatedetector/response.go | 5 +- .../ml/validatedetector/validate_detector.go | 87 +- typedapi/monitoring/bulk/bulk.go | 92 ++- typedapi/monitoring/bulk/request.go | 4 +- typedapi/monitoring/bulk/response.go | 5 +- .../clear_repositories_metering_archive.go | 100 ++- .../response.go | 5 +- .../get_repositories_metering_info.go | 97 ++- .../getrepositoriesmeteringinfo/response.go | 5 +- typedapi/nodes/hotthreads/hot_threads.go | 99 ++- typedapi/nodes/hotthreads/response.go | 5 +- typedapi/nodes/info/info.go | 108 ++- typedapi/nodes/info/response.go | 5 +- .../reload_secure_settings.go | 92 ++- .../nodes/reloadsecuresettings/request.go | 4 +- .../nodes/reloadsecuresettings/response.go | 5 +- typedapi/nodes/stats/response.go | 5 +- typedapi/nodes/stats/stats.go | 123 ++- typedapi/nodes/usage/response.go | 5 +- typedapi/nodes/usage/usage.go | 108 ++- typedapi/queryruleset/delete/delete.go | 99 ++- typedapi/queryruleset/delete/response.go | 5 +- typedapi/queryruleset/get/get.go | 99 ++- typedapi/queryruleset/get/response.go | 5 +- typedapi/queryruleset/list/list.go | 96 ++- typedapi/queryruleset/list/response.go | 5 +- typedapi/queryruleset/put/put.go | 92 ++- typedapi/queryruleset/put/request.go | 4 +- typedapi/queryruleset/put/response.go | 5 +- typedapi/rollup/deletejob/delete_job.go | 99 ++- typedapi/rollup/deletejob/response.go | 5 +- typedapi/rollup/getjobs/get_jobs.go | 99 ++- typedapi/rollup/getjobs/response.go | 5 +- .../rollup/getrollupcaps/get_rollup_caps.go | 99 ++- typedapi/rollup/getrollupcaps/response.go | 4 +- .../get_rollup_index_caps.go | 99 ++- .../rollup/getrollupindexcaps/response.go | 4 +- typedapi/rollup/putjob/put_job.go | 92 ++- typedapi/rollup/putjob/request.go | 4 +- typedapi/rollup/putjob/response.go | 5 +- typedapi/rollup/rollupsearch/request.go | 4 +- typedapi/rollup/rollupsearch/response.go | 5 +- typedapi/rollup/rollupsearch/rollup_search.go | 92 ++- typedapi/rollup/startjob/response.go | 5 +- typedapi/rollup/startjob/start_job.go | 99 ++- typedapi/rollup/stopjob/response.go | 5 +- typedapi/rollup/stopjob/stop_job.go | 99 ++- .../cachestats/cache_stats.go | 99 ++- .../cachestats/response.go | 5 +- .../clearcache/clear_cache.go | 99 ++- .../clearcache/response.go | 4 +- typedapi/searchablesnapshots/mount/mount.go | 95 ++- typedapi/searchablesnapshots/mount/request.go | 4 +- .../searchablesnapshots/mount/response.go | 5 +- .../searchablesnapshots/stats/response.go | 5 +- typedapi/searchablesnapshots/stats/stats.go | 99 ++- typedapi/searchapplication/delete/delete.go | 99 ++- typedapi/searchapplication/delete/response.go | 5 +- .../delete_behavioral_analytics.go | 99 ++- .../deletebehavioralanalytics/response.go | 5 +- typedapi/searchapplication/get/get.go | 99 ++- typedapi/searchapplication/get/response.go | 5 +- .../get_behavioral_analytics.go | 99 ++- .../getbehavioralanalytics/response.go | 4 +- typedapi/searchapplication/list/list.go | 96 ++- typedapi/searchapplication/list/response.go | 5 +- typedapi/searchapplication/put/put.go | 92 ++- typedapi/searchapplication/put/request.go | 4 +- typedapi/searchapplication/put/response.go | 5 +- .../put_behavioral_analytics.go | 99 ++- .../putbehavioralanalytics/response.go | 5 +- typedapi/searchapplication/search/request.go | 4 +- typedapi/searchapplication/search/response.go | 5 +- typedapi/searchapplication/search/search.go | 92 ++- .../activate_user_profile.go | 87 +- .../security/activateuserprofile/request.go | 4 +- .../security/activateuserprofile/response.go | 5 +- .../security/authenticate/authenticate.go | 94 ++- typedapi/security/authenticate/response.go | 5 +- .../bulkupdateapikeys/bulk_update_api_keys.go | 73 +- .../changepassword/change_password.go | 90 ++- typedapi/security/changepassword/request.go | 4 +- typedapi/security/changepassword/response.go | 5 +- .../clearapikeycache/clear_api_key_cache.go | 97 ++- .../security/clearapikeycache/response.go | 5 +- .../clear_cached_privileges.go | 97 ++- .../clearcachedprivileges/response.go | 5 +- .../clearcachedrealms/clear_cached_realms.go | 97 ++- .../security/clearcachedrealms/response.go | 5 +- .../clearcachedroles/clear_cached_roles.go | 97 ++- .../security/clearcachedroles/response.go | 5 +- .../clear_cached_service_tokens.go | 103 ++- .../clearcachedservicetokens/response.go | 5 +- .../security/createapikey/create_api_key.go | 87 +- typedapi/security/createapikey/request.go | 4 +- typedapi/security/createapikey/response.go | 5 +- .../create_cross_cluster_api_key.go | 73 +- .../create_service_token.go | 109 ++- .../security/createservicetoken/response.go | 5 +- .../deleteprivileges/delete_privileges.go | 100 ++- .../security/deleteprivileges/response.go | 4 +- typedapi/security/deleterole/delete_role.go | 97 ++- typedapi/security/deleterole/response.go | 5 +- .../deleterolemapping/delete_role_mapping.go | 97 ++- .../security/deleterolemapping/response.go | 5 +- .../delete_service_token.go | 103 ++- .../security/deleteservicetoken/response.go | 5 +- typedapi/security/deleteuser/delete_user.go | 97 ++- typedapi/security/deleteuser/response.go | 5 +- typedapi/security/disableuser/disable_user.go | 97 ++- typedapi/security/disableuser/response.go | 5 +- .../disable_user_profile.go | 99 ++- .../security/disableuserprofile/response.go | 5 +- typedapi/security/enableuser/enable_user.go | 97 ++- typedapi/security/enableuser/response.go | 5 +- .../enableuserprofile/enable_user_profile.go | 99 ++- .../security/enableuserprofile/response.go | 5 +- .../security/enrollkibana/enroll_kibana.go | 98 ++- typedapi/security/enrollkibana/response.go | 5 +- typedapi/security/enrollnode/enroll_node.go | 98 ++- typedapi/security/enrollnode/response.go | 5 +- typedapi/security/getapikey/get_api_key.go | 94 ++- typedapi/security/getapikey/response.go | 5 +- .../get_builtin_privileges.go | 94 ++- .../security/getbuiltinprivileges/response.go | 5 +- .../security/getprivileges/get_privileges.go | 103 ++- typedapi/security/getprivileges/response.go | 4 +- typedapi/security/getrole/get_role.go | 97 ++- typedapi/security/getrole/response.go | 4 +- .../getrolemapping/get_role_mapping.go | 97 ++- typedapi/security/getrolemapping/response.go | 4 +- .../get_service_accounts.go | 103 ++- .../security/getserviceaccounts/response.go | 4 +- .../get_service_credentials.go | 100 ++- .../getservicecredentials/response.go | 5 +- typedapi/security/getsettings/get_settings.go | 232 ++++++ typedapi/security/gettoken/get_token.go | 87 +- typedapi/security/gettoken/request.go | 4 +- typedapi/security/gettoken/response.go | 5 +- typedapi/security/getuser/get_user.go | 97 ++- typedapi/security/getuser/response.go | 4 +- .../getuserprivileges/get_user_privileges.go | 94 ++- .../security/getuserprivileges/response.go | 5 +- .../getuserprofile/get_user_profile.go | 97 ++- typedapi/security/getuserprofile/response.go | 5 +- .../security/grantapikey/grant_api_key.go | 87 +- typedapi/security/grantapikey/request.go | 4 +- typedapi/security/grantapikey/response.go | 5 +- .../security/hasprivileges/has_privileges.go | 90 ++- typedapi/security/hasprivileges/request.go | 4 +- typedapi/security/hasprivileges/response.go | 5 +- .../has_privileges_user_profile.go | 87 +- .../hasprivilegesuserprofile/request.go | 4 +- .../hasprivilegesuserprofile/response.go | 5 +- .../invalidateapikey/invalidate_api_key.go | 87 +- typedapi/security/invalidateapikey/request.go | 4 +- .../security/invalidateapikey/response.go | 5 +- .../invalidatetoken/invalidate_token.go | 87 +- typedapi/security/invalidatetoken/request.go | 4 +- typedapi/security/invalidatetoken/response.go | 5 +- .../oidcauthenticate/oidc_authenticate.go | 73 +- typedapi/security/oidclogout/oidc_logout.go | 73 +- .../oidc_prepare_authentication.go | 73 +- .../security/putprivileges/put_privileges.go | 87 +- typedapi/security/putprivileges/request.go | 4 +- typedapi/security/putprivileges/response.go | 4 +- typedapi/security/putrole/put_role.go | 90 ++- typedapi/security/putrole/request.go | 4 +- typedapi/security/putrole/response.go | 5 +- .../putrolemapping/put_role_mapping.go | 97 ++- typedapi/security/putrolemapping/request.go | 15 +- typedapi/security/putrolemapping/response.go | 5 +- typedapi/security/putuser/put_user.go | 90 ++- typedapi/security/putuser/request.go | 4 +- typedapi/security/putuser/response.go | 5 +- .../security/queryapikeys/query_api_keys.go | 87 +- typedapi/security/queryapikeys/request.go | 4 +- typedapi/security/queryapikeys/response.go | 5 +- typedapi/security/samlauthenticate/request.go | 4 +- .../security/samlauthenticate/response.go | 5 +- .../samlauthenticate/saml_authenticate.go | 87 +- .../security/samlcompletelogout/request.go | 4 +- .../saml_complete_logout.go | 64 +- typedapi/security/samlinvalidate/request.go | 4 +- typedapi/security/samlinvalidate/response.go | 5 +- .../samlinvalidate/saml_invalidate.go | 87 +- typedapi/security/samllogout/request.go | 4 +- typedapi/security/samllogout/response.go | 5 +- typedapi/security/samllogout/saml_logout.go | 87 +- .../samlprepareauthentication/request.go | 4 +- .../samlprepareauthentication/response.go | 5 +- .../saml_prepare_authentication.go | 87 +- .../samlserviceprovidermetadata/response.go | 5 +- .../saml_service_provider_metadata.go | 99 ++- .../security/suggestuserprofiles/request.go | 4 +- .../security/suggestuserprofiles/response.go | 5 +- .../suggest_user_profiles.go | 89 ++- typedapi/security/updateapikey/request.go | 4 +- typedapi/security/updateapikey/response.go | 5 +- .../security/updateapikey/update_api_key.go | 90 ++- .../updatesettings/update_settings.go | 232 ++++++ .../security/updateuserprofiledata/request.go | 4 +- .../updateuserprofiledata/response.go | 5 +- .../update_user_profile_data.go | 90 ++- typedapi/shutdown/deletenode/delete_node.go | 99 ++- typedapi/shutdown/deletenode/response.go | 5 +- typedapi/shutdown/getnode/get_node.go | 99 ++- typedapi/shutdown/getnode/response.go | 5 +- typedapi/shutdown/putnode/put_node.go | 90 ++- typedapi/shutdown/putnode/request.go | 4 +- typedapi/shutdown/putnode/response.go | 5 +- .../slm/deletelifecycle/delete_lifecycle.go | 97 ++- typedapi/slm/deletelifecycle/response.go | 5 +- .../slm/executelifecycle/execute_lifecycle.go | 97 ++- typedapi/slm/executelifecycle/response.go | 5 +- .../slm/executeretention/execute_retention.go | 94 ++- typedapi/slm/executeretention/response.go | 5 +- typedapi/slm/getlifecycle/get_lifecycle.go | 97 ++- typedapi/slm/getlifecycle/response.go | 4 +- typedapi/slm/getstats/get_stats.go | 96 ++- typedapi/slm/getstats/response.go | 5 +- typedapi/slm/getstatus/get_status.go | 94 ++- typedapi/slm/getstatus/response.go | 5 +- typedapi/slm/putlifecycle/put_lifecycle.go | 90 ++- typedapi/slm/putlifecycle/request.go | 4 +- typedapi/slm/putlifecycle/response.go | 5 +- typedapi/slm/start/response.go | 5 +- typedapi/slm/start/start.go | 94 ++- typedapi/slm/stop/response.go | 5 +- typedapi/slm/stop/stop.go | 94 ++- .../cleanuprepository/cleanup_repository.go | 99 ++- .../snapshot/cleanuprepository/response.go | 5 +- typedapi/snapshot/clone/clone.go | 98 ++- typedapi/snapshot/clone/request.go | 4 +- typedapi/snapshot/clone/response.go | 5 +- typedapi/snapshot/create/create.go | 95 ++- typedapi/snapshot/create/request.go | 4 +- typedapi/snapshot/create/response.go | 5 +- .../createrepository/create_repository.go | 92 ++- typedapi/snapshot/createrepository/request.go | 4 +- .../snapshot/createrepository/response.go | 5 +- typedapi/snapshot/delete/delete.go | 102 ++- typedapi/snapshot/delete/response.go | 5 +- .../deleterepository/delete_repository.go | 99 ++- .../snapshot/deleterepository/response.go | 5 +- typedapi/snapshot/get/get.go | 102 ++- typedapi/snapshot/get/response.go | 5 +- .../snapshot/getrepository/get_repository.go | 99 ++- typedapi/snapshot/getrepository/response.go | 4 +- typedapi/snapshot/restore/request.go | 4 +- typedapi/snapshot/restore/response.go | 5 +- typedapi/snapshot/restore/restore.go | 95 ++- typedapi/snapshot/status/response.go | 5 +- typedapi/snapshot/status/status.go | 105 ++- .../snapshot/verifyrepository/response.go | 5 +- .../verifyrepository/verify_repository.go | 99 ++- typedapi/sql/clearcursor/clear_cursor.go | 87 +- typedapi/sql/clearcursor/request.go | 4 +- typedapi/sql/clearcursor/response.go | 5 +- typedapi/sql/deleteasync/delete_async.go | 99 ++- typedapi/sql/deleteasync/response.go | 5 +- typedapi/sql/getasync/get_async.go | 99 ++- typedapi/sql/getasync/response.go | 5 +- .../sql/getasyncstatus/get_async_status.go | 99 ++- typedapi/sql/getasyncstatus/response.go | 5 +- typedapi/sql/query/query.go | 87 +- typedapi/sql/query/request.go | 4 +- typedapi/sql/query/response.go | 5 +- typedapi/sql/translate/request.go | 4 +- typedapi/sql/translate/response.go | 5 +- typedapi/sql/translate/translate.go | 87 +- typedapi/ssl/certificates/certificates.go | 94 ++- typedapi/ssl/certificates/response.go | 4 +- .../synonyms/deletesynonym/delete_synonym.go | 99 ++- typedapi/synonyms/deletesynonym/response.go | 5 +- .../deletesynonymrule/delete_synonym_rule.go | 104 ++- .../synonyms/deletesynonymrule/response.go | 5 +- typedapi/synonyms/getsynonym/get_synonym.go | 99 ++- typedapi/synonyms/getsynonym/response.go | 5 +- .../getsynonymrule/get_synonym_rule.go | 104 ++- typedapi/synonyms/getsynonymrule/response.go | 5 +- .../getsynonymssets/get_synonyms_sets.go | 96 ++- typedapi/synonyms/getsynonymssets/response.go | 5 +- typedapi/synonyms/putsynonym/put_synonym.go | 92 ++- typedapi/synonyms/putsynonym/request.go | 4 +- typedapi/synonyms/putsynonym/response.go | 5 +- .../putsynonymrule/put_synonym_rule.go | 95 ++- typedapi/synonyms/putsynonymrule/request.go | 4 +- typedapi/synonyms/putsynonymrule/response.go | 5 +- typedapi/tasks/cancel/cancel.go | 99 ++- typedapi/tasks/cancel/response.go | 5 +- typedapi/tasks/get/get.go | 99 ++- typedapi/tasks/get/response.go | 5 +- typedapi/tasks/list/list.go | 96 ++- typedapi/tasks/list/response.go | 5 +- .../findstructure/find_structure.go | 87 +- .../textstructure/findstructure/request.go | 4 +- .../textstructure/findstructure/response.go | 5 +- .../deletetransform/delete_transform.go | 107 ++- .../transform/deletetransform/response.go | 5 +- .../transform/gettransform/get_transform.go | 97 ++- typedapi/transform/gettransform/response.go | 5 +- .../gettransformstats/get_transform_stats.go | 97 ++- .../transform/gettransformstats/response.go | 5 +- .../previewtransform/preview_transform.go | 90 ++- .../transform/previewtransform/request.go | 4 +- .../transform/previewtransform/response.go | 5 +- .../transform/puttransform/put_transform.go | 90 ++- typedapi/transform/puttransform/request.go | 4 +- typedapi/transform/puttransform/response.go | 5 +- .../resettransform/reset_transform.go | 97 ++- typedapi/transform/resettransform/response.go | 5 +- .../schedulenowtransform/response.go | 5 +- .../schedule_now_transform.go | 99 ++- typedapi/transform/starttransform/response.go | 5 +- .../starttransform/start_transform.go | 97 ++- typedapi/transform/stoptransform/response.go | 5 +- .../transform/stoptransform/stop_transform.go | 97 ++- typedapi/transform/updatetransform/request.go | 4 +- .../transform/updatetransform/response.go | 5 +- .../updatetransform/update_transform.go | 90 ++- .../transform/upgradetransforms/response.go | 5 +- .../upgradetransforms/upgrade_transforms.go | 96 ++- typedapi/types/acknowledgement.go | 4 +- typedapi/types/acknowledgestate.go | 4 +- typedapi/types/actionstatus.go | 4 +- typedapi/types/activationstate.go | 4 +- typedapi/types/activationstatus.go | 4 +- typedapi/types/adaptiveselection.go | 4 +- typedapi/types/addaction.go | 4 +- typedapi/types/adjacencymatrixaggregate.go | 4 +- typedapi/types/adjacencymatrixaggregation.go | 4 +- typedapi/types/adjacencymatrixbucket.go | 4 +- typedapi/types/aggregate.go | 4 +- .../types/aggregatemetricdoubleproperty.go | 16 +- typedapi/types/aggregateorder.go | 4 +- typedapi/types/aggregateoutput.go | 4 +- typedapi/types/aggregation.go | 4 +- typedapi/types/aggregationbreakdown.go | 4 +- typedapi/types/aggregationprofile.go | 4 +- typedapi/types/aggregationprofiledebug.go | 4 +- .../aggregationprofiledelegatedebugfilter.go | 4 +- typedapi/types/aggregationrange.go | 4 +- typedapi/types/aggregations.go | 4 +- typedapi/types/alias.go | 4 +- typedapi/types/aliasdefinition.go | 4 +- typedapi/types/aliasesrecord.go | 4 +- typedapi/types/allfield.go | 4 +- typedapi/types/allocationdecision.go | 4 +- typedapi/types/allocationrecord.go | 4 +- typedapi/types/allocationstore.go | 4 +- typedapi/types/alwayscondition.go | 4 +- typedapi/types/analysisconfig.go | 4 +- typedapi/types/analysisconfigread.go | 4 +- typedapi/types/analysislimits.go | 4 +- typedapi/types/analysismemorylimit.go | 4 +- typedapi/types/analytics.go | 4 +- typedapi/types/analyticscollection.go | 4 +- typedapi/types/analyticsstatistics.go | 4 +- typedapi/types/analyzedetail.go | 4 +- typedapi/types/analyzer.go | 4 +- typedapi/types/analyzerdetail.go | 4 +- typedapi/types/analyzetoken.go | 4 +- typedapi/types/anomaly.go | 4 +- typedapi/types/anomalycause.go | 4 +- typedapi/types/anomalydetectors.go | 4 +- typedapi/types/anomalyexplanation.go | 4 +- typedapi/types/apikey.go | 4 +- typedapi/types/apikeyauthorization.go | 4 +- typedapi/types/appendprocessor.go | 4 +- .../types/applicationglobaluserprivileges.go | 4 +- typedapi/types/applicationprivileges.go | 4 +- typedapi/types/applicationprivilegescheck.go | 4 +- typedapi/types/applicationsprivileges.go | 4 +- typedapi/types/archive.go | 4 +- typedapi/types/arraycomparecondition.go | 4 +- typedapi/types/arraycompareopparams.go | 4 +- typedapi/types/arraypercentilesitem.go | 4 +- typedapi/types/asciifoldingtokenfilter.go | 4 +- typedapi/types/asyncsearch.go | 4 +- typedapi/types/attachmentprocessor.go | 4 +- typedapi/types/audit.go | 4 +- typedapi/types/authenticateduser.go | 4 +- typedapi/types/authenticatetoken.go | 4 +- typedapi/types/authenticationprovider.go | 4 +- typedapi/types/autodatehistogramaggregate.go | 4 +- .../types/autodatehistogramaggregation.go | 4 +- typedapi/types/autofollowedcluster.go | 4 +- typedapi/types/autofollowpattern.go | 4 +- typedapi/types/autofollowpatternsummary.go | 4 +- typedapi/types/autofollowstats.go | 4 +- typedapi/types/autoscalingcapacity.go | 4 +- typedapi/types/autoscalingdecider.go | 4 +- typedapi/types/autoscalingdeciders.go | 4 +- typedapi/types/autoscalingnode.go | 4 +- typedapi/types/autoscalingpolicy.go | 4 +- typedapi/types/autoscalingresources.go | 4 +- typedapi/types/averageaggregation.go | 4 +- typedapi/types/averagebucketaggregation.go | 4 +- typedapi/types/avgaggregate.go | 4 +- typedapi/types/base.go | 4 +- typedapi/types/baseindicator.go | 4 +- typedapi/types/basenode.go | 4 +- typedapi/types/binaryproperty.go | 16 +- typedapi/types/booleanproperty.go | 16 +- typedapi/types/boolquery.go | 4 +- typedapi/types/boostingquery.go | 4 +- typedapi/types/boxplotaggregate.go | 4 +- typedapi/types/boxplotaggregation.go | 4 +- typedapi/types/breaker.go | 4 +- .../types/bucketcorrelationaggregation.go | 4 +- typedapi/types/bucketcorrelationfunction.go | 4 +- ...cketcorrelationfunctioncountcorrelation.go | 4 +- ...lationfunctioncountcorrelationindicator.go | 4 +- typedapi/types/bucketinfluencer.go | 4 +- typedapi/types/bucketksaggregation.go | 4 +- typedapi/types/bucketmetricvalueaggregate.go | 4 +- typedapi/types/bucketpathaggregation.go | 4 +- .../types/bucketsadjacencymatrixbucket.go | 4 +- typedapi/types/bucketscompositebucket.go | 4 +- typedapi/types/bucketscriptaggregation.go | 4 +- typedapi/types/bucketsdatehistogrambucket.go | 4 +- typedapi/types/bucketsdoubletermsbucket.go | 4 +- typedapi/types/bucketselectoraggregation.go | 4 +- typedapi/types/bucketsfiltersbucket.go | 4 +- .../types/bucketsfrequentitemsetsbucket.go | 4 +- typedapi/types/bucketsgeohashgridbucket.go | 4 +- typedapi/types/bucketsgeohexgridbucket.go | 4 +- typedapi/types/bucketsgeotilegridbucket.go | 4 +- typedapi/types/bucketshistogrambucket.go | 4 +- typedapi/types/bucketsipprefixbucket.go | 4 +- typedapi/types/bucketsiprangebucket.go | 4 +- typedapi/types/bucketslongraretermsbucket.go | 4 +- typedapi/types/bucketslongtermsbucket.go | 4 +- typedapi/types/bucketsmultitermsbucket.go | 4 +- typedapi/types/bucketsortaggregation.go | 4 +- typedapi/types/bucketspath.go | 4 +- typedapi/types/bucketsquery.go | 4 +- typedapi/types/bucketsrangebucket.go | 4 +- .../bucketssignificantlongtermsbucket.go | 4 +- .../bucketssignificantstringtermsbucket.go | 4 +- .../types/bucketsstringraretermsbucket.go | 4 +- typedapi/types/bucketsstringtermsbucket.go | 4 +- typedapi/types/bucketsummary.go | 4 +- .../bucketsvariablewidthhistogrambucket.go | 4 +- typedapi/types/bucketsvoid.go | 4 +- typedapi/types/buildinformation.go | 4 +- typedapi/types/bulkindexbyscrollfailure.go | 4 +- typedapi/types/bulkstats.go | 4 +- typedapi/types/bytenumberproperty.go | 16 +- typedapi/types/bytesize.go | 4 +- typedapi/types/bytesprocessor.go | 4 +- typedapi/types/cachequeries.go | 4 +- typedapi/types/cachestats.go | 4 +- typedapi/types/calendar.go | 4 +- typedapi/types/calendarevent.go | 4 +- typedapi/types/cardinalityaggregate.go | 4 +- typedapi/types/cardinalityaggregation.go | 4 +- typedapi/types/catanonalydetectorcolumns.go | 4 +- typedapi/types/catcomponenttemplate.go | 4 +- typedapi/types/catdatafeedcolumns.go | 4 +- typedapi/types/catdfacolumns.go | 4 +- typedapi/types/categorizationanalyzer.go | 4 +- .../types/categorizationanalyzerdefinition.go | 4 +- typedapi/types/categorizetextaggregation.go | 4 +- typedapi/types/categorizetextanalyzer.go | 4 +- typedapi/types/category.go | 4 +- typedapi/types/cattrainedmodelscolumns.go | 4 +- typedapi/types/cattransformcolumns.go | 4 +- typedapi/types/ccr.go | 4 +- typedapi/types/ccrshardstats.go | 4 +- typedapi/types/certificateinformation.go | 4 +- typedapi/types/cgroup.go | 4 +- typedapi/types/cgroupcpu.go | 4 +- typedapi/types/cgroupcpustat.go | 4 +- typedapi/types/cgroupmemory.go | 4 +- typedapi/types/chaininput.go | 4 +- typedapi/types/charfilter.go | 4 +- typedapi/types/charfilterdefinition.go | 4 +- typedapi/types/charfilterdetail.go | 4 +- typedapi/types/charfiltertypes.go | 4 +- typedapi/types/chargrouptokenizer.go | 4 +- typedapi/types/checkpointing.go | 4 +- typedapi/types/checkpointstats.go | 4 +- typedapi/types/childrenaggregate.go | 4 +- typedapi/types/childrenaggregation.go | 4 +- typedapi/types/chisquareheuristic.go | 4 +- typedapi/types/chunkingconfig.go | 4 +- typedapi/types/circleprocessor.go | 4 +- .../types/classificationinferenceoptions.go | 4 +- typedapi/types/cleanuprepositoryresults.go | 4 +- typedapi/types/client.go | 4 +- typedapi/types/closeindexresult.go | 4 +- typedapi/types/closeshardresult.go | 4 +- typedapi/types/clusterappliedstats.go | 4 +- typedapi/types/clustercomponenttemplate.go | 4 +- typedapi/types/clusterdetails.go | 4 +- typedapi/types/clusterfilesystem.go | 4 +- typedapi/types/clusterindexingpressure.go | 4 +- typedapi/types/clusterindices.go | 4 +- typedapi/types/clusterindicesshards.go | 4 +- typedapi/types/clusterindicesshardsindex.go | 4 +- typedapi/types/clusterinfo.go | 4 +- typedapi/types/clusterinfotargets.go | 4 +- typedapi/types/clusteringest.go | 4 +- typedapi/types/clusterjvm.go | 4 +- typedapi/types/clusterjvmmemory.go | 4 +- typedapi/types/clusterjvmversion.go | 4 +- typedapi/types/clusternetworktypes.go | 4 +- typedapi/types/clusternode.go | 4 +- typedapi/types/clusternodecount.go | 4 +- typedapi/types/clusternodes.go | 4 +- typedapi/types/clusteroperatingsystem.go | 4 +- .../clusteroperatingsystemarchitecture.go | 4 +- typedapi/types/clusteroperatingsystemname.go | 4 +- .../types/clusteroperatingsystemprettyname.go | 4 +- typedapi/types/clusterpressurememory.go | 4 +- typedapi/types/clusterprocess.go | 4 +- typedapi/types/clusterprocesscpu.go | 4 +- .../clusterprocessopenfiledescriptors.go | 4 +- typedapi/types/clusterprocessor.go | 4 +- typedapi/types/clusterremoteinfo.go | 4 +- typedapi/types/clusterremoteproxyinfo.go | 4 +- typedapi/types/clusterremotesniffinfo.go | 4 +- typedapi/types/clusterruntimefieldtypes.go | 4 +- typedapi/types/clustershardmetrics.go | 4 +- typedapi/types/clusterstatequeue.go | 4 +- typedapi/types/clusterstateupdate.go | 4 +- typedapi/types/clusterstatistics.go | 4 +- typedapi/types/collector.go | 4 +- typedapi/types/column.go | 4 +- typedapi/types/combinedfieldsquery.go | 4 +- typedapi/types/command.go | 4 +- .../types/commandallocateprimaryaction.go | 4 +- .../types/commandallocatereplicaaction.go | 4 +- typedapi/types/commandcancelaction.go | 4 +- typedapi/types/commandmoveaction.go | 4 +- typedapi/types/commongramstokenfilter.go | 4 +- typedapi/types/commontermsquery.go | 4 +- typedapi/types/compactnodeinfo.go | 4 +- typedapi/types/completioncontext.go | 4 +- typedapi/types/completionproperty.go | 16 +- typedapi/types/completionstats.go | 4 +- typedapi/types/completionsuggest.go | 4 +- typedapi/types/completionsuggester.go | 4 +- typedapi/types/completionsuggestoption.go | 4 +- typedapi/types/componenttemplatenode.go | 4 +- typedapi/types/componenttemplatesummary.go | 4 +- typedapi/types/compositeaggregate.go | 4 +- typedapi/types/compositeaggregatekey.go | 4 +- typedapi/types/compositeaggregation.go | 4 +- typedapi/types/compositeaggregationsource.go | 4 +- typedapi/types/compositebucket.go | 4 +- .../compositedatehistogramaggregation.go | 4 +- .../types/compositegeotilegridaggregation.go | 4 +- .../types/compositehistogramaggregation.go | 4 +- typedapi/types/compositetermsaggregation.go | 4 +- typedapi/types/conditiontokenfilter.go | 4 +- typedapi/types/configuration.go | 4 +- typedapi/types/configurations.go | 4 +- typedapi/types/confusionmatrixitem.go | 4 +- typedapi/types/confusionmatrixprediction.go | 4 +- typedapi/types/confusionmatrixthreshold.go | 4 +- typedapi/types/connection.go | 4 +- typedapi/types/constantkeywordproperty.go | 16 +- typedapi/types/constantscorequery.go | 4 +- typedapi/types/context.go | 4 +- typedapi/types/contextmethod.go | 4 +- typedapi/types/contextmethodparam.go | 4 +- typedapi/types/convertprocessor.go | 4 +- typedapi/types/coordinatorstats.go | 4 +- typedapi/types/coordsgeobounds.go | 4 +- typedapi/types/coreknnquery.go | 4 +- typedapi/types/counter.go | 4 +- typedapi/types/countrecord.go | 4 +- typedapi/types/cpu.go | 4 +- typedapi/types/cpuacct.go | 4 +- typedapi/types/createdstatus.go | 4 +- typedapi/types/createoperation.go | 4 +- typedapi/types/csvprocessor.go | 4 +- .../types/cumulativecardinalityaggregate.go | 4 +- .../types/cumulativecardinalityaggregation.go | 4 +- typedapi/types/cumulativesumaggregation.go | 4 +- typedapi/types/currentnode.go | 4 +- typedapi/types/customanalyzer.go | 4 +- .../types/customcategorizetextanalyzer.go | 4 +- typedapi/types/customnormalizer.go | 4 +- typedapi/types/dailyschedule.go | 4 +- typedapi/types/danglingindex.go | 4 +- typedapi/types/datacounts.go | 4 +- typedapi/types/datadescription.go | 4 +- typedapi/types/dataemailattachment.go | 4 +- typedapi/types/datafeedauthorization.go | 4 +- typedapi/types/datafeedconfig.go | 4 +- typedapi/types/datafeedrunningstate.go | 4 +- typedapi/types/datafeeds.go | 4 +- typedapi/types/datafeedsrecord.go | 4 +- typedapi/types/datafeedstats.go | 4 +- typedapi/types/datafeedtimingstats.go | 4 +- typedapi/types/dataframeanalysis.go | 4 +- .../types/dataframeanalysisanalyzedfields.go | 4 +- .../types/dataframeanalysisclassification.go | 4 +- typedapi/types/dataframeanalysiscontainer.go | 4 +- .../dataframeanalysisfeatureprocessor.go | 4 +- ...alysisfeatureprocessorfrequencyencoding.go | 4 +- ...meanalysisfeatureprocessormultiencoding.go | 4 +- ...meanalysisfeatureprocessorngramencoding.go | 4 +- ...eanalysisfeatureprocessoronehotencoding.go | 4 +- ...lysisfeatureprocessortargetmeanencoding.go | 4 +- .../dataframeanalysisoutlierdetection.go | 4 +- typedapi/types/dataframeanalysisregression.go | 4 +- typedapi/types/dataframeanalytics.go | 4 +- .../types/dataframeanalyticsauthorization.go | 4 +- .../types/dataframeanalyticsdestination.go | 4 +- .../types/dataframeanalyticsfieldselection.go | 4 +- .../dataframeanalyticsmemoryestimation.go | 4 +- typedapi/types/dataframeanalyticsrecord.go | 4 +- typedapi/types/dataframeanalyticssource.go | 4 +- .../types/dataframeanalyticsstatscontainer.go | 4 +- .../dataframeanalyticsstatsdatacounts.go | 4 +- .../dataframeanalyticsstatshyperparameters.go | 4 +- .../dataframeanalyticsstatsmemoryusage.go | 4 +- ...dataframeanalyticsstatsoutlierdetection.go | 4 +- .../types/dataframeanalyticsstatsprogress.go | 4 +- typedapi/types/dataframeanalyticssummary.go | 4 +- .../types/dataframeclassificationsummary.go | 4 +- .../dataframeclassificationsummaryaccuracy.go | 4 +- ...icationsummarymulticlassconfusionmatrix.go | 4 +- ...dataframeclassificationsummaryprecision.go | 4 +- .../dataframeclassificationsummaryrecall.go | 4 +- typedapi/types/dataframeevaluationclass.go | 4 +- .../dataframeevaluationclassification.go | 4 +- ...ataframeevaluationclassificationmetrics.go | 4 +- ...meevaluationclassificationmetricsaucroc.go | 4 +- .../types/dataframeevaluationcontainer.go | 4 +- typedapi/types/dataframeevaluationmetrics.go | 4 +- .../dataframeevaluationoutlierdetection.go | 4 +- ...aframeevaluationoutlierdetectionmetrics.go | 4 +- .../types/dataframeevaluationregression.go | 4 +- .../dataframeevaluationregressionmetrics.go | 4 +- ...taframeevaluationregressionmetricshuber.go | 4 +- ...ataframeevaluationregressionmetricsmsle.go | 4 +- .../types/dataframeevaluationsummaryaucroc.go | 4 +- ...taframeevaluationsummaryaucroccurveitem.go | 4 +- typedapi/types/dataframeevaluationvalue.go | 4 +- .../types/dataframeoutlierdetectionsummary.go | 4 +- typedapi/types/dataframepreviewconfig.go | 4 +- typedapi/types/dataframeregressionsummary.go | 4 +- typedapi/types/datapathstats.go | 4 +- typedapi/types/datastream.go | 7 +- typedapi/types/datastreamindex.go | 8 +- typedapi/types/datastreamlifecycle.go | 4 +- .../types/datastreamlifecycledownsampling.go | 4 +- typedapi/types/datastreamlifecycleexplain.go | 4 +- .../datastreamlifecyclerolloverconditions.go | 4 +- .../types/datastreamlifecyclewithrollover.go | 4 +- typedapi/types/datastreamnames.go | 4 +- typedapi/types/datastreams.go | 4 +- typedapi/types/datastreamsstatsitem.go | 4 +- typedapi/types/datastreamtimestamp.go | 4 +- typedapi/types/datastreamtimestampfield.go | 4 +- typedapi/types/datastreamvisibility.go | 4 +- typedapi/types/datastreamwithlifecycle.go | 4 +- typedapi/types/datatierphasestatistics.go | 4 +- typedapi/types/datatiers.go | 4 +- typedapi/types/datedecayfunction.go | 4 +- typedapi/types/datedistancefeaturequery.go | 4 +- typedapi/types/datehistogramaggregate.go | 4 +- typedapi/types/datehistogramaggregation.go | 4 +- typedapi/types/datehistogrambucket.go | 4 +- typedapi/types/datehistogramgrouping.go | 4 +- typedapi/types/dateindexnameprocessor.go | 4 +- typedapi/types/datenanosproperty.go | 16 +- typedapi/types/dateprocessor.go | 4 +- typedapi/types/dateproperty.go | 16 +- typedapi/types/daterangeaggregate.go | 4 +- typedapi/types/daterangeaggregation.go | 4 +- typedapi/types/daterangeexpression.go | 4 +- typedapi/types/daterangeproperty.go | 16 +- typedapi/types/daterangequery.go | 4 +- typedapi/types/datetime.go | 4 +- typedapi/types/decayfunction.go | 4 +- .../types/decayplacementdatemathduration.go | 4 +- typedapi/types/decayplacementdoubledouble.go | 4 +- .../decayplacementgeolocationdistance.go | 4 +- typedapi/types/defaults.go | 4 +- typedapi/types/definition.go | 4 +- typedapi/types/delayeddatacheckconfig.go | 4 +- typedapi/types/deleteoperation.go | 4 +- typedapi/types/delimitedpayloadtokenfilter.go | 4 +- typedapi/types/densevectorindexoptions.go | 4 +- typedapi/types/densevectorproperty.go | 16 +- typedapi/types/deprecation.go | 4 +- typedapi/types/deprecationindexing.go | 4 +- typedapi/types/derivativeaggregate.go | 4 +- typedapi/types/derivativeaggregation.go | 4 +- typedapi/types/detectionrule.go | 4 +- typedapi/types/detector.go | 4 +- typedapi/types/detectorread.go | 4 +- typedapi/types/diagnosis.go | 4 +- typedapi/types/diagnosisaffectedresources.go | 4 +- .../dictionarydecompoundertokenfilter.go | 4 +- typedapi/types/directgenerator.go | 4 +- typedapi/types/discovery.go | 4 +- typedapi/types/discoverynode.go | 4 +- typedapi/types/diskindicator.go | 4 +- typedapi/types/diskindicatordetails.go | 4 +- typedapi/types/diskusage.go | 4 +- typedapi/types/dismaxquery.go | 4 +- typedapi/types/dissectprocessor.go | 4 +- typedapi/types/distancefeaturequery.go | 4 +- ...istancefeaturequerybasedatemathduration.go | 4 +- ...ancefeaturequerybasegeolocationdistance.go | 4 +- .../types/diversifiedsampleraggregation.go | 4 +- typedapi/types/docstats.go | 4 +- typedapi/types/document.go | 4 +- typedapi/types/documentrating.go | 4 +- typedapi/types/documentsimulation.go | 4 +- typedapi/types/dotexpanderprocessor.go | 4 +- typedapi/types/doublenumberproperty.go | 16 +- typedapi/types/doublerangeproperty.go | 16 +- typedapi/types/doubletermsaggregate.go | 4 +- typedapi/types/doubletermsbucket.go | 4 +- typedapi/types/downsampleconfig.go | 4 +- typedapi/types/downsamplinground.go | 4 +- typedapi/types/dropprocessor.go | 4 +- typedapi/types/duration.go | 4 +- .../types/durationvalueunitfloatmillis.go | 4 +- typedapi/types/durationvalueunitmillis.go | 4 +- typedapi/types/durationvalueunitnanos.go | 4 +- typedapi/types/durationvalueunitseconds.go | 4 +- typedapi/types/dutchanalyzer.go | 4 +- typedapi/types/dynamicproperty.go | 16 +- typedapi/types/dynamictemplate.go | 10 +- typedapi/types/edgengramtokenfilter.go | 4 +- typedapi/types/edgengramtokenizer.go | 4 +- typedapi/types/elasticsearchversioninfo.go | 4 +- typedapi/types/elisiontokenfilter.go | 4 +- typedapi/types/email.go | 4 +- typedapi/types/emailaction.go | 4 +- typedapi/types/emailattachmentcontainer.go | 4 +- typedapi/types/emailbody.go | 4 +- typedapi/types/emailresult.go | 4 +- typedapi/types/emptyobject.go | 4 +- typedapi/types/enrichpolicy.go | 15 +- typedapi/types/enrichprocessor.go | 4 +- typedapi/types/ensemble.go | 4 +- .../accesstokengranttype.go | 4 +- .../acknowledgementoptions.go | 4 +- .../actionexecutionmode.go | 4 +- .../actionstatusoptions.go | 4 +- typedapi/types/enums/actiontype/actiontype.go | 4 +- .../allocationexplaindecision.go | 4 +- .../enums/apikeygranttype/apikeygranttype.go | 4 +- typedapi/types/enums/appliesto/appliesto.go | 4 +- .../enums/boundaryscanner/boundaryscanner.go | 4 +- typedapi/types/enums/bytes/bytes.go | 4 +- .../calendarinterval/calendarinterval.go | 4 +- .../cardinalityexecutionmode.go | 4 +- .../catanomalydetectorcolumn.go | 4 +- .../catdatafeedcolumn/catdatafeedcolumn.go | 4 +- .../types/enums/catdfacolumn/catdfacolumn.go | 4 +- .../categorizationstatus.go | 4 +- .../cattrainedmodelscolumn.go | 4 +- .../cattransformcolumn/cattransformcolumn.go | 4 +- .../enums/childscoremode/childscoremode.go | 4 +- .../types/enums/chunkingmode/chunkingmode.go | 4 +- .../clusterinfotarget/clusterinfotarget.go | 4 +- .../clusterprivilege/clusterprivilege.go | 4 +- .../clustersearchstatus.go | 4 +- .../combinedfieldsoperator.go | 4 +- .../combinedfieldszeroterms.go | 4 +- .../types/enums/conditionop/conditionop.go | 4 +- .../conditionoperator/conditionoperator.go | 4 +- .../enums/conditiontype/conditiontype.go | 4 +- typedapi/types/enums/conflicts/conflicts.go | 4 +- .../connectionscheme/connectionscheme.go | 4 +- .../types/enums/converttype/converttype.go | 4 +- .../dataattachmentformat.go | 4 +- .../enums/datafeedstate/datafeedstate.go | 4 +- .../enums/dataframestate/dataframestate.go | 4 +- typedapi/types/enums/day/day.go | 4 +- typedapi/types/enums/decision/decision.go | 4 +- .../delimitedpayloadencoding.go | 4 +- .../deploymentallocationstate.go | 4 +- .../deploymentassignmentstate.go | 4 +- .../enums/deploymentstate/deploymentstate.go | 4 +- .../deprecationlevel/deprecationlevel.go | 4 +- .../dfiindependencemeasure.go | 4 +- .../enums/dfraftereffect/dfraftereffect.go | 4 +- .../enums/dfrbasicmodel/dfrbasicmodel.go | 4 +- .../types/enums/distanceunit/distanceunit.go | 4 +- .../enums/dynamicmapping/dynamicmapping.go | 4 +- .../enums/edgengramside/edgengramside.go | 4 +- .../enums/emailpriority/emailpriority.go | 4 +- .../enrichpolicyphase/enrichpolicyphase.go | 4 +- .../enums/excludefrequent/excludefrequent.go | 4 +- .../enums/executionphase/executionphase.go | 4 +- .../enums/executionstatus/executionstatus.go | 4 +- .../enums/expandwildcard/expandwildcard.go | 4 +- typedapi/types/enums/feature/feature.go | 4 +- .../fieldsortnumerictype.go | 4 +- typedapi/types/enums/fieldtype/fieldtype.go | 4 +- .../fieldvaluefactormodifier.go | 4 +- typedapi/types/enums/filtertype/filtertype.go | 4 +- .../followerindexstatus.go | 4 +- .../functionboostmode/functionboostmode.go | 4 +- .../functionscoremode/functionscoremode.go | 4 +- typedapi/types/enums/gappolicy/gappolicy.go | 4 +- .../enums/geodistancetype/geodistancetype.go | 4 +- .../types/enums/geoexecution/geoexecution.go | 4 +- .../enums/geoorientation/geoorientation.go | 4 +- .../geoshaperelation/geoshaperelation.go | 4 +- .../types/enums/geostrategy/geostrategy.go | 4 +- .../geovalidationmethod.go | 4 +- typedapi/types/enums/granttype/granttype.go | 4 +- .../gridaggregationtype.go | 4 +- typedapi/types/enums/gridtype/gridtype.go | 4 +- typedapi/types/enums/groupby/groupby.go | 4 +- .../types/enums/healthstatus/healthstatus.go | 4 +- .../highlighterencoder/highlighterencoder.go | 4 +- .../highlighterfragmenter.go | 4 +- .../highlighterorder/highlighterorder.go | 4 +- .../highlightertagsschema.go | 4 +- .../enums/highlightertype/highlightertype.go | 4 +- .../enums/holtwinterstype/holtwinterstype.go | 4 +- .../enums/httpinputmethod/httpinputmethod.go | 4 +- .../enums/ibdistribution/ibdistribution.go | 4 +- typedapi/types/enums/iblambda/iblambda.go | 4 +- .../icucollationalternate.go | 4 +- .../icucollationcasefirst.go | 4 +- .../icucollationdecomposition.go | 4 +- .../icucollationstrength.go | 4 +- .../icunormalizationmode.go | 4 +- .../icunormalizationtype.go | 4 +- .../icutransformdirection.go | 4 +- typedapi/types/enums/impactarea/impactarea.go | 4 +- typedapi/types/enums/include/include.go | 4 +- .../indexcheckonstartup.go | 4 +- .../indexingjobstate/indexingjobstate.go | 4 +- .../indexmetadatastate/indexmetadatastate.go | 4 +- .../types/enums/indexoptions/indexoptions.go | 4 +- .../enums/indexprivilege/indexprivilege.go | 4 +- .../indexroutingallocationoptions.go | 4 +- .../indexroutingrebalanceoptions.go | 4 +- .../indicatorhealthstatus.go | 4 +- .../indicesblockoptions.go | 4 +- typedapi/types/enums/inputtype/inputtype.go | 4 +- .../jobblockedreason/jobblockedreason.go | 4 +- typedapi/types/enums/jobstate/jobstate.go | 4 +- .../jsonprocessorconflictstrategy.go | 4 +- .../enums/keeptypesmode/keeptypesmode.go | 4 +- .../kuromojitokenizationmode.go | 4 +- typedapi/types/enums/language/language.go | 4 +- typedapi/types/enums/level/level.go | 4 +- .../enums/licensestatus/licensestatus.go | 4 +- .../types/enums/licensetype/licensetype.go | 4 +- .../lifecycleoperationmode.go | 4 +- typedapi/types/enums/managedby/managedby.go | 61 ++ typedapi/types/enums/matchtype/matchtype.go | 4 +- .../types/enums/memorystatus/memorystatus.go | 4 +- typedapi/types/enums/metric/metric.go | 4 +- .../enums/migrationstatus/migrationstatus.go | 4 +- .../enums/minimuminterval/minimuminterval.go | 4 +- .../types/enums/missingorder/missingorder.go | 4 +- typedapi/types/enums/month/month.go | 4 +- .../enums/multivaluemode/multivaluemode.go | 4 +- typedapi/types/enums/noderole/noderole.go | 4 +- .../noridecompoundmode/noridecompoundmode.go | 4 +- .../enums/normalization/normalization.go | 4 +- .../enums/normalizemethod/normalizemethod.go | 4 +- .../numericfielddataformat.go | 4 +- .../enums/onscripterror/onscripterror.go | 4 +- .../enums/operationtype/operationtype.go | 4 +- typedapi/types/enums/operator/operator.go | 4 +- typedapi/types/enums/optype/optype.go | 4 +- .../pagerdutycontexttype.go | 4 +- .../pagerdutyeventtype/pagerdutyeventtype.go | 4 +- .../enums/phoneticencoder/phoneticencoder.go | 4 +- .../phoneticlanguage/phoneticlanguage.go | 4 +- .../phoneticnametype/phoneticnametype.go | 4 +- .../phoneticruletype/phoneticruletype.go | 4 +- typedapi/types/enums/policytype/policytype.go | 4 +- typedapi/types/enums/quantifier/quantifier.go | 4 +- .../queryrulecriteriatype.go | 4 +- .../enums/queryruletype/queryruletype.go | 4 +- .../enums/rangerelation/rangerelation.go | 4 +- typedapi/types/enums/ratemode/ratemode.go | 4 +- typedapi/types/enums/refresh/refresh.go | 4 +- .../responsecontenttype.go | 4 +- typedapi/types/enums/result/result.go | 4 +- .../enums/resultposition/resultposition.go | 4 +- .../types/enums/routingstate/routingstate.go | 4 +- typedapi/types/enums/ruleaction/ruleaction.go | 4 +- .../runtimefieldtype/runtimefieldtype.go | 4 +- .../sampleraggregationexecutionhint.go | 4 +- typedapi/types/enums/scoremode/scoremode.go | 4 +- .../enums/scriptlanguage/scriptlanguage.go | 4 +- .../enums/scriptsorttype/scriptsorttype.go | 4 +- typedapi/types/enums/searchtype/searchtype.go | 4 +- .../segmentsortmissing/segmentsortmissing.go | 4 +- .../enums/segmentsortmode/segmentsortmode.go | 4 +- .../segmentsortorder/segmentsortorder.go | 4 +- typedapi/types/enums/shapetype/shapetype.go | 4 +- .../shardroutingstate/shardroutingstate.go | 4 +- .../shardsstatsstage/shardsstatsstage.go | 4 +- .../shardstoreallocation.go | 4 +- .../shardstorestatus/shardstorestatus.go | 4 +- .../enums/shutdownstatus/shutdownstatus.go | 4 +- .../types/enums/shutdowntype/shutdowntype.go | 4 +- .../simplequerystringflag.go | 4 +- .../slicescalculation/slicescalculation.go | 4 +- .../types/enums/snapshotsort/snapshotsort.go | 4 +- .../snapshotupgradestate.go | 4 +- .../snowballlanguage/snowballlanguage.go | 4 +- typedapi/types/enums/sortmode/sortmode.go | 4 +- typedapi/types/enums/sortorder/sortorder.go | 4 +- .../enums/sourcefieldmode/sourcefieldmode.go | 4 +- typedapi/types/enums/statslevel/statslevel.go | 4 +- .../types/enums/storagetype/storagetype.go | 4 +- .../enums/stringdistance/stringdistance.go | 4 +- .../types/enums/suggestmode/suggestmode.go | 4 +- .../types/enums/suggestsort/suggestsort.go | 4 +- .../enums/synonymformat/synonymformat.go | 4 +- typedapi/types/enums/tasktype/tasktype.go | 57 ++ .../enums/templateformat/templateformat.go | 4 +- .../termsaggregationcollectmode.go | 4 +- .../termsaggregationexecutionhint.go | 4 +- .../termvectoroption/termvectoroption.go | 4 +- .../enums/textquerytype/textquerytype.go | 4 +- typedapi/types/enums/threadtype/threadtype.go | 4 +- .../timeseriesmetrictype.go | 4 +- typedapi/types/enums/timeunit/timeunit.go | 4 +- typedapi/types/enums/tokenchar/tokenchar.go | 4 +- .../tokenizationtruncate.go | 4 +- .../totalhitsrelation/totalhitsrelation.go | 4 +- .../trainedmodeltype/trainedmodeltype.go | 4 +- .../trainingpriority/trainingpriority.go | 4 +- .../translogdurability/translogdurability.go | 4 +- typedapi/types/enums/ttesttype/ttesttype.go | 4 +- typedapi/types/enums/type_/type_.go | 4 +- .../unassignedinformationreason.go | 4 +- .../useragentproperty/useragentproperty.go | 4 +- typedapi/types/enums/valuetype/valuetype.go | 4 +- .../types/enums/versiontype/versiontype.go | 4 +- .../waitforactiveshardoptions.go | 4 +- .../enums/waitforevents/waitforevents.go | 4 +- .../enums/watchermetric/watchermetric.go | 4 +- .../types/enums/watcherstate/watcherstate.go | 4 +- .../enums/zerotermsquery/zerotermsquery.go | 4 +- typedapi/types/epochtimeunitmillis.go | 4 +- typedapi/types/epochtimeunitseconds.go | 4 +- typedapi/types/eql.go | 4 +- typedapi/types/eqlfeatures.go | 4 +- typedapi/types/eqlfeaturesjoin.go | 4 +- typedapi/types/eqlfeatureskeys.go | 4 +- typedapi/types/eqlfeaturespipes.go | 4 +- typedapi/types/eqlfeaturessequences.go | 4 +- typedapi/types/eqlhits.go | 4 +- typedapi/types/errorcause.go | 4 +- .../types/{managedby.go => esqlcolumns.go} | 8 +- typedapi/types/eventdatastream.go | 4 +- typedapi/types/ewmamodelsettings.go | 4 +- .../types/ewmamovingaverageaggregation.go | 4 +- typedapi/types/executeenrichpolicystatus.go | 4 +- typedapi/types/executingpolicy.go | 4 +- typedapi/types/executionresult.go | 4 +- typedapi/types/executionresultaction.go | 4 +- typedapi/types/executionresultcondition.go | 4 +- typedapi/types/executionresultinput.go | 4 +- typedapi/types/executionstate.go | 4 +- typedapi/types/executionthreadpool.go | 4 +- typedapi/types/existsquery.go | 4 +- typedapi/types/expandwildcards.go | 4 +- typedapi/types/explainanalyzetoken.go | 4 +- typedapi/types/explanation.go | 4 +- typedapi/types/explanationdetail.go | 4 +- typedapi/types/explorecontrols.go | 4 +- typedapi/types/extendedboundsdouble.go | 4 +- typedapi/types/extendedboundsfielddatemath.go | 4 +- typedapi/types/extendedmemorystats.go | 4 +- typedapi/types/extendedstatsaggregate.go | 4 +- typedapi/types/extendedstatsaggregation.go | 4 +- .../types/extendedstatsbucketaggregate.go | 4 +- .../types/extendedstatsbucketaggregation.go | 4 +- typedapi/types/failprocessor.go | 4 +- typedapi/types/feature.go | 4 +- typedapi/types/features.go | 4 +- typedapi/types/featuretoggle.go | 4 +- typedapi/types/fetchprofile.go | 4 +- typedapi/types/fetchprofilebreakdown.go | 4 +- typedapi/types/fetchprofiledebug.go | 4 +- typedapi/types/fieldaliasproperty.go | 16 +- typedapi/types/fieldandformat.go | 4 +- typedapi/types/fieldcapability.go | 4 +- typedapi/types/fieldcollapse.go | 4 +- typedapi/types/fielddatafrequencyfilter.go | 4 +- typedapi/types/fielddatarecord.go | 4 +- typedapi/types/fielddatastats.go | 4 +- typedapi/types/fielddatemath.go | 4 +- typedapi/types/fieldlookup.go | 4 +- typedapi/types/fieldmapping.go | 10 +- typedapi/types/fieldmemoryusage.go | 4 +- typedapi/types/fieldmetric.go | 4 +- typedapi/types/fieldnamesfield.go | 4 +- typedapi/types/fieldrule.go | 4 +- typedapi/types/fields.go | 4 +- typedapi/types/fieldsecurity.go | 4 +- typedapi/types/fieldsizeusage.go | 4 +- typedapi/types/fieldsort.go | 4 +- typedapi/types/fieldstat.go | 4 +- typedapi/types/fieldstatistics.go | 4 +- typedapi/types/fieldsuggester.go | 4 +- typedapi/types/fieldsummary.go | 4 +- typedapi/types/fieldsusagebody.go | 4 +- typedapi/types/fieldtypes.go | 4 +- typedapi/types/fieldtypesmappings.go | 4 +- typedapi/types/fieldvalue.go | 4 +- .../types/fieldvaluefactorscorefunction.go | 4 +- typedapi/types/filecountsnapshotstats.go | 4 +- typedapi/types/filedetails.go | 4 +- typedapi/types/filesystem.go | 4 +- typedapi/types/filesystemtotal.go | 4 +- typedapi/types/fillmaskinferenceoptions.go | 4 +- .../types/fillmaskinferenceupdateoptions.go | 4 +- typedapi/types/filteraggregate.go | 4 +- typedapi/types/filterref.go | 4 +- typedapi/types/filtersaggregate.go | 4 +- typedapi/types/filtersaggregation.go | 4 +- typedapi/types/filtersbucket.go | 4 +- typedapi/types/fingerprintanalyzer.go | 4 +- typedapi/types/fingerprinttokenfilter.go | 4 +- typedapi/types/flattened.go | 4 +- typedapi/types/flattenedproperty.go | 16 +- typedapi/types/floatnumberproperty.go | 16 +- typedapi/types/floatrangeproperty.go | 16 +- typedapi/types/flushstats.go | 4 +- typedapi/types/followerindex.go | 4 +- typedapi/types/followerindexparameters.go | 4 +- typedapi/types/followindexstats.go | 4 +- typedapi/types/followstats.go | 4 +- typedapi/types/forcemergeconfiguration.go | 4 +- typedapi/types/forcemergeresponsebody.go | 4 +- typedapi/types/foreachprocessor.go | 4 +- .../types/formattablemetricaggregation.go | 4 +- typedapi/types/foundstatus.go | 4 +- .../types/frequencyencodingpreprocessor.go | 4 +- typedapi/types/frequentitemsetsaggregate.go | 4 +- typedapi/types/frequentitemsetsaggregation.go | 4 +- typedapi/types/frequentitemsetsbucket.go | 4 +- typedapi/types/frequentitemsetsfield.go | 4 +- typedapi/types/frozenindices.go | 4 +- typedapi/types/functionscore.go | 4 +- typedapi/types/functionscorequery.go | 4 +- typedapi/types/fuzziness.go | 4 +- typedapi/types/fuzzyquery.go | 4 +- typedapi/types/garbagecollector.go | 4 +- typedapi/types/garbagecollectortotal.go | 4 +- typedapi/types/geoboundingboxquery.go | 4 +- typedapi/types/geobounds.go | 4 +- typedapi/types/geoboundsaggregate.go | 4 +- typedapi/types/geoboundsaggregation.go | 4 +- typedapi/types/geocentroidaggregate.go | 4 +- typedapi/types/geocentroidaggregation.go | 4 +- typedapi/types/geodecayfunction.go | 4 +- typedapi/types/geodistanceaggregate.go | 4 +- typedapi/types/geodistanceaggregation.go | 4 +- typedapi/types/geodistancefeaturequery.go | 4 +- typedapi/types/geodistancequery.go | 4 +- typedapi/types/geodistancesort.go | 4 +- typedapi/types/geohashgridaggregate.go | 4 +- typedapi/types/geohashgridaggregation.go | 4 +- typedapi/types/geohashgridbucket.go | 4 +- typedapi/types/geohashlocation.go | 4 +- typedapi/types/geohashprecision.go | 4 +- typedapi/types/geohexgridaggregate.go | 4 +- typedapi/types/geohexgridaggregation.go | 4 +- typedapi/types/geohexgridbucket.go | 4 +- typedapi/types/geoipdownloadstatistics.go | 4 +- typedapi/types/geoipnodedatabasename.go | 4 +- typedapi/types/geoipnodedatabases.go | 4 +- typedapi/types/geoipprocessor.go | 4 +- typedapi/types/geoline.go | 4 +- typedapi/types/geolineaggregate.go | 4 +- typedapi/types/geolineaggregation.go | 4 +- typedapi/types/geolinepoint.go | 4 +- typedapi/types/geolinesort.go | 4 +- typedapi/types/geolocation.go | 4 +- typedapi/types/geopointproperty.go | 16 +- typedapi/types/geopolygonpoints.go | 4 +- typedapi/types/geopolygonquery.go | 4 +- typedapi/types/georesults.go | 4 +- typedapi/types/geoshapefieldquery.go | 4 +- typedapi/types/geoshapeproperty.go | 16 +- typedapi/types/geoshapequery.go | 4 +- typedapi/types/geotilegridaggregate.go | 4 +- typedapi/types/geotilegridaggregation.go | 4 +- typedapi/types/geotilegridbucket.go | 4 +- typedapi/types/getmigrationfeature.go | 4 +- typedapi/types/getresult.go | 4 +- typedapi/types/getscriptcontext.go | 4 +- typedapi/types/getstats.go | 4 +- typedapi/types/getuserprofileerrors.go | 4 +- typedapi/types/globalaggregate.go | 4 +- typedapi/types/globalaggregation.go | 4 +- typedapi/types/globalprivilege.go | 4 +- .../googlenormalizeddistanceheuristic.go | 4 +- typedapi/types/grantapikey.go | 4 +- typedapi/types/grokprocessor.go | 4 +- typedapi/types/groupings.go | 4 +- typedapi/types/gsubprocessor.go | 4 +- typedapi/types/halffloatnumberproperty.go | 16 +- typedapi/types/haschildquery.go | 4 +- typedapi/types/hasparentquery.go | 4 +- .../types/hasprivilegesuserprofileerrors.go | 4 +- typedapi/types/hdrmethod.go | 4 +- typedapi/types/hdrpercentileranksaggregate.go | 4 +- typedapi/types/hdrpercentilesaggregate.go | 4 +- typedapi/types/healthrecord.go | 4 +- typedapi/types/healthresponsebody.go | 4 +- typedapi/types/healthstatistics.go | 4 +- typedapi/types/helprecord.go | 4 +- typedapi/types/highlight.go | 4 +- typedapi/types/highlightfield.go | 4 +- typedapi/types/hint.go | 4 +- typedapi/types/histogramaggregate.go | 4 +- typedapi/types/histogramaggregation.go | 4 +- typedapi/types/histogrambucket.go | 4 +- typedapi/types/histogramgrouping.go | 4 +- typedapi/types/histogramproperty.go | 16 +- typedapi/types/hit.go | 4 +- typedapi/types/hitsevent.go | 4 +- typedapi/types/hitsmetadata.go | 4 +- typedapi/types/hitssequence.go | 4 +- typedapi/types/holtlinearmodelsettings.go | 4 +- .../types/holtmovingaverageaggregation.go | 4 +- typedapi/types/holtwintersmodelsettings.go | 4 +- .../holtwintersmovingaverageaggregation.go | 4 +- typedapi/types/hop.go | 4 +- typedapi/types/hotthread.go | 4 +- typedapi/types/hourandminute.go | 4 +- typedapi/types/hourlyschedule.go | 4 +- typedapi/types/htmlstripcharfilter.go | 4 +- typedapi/types/http.go | 4 +- typedapi/types/httpemailattachment.go | 4 +- typedapi/types/httpheaders.go | 4 +- typedapi/types/httpinput.go | 4 +- typedapi/types/httpinputauthentication.go | 4 +- .../types/httpinputbasicauthentication.go | 4 +- typedapi/types/httpinputproxy.go | 4 +- typedapi/types/httpinputrequestdefinition.go | 4 +- typedapi/types/httpinputrequestresult.go | 4 +- typedapi/types/httpinputresponseresult.go | 4 +- typedapi/types/hunspelltokenfilter.go | 4 +- typedapi/types/hyperparameter.go | 4 +- typedapi/types/hyperparameters.go | 4 +- .../hyphenationdecompoundertokenfilter.go | 4 +- typedapi/types/icuanalyzer.go | 4 +- typedapi/types/icucollationtokenfilter.go | 4 +- typedapi/types/icufoldingtokenfilter.go | 4 +- typedapi/types/icunormalizationcharfilter.go | 4 +- typedapi/types/icunormalizationtokenfilter.go | 4 +- typedapi/types/icutokenizer.go | 4 +- typedapi/types/icutransformtokenfilter.go | 4 +- typedapi/types/ids.go | 4 +- typedapi/types/idsquery.go | 4 +- typedapi/types/ilm.go | 4 +- typedapi/types/ilmindicator.go | 4 +- typedapi/types/ilmindicatordetails.go | 4 +- typedapi/types/ilmpolicy.go | 4 +- typedapi/types/ilmpolicystatistics.go | 4 +- typedapi/types/impact.go | 4 +- typedapi/types/indexaction.go | 4 +- typedapi/types/indexaliases.go | 4 +- typedapi/types/indexanddatastreamaction.go | 4 +- typedapi/types/indexcapabilities.go | 4 +- typedapi/types/indexdetails.go | 4 +- typedapi/types/indexfield.go | 4 +- typedapi/types/indexhealthstats.go | 4 +- .../types/indexingpressurememorysummary.go | 4 +- typedapi/types/indexingslowlogsettings.go | 4 +- typedapi/types/indexingslowlogtresholds.go | 4 +- typedapi/types/indexingstats.go | 4 +- typedapi/types/indexmappingrecord.go | 4 +- typedapi/types/indexoperation.go | 4 +- typedapi/types/indexprivilegescheck.go | 4 +- typedapi/types/indexresult.go | 4 +- typedapi/types/indexresultsummary.go | 4 +- typedapi/types/indexrouting.go | 4 +- typedapi/types/indexroutingallocation.go | 4 +- typedapi/types/indexroutingallocationdisk.go | 4 +- .../types/indexroutingallocationinclude.go | 4 +- .../indexroutingallocationinitialrecovery.go | 4 +- typedapi/types/indexroutingrebalance.go | 4 +- typedapi/types/indexsegment.go | 4 +- typedapi/types/indexsegmentsort.go | 4 +- typedapi/types/indexsettingblocks.go | 4 +- typedapi/types/indexsettings.go | 4 +- typedapi/types/indexsettingsanalysis.go | 4 +- typedapi/types/indexsettingslifecycle.go | 4 +- typedapi/types/indexsettingslifecyclestep.go | 4 +- typedapi/types/indexsettingstimeseries.go | 4 +- typedapi/types/indexstate.go | 4 +- typedapi/types/indexstats.go | 4 +- typedapi/types/indextemplate.go | 4 +- .../indextemplatedatastreamconfiguration.go | 4 +- typedapi/types/indextemplateitem.go | 4 +- typedapi/types/indextemplatemapping.go | 4 +- typedapi/types/indextemplatesummary.go | 4 +- typedapi/types/indexversioning.go | 4 +- typedapi/types/indicatornode.go | 4 +- typedapi/types/indicators.go | 4 +- typedapi/types/indices.go | 4 +- typedapi/types/indicesaction.go | 4 +- typedapi/types/indicesblockstatus.go | 4 +- typedapi/types/indicesindexingpressure.go | 4 +- .../types/indicesindexingpressurememory.go | 4 +- typedapi/types/indicesmodifyaction.go | 4 +- typedapi/types/indicesoptions.go | 4 +- typedapi/types/indicesprivileges.go | 4 +- typedapi/types/indicesprivilegesquery.go | 4 +- typedapi/types/indicesrecord.go | 4 +- typedapi/types/indicesshardsstats.go | 4 +- typedapi/types/indicesshardstats.go | 4 +- typedapi/types/indicesshardstores.go | 4 +- typedapi/types/indicesstats.go | 4 +- .../types/indicesvalidationexplanation.go | 4 +- typedapi/types/indicesversions.go | 4 +- typedapi/types/inferenceaggregate.go | 4 +- typedapi/types/inferenceaggregation.go | 4 +- typedapi/types/inferenceclassimportance.go | 4 +- typedapi/types/inferenceconfig.go | 4 +- .../types/inferenceconfigclassification.go | 4 +- typedapi/types/inferenceconfigcontainer.go | 4 +- .../types/inferenceconfigcreatecontainer.go | 4 +- typedapi/types/inferenceconfigregression.go | 4 +- .../types/inferenceconfigupdatecontainer.go | 4 +- typedapi/types/inferencefeatureimportance.go | 4 +- typedapi/types/inferenceprocessor.go | 4 +- typedapi/types/inferenceresponseresult.go | 4 +- typedapi/types/inferenceresult.go | 36 + typedapi/types/inferencetopclassentry.go | 4 +- typedapi/types/influence.go | 4 +- typedapi/types/influencer.go | 4 +- typedapi/types/infofeaturestate.go | 4 +- typedapi/types/ingestpipeline.go | 12 +- typedapi/types/ingesttotal.go | 4 +- typedapi/types/inlineget.go | 4 +- typedapi/types/inlinegetdictuserdefined.go | 4 +- typedapi/types/inlinescript.go | 4 +- typedapi/types/innerhits.go | 4 +- typedapi/types/innerhitsresult.go | 4 +- typedapi/types/inprogress.go | 4 +- typedapi/types/input.go | 4 +- typedapi/types/integernumberproperty.go | 16 +- typedapi/types/integerrangeproperty.go | 16 +- typedapi/types/intervals.go | 4 +- typedapi/types/intervalsallof.go | 4 +- typedapi/types/intervalsanyof.go | 4 +- typedapi/types/intervalsfilter.go | 4 +- typedapi/types/intervalsfuzzy.go | 4 +- typedapi/types/intervalsmatch.go | 4 +- typedapi/types/intervalsprefix.go | 4 +- typedapi/types/intervalsquery.go | 4 +- typedapi/types/intervalswildcard.go | 4 +- typedapi/types/invertedindex.go | 4 +- typedapi/types/invocation.go | 4 +- typedapi/types/invocations.go | 4 +- typedapi/types/iostatdevice.go | 4 +- typedapi/types/iostats.go | 4 +- typedapi/types/ipfilter.go | 4 +- typedapi/types/ipprefixaggregate.go | 4 +- typedapi/types/ipprefixaggregation.go | 4 +- typedapi/types/ipprefixbucket.go | 4 +- typedapi/types/ipproperty.go | 16 +- typedapi/types/iprangeaggregate.go | 4 +- typedapi/types/iprangeaggregation.go | 4 +- typedapi/types/iprangeaggregationrange.go | 4 +- typedapi/types/iprangebucket.go | 4 +- typedapi/types/iprangeproperty.go | 16 +- typedapi/types/job.go | 4 +- typedapi/types/jobblocked.go | 4 +- typedapi/types/jobconfig.go | 4 +- typedapi/types/jobforecaststatistics.go | 4 +- typedapi/types/jobsrecord.go | 4 +- typedapi/types/jobstatistics.go | 4 +- typedapi/types/jobstats.go | 4 +- typedapi/types/jobtimingstats.go | 4 +- typedapi/types/jobusage.go | 4 +- typedapi/types/joinprocessor.go | 4 +- typedapi/types/joinproperty.go | 16 +- typedapi/types/jsonprocessor.go | 4 +- typedapi/types/jvm.go | 4 +- typedapi/types/jvmclasses.go | 4 +- typedapi/types/jvmmemorystats.go | 4 +- typedapi/types/jvmstats.go | 4 +- typedapi/types/jvmthreads.go | 4 +- typedapi/types/keeptypestokenfilter.go | 4 +- typedapi/types/keepwordstokenfilter.go | 4 +- typedapi/types/keyedpercentiles.go | 4 +- typedapi/types/keyedprocessor.go | 4 +- typedapi/types/keyvalueprocessor.go | 4 +- typedapi/types/keywordanalyzer.go | 4 +- typedapi/types/keywordmarkertokenfilter.go | 4 +- typedapi/types/keywordproperty.go | 16 +- typedapi/types/keywordtokenizer.go | 4 +- typedapi/types/kibanatoken.go | 4 +- typedapi/types/knnquery.go | 4 +- typedapi/types/kstemtokenfilter.go | 4 +- typedapi/types/kuromojianalyzer.go | 4 +- .../types/kuromojiiterationmarkcharfilter.go | 4 +- .../types/kuromojipartofspeechtokenfilter.go | 4 +- .../types/kuromojireadingformtokenfilter.go | 4 +- typedapi/types/kuromojistemmertokenfilter.go | 4 +- typedapi/types/kuromojitokenizer.go | 4 +- typedapi/types/languageanalyzer.go | 4 +- typedapi/types/languagecontext.go | 4 +- typedapi/types/laplacesmoothingmodel.go | 4 +- typedapi/types/latest.go | 4 +- typedapi/types/latlongeolocation.go | 4 +- typedapi/types/lengthtokenfilter.go | 4 +- typedapi/types/lettertokenizer.go | 4 +- typedapi/types/license.go | 4 +- typedapi/types/licenseinformation.go | 4 +- typedapi/types/lifecycle.go | 4 +- typedapi/types/lifecycleexplain.go | 4 +- typedapi/types/lifecycleexplainmanaged.go | 4 +- .../types/lifecycleexplainphaseexecution.go | 4 +- typedapi/types/lifecycleexplainunmanaged.go | 4 +- typedapi/types/like.go | 4 +- typedapi/types/likedocument.go | 4 +- typedapi/types/limits.go | 4 +- typedapi/types/limittokencounttokenfilter.go | 4 +- .../linearinterpolationsmoothingmodel.go | 4 +- .../types/linearmovingaverageaggregation.go | 4 +- typedapi/types/loggingaction.go | 4 +- typedapi/types/loggingresult.go | 4 +- typedapi/types/logstashpipeline.go | 4 +- typedapi/types/longnumberproperty.go | 16 +- typedapi/types/longrangeproperty.go | 16 +- typedapi/types/longraretermsaggregate.go | 4 +- typedapi/types/longraretermsbucket.go | 4 +- typedapi/types/longtermsaggregate.go | 4 +- typedapi/types/longtermsbucket.go | 4 +- typedapi/types/lowercasenormalizer.go | 4 +- typedapi/types/lowercaseprocessor.go | 4 +- typedapi/types/lowercasetokenfilter.go | 4 +- typedapi/types/lowercasetokenizer.go | 4 +- typedapi/types/machinelearning.go | 4 +- typedapi/types/manageuserprivileges.go | 4 +- typedapi/types/mapboxvectortiles.go | 4 +- typedapi/types/mappingcharfilter.go | 4 +- typedapi/types/mappinglimitsettings.go | 4 +- typedapi/types/mappinglimitsettingsdepth.go | 4 +- .../mappinglimitsettingsdimensionfields.go | 4 +- .../mappinglimitsettingsfieldnamelength.go | 4 +- .../types/mappinglimitsettingsnestedfields.go | 4 +- .../mappinglimitsettingsnestedobjects.go | 4 +- .../types/mappinglimitsettingstotalfields.go | 4 +- typedapi/types/mappingstats.go | 4 +- typedapi/types/masterisstableindicator.go | 4 +- ...erisstableindicatorclusterformationnode.go | 4 +- .../types/masterisstableindicatordetails.go | 4 +- ...stableindicatorexceptionfetchinghistory.go | 4 +- typedapi/types/masterrecord.go | 4 +- typedapi/types/matchallquery.go | 4 +- typedapi/types/matchboolprefixquery.go | 4 +- typedapi/types/matchnonequery.go | 4 +- typedapi/types/matchonlytextproperty.go | 10 +- typedapi/types/matchphraseprefixquery.go | 4 +- typedapi/types/matchphrasequery.go | 4 +- typedapi/types/matchquery.go | 4 +- typedapi/types/matrixaggregation.go | 4 +- typedapi/types/matrixstatsaggregate.go | 4 +- typedapi/types/matrixstatsaggregation.go | 4 +- typedapi/types/matrixstatsfields.go | 4 +- typedapi/types/maxaggregate.go | 4 +- typedapi/types/maxaggregation.go | 4 +- typedapi/types/maxbucketaggregation.go | 4 +- .../types/medianabsolutedeviationaggregate.go | 4 +- .../medianabsolutedeviationaggregation.go | 4 +- typedapi/types/memmlstats.go | 4 +- typedapi/types/memory.go | 4 +- typedapi/types/memorystats.go | 4 +- typedapi/types/memstats.go | 4 +- typedapi/types/merge.go | 4 +- typedapi/types/mergescheduler.go | 4 +- typedapi/types/mergesstats.go | 4 +- typedapi/types/metadata.go | 4 +- typedapi/types/metrics.go | 4 +- typedapi/types/mgetoperation.go | 4 +- typedapi/types/mgetresponseitem.go | 4 +- typedapi/types/migrationfeatureindexinfo.go | 4 +- typedapi/types/minaggregate.go | 4 +- typedapi/types/minaggregation.go | 4 +- typedapi/types/minbucketaggregation.go | 4 +- typedapi/types/minimallicenseinformation.go | 4 +- typedapi/types/minimumshouldmatch.go | 4 +- typedapi/types/missing.go | 4 +- typedapi/types/missingaggregate.go | 4 +- typedapi/types/missingaggregation.go | 4 +- typedapi/types/mlcounter.go | 4 +- typedapi/types/mldatafeed.go | 4 +- typedapi/types/mldataframeanalyticsjobs.go | 4 +- .../types/mldataframeanalyticsjobsanalysis.go | 4 +- .../types/mldataframeanalyticsjobscount.go | 4 +- .../types/mldataframeanalyticsjobsmemory.go | 4 +- typedapi/types/mlfilter.go | 4 +- typedapi/types/mlinference.go | 4 +- typedapi/types/mlinferencedeployments.go | 4 +- .../types/mlinferencedeploymentstimems.go | 4 +- typedapi/types/mlinferenceingestprocessor.go | 4 +- .../types/mlinferenceingestprocessorcount.go | 4 +- typedapi/types/mlinferencetrainedmodels.go | 4 +- .../types/mlinferencetrainedmodelscount.go | 4 +- typedapi/types/mljobforecasts.go | 4 +- typedapi/types/modelconfig.go | 90 +++ typedapi/types/modelconfigcontainer.go | 113 +++ typedapi/types/modelplotconfig.go | 4 +- typedapi/types/modelsizestats.go | 4 +- typedapi/types/modelsnapshot.go | 4 +- typedapi/types/modelsnapshotupgrade.go | 4 +- typedapi/types/monitoring.go | 4 +- typedapi/types/morelikethisquery.go | 4 +- typedapi/types/mountedsnapshot.go | 4 +- typedapi/types/movingaverageaggregation.go | 4 +- typedapi/types/movingfunctionaggregation.go | 4 +- .../types/movingpercentilesaggregation.go | 4 +- typedapi/types/msearchrequestitem.go | 4 +- typedapi/types/msearchresponseitem.go | 4 +- typedapi/types/mtermvectorsoperation.go | 4 +- ...ucketaggregatebaseadjacencymatrixbucket.go | 4 +- ...multibucketaggregatebasecompositebucket.go | 4 +- ...ibucketaggregatebasedatehistogrambucket.go | 4 +- ...ltibucketaggregatebasedoubletermsbucket.go | 4 +- .../multibucketaggregatebasefiltersbucket.go | 4 +- ...cketaggregatebasefrequentitemsetsbucket.go | 4 +- ...ltibucketaggregatebasegeohashgridbucket.go | 4 +- ...ultibucketaggregatebasegeohexgridbucket.go | 4 +- ...ltibucketaggregatebasegeotilegridbucket.go | 4 +- ...multibucketaggregatebasehistogrambucket.go | 4 +- .../multibucketaggregatebaseipprefixbucket.go | 4 +- .../multibucketaggregatebaseiprangebucket.go | 4 +- ...ibucketaggregatebaselongraretermsbucket.go | 4 +- ...multibucketaggregatebaselongtermsbucket.go | 4 +- ...ultibucketaggregatebasemultitermsbucket.go | 4 +- .../multibucketaggregatebaserangebucket.go | 4 +- ...aggregatebasesignificantlongtermsbucket.go | 4 +- ...gregatebasesignificantstringtermsbucket.go | 4 +- ...ucketaggregatebasestringraretermsbucket.go | 4 +- ...ltibucketaggregatebasestringtermsbucket.go | 4 +- ...gregatebasevariablewidthhistogrambucket.go | 4 +- .../types/multibucketaggregatebasevoid.go | 4 +- typedapi/types/multigeterror.go | 4 +- typedapi/types/multimatchquery.go | 4 +- typedapi/types/multiplexertokenfilter.go | 4 +- typedapi/types/multisearchbody.go | 4 +- typedapi/types/multisearchheader.go | 4 +- typedapi/types/multisearchitem.go | 4 +- typedapi/types/multisearchresult.go | 4 +- typedapi/types/multitermlookup.go | 4 +- typedapi/types/multitermsaggregate.go | 4 +- typedapi/types/multitermsaggregation.go | 4 +- typedapi/types/multitermsbucket.go | 4 +- typedapi/types/murmur3hashproperty.go | 16 +- typedapi/types/mutualinformationheuristic.go | 4 +- typedapi/types/names.go | 4 +- typedapi/types/nativecode.go | 4 +- typedapi/types/nativecodeinformation.go | 4 +- typedapi/types/nerinferenceoptions.go | 4 +- typedapi/types/nerinferenceupdateoptions.go | 4 +- typedapi/types/nestedaggregate.go | 4 +- typedapi/types/nestedaggregation.go | 4 +- typedapi/types/nestedidentity.go | 4 +- typedapi/types/nestedproperty.go | 16 +- typedapi/types/nestedquery.go | 4 +- typedapi/types/nestedsortvalue.go | 4 +- typedapi/types/nevercondition.go | 4 +- typedapi/types/ngramtokenfilter.go | 4 +- typedapi/types/ngramtokenizer.go | 4 +- typedapi/types/nlpberttokenizationconfig.go | 4 +- .../types/nlprobertatokenizationconfig.go | 4 +- .../types/nlptokenizationupdateoptions.go | 4 +- typedapi/types/node.go | 4 +- typedapi/types/nodeallocationexplanation.go | 4 +- typedapi/types/nodeattributes.go | 4 +- typedapi/types/nodeattributesrecord.go | 4 +- typedapi/types/nodebufferpool.go | 4 +- typedapi/types/nodediskusage.go | 4 +- typedapi/types/nodeids.go | 4 +- typedapi/types/nodeinfo.go | 4 +- typedapi/types/nodeinfoaction.go | 4 +- typedapi/types/nodeinfoaggregation.go | 4 +- typedapi/types/nodeinfobootstrap.go | 4 +- typedapi/types/nodeinfoclient.go | 4 +- typedapi/types/nodeinfodiscover.go | 4 +- typedapi/types/nodeinfohttp.go | 4 +- typedapi/types/nodeinfoingest.go | 4 +- typedapi/types/nodeinfoingestdownloader.go | 4 +- typedapi/types/nodeinfoingestinfo.go | 4 +- typedapi/types/nodeinfoingestprocessor.go | 4 +- typedapi/types/nodeinfojvmmemory.go | 4 +- typedapi/types/nodeinfomemory.go | 4 +- typedapi/types/nodeinfonetwork.go | 4 +- typedapi/types/nodeinfonetworkinterface.go | 4 +- typedapi/types/nodeinfooscpu.go | 4 +- typedapi/types/nodeinfopath.go | 4 +- typedapi/types/nodeinforepositories.go | 4 +- typedapi/types/nodeinforepositoriesurl.go | 4 +- typedapi/types/nodeinfoscript.go | 4 +- typedapi/types/nodeinfosearch.go | 4 +- typedapi/types/nodeinfosearchremote.go | 4 +- typedapi/types/nodeinfosettings.go | 4 +- typedapi/types/nodeinfosettingscluster.go | 4 +- .../types/nodeinfosettingsclusterelection.go | 4 +- typedapi/types/nodeinfosettingshttp.go | 4 +- typedapi/types/nodeinfosettingshttptype.go | 4 +- typedapi/types/nodeinfosettingsingest.go | 4 +- typedapi/types/nodeinfosettingsnetwork.go | 4 +- typedapi/types/nodeinfosettingsnode.go | 4 +- typedapi/types/nodeinfosettingstransport.go | 4 +- .../nodeinfosettingstransportfeatures.go | 4 +- .../types/nodeinfosettingstransporttype.go | 4 +- typedapi/types/nodeinfotransport.go | 4 +- typedapi/types/nodeinfoxpack.go | 4 +- typedapi/types/nodeinfoxpacklicense.go | 4 +- typedapi/types/nodeinfoxpacklicensetype.go | 4 +- typedapi/types/nodeinfoxpacksecurity.go | 4 +- typedapi/types/nodeinfoxpacksecurityauthc.go | 4 +- .../types/nodeinfoxpacksecurityauthcrealms.go | 4 +- .../nodeinfoxpacksecurityauthcrealmsstatus.go | 4 +- .../types/nodeinfoxpacksecurityauthctoken.go | 4 +- typedapi/types/nodeinfoxpacksecurityssl.go | 4 +- typedapi/types/nodejvminfo.go | 4 +- typedapi/types/nodeoperatingsysteminfo.go | 4 +- typedapi/types/nodepackagingtype.go | 4 +- typedapi/types/nodeprocessinfo.go | 4 +- typedapi/types/nodereloaderror.go | 4 +- typedapi/types/nodereloadresult.go | 4 +- typedapi/types/nodescontext.go | 4 +- typedapi/types/nodescredentials.go | 4 +- typedapi/types/nodescredentialsfiletoken.go | 4 +- typedapi/types/nodeshard.go | 4 +- typedapi/types/nodeshutdownstatus.go | 4 +- typedapi/types/nodesindexingpressure.go | 4 +- typedapi/types/nodesindexingpressurememory.go | 4 +- typedapi/types/nodesingest.go | 4 +- typedapi/types/nodesrecord.go | 4 +- typedapi/types/nodestatistics.go | 4 +- typedapi/types/nodetasks.go | 4 +- typedapi/types/nodethreadpoolinfo.go | 4 +- typedapi/types/nodeusage.go | 4 +- typedapi/types/norianalyzer.go | 4 +- typedapi/types/noripartofspeechtokenfilter.go | 4 +- typedapi/types/noritokenizer.go | 4 +- typedapi/types/normalizeaggregation.go | 4 +- typedapi/types/normalizer.go | 4 +- typedapi/types/numberrangequery.go | 4 +- typedapi/types/numericdecayfunction.go | 4 +- typedapi/types/numericfielddata.go | 4 +- typedapi/types/objectproperty.go | 16 +- typedapi/types/onehotencodingpreprocessor.go | 4 +- typedapi/types/operatingsystem.go | 4 +- typedapi/types/operatingsystemmemoryinfo.go | 4 +- typedapi/types/operationcontainer.go | 4 +- typedapi/types/outlierdetectionparameters.go | 4 +- typedapi/types/overallbucket.go | 4 +- typedapi/types/overallbucketjob.go | 4 +- typedapi/types/overlapping.go | 4 +- typedapi/types/page.go | 4 +- typedapi/types/pagerdutyaction.go | 4 +- typedapi/types/pagerdutycontext.go | 4 +- typedapi/types/pagerdutyevent.go | 4 +- typedapi/types/pagerdutyeventproxy.go | 4 +- typedapi/types/pagerdutyresult.go | 4 +- typedapi/types/painlesscontextsetup.go | 4 +- typedapi/types/parentaggregate.go | 4 +- typedapi/types/parentaggregation.go | 4 +- typedapi/types/parentidquery.go | 4 +- typedapi/types/parenttaskinfo.go | 4 +- typedapi/types/passthroughinferenceoptions.go | 4 +- .../passthroughinferenceupdateoptions.go | 4 +- typedapi/types/pathhierarchytokenizer.go | 8 +- typedapi/types/patternanalyzer.go | 4 +- typedapi/types/patterncapturetokenfilter.go | 4 +- typedapi/types/patternreplacecharfilter.go | 4 +- typedapi/types/patternreplacetokenfilter.go | 4 +- typedapi/types/patterntokenizer.go | 4 +- typedapi/types/pendingtask.go | 4 +- typedapi/types/pendingtasksrecord.go | 4 +- typedapi/types/percentage.go | 4 +- typedapi/types/percentagescoreheuristic.go | 4 +- typedapi/types/percentileranksaggregation.go | 4 +- typedapi/types/percentiles.go | 4 +- typedapi/types/percentilesaggregation.go | 4 +- typedapi/types/percentilesbucketaggregate.go | 4 +- .../types/percentilesbucketaggregation.go | 4 +- typedapi/types/percolatequery.go | 4 +- typedapi/types/percolatorproperty.go | 16 +- typedapi/types/perpartitioncategorization.go | 4 +- typedapi/types/persistenttaskstatus.go | 4 +- typedapi/types/phase.go | 4 +- typedapi/types/phases.go | 4 +- typedapi/types/phonetictokenfilter.go | 4 +- typedapi/types/phrasesuggest.go | 4 +- typedapi/types/phrasesuggestcollate.go | 4 +- typedapi/types/phrasesuggestcollatequery.go | 4 +- typedapi/types/phrasesuggester.go | 4 +- typedapi/types/phrasesuggesthighlight.go | 4 +- typedapi/types/phrasesuggestoption.go | 4 +- typedapi/types/pinneddoc.go | 4 +- typedapi/types/pinnedquery.go | 4 +- typedapi/types/pipelineconfig.go | 4 +- typedapi/types/pipelinemetadata.go | 4 +- typedapi/types/pipelineprocessor.go | 4 +- typedapi/types/pipelinesettings.go | 4 +- typedapi/types/pipelinesimulation.go | 4 +- ...pipeseparatedflagssimplequerystringflag.go | 4 +- typedapi/types/pivot.go | 4 +- typedapi/types/pivotgroupbycontainer.go | 4 +- typedapi/types/pluginsrecord.go | 4 +- typedapi/types/pluginsstatus.go | 4 +- typedapi/types/pluginstats.go | 4 +- typedapi/types/pointintimereference.go | 4 +- typedapi/types/pointproperty.go | 16 +- typedapi/types/pool.go | 4 +- typedapi/types/porterstemtokenfilter.go | 4 +- typedapi/types/postmigrationfeature.go | 4 +- typedapi/types/predicatetokenfilter.go | 4 +- typedapi/types/predictedvalue.go | 4 +- typedapi/types/prefixquery.go | 4 +- typedapi/types/preprocessor.go | 4 +- typedapi/types/pressurememory.go | 4 +- typedapi/types/privileges.go | 4 +- typedapi/types/privilegesactions.go | 4 +- typedapi/types/privilegescheck.go | 4 +- typedapi/types/process.go | 4 +- typedapi/types/processor.go | 4 +- typedapi/types/processorcontainer.go | 4 +- typedapi/types/profile.go | 4 +- typedapi/types/property.go | 5 +- typedapi/types/publishedclusterstates.go | 4 +- typedapi/types/queries.go | 4 +- typedapi/types/query.go | 4 +- typedapi/types/querybreakdown.go | 4 +- typedapi/types/querycachestats.go | 4 +- typedapi/types/queryprofile.go | 4 +- typedapi/types/queryrule.go | 4 +- typedapi/types/queryruleactions.go | 4 +- typedapi/types/queryrulecriteria.go | 4 +- typedapi/types/queryruleset.go | 4 +- typedapi/types/queryrulesetlistitem.go | 4 +- typedapi/types/querystringquery.go | 4 +- typedapi/types/queryvectorbuilder.go | 4 +- typedapi/types/querywatch.go | 4 +- .../questionansweringinferenceoptions.go | 4 +- ...questionansweringinferenceupdateoptions.go | 4 +- typedapi/types/randomscorefunction.go | 4 +- typedapi/types/rangeaggregate.go | 4 +- typedapi/types/rangeaggregation.go | 4 +- typedapi/types/rangebucket.go | 4 +- typedapi/types/rangequery.go | 4 +- typedapi/types/rankcontainer.go | 4 +- typedapi/types/rankevalhit.go | 4 +- typedapi/types/rankevalhititem.go | 4 +- typedapi/types/rankevalmetric.go | 4 +- typedapi/types/rankevalmetricdetail.go | 4 +- .../rankevalmetricdiscountedcumulativegain.go | 4 +- .../rankevalmetricexpectedreciprocalrank.go | 4 +- .../types/rankevalmetricmeanreciprocalrank.go | 4 +- typedapi/types/rankevalmetricprecision.go | 4 +- .../types/rankevalmetricratingtreshold.go | 4 +- typedapi/types/rankevalmetricrecall.go | 4 +- typedapi/types/rankevalquery.go | 4 +- typedapi/types/rankevalrequestitem.go | 4 +- typedapi/types/rankfeaturefunction.go | 4 +- typedapi/types/rankfeaturefunctionlinear.go | 4 +- .../types/rankfeaturefunctionlogarithm.go | 4 +- .../types/rankfeaturefunctionsaturation.go | 4 +- typedapi/types/rankfeaturefunctionsigmoid.go | 4 +- typedapi/types/rankfeatureproperty.go | 16 +- typedapi/types/rankfeaturequery.go | 4 +- typedapi/types/rankfeaturesproperty.go | 16 +- typedapi/types/raretermsaggregation.go | 4 +- typedapi/types/rateaggregate.go | 4 +- typedapi/types/rateaggregation.go | 4 +- typedapi/types/readexception.go | 4 +- typedapi/types/realmcache.go | 4 +- typedapi/types/realminfo.go | 4 +- typedapi/types/recording.go | 4 +- typedapi/types/recoverybytes.go | 4 +- typedapi/types/recoveryfiles.go | 4 +- typedapi/types/recoveryindexstatus.go | 4 +- typedapi/types/recoveryorigin.go | 4 +- typedapi/types/recoveryrecord.go | 4 +- typedapi/types/recoverystartstatus.go | 4 +- typedapi/types/recoverystats.go | 4 +- typedapi/types/recoverystatus.go | 4 +- typedapi/types/refreshstats.go | 4 +- typedapi/types/regexoptions.go | 4 +- typedapi/types/regexpquery.go | 4 +- typedapi/types/regressioninferenceoptions.go | 4 +- typedapi/types/reindexdestination.go | 4 +- typedapi/types/reindexnode.go | 4 +- typedapi/types/reindexsource.go | 4 +- typedapi/types/reindexstatus.go | 4 +- typedapi/types/reindextask.go | 4 +- typedapi/types/reloaddetails.go | 4 +- typedapi/types/reloadresult.go | 4 +- typedapi/types/relocationfailureinfo.go | 4 +- typedapi/types/remotesource.go | 4 +- typedapi/types/removeaction.go | 4 +- typedapi/types/removeduplicatestokenfilter.go | 4 +- typedapi/types/removeindexaction.go | 4 +- typedapi/types/removeprocessor.go | 4 +- typedapi/types/renameprocessor.go | 4 +- typedapi/types/reportingemailattachment.go | 4 +- typedapi/types/repositoriesrecord.go | 4 +- typedapi/types/repository.go | 4 +- .../types/repositoryintegrityindicator.go | 4 +- .../repositoryintegrityindicatordetails.go | 4 +- typedapi/types/repositorylocation.go | 4 +- .../types/repositorymeteringinformation.go | 4 +- typedapi/types/repositorysettings.go | 4 +- typedapi/types/requestcachestats.go | 4 +- typedapi/types/requestcounts.go | 4 +- typedapi/types/requestitem.go | 4 +- typedapi/types/reroutedecision.go | 4 +- typedapi/types/rerouteexplanation.go | 4 +- typedapi/types/rerouteparameters.go | 4 +- typedapi/types/rescore.go | 4 +- typedapi/types/rescorequery.go | 4 +- typedapi/types/reservedsize.go | 4 +- typedapi/types/resolveindexaliasitem.go | 4 +- typedapi/types/resolveindexdatastreamsitem.go | 4 +- typedapi/types/resolveindexitem.go | 4 +- typedapi/types/resourceprivileges.go | 4 +- typedapi/types/responsebody.go | 4 +- typedapi/types/responseitem.go | 4 +- typedapi/types/retention.go | 4 +- typedapi/types/retentionlease.go | 4 +- typedapi/types/retentionpolicy.go | 4 +- typedapi/types/retentionpolicycontainer.go | 4 +- typedapi/types/retries.go | 4 +- typedapi/types/reversenestedaggregate.go | 4 +- typedapi/types/reversenestedaggregation.go | 4 +- typedapi/types/reversetokenfilter.go | 4 +- typedapi/types/role.go | 4 +- typedapi/types/roledescriptor.go | 4 +- typedapi/types/roledescriptorread.go | 4 +- typedapi/types/roledescriptorwrapper.go | 4 +- typedapi/types/rolemappingrule.go | 4 +- typedapi/types/roletemplate.go | 4 +- typedapi/types/roletemplateinlinequery.go | 4 +- typedapi/types/roletemplateinlinescript.go | 4 +- typedapi/types/roletemplatequery.go | 4 +- typedapi/types/roletemplatescript.go | 4 +- typedapi/types/rolloverconditions.go | 4 +- typedapi/types/rollupcapabilities.go | 4 +- typedapi/types/rollupcapabilitysummary.go | 4 +- typedapi/types/rollupfieldsummary.go | 4 +- typedapi/types/rollupjob.go | 4 +- typedapi/types/rollupjobconfiguration.go | 4 +- typedapi/types/rollupjobstats.go | 4 +- typedapi/types/rollupjobstatus.go | 4 +- typedapi/types/rollupjobsummary.go | 4 +- typedapi/types/rollupjobsummaryfield.go | 4 +- typedapi/types/routingfield.go | 4 +- typedapi/types/rrfrank.go | 4 +- typedapi/types/rulecondition.go | 4 +- typedapi/types/rulequery.go | 4 +- typedapi/types/runningstatesearchinterval.go | 4 +- typedapi/types/runtimefield.go | 4 +- typedapi/types/runtimefieldfetchfields.go | 4 +- typedapi/types/runtimefields.go | 4 +- typedapi/types/runtimefieldstype.go | 4 +- typedapi/types/samplediversity.go | 4 +- typedapi/types/sampleraggregate.go | 4 +- typedapi/types/sampleraggregation.go | 4 +- typedapi/types/scalarvalue.go | 32 + typedapi/types/scaledfloatnumberproperty.go | 16 +- typedapi/types/schedulecontainer.go | 4 +- typedapi/types/scheduletimeofday.go | 4 +- typedapi/types/scheduletriggerevent.go | 4 +- typedapi/types/scoresort.go | 4 +- typedapi/types/script.go | 4 +- typedapi/types/scriptcache.go | 4 +- typedapi/types/scriptcondition.go | 4 +- typedapi/types/scriptedheuristic.go | 4 +- typedapi/types/scriptedmetricaggregate.go | 4 +- typedapi/types/scriptedmetricaggregation.go | 4 +- typedapi/types/scriptfield.go | 4 +- typedapi/types/scripting.go | 4 +- typedapi/types/scriptquery.go | 4 +- typedapi/types/scriptscorefunction.go | 4 +- typedapi/types/scriptscorequery.go | 4 +- typedapi/types/scriptsort.go | 4 +- typedapi/types/scripttransform.go | 4 +- typedapi/types/scrollids.go | 4 +- typedapi/types/searchablesnapshots.go | 4 +- typedapi/types/searchapplication.go | 4 +- typedapi/types/searchapplicationlistitem.go | 4 +- typedapi/types/searchapplicationtemplate.go | 4 +- typedapi/types/searchasyoutypeproperty.go | 16 +- typedapi/types/searchidle.go | 4 +- typedapi/types/searchinput.go | 4 +- typedapi/types/searchinputrequestbody.go | 4 +- .../types/searchinputrequestdefinition.go | 4 +- typedapi/types/searchprofile.go | 4 +- typedapi/types/searchstats.go | 4 +- typedapi/types/searchtemplaterequestbody.go | 4 +- typedapi/types/searchtransform.go | 4 +- typedapi/types/security.go | 4 +- typedapi/types/securityrealm.go | 4 +- typedapi/types/securityrolemapping.go | 4 +- typedapi/types/securityroles.go | 4 +- typedapi/types/securityrolesdls.go | 4 +- typedapi/types/securityrolesdlsbitsetcache.go | 4 +- typedapi/types/securityrolesfile.go | 4 +- typedapi/types/securityrolesnative.go | 4 +- typedapi/types/segment.go | 4 +- typedapi/types/segmentsrecord.go | 4 +- typedapi/types/segmentsstats.go | 4 +- .../types/serialdifferencingaggregation.go | 4 +- typedapi/types/serializedclusterstate.go | 4 +- .../types/serializedclusterstatedetail.go | 4 +- typedapi/types/servicetoken.go | 4 +- typedapi/types/setprocessor.go | 4 +- typedapi/types/setsecurityuserprocessor.go | 4 +- typedapi/types/settings.go | 4 +- typedapi/types/settingsanalyze.go | 4 +- typedapi/types/settingshighlight.go | 4 +- typedapi/types/settingsquerystring.go | 4 +- typedapi/types/settingssearch.go | 4 +- typedapi/types/settingssimilarity.go | 4 +- typedapi/types/settingssimilaritybm25.go | 4 +- typedapi/types/settingssimilaritydfi.go | 4 +- typedapi/types/settingssimilaritydfr.go | 4 +- typedapi/types/settingssimilarityib.go | 4 +- typedapi/types/settingssimilaritylmd.go | 4 +- typedapi/types/settingssimilaritylmj.go | 4 +- .../types/settingssimilarityscriptedtfidf.go | 4 +- typedapi/types/shapefieldquery.go | 4 +- typedapi/types/shapeproperty.go | 16 +- typedapi/types/shapequery.go | 4 +- typedapi/types/shardcommit.go | 4 +- typedapi/types/shardfailure.go | 4 +- typedapi/types/shardfilesizeinfo.go | 4 +- typedapi/types/shardhealthstats.go | 4 +- typedapi/types/shardlease.go | 4 +- typedapi/types/shardmigrationstatus.go | 4 +- typedapi/types/shardpath.go | 4 +- typedapi/types/shardprofile.go | 4 +- typedapi/types/shardquerycache.go | 4 +- typedapi/types/shardrecovery.go | 4 +- typedapi/types/shardretentionleases.go | 4 +- typedapi/types/shardrouting.go | 4 +- typedapi/types/shardsavailabilityindicator.go | 4 +- .../shardsavailabilityindicatordetails.go | 4 +- typedapi/types/shardscapacityindicator.go | 4 +- .../types/shardscapacityindicatordetails.go | 4 +- .../shardscapacityindicatortierdetail.go | 4 +- typedapi/types/shardsegmentrouting.go | 4 +- typedapi/types/shardsequencenumber.go | 4 +- typedapi/types/shardsrecord.go | 4 +- typedapi/types/shardssegment.go | 4 +- typedapi/types/shardsstatssummary.go | 4 +- typedapi/types/shardsstatssummaryitem.go | 4 +- typedapi/types/shardstatistics.go | 4 +- typedapi/types/shardstore.go | 4 +- typedapi/types/shardstoreexception.go | 4 +- typedapi/types/shardstoreindex.go | 4 +- typedapi/types/shardstorenode.go | 4 +- typedapi/types/shardstorewrapper.go | 4 +- typedapi/types/shardstotalstats.go | 4 +- typedapi/types/shared.go | 4 +- typedapi/types/shingletokenfilter.go | 4 +- typedapi/types/shortnumberproperty.go | 16 +- typedapi/types/shrinkconfiguration.go | 4 +- .../types/significantlongtermsaggregate.go | 4 +- typedapi/types/significantlongtermsbucket.go | 4 +- .../types/significantstringtermsaggregate.go | 4 +- .../types/significantstringtermsbucket.go | 4 +- ...aggregatebasesignificantlongtermsbucket.go | 4 +- ...gregatebasesignificantstringtermsbucket.go | 4 +- .../significanttermsaggregatebasevoid.go | 4 +- typedapi/types/significanttermsaggregation.go | 4 +- typedapi/types/significanttextaggregation.go | 4 +- typedapi/types/simpleanalyzer.go | 4 +- .../types/simplemovingaverageaggregation.go | 4 +- typedapi/types/simplequerystringflags.go | 4 +- typedapi/types/simplequerystringquery.go | 4 +- typedapi/types/simplevalueaggregate.go | 4 +- typedapi/types/simulatedactions.go | 4 +- typedapi/types/simulateingest.go | 4 +- typedapi/types/sizefield.go | 4 +- typedapi/types/slackaction.go | 4 +- typedapi/types/slackattachment.go | 4 +- typedapi/types/slackattachmentfield.go | 4 +- typedapi/types/slackdynamicattachment.go | 4 +- typedapi/types/slackmessage.go | 4 +- typedapi/types/slackresult.go | 4 +- typedapi/types/slicedscroll.go | 4 +- typedapi/types/slices.go | 4 +- typedapi/types/slm.go | 4 +- typedapi/types/slmindicator.go | 4 +- typedapi/types/slmindicatordetails.go | 4 +- .../types/slmindicatorunhealthypolicies.go | 4 +- typedapi/types/slmpolicy.go | 4 +- typedapi/types/slowlogsettings.go | 4 +- typedapi/types/slowlogtresholdlevels.go | 4 +- typedapi/types/slowlogtresholds.go | 4 +- typedapi/types/smoothingmodelcontainer.go | 4 +- typedapi/types/snapshotindexstats.go | 4 +- typedapi/types/snapshotinfo.go | 4 +- typedapi/types/snapshotlifecycle.go | 4 +- typedapi/types/snapshotresponseitem.go | 4 +- typedapi/types/snapshotrestore.go | 4 +- typedapi/types/snapshotshardfailure.go | 4 +- typedapi/types/snapshotshardsstats.go | 4 +- typedapi/types/snapshotshardsstatus.go | 4 +- typedapi/types/snapshotsrecord.go | 4 +- typedapi/types/snapshotstats.go | 4 +- typedapi/types/snowballanalyzer.go | 4 +- typedapi/types/snowballtokenfilter.go | 4 +- typedapi/types/softdeletes.go | 4 +- typedapi/types/sort.go | 4 +- typedapi/types/sortcombinations.go | 4 +- typedapi/types/sortoptions.go | 4 +- typedapi/types/sortprocessor.go | 4 +- typedapi/types/sourceconfig.go | 4 +- typedapi/types/sourceconfigparam.go | 4 +- typedapi/types/sourcefield.go | 4 +- typedapi/types/sourcefilter.go | 4 +- typedapi/types/spancontainingquery.go | 4 +- typedapi/types/spanfieldmaskingquery.go | 4 +- typedapi/types/spanfirstquery.go | 4 +- typedapi/types/spangapquery.go | 4 +- typedapi/types/spanmultitermquery.go | 4 +- typedapi/types/spannearquery.go | 4 +- typedapi/types/spannotquery.go | 4 +- typedapi/types/spanorquery.go | 4 +- typedapi/types/spanquery.go | 4 +- typedapi/types/spantermquery.go | 4 +- typedapi/types/spanwithinquery.go | 4 +- typedapi/types/sparseembeddingresult.go | 67 ++ typedapi/types/sparsevector.go | 26 + typedapi/types/sparsevectorproperty.go | 740 ++++++++++++++++++ typedapi/types/splitprocessor.go | 4 +- typedapi/types/sql.go | 4 +- typedapi/types/ssl.go | 4 +- typedapi/types/standardanalyzer.go | 4 +- typedapi/types/standarddeviationbounds.go | 4 +- .../types/standarddeviationboundsasstring.go | 4 +- typedapi/types/standardtokenizer.go | 4 +- typedapi/types/statistics.go | 4 +- typedapi/types/stats.go | 4 +- typedapi/types/statsaggregate.go | 4 +- typedapi/types/statsaggregation.go | 4 +- typedapi/types/statsbucketaggregate.go | 4 +- typedapi/types/statsbucketaggregation.go | 4 +- typedapi/types/status.go | 4 +- typedapi/types/stemmeroverridetokenfilter.go | 4 +- typedapi/types/stemmertokenfilter.go | 4 +- typedapi/types/stepkey.go | 4 +- typedapi/types/stopanalyzer.go | 4 +- typedapi/types/stoptokenfilter.go | 4 +- typedapi/types/stopwords.go | 4 +- typedapi/types/storage.go | 4 +- typedapi/types/storedscript.go | 4 +- typedapi/types/storedscriptid.go | 4 +- typedapi/types/storestats.go | 4 +- typedapi/types/stringifiedboolean.go | 4 +- .../types/stringifiedepochtimeunitmillis.go | 4 +- .../types/stringifiedepochtimeunitseconds.go | 4 +- typedapi/types/stringifiedinteger.go | 4 +- typedapi/types/stringifiedversionnumber.go | 4 +- typedapi/types/stringraretermsaggregate.go | 4 +- typedapi/types/stringraretermsbucket.go | 4 +- typedapi/types/stringstatsaggregate.go | 4 +- typedapi/types/stringstatsaggregation.go | 4 +- typedapi/types/stringtermsaggregate.go | 4 +- typedapi/types/stringtermsbucket.go | 4 +- typedapi/types/stupidbackoffsmoothingmodel.go | 4 +- typedapi/types/suggest.go | 4 +- typedapi/types/suggestcontext.go | 4 +- typedapi/types/suggester.go | 4 +- typedapi/types/suggestfuzziness.go | 4 +- typedapi/types/sumaggregate.go | 4 +- typedapi/types/sumaggregation.go | 4 +- typedapi/types/sumbucketaggregation.go | 4 +- typedapi/types/summary.go | 4 +- typedapi/types/synccontainer.go | 4 +- typedapi/types/synonymgraphtokenfilter.go | 4 +- typedapi/types/synonymrule.go | 4 +- typedapi/types/synonymruleread.go | 4 +- typedapi/types/synonymssetitem.go | 4 +- typedapi/types/synonymsupdateresult.go | 4 +- typedapi/types/synonymtokenfilter.go | 4 +- .../types/targetmeanencodingpreprocessor.go | 4 +- typedapi/types/taskfailure.go | 4 +- typedapi/types/taskid.go | 4 +- typedapi/types/taskinfo.go | 4 +- typedapi/types/taskinfos.go | 4 +- typedapi/types/tasksrecord.go | 4 +- typedapi/types/tdigest.go | 4 +- .../types/tdigestpercentileranksaggregate.go | 4 +- typedapi/types/tdigestpercentilesaggregate.go | 4 +- typedapi/types/template.go | 4 +- typedapi/types/templateconfig.go | 4 +- typedapi/types/templatemapping.go | 4 +- typedapi/types/templatesrecord.go | 4 +- typedapi/types/term.go | 4 +- typedapi/types/termquery.go | 4 +- .../termsaggregatebasedoubletermsbucket.go | 4 +- .../termsaggregatebaselongtermsbucket.go | 4 +- .../termsaggregatebasemultitermsbucket.go | 4 +- .../termsaggregatebasestringtermsbucket.go | 4 +- typedapi/types/termsaggregatebasevoid.go | 4 +- typedapi/types/termsaggregation.go | 4 +- typedapi/types/termsexclude.go | 4 +- typedapi/types/termsgrouping.go | 4 +- typedapi/types/termsinclude.go | 4 +- typedapi/types/termslookup.go | 4 +- typedapi/types/termspartition.go | 4 +- typedapi/types/termsquery.go | 4 +- typedapi/types/termsqueryfield.go | 4 +- typedapi/types/termssetquery.go | 4 +- typedapi/types/termsuggest.go | 4 +- typedapi/types/termsuggester.go | 4 +- typedapi/types/termsuggestoption.go | 4 +- typedapi/types/termvector.go | 4 +- typedapi/types/termvectorsfilter.go | 4 +- typedapi/types/termvectorsresult.go | 4 +- typedapi/types/termvectorstoken.go | 4 +- typedapi/types/testpopulation.go | 4 +- .../textclassificationinferenceoptions.go | 4 +- ...extclassificationinferenceupdateoptions.go | 4 +- typedapi/types/textembedding.go | 4 +- .../types/textembeddinginferenceoptions.go | 4 +- .../textembeddinginferenceupdateoptions.go | 4 +- typedapi/types/textembeddingresult.go | 67 ++ .../types/textexpansioninferenceoptions.go | 4 +- .../textexpansioninferenceupdateoptions.go | 4 +- typedapi/types/textexpansionquery.go | 4 +- typedapi/types/textindexprefixes.go | 4 +- typedapi/types/textproperty.go | 16 +- typedapi/types/texttoanalyze.go | 4 +- typedapi/types/threadcount.go | 4 +- typedapi/types/threadpoolrecord.go | 4 +- typedapi/types/throttlestate.go | 4 +- typedapi/types/timeofmonth.go | 4 +- typedapi/types/timeofweek.go | 4 +- typedapi/types/timeofyear.go | 4 +- typedapi/types/timesync.go | 4 +- typedapi/types/timingstats.go | 4 +- typedapi/types/tokencountproperty.go | 16 +- typedapi/types/tokendetail.go | 4 +- typedapi/types/tokenfilter.go | 4 +- typedapi/types/tokenfilterdefinition.go | 4 +- typedapi/types/tokenizationconfigcontainer.go | 4 +- typedapi/types/tokenizer.go | 4 +- typedapi/types/tokenizerdefinition.go | 4 +- typedapi/types/topclassentry.go | 4 +- typedapi/types/tophit.go | 4 +- typedapi/types/tophitsaggregate.go | 4 +- typedapi/types/tophitsaggregation.go | 4 +- typedapi/types/topleftbottomrightgeobounds.go | 4 +- typedapi/types/topmetrics.go | 4 +- typedapi/types/topmetricsaggregate.go | 4 +- typedapi/types/topmetricsaggregation.go | 4 +- typedapi/types/topmetricsvalue.go | 4 +- typedapi/types/toprightbottomleftgeobounds.go | 4 +- typedapi/types/totalfeatureimportance.go | 4 +- typedapi/types/totalfeatureimportanceclass.go | 4 +- .../types/totalfeatureimportancestatistics.go | 4 +- typedapi/types/totaluserprofiles.go | 4 +- typedapi/types/trackhits.go | 4 +- typedapi/types/trainedmodel.go | 4 +- typedapi/types/trainedmodelassignment.go | 4 +- .../trainedmodelassignmentroutingtable.go | 4 +- .../trainedmodelassignmenttaskparameters.go | 4 +- typedapi/types/trainedmodelconfig.go | 4 +- typedapi/types/trainedmodelconfiginput.go | 4 +- typedapi/types/trainedmodelconfigmetadata.go | 4 +- .../trainedmodeldeploymentallocationstatus.go | 4 +- .../types/trainedmodeldeploymentnodesstats.go | 4 +- typedapi/types/trainedmodeldeploymentstats.go | 4 +- typedapi/types/trainedmodelentities.go | 4 +- .../trainedmodelinferenceclassimportance.go | 4 +- .../trainedmodelinferencefeatureimportance.go | 4 +- typedapi/types/trainedmodelinferencestats.go | 4 +- typedapi/types/trainedmodellocation.go | 4 +- typedapi/types/trainedmodellocationindex.go | 4 +- typedapi/types/trainedmodelsizestats.go | 4 +- typedapi/types/trainedmodelsrecord.go | 4 +- typedapi/types/trainedmodelstats.go | 4 +- typedapi/types/trainedmodeltree.go | 4 +- typedapi/types/trainedmodeltreenode.go | 4 +- typedapi/types/transformauthorization.go | 4 +- typedapi/types/transformcontainer.go | 4 +- typedapi/types/transformdestination.go | 4 +- typedapi/types/transformindexerstats.go | 4 +- typedapi/types/transformprogress.go | 4 +- typedapi/types/transformsource.go | 4 +- typedapi/types/transformsrecord.go | 4 +- typedapi/types/transformstats.go | 4 +- typedapi/types/transformstatshealth.go | 4 +- typedapi/types/transformsummary.go | 4 +- typedapi/types/transientmetadataconfig.go | 4 +- typedapi/types/translog.go | 4 +- typedapi/types/translogretention.go | 4 +- typedapi/types/translogstats.go | 4 +- typedapi/types/translogstatus.go | 4 +- typedapi/types/transport.go | 4 +- typedapi/types/transporthistogram.go | 4 +- typedapi/types/triggercontainer.go | 4 +- typedapi/types/triggereventcontainer.go | 4 +- typedapi/types/triggereventresult.go | 4 +- typedapi/types/trimprocessor.go | 4 +- typedapi/types/trimtokenfilter.go | 4 +- typedapi/types/truncatetokenfilter.go | 4 +- typedapi/types/ttestaggregate.go | 4 +- typedapi/types/ttestaggregation.go | 4 +- typedapi/types/typefieldmappings.go | 4 +- typedapi/types/typemapping.go | 10 +- typedapi/types/typequery.go | 4 +- typedapi/types/uaxemailurltokenizer.go | 4 +- typedapi/types/unassignedinformation.go | 4 +- typedapi/types/uniquetokenfilter.go | 4 +- typedapi/types/unmappedraretermsaggregate.go | 4 +- typedapi/types/unmappedsampleraggregate.go | 4 +- .../unmappedsignificanttermsaggregate.go | 4 +- typedapi/types/unmappedtermsaggregate.go | 4 +- typedapi/types/unrateddocument.go | 4 +- typedapi/types/unsignedlongnumberproperty.go | 16 +- typedapi/types/updateaction.go | 4 +- typedapi/types/updatebyqueryrethrottlenode.go | 4 +- typedapi/types/updateoperation.go | 4 +- typedapi/types/uppercaseprocessor.go | 4 +- typedapi/types/uppercasetokenfilter.go | 4 +- typedapi/types/urldecodeprocessor.go | 4 +- typedapi/types/usagestatsindex.go | 4 +- typedapi/types/usagestatsshards.go | 4 +- typedapi/types/user.go | 4 +- typedapi/types/useragentprocessor.go | 4 +- typedapi/types/userindicesprivileges.go | 4 +- typedapi/types/userprofile.go | 4 +- typedapi/types/userprofilehitmetadata.go | 4 +- typedapi/types/userprofileuser.go | 4 +- typedapi/types/userprofilewithmetadata.go | 4 +- typedapi/types/userrealm.go | 4 +- typedapi/types/validationloss.go | 4 +- typedapi/types/valuecountaggregate.go | 4 +- typedapi/types/valuecountaggregation.go | 4 +- .../types/variablewidthhistogramaggregate.go | 4 +- .../variablewidthhistogramaggregation.go | 4 +- .../types/variablewidthhistogrambucket.go | 4 +- typedapi/types/vector.go | 4 +- typedapi/types/verifyindex.go | 4 +- typedapi/types/versionproperty.go | 16 +- typedapi/types/vertex.go | 4 +- typedapi/types/vertexdefinition.go | 4 +- typedapi/types/vertexinclude.go | 4 +- typedapi/types/vocabulary.go | 4 +- typedapi/types/waitforactiveshards.go | 4 +- typedapi/types/warmerstats.go | 4 +- typedapi/types/watch.go | 4 +- typedapi/types/watcher.go | 4 +- typedapi/types/watcheraction.go | 4 +- typedapi/types/watcheractions.go | 4 +- typedapi/types/watcheractiontotals.go | 4 +- typedapi/types/watchercondition.go | 4 +- typedapi/types/watcherinput.go | 4 +- typedapi/types/watchernodestats.go | 4 +- typedapi/types/watcherstatusactions.go | 4 +- typedapi/types/watcherwatch.go | 4 +- typedapi/types/watcherwatchtrigger.go | 4 +- typedapi/types/watcherwatchtriggerschedule.go | 4 +- typedapi/types/watchrecord.go | 4 +- typedapi/types/watchrecordqueuedstats.go | 4 +- typedapi/types/watchrecordstats.go | 4 +- typedapi/types/watchstatus.go | 4 +- typedapi/types/webhookaction.go | 4 +- typedapi/types/webhookresult.go | 4 +- typedapi/types/weightedaverageaggregation.go | 4 +- typedapi/types/weightedaveragevalue.go | 4 +- typedapi/types/weightedavgaggregate.go | 4 +- typedapi/types/weights.go | 4 +- typedapi/types/whitespaceanalyzer.go | 4 +- typedapi/types/whitespacetokenizer.go | 4 +- typedapi/types/wildcardproperty.go | 16 +- typedapi/types/wildcardquery.go | 4 +- typedapi/types/wktgeobounds.go | 4 +- .../types/worddelimitergraphtokenfilter.go | 4 +- typedapi/types/worddelimitertokenfilter.go | 4 +- typedapi/types/wrapperquery.go | 4 +- typedapi/types/writeoperation.go | 4 +- typedapi/types/xpackdatafeed.go | 4 +- typedapi/types/xpackfeature.go | 4 +- typedapi/types/xpackfeatures.go | 4 +- typedapi/types/xpackquery.go | 4 +- typedapi/types/xpackrealm.go | 4 +- typedapi/types/xpackrolemapping.go | 4 +- typedapi/types/xpackruntimefieldtypes.go | 4 +- .../zeroshotclassificationinferenceoptions.go | 4 +- ...hotclassificationinferenceupdateoptions.go | 4 +- typedapi/watcher/ackwatch/ack_watch.go | 103 ++- typedapi/watcher/ackwatch/response.go | 5 +- .../watcher/activatewatch/activate_watch.go | 97 ++- typedapi/watcher/activatewatch/response.go | 5 +- .../deactivatewatch/deactivate_watch.go | 97 ++- typedapi/watcher/deactivatewatch/response.go | 5 +- typedapi/watcher/deletewatch/delete_watch.go | 97 ++- typedapi/watcher/deletewatch/response.go | 5 +- .../watcher/executewatch/execute_watch.go | 90 ++- typedapi/watcher/executewatch/request.go | 4 +- typedapi/watcher/executewatch/response.go | 5 +- typedapi/watcher/getsettings/get_settings.go | 73 +- typedapi/watcher/getwatch/get_watch.go | 97 ++- typedapi/watcher/getwatch/response.go | 5 +- typedapi/watcher/putwatch/put_watch.go | 90 ++- typedapi/watcher/putwatch/request.go | 4 +- typedapi/watcher/putwatch/response.go | 5 +- .../watcher/querywatches/query_watches.go | 87 +- typedapi/watcher/querywatches/request.go | 4 +- typedapi/watcher/querywatches/response.go | 5 +- typedapi/watcher/start/response.go | 5 +- typedapi/watcher/start/start.go | 94 ++- typedapi/watcher/stats/response.go | 5 +- typedapi/watcher/stats/stats.go | 97 ++- typedapi/watcher/stop/response.go | 5 +- typedapi/watcher/stop/stop.go | 94 ++- .../watcher/updatesettings/update_settings.go | 73 +- typedapi/xpack/info/info.go | 94 ++- typedapi/xpack/info/response.go | 5 +- typedapi/xpack/usage/response.go | 5 +- typedapi/xpack/usage/usage.go | 94 ++- 3416 files changed, 67444 insertions(+), 10927 deletions(-) create mode 100644 esapi/api.connector.check_in.go create mode 100644 esapi/api.connector.delete.go create mode 100644 esapi/api.connector.get.go create mode 100644 esapi/api.connector.last_sync.go create mode 100644 esapi/api.connector.list.go create mode 100644 esapi/api.connector.post.go create mode 100644 esapi/api.connector.put.go create mode 100644 esapi/api.connector.update_configuration.go create mode 100644 esapi/api.connector.update_error.go create mode 100644 esapi/api.connector.update_filtering.go create mode 100644 esapi/api.connector.update_name.go create mode 100644 esapi/api.connector.update_pipeline.go create mode 100644 esapi/api.connector.update_scheduling.go create mode 100644 esapi/api.connector_sync_job.cancel.go create mode 100644 esapi/api.connector_sync_job.check_in.go create mode 100644 esapi/api.connector_sync_job.delete.go create mode 100644 esapi/api.connector_sync_job.error.go create mode 100644 esapi/api.connector_sync_job.get.go create mode 100644 esapi/api.connector_sync_job.list.go create mode 100644 esapi/api.connector_sync_job.post.go create mode 100644 esapi/api.connector_sync_job.update_stats.go create mode 100644 esapi/api.simulate.ingest.go create mode 100644 typedapi/esql/query/query.go create mode 100644 typedapi/esql/query/request.go create mode 100644 typedapi/esql/query/response.go create mode 100644 typedapi/fleet/postsecret/post_secret.go create mode 100644 typedapi/inference/deletemodel/delete_model.go create mode 100644 typedapi/inference/deletemodel/response.go create mode 100644 typedapi/inference/getmodel/get_model.go create mode 100644 typedapi/inference/getmodel/response.go create mode 100644 typedapi/inference/inference/inference.go create mode 100644 typedapi/inference/inference/request.go create mode 100644 typedapi/inference/inference/response.go create mode 100644 typedapi/inference/putmodel/put_model.go create mode 100644 typedapi/inference/putmodel/request.go create mode 100644 typedapi/inference/putmodel/response.go create mode 100644 typedapi/security/getsettings/get_settings.go create mode 100644 typedapi/security/updatesettings/update_settings.go create mode 100644 typedapi/types/enums/managedby/managedby.go create mode 100644 typedapi/types/enums/tasktype/tasktype.go rename typedapi/types/{managedby.go => esqlcolumns.go} (72%) create mode 100644 typedapi/types/inferenceresult.go create mode 100644 typedapi/types/modelconfig.go create mode 100644 typedapi/types/modelconfigcontainer.go create mode 100644 typedapi/types/scalarvalue.go create mode 100644 typedapi/types/sparseembeddingresult.go create mode 100644 typedapi/types/sparsevector.go create mode 100644 typedapi/types/sparsevectorproperty.go create mode 100644 typedapi/types/textembeddingresult.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 702066fc53..87d94af381 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,50 @@ +# 8.12.0 + +## Client + +The client now provides OpenTelemetry integration. This integration can be enabled in the config using the `elasticsearch.NewOpenTelemetryInstrumentation`. +Once set up, the provided `context` will be used to record spans with useful information about the request being made to the server. + +More about what you can expect in the [Semantic Conventions for Elasticsearch](https://opentelemetry.io/docs/specs/semconv/database/elasticsearch/). + +## API + +* `SimulateIngest` +* `ConnectorCheckIn` +* `ConnectorDelete` +* `ConnectorGet` +* `ConnectorLastSync` +* `ConnectorList` +* `ConnectorPost` +* `ConnectorPut` +* `ConnectorSyncJobCancel` +* `ConnectorSyncJobCheckIn` +* `ConnectorSyncJobDelete` +* `ConnectorSyncJobError` +* `ConnectorSyncJobGet` +* `ConnectorSyncJobList` +* `ConnectorSyncJobPost` +* `ConnectorSyncJobUpdateStats` +* `ConnectorUpdateConfiguration` +* `ConnectorUpdateError` +* `ConnectorUpdateFiltering` +* `ConnectorUpdateName` +* `ConnectorUpdatePipeline` +* `ConnectorUpdateScheduling` + +## Typed API + +* `Esql.Query` [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-rest.html) +* `Fleet.PostSecret` +* `Inference` [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/inference-apis.html) + * `DeleteModel` [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference-api.html) + * `GetModel` [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-inference-api.html) + * `Inference` [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/post-inference-api.html) + * `PutModel` [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference-api.html) +* `SearchApplication` + * `GetSettings` [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-settings.html) + * `UpdateSettings` [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-settings.html) + # 8.11.1 ## Typed API diff --git a/_examples/bulk/benchmarks/go.sum b/_examples/bulk/benchmarks/go.sum index ab9e02f466..4ba2e82690 100644 --- a/_examples/bulk/benchmarks/go.sum +++ b/_examples/bulk/benchmarks/go.sum @@ -1,9 +1,18 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27 h1:O58SwZ7pdt7Lzy8JqpJubJlgDbr9jVV7ro4HFPvaZDw= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219142016-630b95dfa5ac/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8= github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U= @@ -13,7 +22,22 @@ github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9 github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/montanaflynn/stats v0.6.3 h1:F8446DrvIF5V5smZfZ8K9nrmmix0AFgevPdLruGOmzk= github.com/montanaflynn/stats v0.6.3/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/_examples/bulk/go.mod b/_examples/bulk/go.mod index eddfa8283a..28fac2c21c 100644 --- a/_examples/bulk/go.mod +++ b/_examples/bulk/go.mod @@ -7,7 +7,6 @@ replace github.com/elastic/go-elasticsearch/v8 => ../.. require ( github.com/cenkalti/backoff/v4 v4.1.2 // indirect github.com/dustin/go-humanize v1.0.0 // indirect - github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27 // indirect github.com/elastic/go-elasticsearch/v8 v8.0.0-20211123103400-5f8a17a2322f // indirect github.com/mailru/easyjson v0.7.7 // indirect ) diff --git a/_examples/bulk/go.sum b/_examples/bulk/go.sum index 536930da7e..b28d260856 100644 --- a/_examples/bulk/go.sum +++ b/_examples/bulk/go.sum @@ -1,10 +1,49 @@ github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27 h1:O58SwZ7pdt7Lzy8JqpJubJlgDbr9jVV7ro4HFPvaZDw= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219142016-630b95dfa5ac/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b h1:gukInwnC6WLBaoc4Knb2nG3lSxBuqaEEDYFBz4orRcw= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= \ No newline at end of file +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/_examples/bulk/kafka/go.sum b/_examples/bulk/kafka/go.sum index 7c50f1a1a8..8aa74dd9b2 100644 --- a/_examples/bulk/kafka/go.sum +++ b/_examples/bulk/kafka/go.sum @@ -13,6 +13,9 @@ github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27 h1 github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c h1:onA2RpIyeCPvYAj1LFYiiMTrSpqVINWMfYFRS7lofJs= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219142016-630b95dfa5ac/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= github.com/elastic/go-licenser v0.3.1 h1:RmRukU/JUmts+rpexAw0Fvt2ly7VVu6mw8z4HrEzObU= github.com/elastic/go-licenser v0.3.1/go.mod h1:D8eNQk70FOCVBl3smCGQt/lv7meBeQno2eI1S5apiHQ= github.com/elastic/go-sysinfo v1.1.1 h1:ZVlaLDyhVkDfjwPGU55CQRCRolNpc7P0BbyhhQZQmMI= @@ -20,6 +23,9 @@ github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6 github.com/elastic/go-windows v1.0.0 h1:qLURgZFkkrYyTTkvYpsZIgf83AUsdIHfvlJaqaZ7aSY= github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -28,6 +34,7 @@ github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/jcchavezs/porto v0.1.0 h1:Xmxxn25zQMmgE7/yHYmh19KcItG81hIwfbEEFnd6w/Q= github.com/jcchavezs/porto v0.1.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -57,11 +64,16 @@ github.com/santhosh-tekuri/jsonschema v1.2.4/go.mod h1:TEAUOeZSmIxTTuHatJzrvARHi github.com/segmentio/kafka-go v0.4.25 h1:QVx9yz12syKBFkxR+dVDDwTO0ItHgnjjhIdBfqizj+8= github.com/segmentio/kafka-go v0.4.25/go.mod h1:XzMcoMjSzDGHcIwpWUI7GB43iKZ2fTVmryPSGLf/MPg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -77,6 +89,10 @@ go.elastic.co/fastjson v1.0.0 h1:ooXV/ABvf+tBul26jcVViPT3sBir0PvXgibYB1IQQzg= go.elastic.co/fastjson v1.0.0/go.mod h1:PmeUOMMtLHQr9ZS9J9owrAVg0FkaZDRZJEFTTGHtchs= go.elastic.co/fastjson v1.1.0 h1:3MrGBWWVIxe/xvsbpghtkFoPciPhOCmjsR/HfwEeQR4= go.elastic.co/fastjson v1.1.0/go.mod h1:boNGISWMjQsUPy/t6yqt2/1Wx4YNPSe+mZjlyw9vKKI= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -97,6 +113,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191025021431-6c3a3bfe00ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e h1:9vRrk9YW2BTzLP0VCB9ZDjU4cPqkg+IDWL7XgxA1yxQ= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -115,5 +132,6 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= diff --git a/_examples/cloudfunction/go.sum b/_examples/cloudfunction/go.sum index 65fb893f3e..bdd3e36be7 100644 --- a/_examples/cloudfunction/go.sum +++ b/_examples/cloudfunction/go.sum @@ -1,2 +1,41 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27 h1:O58SwZ7pdt7Lzy8JqpJubJlgDbr9jVV7ro4HFPvaZDw= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219142016-630b95dfa5ac/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b h1:gukInwnC6WLBaoc4Knb2nG3lSxBuqaEEDYFBz4orRcw= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/_examples/encoding/go.sum b/_examples/encoding/go.sum index b6adbfb999..03dd710318 100644 --- a/_examples/encoding/go.sum +++ b/_examples/encoding/go.sum @@ -1,7 +1,21 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27 h1:O58SwZ7pdt7Lzy8JqpJubJlgDbr9jVV7ro4HFPvaZDw= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219142016-630b95dfa5ac/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b h1:gukInwnC6WLBaoc4Knb2nG3lSxBuqaEEDYFBz4orRcw= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -11,13 +25,38 @@ github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tidwall/gjson v1.9.3 h1:hqzS9wAHMO+KVBBkLxYdkEeeFHuqr95GfClRLKlgK0E= github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/_examples/fasthttp/go.sum b/_examples/fasthttp/go.sum index e98944d5f4..faf017c875 100644 --- a/_examples/fasthttp/go.sum +++ b/_examples/fasthttp/go.sum @@ -1,24 +1,69 @@ github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c h1:onA2RpIyeCPvYAj1LFYiiMTrSpqVINWMfYFRS7lofJs= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219142016-630b95dfa5ac/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b h1:gukInwnC6WLBaoc4Knb2nG3lSxBuqaEEDYFBz4orRcw= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/klauspost/compress v1.15.0 h1:xqfchp4whNFxn5A4XFyyYtitiWI8Hy5EW59jEwcyL6U= github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.34.0 h1:d3AAQJ2DRcxJYHm7OXNXtXt2as1vMDfxeIcFvhmGGm4= github.com/valyala/fasthttp v1.34.0/go.mod h1:epZA5N+7pY6ZaEKRmstzOuYJx9HI8DI1oaCGZpdH4h0= +github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IKUQ8kj74bxZrgw87eMMVc= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/_examples/instrumentation/go.mod b/_examples/instrumentation/go.mod index 44529be03a..3809211d08 100644 --- a/_examples/instrumentation/go.mod +++ b/_examples/instrumentation/go.mod @@ -5,7 +5,7 @@ go 1.11 replace github.com/elastic/go-elasticsearch/v8 => ../.. require ( - github.com/elastic/elastic-transport-go/v8 v8.0.0-20230201152525-7be14259265a + github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b github.com/elastic/go-elasticsearch/v8 v8.0.0-20191002063538-b491ce54d752 github.com/fatih/color v1.7.0 github.com/mattn/go-colorable v0.1.0 // indirect diff --git a/_examples/instrumentation/go.sum b/_examples/instrumentation/go.sum index b160e94dfb..a2a420c3ed 100644 --- a/_examples/instrumentation/go.sum +++ b/_examples/instrumentation/go.sum @@ -1,9 +1,13 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0 h1:eOI3/cP2VTU6uZLDYAoic+eyzzB9YyGmJ7eIjl8rOPg= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +git.apache.org/thrift.git v0.0.0-20181218151757-9b75e4fe745a h1:GnKpWvJXysBGdcWMEibN//UeRRJeLDUgsXjKXjagFLg= git.apache.org/thrift.git v0.0.0-20181218151757-9b75e4fe745a/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cucumber/godog v0.8.1 h1:lVb+X41I4YDreE+ibZ50bdXmySxgRviYFgKY6Aw4XE8= github.com/cucumber/godog v0.8.1/go.mod h1:vSh3r/lM+psC1BPXvdkSEuNjmXfpVqrMGYAElF6hxnA= @@ -12,6 +16,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/elastic/elastic-transport-go/v8 v8.0.0-20230201152525-7be14259265a h1:WoeSTB0D6DO+2nZyVmvSLZFTbKiB+ZUhjWZ9NkRjnXM= github.com/elastic/elastic-transport-go/v8 v8.0.0-20230201152525-7be14259265a/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219142016-630b95dfa5ac/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b h1:gukInwnC6WLBaoc4Knb2nG3lSxBuqaEEDYFBz4orRcw= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= github.com/elastic/go-sysinfo v1.0.1/go.mod h1:O/D5m1VpYLwGjCYzEt63g3Z1uO3jXfwyzzjiW90t8cY= github.com/elastic/go-sysinfo v1.1.1 h1:ZVlaLDyhVkDfjwPGU55CQRCRolNpc7P0BbyhhQZQmMI= github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= @@ -19,23 +27,39 @@ github.com/elastic/go-windows v1.0.0 h1:qLURgZFkkrYyTTkvYpsZIgf83AUsdIHfvlJaqaZ7 github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7 h1:2hRPrmiwPrp3fQX967rNJIhQPtiGXdlQWAxKbKw3VHA= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/grpc-ecosystem/grpc-gateway v1.6.2 h1:8KyC64BiO8ndiGHY5DlFWWdangUPC9QHPakFRre/Ud0= github.com/grpc-ecosystem/grpc-gateway v1.6.2/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4= github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak= +github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -43,16 +67,21 @@ github.com/mattn/go-colorable v0.1.0 h1:v2XXALHHh6zHfYTJ+cSkwtyffnaOyR1MXaA91mTr github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/openzipkin/zipkin-go v0.1.3 h1:36hTtUTQR/vPX7YVJo2PYexSbHdAJiAkDrjuXw/YlYQ= github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.0.0-20181218105931-67670fe90761 h1:z6tvbDJ5OLJ48FFmnksv04a78maSTRBUIhkdHYV5Y98= github.com/prometheus/common v0.0.0-20181218105931-67670fe90761/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -61,10 +90,18 @@ github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDa github.com/santhosh-tekuri/jsonschema v1.2.4 h1:hNhW8e7t+H1vgY+1QeEQpveR6D4+OwKPXCfD2aieJis= github.com/santhosh-tekuri/jsonschema v1.2.4/go.mod h1:TEAUOeZSmIxTTuHatJzrvARHiuO9LYd+cIxzgEHCQI4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.elastic.co/apm v1.5.0/go.mod h1:OdB9sPtM6Vt7oz3VXt7+KR96i9li74qrxBGHTQygFvk= go.elastic.co/apm v1.11.0 h1:uJyt6nCW9880sZhfl1tB//Jy/5TadNoAd8edRUtgb3w= @@ -78,6 +115,14 @@ go.elastic.co/fastjson v1.1.0 h1:3MrGBWWVIxe/xvsbpghtkFoPciPhOCmjsR/HfwEeQR4= go.elastic.co/fastjson v1.1.0/go.mod h1:boNGISWMjQsUPy/t6yqt2/1Wx4YNPSe+mZjlyw9vKKI= go.opencensus.io v0.19.0 h1:+jrnNy8MR4GZXvwF9PEuSyHxA4NaTf6601oNRwCSXq0= go.opencensus.io v0.19.0/go.mod h1:AYeH0+ZxYyghG8diqaaIq/9P3VgCCt5GF2ldCY4dkFg= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -85,8 +130,10 @@ golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 h1:rJm0LuqUjoDhSk2zO9ISMSToQxGz7Os2jRiOL8AWu4c= golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -102,12 +149,14 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890 h1:uESlIz09WIHT2I+pasSXcpLYqYK8wHcdCetU3VuMBJE= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181218192612-074acd46bca6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -123,6 +172,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= @@ -138,16 +189,22 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.0.0-20181220000619-583d854617af h1:iQMS7JKv/0w/iiWf1M49Cg3dmOkBoBZT5KheqPDpaac= google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.3.0 h1:FBSsiFRMz3LBeXIomRnVzrQwSDj4ibvcRexLG0LZGQk= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb h1:dQshZyyJ5W/Xk8myF4GKBak1pZW6EywJuQ8+44EQhGA= google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= @@ -155,7 +212,11 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3 h1:LyX67rVB0kBUFoROrQfzKwdrYLH1cRzHibxdJW85J1c= honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= diff --git a/_examples/logging/go.mod b/_examples/logging/go.mod index 916195bd3a..067715d93e 100644 --- a/_examples/logging/go.mod +++ b/_examples/logging/go.mod @@ -5,7 +5,6 @@ go 1.11 replace github.com/elastic/go-elasticsearch/v8 => ../.. require ( - github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27 // indirect github.com/elastic/go-elasticsearch/v8 v8.0.0-20211123103400-5f8a17a2322f // indirect github.com/rs/zerolog v1.26.0 // indirect ) diff --git a/_examples/logging/go.sum b/_examples/logging/go.sum index 0afb0d23e8..e76cf6d142 100644 --- a/_examples/logging/go.sum +++ b/_examples/logging/go.sum @@ -1,31 +1,83 @@ +github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27 h1:O58SwZ7pdt7Lzy8JqpJubJlgDbr9jVV7ro4HFPvaZDw= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219142016-630b95dfa5ac/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b h1:gukInwnC6WLBaoc4Knb2nG3lSxBuqaEEDYFBz4orRcw= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rs/xid v1.3.0 h1:6NjYksEUlhurdVehpc7S7dk6DAmcKv8V9gG0FsVN2U4= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.26.0 h1:ORM4ibhEZeTeQlCojCK2kPz1ogAY4bGs4tD+SaAdGaE= github.com/rs/zerolog v1.26.0/go.mod h1:yBiM87lvSqX8h0Ww4sdzNSkVYZ8dL2xjZJG1lAuGZEo= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/yuin/goldmark v1.4.0 h1:OtISOGfH6sOWa1/qXqqAiOIAO6Z5J3AEAE18WAq6BiQ= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/_examples/security/go.sum b/_examples/security/go.sum index 65fb893f3e..bdd3e36be7 100644 --- a/_examples/security/go.sum +++ b/_examples/security/go.sum @@ -1,2 +1,41 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27 h1:O58SwZ7pdt7Lzy8JqpJubJlgDbr9jVV7ro4HFPvaZDw= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219142016-630b95dfa5ac/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b h1:gukInwnC6WLBaoc4Knb2nG3lSxBuqaEEDYFBz4orRcw= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/_examples/xkcdsearch/go.mod b/_examples/xkcdsearch/go.mod index a6c3a8484c..68022aac2f 100644 --- a/_examples/xkcdsearch/go.mod +++ b/_examples/xkcdsearch/go.mod @@ -12,9 +12,14 @@ require ( ) require ( - github.com/elastic/elastic-transport-go/v8 v8.0.0-20230201152525-7be14259265a // indirect + github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b // indirect + github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/spf13/pflag v1.0.3 // indirect - golang.org/x/sys v0.1.0 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect + golang.org/x/sys v0.14.0 // indirect golang.org/x/term v0.1.0 // indirect ) diff --git a/_examples/xkcdsearch/go.sum b/_examples/xkcdsearch/go.sum index 1aaee1222c..56aa5b0133 100644 --- a/_examples/xkcdsearch/go.sum +++ b/_examples/xkcdsearch/go.sum @@ -1,14 +1,41 @@ -github.com/elastic/elastic-transport-go/v8 v8.0.0-20230201152525-7be14259265a h1:WoeSTB0D6DO+2nZyVmvSLZFTbKiB+ZUhjWZ9NkRjnXM= -github.com/elastic/elastic-transport-go/v8 v8.0.0-20230201152525-7be14259265a/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b h1:gukInwnC6WLBaoc4Knb2nG3lSxBuqaEEDYFBz4orRcw= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rs/zerolog v1.11.0 h1:DRuq/S+4k52uJzBQciUcofXx45GrMC6yrEbb/CoK6+M= github.com/rs/zerolog v1.11.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= @@ -25,8 +52,9 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= @@ -39,3 +67,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/elasticsearch.go b/elasticsearch.go index 7e97f0787a..dcfc98cd02 100644 --- a/elasticsearch.go +++ b/elasticsearch.go @@ -21,7 +21,7 @@ import ( "encoding/base64" "errors" "fmt" - "github.com/elastic/go-elasticsearch/v8/typedapi" + "go.opentelemetry.io/otel/trace" "net/http" "net/url" "os" @@ -32,6 +32,8 @@ import ( "sync" "time" + "github.com/elastic/go-elasticsearch/v8/typedapi" + "github.com/elastic/go-elasticsearch/v8/esapi" "github.com/elastic/go-elasticsearch/v8/internal/version" @@ -65,7 +67,6 @@ func init() { } // Config represents the client configuration. -// type Config struct { Addresses []string // A list of Elasticsearch nodes to use. Username string // Username for HTTP Basic Authentication. @@ -88,8 +89,8 @@ type Config struct { MaxRetries int // Default: 3. RetryOnError func(*http.Request, error) bool // Optional function allowing to indicate which error should be retried. Default: nil. - CompressRequestBody bool // Default: false. - CompressRequestBodyLevel int // Default: gzip.DefaultCompression. + CompressRequestBody bool // Default: false. + CompressRequestBodyLevel int // Default: gzip.DefaultCompression. DiscoverNodesOnStart bool // Discover nodes when initializing the client. Default: false. DiscoverNodesInterval time.Duration // Discover nodes periodically. Default: disabled. @@ -108,10 +109,28 @@ type Config struct { // Optional constructor function for a custom ConnectionPool. Default: nil. ConnectionPoolFunc func([]*elastictransport.Connection, elastictransport.Selector) elastictransport.ConnectionPool + + Instrumentation elastictransport.Instrumentation // Enable instrumentation throughout the client. } -// BaseClient represents the Elasticsearch client. +// NewOpenTelemetryInstrumentation provides the OpenTelemetry integration for both low-level and TypedAPI. +// provider is optional, if nil is passed the integration will retrieve the provider set globally by otel. +// captureSearchBody allows to define if the search queries body should be included in the span. +// Search endpoints are: // +// search +// async_search.submit +// msearch +// eql.search +// terms_enum +// search_template +// msearch_template +// render_search_template +func NewOpenTelemetryInstrumentation(provider trace.TracerProvider, captureSearchBody bool) elastictransport.Instrumentation { + return elastictransport.NewOtelInstrumentation(provider, captureSearchBody, Version) +} + +// BaseClient represents the Elasticsearch client. type BaseClient struct { Transport elastictransport.Interface metaHeader string @@ -140,7 +159,6 @@ type TypedClient struct { // // It will use the ELASTICSEARCH_URL environment variable, if set, // to configure the addresses; use a comma to separate multiple URLs. -// func NewDefaultClient() (*Client, error) { return NewClient(Config{}) } @@ -156,7 +174,6 @@ func NewDefaultClient() (*Client, error) { // environment variable is ignored. // // It's an error to set both cfg.Addresses and cfg.CloudID. -// func NewClient(cfg Config) (*Client, error) { tp, err := newTransport(cfg) if err != nil { @@ -256,7 +273,7 @@ func newTransport(cfg Config) (*elastictransport.Client, error) { cfg.Password = pw } - tp, err := elastictransport.New(elastictransport.Config{ + tpConfig := elastictransport.Config{ UserAgent: userAgent, URLs: urls, @@ -275,7 +292,7 @@ func newTransport(cfg Config) (*elastictransport.Client, error) { MaxRetries: cfg.MaxRetries, RetryBackoff: cfg.RetryBackoff, - CompressRequestBody: cfg.CompressRequestBody, + CompressRequestBody: cfg.CompressRequestBody, CompressRequestBodyLevel: cfg.CompressRequestBodyLevel, EnableMetrics: cfg.EnableMetrics, @@ -287,7 +304,11 @@ func newTransport(cfg Config) (*elastictransport.Client, error) { Logger: cfg.Logger, Selector: cfg.Selector, ConnectionPoolFunc: cfg.ConnectionPoolFunc, - }) + + Instrumentation: cfg.Instrumentation, + } + + tp, err := elastictransport.New(tpConfig) if err != nil { return nil, fmt.Errorf("error creating transport: %s", err) } @@ -296,7 +317,6 @@ func newTransport(cfg Config) (*elastictransport.Client, error) { } // Perform delegates to Transport to execute a request and return a response. -// func (c *BaseClient) Perform(req *http.Request) (*http.Response, error) { // Compatibility Header if c.compatibilityHeader { @@ -332,6 +352,14 @@ func (c *BaseClient) Perform(req *http.Request) (*http.Response, error) { return res, err } +// InstrumentationEnabled propagates back to the client the Instrumentation provided by the transport. +func (c *BaseClient) InstrumentationEnabled() elastictransport.Instrumentation { + if tp, ok := c.Transport.(elastictransport.Instrumented); ok { + return tp.InstrumentationEnabled() + } + return nil +} + // doProductCheck calls f if there as not been a prior successful call to doProductCheck, // returning nil otherwise. func (c *BaseClient) doProductCheck(f func() error) error { @@ -360,7 +388,6 @@ func (c *BaseClient) doProductCheck(f func() error) error { } // genuineCheckHeader validates the presence of the X-Elastic-Product header -// func genuineCheckHeader(header http.Header) error { if header.Get("X-Elastic-Product") != "Elasticsearch" { return errors.New(unknownProduct) @@ -369,7 +396,6 @@ func genuineCheckHeader(header http.Header) error { } // Metrics returns the client metrics. -// func (c *BaseClient) Metrics() (elastictransport.Metrics, error) { if mt, ok := c.Transport.(elastictransport.Measurable); ok { return mt.Metrics() @@ -378,7 +404,6 @@ func (c *BaseClient) Metrics() (elastictransport.Metrics, error) { } // DiscoverNodes reloads the client connections by fetching information from the cluster. -// func (c *BaseClient) DiscoverNodes() error { if dt, ok := c.Transport.(elastictransport.Discoverable); ok { return dt.DiscoverNodes() @@ -388,7 +413,6 @@ func (c *BaseClient) DiscoverNodes() error { // addrsFromEnvironment returns a list of addresses by splitting // the ELASTICSEARCH_URL environment variable with comma, or an empty list. -// func addrsFromEnvironment() []string { var addrs []string @@ -403,7 +427,6 @@ func addrsFromEnvironment() []string { } // addrsToURLs creates a list of url.URL structures from url list. -// func addrsToURLs(addrs []string) ([]*url.URL, error) { var urls []*url.URL for _, addr := range addrs { @@ -419,7 +442,6 @@ func addrsToURLs(addrs []string) ([]*url.URL, error) { // addrFromCloudID extracts the Elasticsearch URL from CloudID. // See: https://www.elastic.co/guide/en/cloud/current/ec-cloud-id.html -// func addrFromCloudID(input string) (string, error) { var scheme = "https://" diff --git a/elasticsearch_internal_test.go b/elasticsearch_internal_test.go index fb49d51b21..952f1a0930 100644 --- a/elasticsearch_internal_test.go +++ b/elasticsearch_internal_test.go @@ -28,6 +28,8 @@ import ( "encoding/base64" "errors" "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v8/typedapi/types" + "io" "io/ioutil" "net/http" "net/http/httptest" @@ -968,3 +970,300 @@ func TestContentTypeOverride(t *testing.T) { search.Do(context.Background(), tp) }) } + +type FakeInstrumentation struct { + Error error + + Name string + Closed bool + ClusterID string + NodeName string + PathParts map[string]string + PersistQuery bool + QueryEndpoint string + Query string + BeforeRequestFunc func(r *http.Request, endpoint string) bool + BeforeRequestResult bool + AfterRequestFunc func(r *http.Request, system, endpoint string) bool + AfterRequestResult bool +} + +func NewFakeInstrumentation(recordQuery bool) *FakeInstrumentation { + return &FakeInstrumentation{ + PersistQuery: recordQuery, + PathParts: make(map[string]string), + } +} + +func (c *FakeInstrumentation) Start(ctx context.Context, name string) context.Context { + c.Name = name + return ctx +} + +func (c *FakeInstrumentation) Close(ctx context.Context) { + c.Closed = true +} + +func (c *FakeInstrumentation) RecordError(ctx context.Context, err error) { + c.Error = err +} + +func (c *FakeInstrumentation) AfterResponse(ctx context.Context, res *http.Response) { + if id := res.Header.Get("X-Found-Handling-Cluster"); id != "" { + c.ClusterID = id + } + if name := res.Header.Get("X-Found-Handling-Instance"); name != "" { + c.NodeName = name + } +} + +func (c *FakeInstrumentation) RecordPathPart(ctx context.Context, pathPart, value string) { + c.PathParts[pathPart] = value +} + +func (c *FakeInstrumentation) RecordRequestBody(ctx context.Context, endpoint string, query io.Reader) io.ReadCloser { + c.QueryEndpoint = endpoint + if !c.PersistQuery { + return nil + } + + buf := bytes.Buffer{} + buf.ReadFrom(query) + c.Query = buf.String() + return io.NopCloser(&buf) +} + +func (c *FakeInstrumentation) BeforeRequest(req *http.Request, endpoint string) { + if c.BeforeRequestFunc != nil { + c.BeforeRequestResult = c.BeforeRequestFunc(req, endpoint) + } +} + +func (c *FakeInstrumentation) AfterRequest(req *http.Request, system, endpoint string) { + if c.AfterRequestFunc != nil { + c.AfterRequestResult = c.AfterRequestFunc(req, system, endpoint) + } +} + +func TestInstrumentation(t *testing.T) { + successTp := func(request *http.Request) (*http.Response, error) { + h := http.Header{} + h.Add("X-Elastic-Product", "Elasticsearch") + h.Add("X-Found-Handling-Cluster", "foo-bar-cluster-id") + h.Add("X-Found-Handling-Instance", "0123456789") + return &http.Response{ + StatusCode: http.StatusOK, + Header: h, + Body: io.NopCloser(strings.NewReader(`{}`)), + }, nil + } + + errorTp := func(request *http.Request) (*http.Response, error) { + h := http.Header{} + h.Add("X-Elastic-Product", "Elasticsearch") + h.Add("X-Found-Handling-Cluster", "foo-bar-cluster-id") + h.Add("X-Found-Handling-Instance", "0123456789") + return &http.Response{ + StatusCode: http.StatusNotFound, + Header: h, + Body: io.NopCloser(strings.NewReader(`{ + "error": { + "root_cause": [ + { + "type": "index_not_found_exception", + "reason": "no such index [foo]", + "resource.type": "index_or_alias", + "resource.id": "foo", + "index_uuid": "_na_", + "index": "foo" + } + ], + "type": "index_not_found_exception", + "reason": "no such index [foo]", + "resource.type": "index_or_alias", + "resource.id": "foo", + "index_uuid": "_na_", + "index": "foo" + }, + "status": 404 +}`)), + }, nil + } + + reason := "index_not_found_exception" + + type args struct { + roundTripFunc func(request *http.Request) (*http.Response, error) + instrumentation *FakeInstrumentation + } + tests := []struct { + name string + args args + want *FakeInstrumentation + }{ + { + name: "with query", + args: args{ + successTp, + NewFakeInstrumentation(true), + }, + want: &FakeInstrumentation{ + Name: "search", + Closed: true, + ClusterID: "foo-bar-cluster-id", + NodeName: "0123456789", + PathParts: map[string]string{"index": "foo"}, + PersistQuery: true, + QueryEndpoint: "search", + Query: "{\"query\":{\"match_all\":{}}}", + BeforeRequestResult: true, + AfterRequestResult: true, + BeforeRequestFunc: func(r *http.Request, endpoint string) bool { + if r != nil { + if r.URL.Path != "/foo/_search" { + return false + } + if r.Method != http.MethodPost { + return false + } + } + + return true + }, + AfterRequestFunc: func(r *http.Request, system, endpoint string) bool { + if r != nil { + if r.URL.Path != "/foo/_search" { + return false + } + if r.Method != http.MethodPost { + return false + } + } + return true + }, + }, + }, + { + name: "without query", + args: args{ + successTp, + NewFakeInstrumentation(false), + }, + want: &FakeInstrumentation{ + Name: "search", + Closed: true, + ClusterID: "foo-bar-cluster-id", + NodeName: "0123456789", + PathParts: map[string]string{"index": "foo"}, + PersistQuery: true, + QueryEndpoint: "search", + Query: "", + BeforeRequestResult: true, + AfterRequestResult: true, + BeforeRequestFunc: func(r *http.Request, endpoint string) bool { return true }, + AfterRequestFunc: func(r *http.Request, system, endpoint string) bool { return true }, + }, + }, + { + name: "with error", + args: args{ + errorTp, + NewFakeInstrumentation(false), + }, + want: &FakeInstrumentation{ + Name: "search", + Closed: true, + ClusterID: "foo-bar-cluster-id", + NodeName: "0123456789", + PathParts: map[string]string{"index": "foo"}, + PersistQuery: true, + QueryEndpoint: "search", + Query: "", + BeforeRequestResult: true, + AfterRequestResult: true, + BeforeRequestFunc: func(r *http.Request, endpoint string) bool { return true }, + AfterRequestFunc: func(r *http.Request, system, endpoint string) bool { return true }, + Error: &types.ElasticsearchError{Status: http.StatusNotFound, ErrorCause: types.ErrorCause{Type: reason}}, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + t.Run("typed client", func(t *testing.T) { + instrument := test.args.instrumentation + instrument.BeforeRequestFunc = test.want.BeforeRequestFunc + instrument.AfterRequestFunc = test.want.AfterRequestFunc + + es, _ := NewTypedClient(Config{ + Transport: &mockTransp{RoundTripFunc: test.args.roundTripFunc}, + Instrumentation: instrument, + }) + es.Search(). + Index("foo"). + Query(&types.Query{ + MatchAll: types.NewMatchAllQuery(), + }). + Do(context.Background()) + + if test.want.Error != nil { + if !errors.Is(instrument.Error, test.want.Error) { + t.Error("ploup") + } + } + + if instrument.BeforeRequestResult != test.want.BeforeRequestResult || + instrument.AfterRequestResult != test.want.AfterRequestResult || + instrument.Name != test.want.Name || + instrument.Query != test.want.Query || + instrument.QueryEndpoint != test.want.QueryEndpoint || + instrument.NodeName != test.want.NodeName || + instrument.ClusterID != test.want.ClusterID || + instrument.Closed == false { + t.Errorf("instrument didn't record the expected values:\ngot: %#v\nwant: %#v", instrument, test.want) + } + + if !reflect.DeepEqual(instrument.PathParts, test.want.PathParts) { + t.Errorf("path parts not within expected values, got: %#v, want: %#v", instrument.PathParts, test.want.PathParts) + } + }) + t.Run("low-level client", func(t *testing.T) { + instrument := test.args.instrumentation + instrument.BeforeRequestFunc = test.want.BeforeRequestFunc + instrument.AfterRequestFunc = test.want.AfterRequestFunc + + es, _ := NewClient(Config{ + Transport: &mockTransp{RoundTripFunc: test.args.roundTripFunc}, + Instrumentation: instrument, + }) + es.Search( + es.Search.WithIndex("foo"), + es.Search.WithBody(strings.NewReader("{\"query\":{\"match_all\":{}}}")), + es.Search.WithContext(context.Background()), + ) + + if test.want.Error != nil { + if !errors.Is(instrument.Error, test.want.Error) { + t.Error("ploup") + } + } + + if instrument.BeforeRequestResult != test.want.BeforeRequestResult || + instrument.AfterRequestResult != test.want.AfterRequestResult || + instrument.Name != test.want.Name || + instrument.Query != test.want.Query || + instrument.QueryEndpoint != test.want.QueryEndpoint || + instrument.NodeName != test.want.NodeName || + instrument.ClusterID != test.want.ClusterID || + instrument.Closed == false { + t.Errorf("instrument didn't record the expected values:\ngot: %#v\nwant: %#v", instrument, test.want) + } + + if !reflect.DeepEqual(instrument.PathParts, test.want.PathParts) { + t.Errorf("path parts not within expected values, got: %#v, want: %#v", instrument.PathParts, test.want.PathParts) + } + }) + }) + } + +} diff --git a/esapi/api._.go b/esapi/api._.go index 09ae8010de..1ccae091cd 100755 --- a/esapi/api._.go +++ b/esapi/api._.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. // -// Code generated from specification version 8.12.0 (fb03858): DO NOT EDIT +// Code generated from specification version 8.12.0 (9326953): DO NOT EDIT package esapi @@ -50,6 +50,27 @@ type API struct { Bulk Bulk ClearScroll ClearScroll ClosePointInTime ClosePointInTime + ConnectorCheckIn ConnectorCheckIn + ConnectorDelete ConnectorDelete + ConnectorGet ConnectorGet + ConnectorLastSync ConnectorLastSync + ConnectorList ConnectorList + ConnectorPost ConnectorPost + ConnectorPut ConnectorPut + ConnectorSyncJobCancel ConnectorSyncJobCancel + ConnectorSyncJobCheckIn ConnectorSyncJobCheckIn + ConnectorSyncJobDelete ConnectorSyncJobDelete + ConnectorSyncJobError ConnectorSyncJobError + ConnectorSyncJobGet ConnectorSyncJobGet + ConnectorSyncJobList ConnectorSyncJobList + ConnectorSyncJobPost ConnectorSyncJobPost + ConnectorSyncJobUpdateStats ConnectorSyncJobUpdateStats + ConnectorUpdateConfiguration ConnectorUpdateConfiguration + ConnectorUpdateError ConnectorUpdateError + ConnectorUpdateFiltering ConnectorUpdateFiltering + ConnectorUpdateName ConnectorUpdateName + ConnectorUpdatePipeline ConnectorUpdatePipeline + ConnectorUpdateScheduling ConnectorUpdateScheduling Count Count Create Create DanglingIndicesDeleteDanglingIndex DanglingIndicesDeleteDanglingIndex @@ -137,6 +158,7 @@ type API struct { ShutdownDeleteNode ShutdownDeleteNode ShutdownGetNode ShutdownGetNode ShutdownPutNode ShutdownPutNode + SimulateIngest SimulateIngest SlmDeleteLifecycle SlmDeleteLifecycle SlmExecuteLifecycle SlmExecuteLifecycle SlmExecuteRetention SlmExecuteRetention @@ -595,6 +617,27 @@ func New(t Transport) *API { Bulk: newBulkFunc(t), ClearScroll: newClearScrollFunc(t), ClosePointInTime: newClosePointInTimeFunc(t), + ConnectorCheckIn: newConnectorCheckInFunc(t), + ConnectorDelete: newConnectorDeleteFunc(t), + ConnectorGet: newConnectorGetFunc(t), + ConnectorLastSync: newConnectorLastSyncFunc(t), + ConnectorList: newConnectorListFunc(t), + ConnectorPost: newConnectorPostFunc(t), + ConnectorPut: newConnectorPutFunc(t), + ConnectorSyncJobCancel: newConnectorSyncJobCancelFunc(t), + ConnectorSyncJobCheckIn: newConnectorSyncJobCheckInFunc(t), + ConnectorSyncJobDelete: newConnectorSyncJobDeleteFunc(t), + ConnectorSyncJobError: newConnectorSyncJobErrorFunc(t), + ConnectorSyncJobGet: newConnectorSyncJobGetFunc(t), + ConnectorSyncJobList: newConnectorSyncJobListFunc(t), + ConnectorSyncJobPost: newConnectorSyncJobPostFunc(t), + ConnectorSyncJobUpdateStats: newConnectorSyncJobUpdateStatsFunc(t), + ConnectorUpdateConfiguration: newConnectorUpdateConfigurationFunc(t), + ConnectorUpdateError: newConnectorUpdateErrorFunc(t), + ConnectorUpdateFiltering: newConnectorUpdateFilteringFunc(t), + ConnectorUpdateName: newConnectorUpdateNameFunc(t), + ConnectorUpdatePipeline: newConnectorUpdatePipelineFunc(t), + ConnectorUpdateScheduling: newConnectorUpdateSchedulingFunc(t), Count: newCountFunc(t), Create: newCreateFunc(t), DanglingIndicesDeleteDanglingIndex: newDanglingIndicesDeleteDanglingIndexFunc(t), @@ -682,6 +725,7 @@ func New(t Transport) *API { ShutdownDeleteNode: newShutdownDeleteNodeFunc(t), ShutdownGetNode: newShutdownGetNodeFunc(t), ShutdownPutNode: newShutdownPutNodeFunc(t), + SimulateIngest: newSimulateIngestFunc(t), SlmDeleteLifecycle: newSlmDeleteLifecycleFunc(t), SlmExecuteLifecycle: newSlmExecuteLifecycleFunc(t), SlmExecuteRetention: newSlmExecuteRetentionFunc(t), diff --git a/esapi/api.bulk.go b/esapi/api.bulk.go index effe926383..5343edff95 100644 --- a/esapi/api.bulk.go +++ b/esapi/api.bulk.go @@ -34,6 +34,11 @@ func newBulkFunc(t Transport) Bulk { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -71,16 +76,27 @@ type BulkRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r BulkRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r BulkRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "bulk") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_bulk")) @@ -88,6 +104,9 @@ func (r BulkRequest) Do(ctx context.Context, transport Transport) (*Response, er if r.Index != "" { path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } } path.WriteString("/") path.WriteString("_bulk") @@ -156,6 +175,9 @@ func (r BulkRequest) Do(ctx context.Context, transport Transport) (*Response, er req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,8 +209,20 @@ func (r BulkRequest) Do(ctx context.Context, transport Transport) (*Response, er req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "bulk") + if reader := instrument.RecordRequestBody(ctx, "bulk", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "bulk") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.aliases.go b/esapi/api.cat.aliases.go index 5285a3c1ab..1c1d79dd7d 100644 --- a/esapi/api.cat.aliases.go +++ b/esapi/api.cat.aliases.go @@ -32,6 +32,11 @@ func newCatAliasesFunc(t Transport) CatAliases { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type CatAliasesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatAliasesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatAliasesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.aliases") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("aliases") + 1 + len(strings.Join(r.Name, ","))) @@ -84,6 +100,9 @@ func (r CatAliasesRequest) Do(ctx context.Context, transport Transport) (*Respon if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } params = make(map[string]string) @@ -134,6 +153,9 @@ func (r CatAliasesRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -161,8 +183,17 @@ func (r CatAliasesRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.aliases") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.aliases") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.allocation.go b/esapi/api.cat.allocation.go index d2303f174b..4367144700 100644 --- a/esapi/api.cat.allocation.go +++ b/esapi/api.cat.allocation.go @@ -33,6 +33,11 @@ func newCatAllocationFunc(t Transport) CatAllocation { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -65,16 +70,27 @@ type CatAllocationRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatAllocationRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatAllocationRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.allocation") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("allocation") + 1 + len(strings.Join(r.NodeID, ","))) @@ -86,6 +102,9 @@ func (r CatAllocationRequest) Do(ctx context.Context, transport Transport) (*Res if len(r.NodeID) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.NodeID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", strings.Join(r.NodeID, ",")) + } } params = make(map[string]string) @@ -140,6 +159,9 @@ func (r CatAllocationRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -167,8 +189,17 @@ func (r CatAllocationRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.allocation") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.allocation") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.component_templates.go b/esapi/api.cat.component_templates.go index bb929b660f..d305d99ab9 100644 --- a/esapi/api.cat.component_templates.go +++ b/esapi/api.cat.component_templates.go @@ -33,6 +33,11 @@ func newCatComponentTemplatesFunc(t Transport) CatComponentTemplates { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type CatComponentTemplatesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatComponentTemplatesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatComponentTemplatesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.component_templates") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("component_templates") + 1 + len(r.Name)) @@ -85,6 +101,9 @@ func (r CatComponentTemplatesRequest) Do(ctx context.Context, transport Transpor if r.Name != "" { path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } } params = make(map[string]string) @@ -135,6 +154,9 @@ func (r CatComponentTemplatesRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -162,8 +184,17 @@ func (r CatComponentTemplatesRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.component_templates") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.component_templates") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.count.go b/esapi/api.cat.count.go index ac33f6bb57..1a228dc7c2 100644 --- a/esapi/api.cat.count.go +++ b/esapi/api.cat.count.go @@ -32,6 +32,11 @@ func newCatCountFunc(t Transport) CatCount { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type CatCountRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatCountRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatCountRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.count") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("count") + 1 + len(strings.Join(r.Index, ","))) @@ -82,6 +98,9 @@ func (r CatCountRequest) Do(ctx context.Context, transport Transport) (*Response if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } params = make(map[string]string) @@ -124,6 +143,9 @@ func (r CatCountRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -151,8 +173,17 @@ func (r CatCountRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.count") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.count") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.fielddata.go b/esapi/api.cat.fielddata.go index bee2871418..60c570915d 100644 --- a/esapi/api.cat.fielddata.go +++ b/esapi/api.cat.fielddata.go @@ -32,6 +32,11 @@ func newCatFielddataFunc(t Transport) CatFielddata { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type CatFielddataRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatFielddataRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatFielddataRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.fielddata") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("fielddata") + 1 + len(strings.Join(r.Fields, ","))) @@ -83,6 +99,9 @@ func (r CatFielddataRequest) Do(ctx context.Context, transport Transport) (*Resp if len(r.Fields) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Fields, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "fields", strings.Join(r.Fields, ",")) + } } params = make(map[string]string) @@ -133,6 +152,9 @@ func (r CatFielddataRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -160,8 +182,17 @@ func (r CatFielddataRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.fielddata") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.fielddata") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.health.go b/esapi/api.cat.health.go index 9e884f1701..e4cae77dad 100644 --- a/esapi/api.cat.health.go +++ b/esapi/api.cat.health.go @@ -32,6 +32,11 @@ func newCatHealthFunc(t Transport) CatHealth { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type CatHealthRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatHealthRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatHealthRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.health") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cat/health")) @@ -125,6 +141,9 @@ func (r CatHealthRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -152,8 +171,17 @@ func (r CatHealthRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.health") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.health") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.help.go b/esapi/api.cat.help.go index d96a1591d9..ba7721c50a 100644 --- a/esapi/api.cat.help.go +++ b/esapi/api.cat.help.go @@ -32,6 +32,11 @@ func newCatHelpFunc(t Transport) CatHelp { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type CatHelpRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatHelpRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatHelpRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.help") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cat")) @@ -100,6 +116,9 @@ func (r CatHelpRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +146,17 @@ func (r CatHelpRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.help") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.help") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.indices.go b/esapi/api.cat.indices.go index 484fb6dea3..ec1c1cf13f 100644 --- a/esapi/api.cat.indices.go +++ b/esapi/api.cat.indices.go @@ -33,6 +33,11 @@ func newCatIndicesFunc(t Transport) CatIndices { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -69,16 +74,27 @@ type CatIndicesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatIndicesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatIndicesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.indices") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("indices") + 1 + len(strings.Join(r.Index, ","))) @@ -90,6 +106,9 @@ func (r CatIndicesRequest) Do(ctx context.Context, transport Transport) (*Respon if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } params = make(map[string]string) @@ -160,6 +179,9 @@ func (r CatIndicesRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,8 +209,17 @@ func (r CatIndicesRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.indices") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.indices") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.master.go b/esapi/api.cat.master.go index 9b9e79baac..743ccbc9fe 100644 --- a/esapi/api.cat.master.go +++ b/esapi/api.cat.master.go @@ -33,6 +33,11 @@ func newCatMasterFunc(t Transport) CatMaster { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type CatMasterRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatMasterRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatMasterRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.master") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cat/master")) @@ -126,6 +142,9 @@ func (r CatMasterRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -153,8 +172,17 @@ func (r CatMasterRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.master") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.master") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.nodeattrs.go b/esapi/api.cat.nodeattrs.go index de450179bb..086b74fa5c 100644 --- a/esapi/api.cat.nodeattrs.go +++ b/esapi/api.cat.nodeattrs.go @@ -33,6 +33,11 @@ func newCatNodeattrsFunc(t Transport) CatNodeattrs { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type CatNodeattrsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatNodeattrsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatNodeattrsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.nodeattrs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cat/nodeattrs")) @@ -126,6 +142,9 @@ func (r CatNodeattrsRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -153,8 +172,17 @@ func (r CatNodeattrsRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.nodeattrs") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.nodeattrs") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.nodes.go b/esapi/api.cat.nodes.go index 9ff25f0d54..aa7bc16312 100644 --- a/esapi/api.cat.nodes.go +++ b/esapi/api.cat.nodes.go @@ -33,6 +33,11 @@ func newCatNodesFunc(t Transport) CatNodes { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -65,16 +70,27 @@ type CatNodesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatNodesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatNodesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.nodes") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cat/nodes")) @@ -141,6 +157,9 @@ func (r CatNodesRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -168,8 +187,17 @@ func (r CatNodesRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.nodes") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.nodes") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.pending_tasks.go b/esapi/api.cat.pending_tasks.go index 6346ee45bf..eb41a62d3a 100644 --- a/esapi/api.cat.pending_tasks.go +++ b/esapi/api.cat.pending_tasks.go @@ -33,6 +33,11 @@ func newCatPendingTasksFunc(t Transport) CatPendingTasks { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type CatPendingTasksRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatPendingTasksRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatPendingTasksRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.pending_tasks") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cat/pending_tasks")) @@ -131,6 +147,9 @@ func (r CatPendingTasksRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -158,8 +177,17 @@ func (r CatPendingTasksRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.pending_tasks") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.pending_tasks") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.plugins.go b/esapi/api.cat.plugins.go index c48fc97bb2..14dede3ea4 100644 --- a/esapi/api.cat.plugins.go +++ b/esapi/api.cat.plugins.go @@ -33,6 +33,11 @@ func newCatPluginsFunc(t Transport) CatPlugins { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type CatPluginsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatPluginsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatPluginsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.plugins") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cat/plugins")) @@ -131,6 +147,9 @@ func (r CatPluginsRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -158,8 +177,17 @@ func (r CatPluginsRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.plugins") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.plugins") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.recovery.go b/esapi/api.cat.recovery.go index 6dc825aa78..0c92488c23 100644 --- a/esapi/api.cat.recovery.go +++ b/esapi/api.cat.recovery.go @@ -32,6 +32,11 @@ func newCatRecoveryFunc(t Transport) CatRecovery { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -65,16 +70,27 @@ type CatRecoveryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatRecoveryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatRecoveryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.recovery") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("recovery") + 1 + len(strings.Join(r.Index, ","))) @@ -86,6 +102,9 @@ func (r CatRecoveryRequest) Do(ctx context.Context, transport Transport) (*Respo if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } params = make(map[string]string) @@ -148,6 +167,9 @@ func (r CatRecoveryRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,8 +197,17 @@ func (r CatRecoveryRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.recovery") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.recovery") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.repositories.go b/esapi/api.cat.repositories.go index e4c7a830bc..63a33ad031 100644 --- a/esapi/api.cat.repositories.go +++ b/esapi/api.cat.repositories.go @@ -33,6 +33,11 @@ func newCatRepositoriesFunc(t Transport) CatRepositories { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type CatRepositoriesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatRepositoriesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatRepositoriesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.repositories") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cat/repositories")) @@ -126,6 +142,9 @@ func (r CatRepositoriesRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -153,8 +172,17 @@ func (r CatRepositoriesRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.repositories") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.repositories") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.segments.go b/esapi/api.cat.segments.go index edf4a53780..d86bc0ff2a 100644 --- a/esapi/api.cat.segments.go +++ b/esapi/api.cat.segments.go @@ -32,6 +32,11 @@ func newCatSegmentsFunc(t Transport) CatSegments { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type CatSegmentsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatSegmentsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatSegmentsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.segments") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("segments") + 1 + len(strings.Join(r.Index, ","))) @@ -83,6 +99,9 @@ func (r CatSegmentsRequest) Do(ctx context.Context, transport Transport) (*Respo if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } params = make(map[string]string) @@ -129,6 +148,9 @@ func (r CatSegmentsRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -156,8 +178,17 @@ func (r CatSegmentsRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.segments") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.segments") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.shards.go b/esapi/api.cat.shards.go index dc117815b5..befb56bdf9 100644 --- a/esapi/api.cat.shards.go +++ b/esapi/api.cat.shards.go @@ -33,6 +33,11 @@ func newCatShardsFunc(t Transport) CatShards { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -65,16 +70,27 @@ type CatShardsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatShardsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatShardsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.shards") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("shards") + 1 + len(strings.Join(r.Index, ","))) @@ -86,6 +102,9 @@ func (r CatShardsRequest) Do(ctx context.Context, transport Transport) (*Respons if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } params = make(map[string]string) @@ -140,6 +159,9 @@ func (r CatShardsRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -167,8 +189,17 @@ func (r CatShardsRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.shards") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.shards") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.snapshots.go b/esapi/api.cat.snapshots.go index 3d0acfd926..514933b446 100644 --- a/esapi/api.cat.snapshots.go +++ b/esapi/api.cat.snapshots.go @@ -33,6 +33,11 @@ func newCatSnapshotsFunc(t Transport) CatSnapshots { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -65,16 +70,27 @@ type CatSnapshotsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatSnapshotsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatSnapshotsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.snapshots") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("snapshots") + 1 + len(strings.Join(r.Repository, ","))) @@ -86,6 +102,9 @@ func (r CatSnapshotsRequest) Do(ctx context.Context, transport Transport) (*Resp if len(r.Repository) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Repository, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", strings.Join(r.Repository, ",")) + } } params = make(map[string]string) @@ -140,6 +159,9 @@ func (r CatSnapshotsRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -167,8 +189,17 @@ func (r CatSnapshotsRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.snapshots") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.snapshots") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.tasks.go b/esapi/api.cat.tasks.go index 325e0fcf33..2fb0798347 100644 --- a/esapi/api.cat.tasks.go +++ b/esapi/api.cat.tasks.go @@ -32,6 +32,11 @@ func newCatTasksFunc(t Transport) CatTasks { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,16 +71,27 @@ type CatTasksRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatTasksRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatTasksRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.tasks") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cat/tasks")) @@ -142,6 +158,9 @@ func (r CatTasksRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -169,8 +188,17 @@ func (r CatTasksRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.tasks") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.tasks") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.templates.go b/esapi/api.cat.templates.go index fceae68e9c..8e9574e90c 100644 --- a/esapi/api.cat.templates.go +++ b/esapi/api.cat.templates.go @@ -33,6 +33,11 @@ func newCatTemplatesFunc(t Transport) CatTemplates { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type CatTemplatesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatTemplatesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatTemplatesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.templates") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("templates") + 1 + len(r.Name)) @@ -85,6 +101,9 @@ func (r CatTemplatesRequest) Do(ctx context.Context, transport Transport) (*Resp if r.Name != "" { path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } } params = make(map[string]string) @@ -135,6 +154,9 @@ func (r CatTemplatesRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -162,8 +184,17 @@ func (r CatTemplatesRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.templates") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.templates") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cat.thread_pool.go b/esapi/api.cat.thread_pool.go index b6be6fbeb6..91021e0f00 100644 --- a/esapi/api.cat.thread_pool.go +++ b/esapi/api.cat.thread_pool.go @@ -33,6 +33,11 @@ func newCatThreadPoolFunc(t Transport) CatThreadPool { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,16 +71,27 @@ type CatThreadPoolRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatThreadPoolRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatThreadPoolRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.thread_pool") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("thread_pool") + 1 + len(strings.Join(r.ThreadPoolPatterns, ","))) @@ -87,6 +103,9 @@ func (r CatThreadPoolRequest) Do(ctx context.Context, transport Transport) (*Res if len(r.ThreadPoolPatterns) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.ThreadPoolPatterns, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "thread_pool_patterns", strings.Join(r.ThreadPoolPatterns, ",")) + } } params = make(map[string]string) @@ -141,6 +160,9 @@ func (r CatThreadPoolRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -168,8 +190,17 @@ func (r CatThreadPoolRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.thread_pool") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.thread_pool") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.clear_scroll.go b/esapi/api.clear_scroll.go index b56e2ce039..d3d299aa5e 100644 --- a/esapi/api.clear_scroll.go +++ b/esapi/api.clear_scroll.go @@ -32,6 +32,11 @@ func newClearScrollFunc(t Transport) ClearScroll { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type ClearScrollRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClearScrollRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClearScrollRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "clear_scroll") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_search") + 1 + len("scroll") + 1 + len(strings.Join(r.ScrollID, ","))) @@ -78,6 +94,9 @@ func (r ClearScrollRequest) Do(ctx context.Context, transport Transport) (*Respo if len(r.ScrollID) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.ScrollID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "scroll_id", strings.Join(r.ScrollID, ",")) + } } params = make(map[string]string) @@ -100,6 +119,9 @@ func (r ClearScrollRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,20 @@ func (r ClearScrollRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "clear_scroll") + if reader := instrument.RecordRequestBody(ctx, "clear_scroll", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "clear_scroll") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.allocation_explain.go b/esapi/api.cluster.allocation_explain.go index 6ab4deb1f2..2cf86b3ef7 100644 --- a/esapi/api.cluster.allocation_explain.go +++ b/esapi/api.cluster.allocation_explain.go @@ -33,6 +33,11 @@ func newClusterAllocationExplainFunc(t Transport) ClusterAllocationExplain { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type ClusterAllocationExplainRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterAllocationExplainRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterAllocationExplainRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.allocation_explain") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_cluster/allocation/explain")) @@ -103,6 +119,9 @@ func (r ClusterAllocationExplainRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +153,20 @@ func (r ClusterAllocationExplainRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.allocation_explain") + if reader := instrument.RecordRequestBody(ctx, "cluster.allocation_explain", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.allocation_explain") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.delete_component_template.go b/esapi/api.cluster.delete_component_template.go index 7f1ed8c8f4..9bfb309437 100644 --- a/esapi/api.cluster.delete_component_template.go +++ b/esapi/api.cluster.delete_component_template.go @@ -32,6 +32,11 @@ func newClusterDeleteComponentTemplateFunc(t Transport) ClusterDeleteComponentTe for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type ClusterDeleteComponentTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterDeleteComponentTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterDeleteComponentTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.delete_component_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_component_template") + 1 + len(r.Name)) @@ -76,6 +92,9 @@ func (r ClusterDeleteComponentTemplateRequest) Do(ctx context.Context, transport path.WriteString("_component_template") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -105,6 +124,9 @@ func (r ClusterDeleteComponentTemplateRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -132,8 +154,17 @@ func (r ClusterDeleteComponentTemplateRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.delete_component_template") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.delete_component_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.delete_voting_config_exclusions.go b/esapi/api.cluster.delete_voting_config_exclusions.go index 74eaace549..be6a72d809 100644 --- a/esapi/api.cluster.delete_voting_config_exclusions.go +++ b/esapi/api.cluster.delete_voting_config_exclusions.go @@ -33,6 +33,11 @@ func newClusterDeleteVotingConfigExclusionsFunc(t Transport) ClusterDeleteVoting for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type ClusterDeleteVotingConfigExclusionsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterDeleteVotingConfigExclusionsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterDeleteVotingConfigExclusionsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.delete_voting_config_exclusions") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + len("/_cluster/voting_config_exclusions")) @@ -101,6 +117,9 @@ func (r ClusterDeleteVotingConfigExclusionsRequest) Do(ctx context.Context, tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +147,17 @@ func (r ClusterDeleteVotingConfigExclusionsRequest) Do(ctx context.Context, tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.delete_voting_config_exclusions") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.delete_voting_config_exclusions") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.exists_component_template.go b/esapi/api.cluster.exists_component_template.go index c447294f84..46ff5dca96 100644 --- a/esapi/api.cluster.exists_component_template.go +++ b/esapi/api.cluster.exists_component_template.go @@ -33,6 +33,11 @@ func newClusterExistsComponentTemplateFunc(t Transport) ClusterExistsComponentTe for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type ClusterExistsComponentTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterExistsComponentTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterExistsComponentTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.exists_component_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "HEAD" path.Grow(7 + 1 + len("_component_template") + 1 + len(r.Name)) @@ -77,6 +93,9 @@ func (r ClusterExistsComponentTemplateRequest) Do(ctx context.Context, transport path.WriteString("_component_template") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -106,6 +125,9 @@ func (r ClusterExistsComponentTemplateRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,17 @@ func (r ClusterExistsComponentTemplateRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.exists_component_template") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.exists_component_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.get_component_template.go b/esapi/api.cluster.get_component_template.go index e54ce6af30..0a14eaefef 100644 --- a/esapi/api.cluster.get_component_template.go +++ b/esapi/api.cluster.get_component_template.go @@ -33,6 +33,11 @@ func newClusterGetComponentTemplateFunc(t Transport) ClusterGetComponentTemplate for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type ClusterGetComponentTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterGetComponentTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterGetComponentTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.get_component_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_component_template") + 1 + len(strings.Join(r.Name, ","))) @@ -79,6 +95,9 @@ func (r ClusterGetComponentTemplateRequest) Do(ctx context.Context, transport Tr if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } params = make(map[string]string) @@ -113,6 +132,9 @@ func (r ClusterGetComponentTemplateRequest) Do(ctx context.Context, transport Tr req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +162,17 @@ func (r ClusterGetComponentTemplateRequest) Do(ctx context.Context, transport Tr req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.get_component_template") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.get_component_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.get_settings.go b/esapi/api.cluster.get_settings.go index 40e9558894..f944e81297 100644 --- a/esapi/api.cluster.get_settings.go +++ b/esapi/api.cluster.get_settings.go @@ -33,6 +33,11 @@ func newClusterGetSettingsFunc(t Transport) ClusterGetSettings { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type ClusterGetSettingsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterGetSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterGetSettingsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.get_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cluster/settings")) @@ -111,6 +127,9 @@ func (r ClusterGetSettingsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +157,17 @@ func (r ClusterGetSettingsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.get_settings") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.get_settings") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.health.go b/esapi/api.cluster.health.go index b29df2f819..3833b78b19 100644 --- a/esapi/api.cluster.health.go +++ b/esapi/api.cluster.health.go @@ -33,6 +33,11 @@ func newClusterHealthFunc(t Transport) ClusterHealth { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -68,16 +73,27 @@ type ClusterHealthRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterHealthRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterHealthRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.health") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cluster") + 1 + len("health") + 1 + len(strings.Join(r.Index, ","))) @@ -89,6 +105,9 @@ func (r ClusterHealthRequest) Do(ctx context.Context, transport Transport) (*Res if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } params = make(map[string]string) @@ -155,6 +174,9 @@ func (r ClusterHealthRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,8 +204,17 @@ func (r ClusterHealthRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.health") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.health") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.info.go b/esapi/api.cluster.info.go index bbc21df36b..a2fc94e308 100644 --- a/esapi/api.cluster.info.go +++ b/esapi/api.cluster.info.go @@ -32,6 +32,11 @@ func newClusterInfoFunc(t Transport) ClusterInfo { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type ClusterInfoRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterInfoRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" if len(r.Target) == 0 { @@ -77,6 +93,9 @@ func (r ClusterInfoRequest) Do(ctx context.Context, transport Transport) (*Respo path.WriteString("_info") path.WriteString("/") path.WriteString(strings.Join(r.Target, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "target", strings.Join(r.Target, ",")) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r ClusterInfoRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -125,8 +147,17 @@ func (r ClusterInfoRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.info") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.info") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.pending_tasks.go b/esapi/api.cluster.pending_tasks.go index 0775579288..9d4aa3ef82 100644 --- a/esapi/api.cluster.pending_tasks.go +++ b/esapi/api.cluster.pending_tasks.go @@ -33,6 +33,11 @@ func newClusterPendingTasksFunc(t Transport) ClusterPendingTasks { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type ClusterPendingTasksRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterPendingTasksRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterPendingTasksRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.pending_tasks") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_cluster/pending_tasks")) @@ -102,6 +118,9 @@ func (r ClusterPendingTasksRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +148,17 @@ func (r ClusterPendingTasksRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.pending_tasks") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.pending_tasks") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.post_voting_config_exclusions.go b/esapi/api.cluster.post_voting_config_exclusions.go index 097b26590d..8cae2ff3d0 100644 --- a/esapi/api.cluster.post_voting_config_exclusions.go +++ b/esapi/api.cluster.post_voting_config_exclusions.go @@ -32,6 +32,11 @@ func newClusterPostVotingConfigExclusionsFunc(t Transport) ClusterPostVotingConf for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type ClusterPostVotingConfigExclusionsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterPostVotingConfigExclusionsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterPostVotingConfigExclusionsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.post_voting_config_exclusions") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_cluster/voting_config_exclusions")) @@ -110,6 +126,9 @@ func (r ClusterPostVotingConfigExclusionsRequest) Do(ctx context.Context, transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -137,8 +156,17 @@ func (r ClusterPostVotingConfigExclusionsRequest) Do(ctx context.Context, transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.post_voting_config_exclusions") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.post_voting_config_exclusions") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.put_component_template.go b/esapi/api.cluster.put_component_template.go index e156580058..0f400bc336 100644 --- a/esapi/api.cluster.put_component_template.go +++ b/esapi/api.cluster.put_component_template.go @@ -34,6 +34,11 @@ func newClusterPutComponentTemplateFunc(t Transport) ClusterPutComponentTemplate for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type ClusterPutComponentTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterPutComponentTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterPutComponentTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.put_component_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_component_template") + 1 + len(r.Name)) @@ -81,6 +97,9 @@ func (r ClusterPutComponentTemplateRequest) Do(ctx context.Context, transport Tr path.WriteString("_component_template") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -114,6 +133,9 @@ func (r ClusterPutComponentTemplateRequest) Do(ctx context.Context, transport Tr req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -145,8 +167,20 @@ func (r ClusterPutComponentTemplateRequest) Do(ctx context.Context, transport Tr req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.put_component_template") + if reader := instrument.RecordRequestBody(ctx, "cluster.put_component_template", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.put_component_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.put_settings.go b/esapi/api.cluster.put_settings.go index 83aede0928..e83014f724 100644 --- a/esapi/api.cluster.put_settings.go +++ b/esapi/api.cluster.put_settings.go @@ -34,6 +34,11 @@ func newClusterPutSettingsFunc(t Transport) ClusterPutSettings { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type ClusterPutSettingsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterPutSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterPutSettingsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.put_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + len("/_cluster/settings")) @@ -109,6 +125,9 @@ func (r ClusterPutSettingsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +159,20 @@ func (r ClusterPutSettingsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.put_settings") + if reader := instrument.RecordRequestBody(ctx, "cluster.put_settings", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.put_settings") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.remote_info.go b/esapi/api.cluster.remote_info.go index e8d3a96d49..26e40816cc 100644 --- a/esapi/api.cluster.remote_info.go +++ b/esapi/api.cluster.remote_info.go @@ -31,6 +31,11 @@ func newClusterRemoteInfoFunc(t Transport) ClusterRemoteInfo { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type ClusterRemoteInfoRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterRemoteInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterRemoteInfoRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.remote_info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_remote/info")) @@ -88,6 +104,9 @@ func (r ClusterRemoteInfoRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r ClusterRemoteInfoRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.remote_info") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.remote_info") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.reroute.go b/esapi/api.cluster.reroute.go index c7e30c78fe..ba59117f4a 100644 --- a/esapi/api.cluster.reroute.go +++ b/esapi/api.cluster.reroute.go @@ -34,6 +34,11 @@ func newClusterRerouteFunc(t Transport) ClusterReroute { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type ClusterRerouteRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterRerouteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterRerouteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.reroute") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_cluster/reroute")) @@ -124,6 +140,9 @@ func (r ClusterRerouteRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -155,8 +174,20 @@ func (r ClusterRerouteRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.reroute") + if reader := instrument.RecordRequestBody(ctx, "cluster.reroute", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.reroute") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.state.go b/esapi/api.cluster.state.go index c156b9b385..52de2fcbe1 100644 --- a/esapi/api.cluster.state.go +++ b/esapi/api.cluster.state.go @@ -33,6 +33,11 @@ func newClusterStateFunc(t Transport) ClusterState { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -67,16 +72,27 @@ type ClusterStateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterStateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterStateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.state") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cluster") + 1 + len("state") + 1 + len(strings.Join(r.Metric, ",")) + 1 + len(strings.Join(r.Index, ","))) @@ -88,10 +104,16 @@ func (r ClusterStateRequest) Do(ctx context.Context, transport Transport) (*Resp if len(r.Metric) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Metric, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", strings.Join(r.Metric, ",")) + } } if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } params = make(map[string]string) @@ -146,6 +168,9 @@ func (r ClusterStateRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,8 +198,17 @@ func (r ClusterStateRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.state") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.state") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.cluster.stats.go b/esapi/api.cluster.stats.go index 1a190c0cf3..16f23731b0 100644 --- a/esapi/api.cluster.stats.go +++ b/esapi/api.cluster.stats.go @@ -33,6 +33,11 @@ func newClusterStatsFunc(t Transport) ClusterStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type ClusterStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClusterStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClusterStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(len("/nodes/_cluster/stats/nodes/") + len(strings.Join(r.NodeID, ","))) @@ -111,6 +127,9 @@ func (r ClusterStatsRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +157,17 @@ func (r ClusterStatsRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.connector.check_in.go b/esapi/api.connector.check_in.go new file mode 100644 index 0000000000..ae00513616 --- /dev/null +++ b/esapi/api.connector.check_in.go @@ -0,0 +1,227 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "net/http" + "strings" +) + +func newConnectorCheckInFunc(t Transport) ConnectorCheckIn { + return func(connector_id string, o ...func(*ConnectorCheckInRequest)) (*Response, error) { + var r = ConnectorCheckInRequest{ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorCheckIn updates the last_seen timestamp in the connector document. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorCheckIn func(connector_id string, o ...func(*ConnectorCheckInRequest)) (*Response, error) + +// ConnectorCheckInRequest configures the Connector Check In API request. +type ConnectorCheckInRequest struct { + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorCheckInRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.check_in") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID) + 1 + len("_check_in")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + path.WriteString("/") + path.WriteString("_check_in") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), nil) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.check_in") + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.check_in") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorCheckIn) WithContext(v context.Context) func(*ConnectorCheckInRequest) { + return func(r *ConnectorCheckInRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorCheckIn) WithPretty() func(*ConnectorCheckInRequest) { + return func(r *ConnectorCheckInRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorCheckIn) WithHuman() func(*ConnectorCheckInRequest) { + return func(r *ConnectorCheckInRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorCheckIn) WithErrorTrace() func(*ConnectorCheckInRequest) { + return func(r *ConnectorCheckInRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorCheckIn) WithFilterPath(v ...string) func(*ConnectorCheckInRequest) { + return func(r *ConnectorCheckInRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorCheckIn) WithHeader(h map[string]string) func(*ConnectorCheckInRequest) { + return func(r *ConnectorCheckInRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorCheckIn) WithOpaqueID(s string) func(*ConnectorCheckInRequest) { + return func(r *ConnectorCheckInRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.delete.go b/esapi/api.connector.delete.go new file mode 100644 index 0000000000..2657b31a51 --- /dev/null +++ b/esapi/api.connector.delete.go @@ -0,0 +1,225 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "net/http" + "strings" +) + +func newConnectorDeleteFunc(t Transport) ConnectorDelete { + return func(connector_id string, o ...func(*ConnectorDeleteRequest)) (*Response, error) { + var r = ConnectorDeleteRequest{ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorDelete deletes a connector. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorDelete func(connector_id string, o ...func(*ConnectorDeleteRequest)) (*Response, error) + +// ConnectorDeleteRequest configures the Connector Delete API request. +type ConnectorDeleteRequest struct { + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorDeleteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "DELETE" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID)) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), nil) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.delete") + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.delete") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorDelete) WithContext(v context.Context) func(*ConnectorDeleteRequest) { + return func(r *ConnectorDeleteRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorDelete) WithPretty() func(*ConnectorDeleteRequest) { + return func(r *ConnectorDeleteRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorDelete) WithHuman() func(*ConnectorDeleteRequest) { + return func(r *ConnectorDeleteRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorDelete) WithErrorTrace() func(*ConnectorDeleteRequest) { + return func(r *ConnectorDeleteRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorDelete) WithFilterPath(v ...string) func(*ConnectorDeleteRequest) { + return func(r *ConnectorDeleteRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorDelete) WithHeader(h map[string]string) func(*ConnectorDeleteRequest) { + return func(r *ConnectorDeleteRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorDelete) WithOpaqueID(s string) func(*ConnectorDeleteRequest) { + return func(r *ConnectorDeleteRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.get.go b/esapi/api.connector.get.go new file mode 100644 index 0000000000..73dfb5b49a --- /dev/null +++ b/esapi/api.connector.get.go @@ -0,0 +1,225 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "net/http" + "strings" +) + +func newConnectorGetFunc(t Transport) ConnectorGet { + return func(connector_id string, o ...func(*ConnectorGetRequest)) (*Response, error) { + var r = ConnectorGetRequest{ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorGet returns the details about a connector. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorGet func(connector_id string, o ...func(*ConnectorGetRequest)) (*Response, error) + +// ConnectorGetRequest configures the Connector Get API request. +type ConnectorGetRequest struct { + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorGetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "GET" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID)) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), nil) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.get") + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.get") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorGet) WithContext(v context.Context) func(*ConnectorGetRequest) { + return func(r *ConnectorGetRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorGet) WithPretty() func(*ConnectorGetRequest) { + return func(r *ConnectorGetRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorGet) WithHuman() func(*ConnectorGetRequest) { + return func(r *ConnectorGetRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorGet) WithErrorTrace() func(*ConnectorGetRequest) { + return func(r *ConnectorGetRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorGet) WithFilterPath(v ...string) func(*ConnectorGetRequest) { + return func(r *ConnectorGetRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorGet) WithHeader(h map[string]string) func(*ConnectorGetRequest) { + return func(r *ConnectorGetRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorGet) WithOpaqueID(s string) func(*ConnectorGetRequest) { + return func(r *ConnectorGetRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.last_sync.go b/esapi/api.connector.last_sync.go new file mode 100644 index 0000000000..a17b523979 --- /dev/null +++ b/esapi/api.connector.last_sync.go @@ -0,0 +1,237 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorLastSyncFunc(t Transport) ConnectorLastSync { + return func(body io.Reader, connector_id string, o ...func(*ConnectorLastSyncRequest)) (*Response, error) { + var r = ConnectorLastSyncRequest{Body: body, ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorLastSync updates the stats of last sync in the connector document. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorLastSync func(body io.Reader, connector_id string, o ...func(*ConnectorLastSyncRequest)) (*Response, error) + +// ConnectorLastSyncRequest configures the Connector Last Sync API request. +type ConnectorLastSyncRequest struct { + Body io.Reader + + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorLastSyncRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.last_sync") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID) + 1 + len("_last_sync")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + path.WriteString("/") + path.WriteString("_last_sync") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.last_sync") + if reader := instrument.RecordRequestBody(ctx, "connector.last_sync", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.last_sync") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorLastSync) WithContext(v context.Context) func(*ConnectorLastSyncRequest) { + return func(r *ConnectorLastSyncRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorLastSync) WithPretty() func(*ConnectorLastSyncRequest) { + return func(r *ConnectorLastSyncRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorLastSync) WithHuman() func(*ConnectorLastSyncRequest) { + return func(r *ConnectorLastSyncRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorLastSync) WithErrorTrace() func(*ConnectorLastSyncRequest) { + return func(r *ConnectorLastSyncRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorLastSync) WithFilterPath(v ...string) func(*ConnectorLastSyncRequest) { + return func(r *ConnectorLastSyncRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorLastSync) WithHeader(h map[string]string) func(*ConnectorLastSyncRequest) { + return func(r *ConnectorLastSyncRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorLastSync) WithOpaqueID(s string) func(*ConnectorLastSyncRequest) { + return func(r *ConnectorLastSyncRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.list.go b/esapi/api.connector.list.go new file mode 100644 index 0000000000..17fa8f1e6f --- /dev/null +++ b/esapi/api.connector.list.go @@ -0,0 +1,243 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "net/http" + "strconv" + "strings" +) + +func newConnectorListFunc(t Transport) ConnectorList { + return func(o ...func(*ConnectorListRequest)) (*Response, error) { + var r = ConnectorListRequest{} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorList lists all connectors. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorList func(o ...func(*ConnectorListRequest)) (*Response, error) + +// ConnectorListRequest configures the Connector List API request. +type ConnectorListRequest struct { + From *int + Size *int + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorListRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "GET" + + path.Grow(7 + len("/_connector")) + path.WriteString("http://") + path.WriteString("/_connector") + + params = make(map[string]string) + + if r.From != nil { + params["from"] = strconv.FormatInt(int64(*r.From), 10) + } + + if r.Size != nil { + params["size"] = strconv.FormatInt(int64(*r.Size), 10) + } + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), nil) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.list") + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.list") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorList) WithContext(v context.Context) func(*ConnectorListRequest) { + return func(r *ConnectorListRequest) { + r.ctx = v + } +} + +// WithFrom - starting offset (default: 0). +func (f ConnectorList) WithFrom(v int) func(*ConnectorListRequest) { + return func(r *ConnectorListRequest) { + r.From = &v + } +} + +// WithSize - specifies a max number of results to get (default: 100). +func (f ConnectorList) WithSize(v int) func(*ConnectorListRequest) { + return func(r *ConnectorListRequest) { + r.Size = &v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorList) WithPretty() func(*ConnectorListRequest) { + return func(r *ConnectorListRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorList) WithHuman() func(*ConnectorListRequest) { + return func(r *ConnectorListRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorList) WithErrorTrace() func(*ConnectorListRequest) { + return func(r *ConnectorListRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorList) WithFilterPath(v ...string) func(*ConnectorListRequest) { + return func(r *ConnectorListRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorList) WithHeader(h map[string]string) func(*ConnectorListRequest) { + return func(r *ConnectorListRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorList) WithOpaqueID(s string) func(*ConnectorListRequest) { + return func(r *ConnectorListRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.post.go b/esapi/api.connector.post.go new file mode 100644 index 0000000000..5a1253c99f --- /dev/null +++ b/esapi/api.connector.post.go @@ -0,0 +1,227 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorPostFunc(t Transport) ConnectorPost { + return func(body io.Reader, o ...func(*ConnectorPostRequest)) (*Response, error) { + var r = ConnectorPostRequest{Body: body} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorPost creates a connector. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorPost func(body io.Reader, o ...func(*ConnectorPostRequest)) (*Response, error) + +// ConnectorPostRequest configures the Connector Post API request. +type ConnectorPostRequest struct { + Body io.Reader + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorPostRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.post") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "POST" + + path.Grow(7 + len("/_connector")) + path.WriteString("http://") + path.WriteString("/_connector") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.post") + if reader := instrument.RecordRequestBody(ctx, "connector.post", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.post") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorPost) WithContext(v context.Context) func(*ConnectorPostRequest) { + return func(r *ConnectorPostRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorPost) WithPretty() func(*ConnectorPostRequest) { + return func(r *ConnectorPostRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorPost) WithHuman() func(*ConnectorPostRequest) { + return func(r *ConnectorPostRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorPost) WithErrorTrace() func(*ConnectorPostRequest) { + return func(r *ConnectorPostRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorPost) WithFilterPath(v ...string) func(*ConnectorPostRequest) { + return func(r *ConnectorPostRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorPost) WithHeader(h map[string]string) func(*ConnectorPostRequest) { + return func(r *ConnectorPostRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorPost) WithOpaqueID(s string) func(*ConnectorPostRequest) { + return func(r *ConnectorPostRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.put.go b/esapi/api.connector.put.go new file mode 100644 index 0000000000..4c6c3ac09c --- /dev/null +++ b/esapi/api.connector.put.go @@ -0,0 +1,235 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorPutFunc(t Transport) ConnectorPut { + return func(body io.Reader, connector_id string, o ...func(*ConnectorPutRequest)) (*Response, error) { + var r = ConnectorPutRequest{Body: body, ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorPut creates or updates a connector. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorPut func(body io.Reader, connector_id string, o ...func(*ConnectorPutRequest)) (*Response, error) + +// ConnectorPutRequest configures the Connector Put API request. +type ConnectorPutRequest struct { + Body io.Reader + + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorPutRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.put") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID)) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.put") + if reader := instrument.RecordRequestBody(ctx, "connector.put", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.put") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorPut) WithContext(v context.Context) func(*ConnectorPutRequest) { + return func(r *ConnectorPutRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorPut) WithPretty() func(*ConnectorPutRequest) { + return func(r *ConnectorPutRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorPut) WithHuman() func(*ConnectorPutRequest) { + return func(r *ConnectorPutRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorPut) WithErrorTrace() func(*ConnectorPutRequest) { + return func(r *ConnectorPutRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorPut) WithFilterPath(v ...string) func(*ConnectorPutRequest) { + return func(r *ConnectorPutRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorPut) WithHeader(h map[string]string) func(*ConnectorPutRequest) { + return func(r *ConnectorPutRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorPut) WithOpaqueID(s string) func(*ConnectorPutRequest) { + return func(r *ConnectorPutRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.update_configuration.go b/esapi/api.connector.update_configuration.go new file mode 100644 index 0000000000..044d0d5ee4 --- /dev/null +++ b/esapi/api.connector.update_configuration.go @@ -0,0 +1,237 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorUpdateConfigurationFunc(t Transport) ConnectorUpdateConfiguration { + return func(body io.Reader, connector_id string, o ...func(*ConnectorUpdateConfigurationRequest)) (*Response, error) { + var r = ConnectorUpdateConfigurationRequest{Body: body, ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorUpdateConfiguration updates the connector configuration. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorUpdateConfiguration func(body io.Reader, connector_id string, o ...func(*ConnectorUpdateConfigurationRequest)) (*Response, error) + +// ConnectorUpdateConfigurationRequest configures the Connector Update Configuration API request. +type ConnectorUpdateConfigurationRequest struct { + Body io.Reader + + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorUpdateConfigurationRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.update_configuration") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID) + 1 + len("_configuration")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + path.WriteString("/") + path.WriteString("_configuration") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.update_configuration") + if reader := instrument.RecordRequestBody(ctx, "connector.update_configuration", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.update_configuration") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorUpdateConfiguration) WithContext(v context.Context) func(*ConnectorUpdateConfigurationRequest) { + return func(r *ConnectorUpdateConfigurationRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorUpdateConfiguration) WithPretty() func(*ConnectorUpdateConfigurationRequest) { + return func(r *ConnectorUpdateConfigurationRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorUpdateConfiguration) WithHuman() func(*ConnectorUpdateConfigurationRequest) { + return func(r *ConnectorUpdateConfigurationRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorUpdateConfiguration) WithErrorTrace() func(*ConnectorUpdateConfigurationRequest) { + return func(r *ConnectorUpdateConfigurationRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorUpdateConfiguration) WithFilterPath(v ...string) func(*ConnectorUpdateConfigurationRequest) { + return func(r *ConnectorUpdateConfigurationRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorUpdateConfiguration) WithHeader(h map[string]string) func(*ConnectorUpdateConfigurationRequest) { + return func(r *ConnectorUpdateConfigurationRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorUpdateConfiguration) WithOpaqueID(s string) func(*ConnectorUpdateConfigurationRequest) { + return func(r *ConnectorUpdateConfigurationRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.update_error.go b/esapi/api.connector.update_error.go new file mode 100644 index 0000000000..1b95d4c438 --- /dev/null +++ b/esapi/api.connector.update_error.go @@ -0,0 +1,237 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorUpdateErrorFunc(t Transport) ConnectorUpdateError { + return func(body io.Reader, connector_id string, o ...func(*ConnectorUpdateErrorRequest)) (*Response, error) { + var r = ConnectorUpdateErrorRequest{Body: body, ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorUpdateError updates the error field in the connector document. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorUpdateError func(body io.Reader, connector_id string, o ...func(*ConnectorUpdateErrorRequest)) (*Response, error) + +// ConnectorUpdateErrorRequest configures the Connector Update Error API request. +type ConnectorUpdateErrorRequest struct { + Body io.Reader + + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorUpdateErrorRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.update_error") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID) + 1 + len("_error")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + path.WriteString("/") + path.WriteString("_error") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.update_error") + if reader := instrument.RecordRequestBody(ctx, "connector.update_error", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.update_error") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorUpdateError) WithContext(v context.Context) func(*ConnectorUpdateErrorRequest) { + return func(r *ConnectorUpdateErrorRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorUpdateError) WithPretty() func(*ConnectorUpdateErrorRequest) { + return func(r *ConnectorUpdateErrorRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorUpdateError) WithHuman() func(*ConnectorUpdateErrorRequest) { + return func(r *ConnectorUpdateErrorRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorUpdateError) WithErrorTrace() func(*ConnectorUpdateErrorRequest) { + return func(r *ConnectorUpdateErrorRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorUpdateError) WithFilterPath(v ...string) func(*ConnectorUpdateErrorRequest) { + return func(r *ConnectorUpdateErrorRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorUpdateError) WithHeader(h map[string]string) func(*ConnectorUpdateErrorRequest) { + return func(r *ConnectorUpdateErrorRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorUpdateError) WithOpaqueID(s string) func(*ConnectorUpdateErrorRequest) { + return func(r *ConnectorUpdateErrorRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.update_filtering.go b/esapi/api.connector.update_filtering.go new file mode 100644 index 0000000000..5c84d325b2 --- /dev/null +++ b/esapi/api.connector.update_filtering.go @@ -0,0 +1,237 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorUpdateFilteringFunc(t Transport) ConnectorUpdateFiltering { + return func(body io.Reader, connector_id string, o ...func(*ConnectorUpdateFilteringRequest)) (*Response, error) { + var r = ConnectorUpdateFilteringRequest{Body: body, ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorUpdateFiltering updates the filtering field in the connector document. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorUpdateFiltering func(body io.Reader, connector_id string, o ...func(*ConnectorUpdateFilteringRequest)) (*Response, error) + +// ConnectorUpdateFilteringRequest configures the Connector Update Filtering API request. +type ConnectorUpdateFilteringRequest struct { + Body io.Reader + + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorUpdateFilteringRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.update_filtering") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID) + 1 + len("_filtering")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + path.WriteString("/") + path.WriteString("_filtering") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.update_filtering") + if reader := instrument.RecordRequestBody(ctx, "connector.update_filtering", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.update_filtering") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorUpdateFiltering) WithContext(v context.Context) func(*ConnectorUpdateFilteringRequest) { + return func(r *ConnectorUpdateFilteringRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorUpdateFiltering) WithPretty() func(*ConnectorUpdateFilteringRequest) { + return func(r *ConnectorUpdateFilteringRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorUpdateFiltering) WithHuman() func(*ConnectorUpdateFilteringRequest) { + return func(r *ConnectorUpdateFilteringRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorUpdateFiltering) WithErrorTrace() func(*ConnectorUpdateFilteringRequest) { + return func(r *ConnectorUpdateFilteringRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorUpdateFiltering) WithFilterPath(v ...string) func(*ConnectorUpdateFilteringRequest) { + return func(r *ConnectorUpdateFilteringRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorUpdateFiltering) WithHeader(h map[string]string) func(*ConnectorUpdateFilteringRequest) { + return func(r *ConnectorUpdateFilteringRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorUpdateFiltering) WithOpaqueID(s string) func(*ConnectorUpdateFilteringRequest) { + return func(r *ConnectorUpdateFilteringRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.update_name.go b/esapi/api.connector.update_name.go new file mode 100644 index 0000000000..132f060d2c --- /dev/null +++ b/esapi/api.connector.update_name.go @@ -0,0 +1,237 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorUpdateNameFunc(t Transport) ConnectorUpdateName { + return func(body io.Reader, connector_id string, o ...func(*ConnectorUpdateNameRequest)) (*Response, error) { + var r = ConnectorUpdateNameRequest{Body: body, ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorUpdateName updates the name and/or description fields in the connector document. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorUpdateName func(body io.Reader, connector_id string, o ...func(*ConnectorUpdateNameRequest)) (*Response, error) + +// ConnectorUpdateNameRequest configures the Connector Update Name API request. +type ConnectorUpdateNameRequest struct { + Body io.Reader + + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorUpdateNameRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.update_name") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID) + 1 + len("_name")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + path.WriteString("/") + path.WriteString("_name") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.update_name") + if reader := instrument.RecordRequestBody(ctx, "connector.update_name", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.update_name") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorUpdateName) WithContext(v context.Context) func(*ConnectorUpdateNameRequest) { + return func(r *ConnectorUpdateNameRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorUpdateName) WithPretty() func(*ConnectorUpdateNameRequest) { + return func(r *ConnectorUpdateNameRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorUpdateName) WithHuman() func(*ConnectorUpdateNameRequest) { + return func(r *ConnectorUpdateNameRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorUpdateName) WithErrorTrace() func(*ConnectorUpdateNameRequest) { + return func(r *ConnectorUpdateNameRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorUpdateName) WithFilterPath(v ...string) func(*ConnectorUpdateNameRequest) { + return func(r *ConnectorUpdateNameRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorUpdateName) WithHeader(h map[string]string) func(*ConnectorUpdateNameRequest) { + return func(r *ConnectorUpdateNameRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorUpdateName) WithOpaqueID(s string) func(*ConnectorUpdateNameRequest) { + return func(r *ConnectorUpdateNameRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.update_pipeline.go b/esapi/api.connector.update_pipeline.go new file mode 100644 index 0000000000..c01c858cd4 --- /dev/null +++ b/esapi/api.connector.update_pipeline.go @@ -0,0 +1,237 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorUpdatePipelineFunc(t Transport) ConnectorUpdatePipeline { + return func(body io.Reader, connector_id string, o ...func(*ConnectorUpdatePipelineRequest)) (*Response, error) { + var r = ConnectorUpdatePipelineRequest{Body: body, ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorUpdatePipeline updates the pipeline field in the connector document. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorUpdatePipeline func(body io.Reader, connector_id string, o ...func(*ConnectorUpdatePipelineRequest)) (*Response, error) + +// ConnectorUpdatePipelineRequest configures the Connector Update Pipeline API request. +type ConnectorUpdatePipelineRequest struct { + Body io.Reader + + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorUpdatePipelineRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.update_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID) + 1 + len("_pipeline")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + path.WriteString("/") + path.WriteString("_pipeline") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.update_pipeline") + if reader := instrument.RecordRequestBody(ctx, "connector.update_pipeline", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.update_pipeline") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorUpdatePipeline) WithContext(v context.Context) func(*ConnectorUpdatePipelineRequest) { + return func(r *ConnectorUpdatePipelineRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorUpdatePipeline) WithPretty() func(*ConnectorUpdatePipelineRequest) { + return func(r *ConnectorUpdatePipelineRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorUpdatePipeline) WithHuman() func(*ConnectorUpdatePipelineRequest) { + return func(r *ConnectorUpdatePipelineRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorUpdatePipeline) WithErrorTrace() func(*ConnectorUpdatePipelineRequest) { + return func(r *ConnectorUpdatePipelineRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorUpdatePipeline) WithFilterPath(v ...string) func(*ConnectorUpdatePipelineRequest) { + return func(r *ConnectorUpdatePipelineRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorUpdatePipeline) WithHeader(h map[string]string) func(*ConnectorUpdatePipelineRequest) { + return func(r *ConnectorUpdatePipelineRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorUpdatePipeline) WithOpaqueID(s string) func(*ConnectorUpdatePipelineRequest) { + return func(r *ConnectorUpdatePipelineRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector.update_scheduling.go b/esapi/api.connector.update_scheduling.go new file mode 100644 index 0000000000..e338eb8fb9 --- /dev/null +++ b/esapi/api.connector.update_scheduling.go @@ -0,0 +1,237 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorUpdateSchedulingFunc(t Transport) ConnectorUpdateScheduling { + return func(body io.Reader, connector_id string, o ...func(*ConnectorUpdateSchedulingRequest)) (*Response, error) { + var r = ConnectorUpdateSchedulingRequest{Body: body, ConnectorID: connector_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorUpdateScheduling updates the scheduling field in the connector document. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorUpdateScheduling func(body io.Reader, connector_id string, o ...func(*ConnectorUpdateSchedulingRequest)) (*Response, error) + +// ConnectorUpdateSchedulingRequest configures the Connector Update Scheduling API request. +type ConnectorUpdateSchedulingRequest struct { + Body io.Reader + + ConnectorID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorUpdateSchedulingRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector.update_scheduling") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len(r.ConnectorID) + 1 + len("_scheduling")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString(r.ConnectorID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_id", r.ConnectorID) + } + path.WriteString("/") + path.WriteString("_scheduling") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector.update_scheduling") + if reader := instrument.RecordRequestBody(ctx, "connector.update_scheduling", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector.update_scheduling") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorUpdateScheduling) WithContext(v context.Context) func(*ConnectorUpdateSchedulingRequest) { + return func(r *ConnectorUpdateSchedulingRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorUpdateScheduling) WithPretty() func(*ConnectorUpdateSchedulingRequest) { + return func(r *ConnectorUpdateSchedulingRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorUpdateScheduling) WithHuman() func(*ConnectorUpdateSchedulingRequest) { + return func(r *ConnectorUpdateSchedulingRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorUpdateScheduling) WithErrorTrace() func(*ConnectorUpdateSchedulingRequest) { + return func(r *ConnectorUpdateSchedulingRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorUpdateScheduling) WithFilterPath(v ...string) func(*ConnectorUpdateSchedulingRequest) { + return func(r *ConnectorUpdateSchedulingRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorUpdateScheduling) WithHeader(h map[string]string) func(*ConnectorUpdateSchedulingRequest) { + return func(r *ConnectorUpdateSchedulingRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorUpdateScheduling) WithOpaqueID(s string) func(*ConnectorUpdateSchedulingRequest) { + return func(r *ConnectorUpdateSchedulingRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector_sync_job.cancel.go b/esapi/api.connector_sync_job.cancel.go new file mode 100644 index 0000000000..2117044f4a --- /dev/null +++ b/esapi/api.connector_sync_job.cancel.go @@ -0,0 +1,229 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "net/http" + "strings" +) + +func newConnectorSyncJobCancelFunc(t Transport) ConnectorSyncJobCancel { + return func(connector_sync_job_id string, o ...func(*ConnectorSyncJobCancelRequest)) (*Response, error) { + var r = ConnectorSyncJobCancelRequest{ConnectorSyncJobID: connector_sync_job_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorSyncJobCancel cancels a connector sync job. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorSyncJobCancel func(connector_sync_job_id string, o ...func(*ConnectorSyncJobCancelRequest)) (*Response, error) + +// ConnectorSyncJobCancelRequest configures the Connector Sync Job Cancel API request. +type ConnectorSyncJobCancelRequest struct { + ConnectorSyncJobID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorSyncJobCancelRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector_sync_job.cancel") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len("_sync_job") + 1 + len(r.ConnectorSyncJobID) + 1 + len("_cancel")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString("_sync_job") + path.WriteString("/") + path.WriteString(r.ConnectorSyncJobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_sync_job_id", r.ConnectorSyncJobID) + } + path.WriteString("/") + path.WriteString("_cancel") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), nil) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector_sync_job.cancel") + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector_sync_job.cancel") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorSyncJobCancel) WithContext(v context.Context) func(*ConnectorSyncJobCancelRequest) { + return func(r *ConnectorSyncJobCancelRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorSyncJobCancel) WithPretty() func(*ConnectorSyncJobCancelRequest) { + return func(r *ConnectorSyncJobCancelRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorSyncJobCancel) WithHuman() func(*ConnectorSyncJobCancelRequest) { + return func(r *ConnectorSyncJobCancelRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorSyncJobCancel) WithErrorTrace() func(*ConnectorSyncJobCancelRequest) { + return func(r *ConnectorSyncJobCancelRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorSyncJobCancel) WithFilterPath(v ...string) func(*ConnectorSyncJobCancelRequest) { + return func(r *ConnectorSyncJobCancelRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorSyncJobCancel) WithHeader(h map[string]string) func(*ConnectorSyncJobCancelRequest) { + return func(r *ConnectorSyncJobCancelRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorSyncJobCancel) WithOpaqueID(s string) func(*ConnectorSyncJobCancelRequest) { + return func(r *ConnectorSyncJobCancelRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector_sync_job.check_in.go b/esapi/api.connector_sync_job.check_in.go new file mode 100644 index 0000000000..01fc72475f --- /dev/null +++ b/esapi/api.connector_sync_job.check_in.go @@ -0,0 +1,229 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "net/http" + "strings" +) + +func newConnectorSyncJobCheckInFunc(t Transport) ConnectorSyncJobCheckIn { + return func(connector_sync_job_id string, o ...func(*ConnectorSyncJobCheckInRequest)) (*Response, error) { + var r = ConnectorSyncJobCheckInRequest{ConnectorSyncJobID: connector_sync_job_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorSyncJobCheckIn checks in a connector sync job (refreshes 'last_seen'). +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorSyncJobCheckIn func(connector_sync_job_id string, o ...func(*ConnectorSyncJobCheckInRequest)) (*Response, error) + +// ConnectorSyncJobCheckInRequest configures the Connector Sync Job Check In API request. +type ConnectorSyncJobCheckInRequest struct { + ConnectorSyncJobID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorSyncJobCheckInRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector_sync_job.check_in") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len("_sync_job") + 1 + len(r.ConnectorSyncJobID) + 1 + len("_check_in")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString("_sync_job") + path.WriteString("/") + path.WriteString(r.ConnectorSyncJobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_sync_job_id", r.ConnectorSyncJobID) + } + path.WriteString("/") + path.WriteString("_check_in") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), nil) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector_sync_job.check_in") + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector_sync_job.check_in") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorSyncJobCheckIn) WithContext(v context.Context) func(*ConnectorSyncJobCheckInRequest) { + return func(r *ConnectorSyncJobCheckInRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorSyncJobCheckIn) WithPretty() func(*ConnectorSyncJobCheckInRequest) { + return func(r *ConnectorSyncJobCheckInRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorSyncJobCheckIn) WithHuman() func(*ConnectorSyncJobCheckInRequest) { + return func(r *ConnectorSyncJobCheckInRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorSyncJobCheckIn) WithErrorTrace() func(*ConnectorSyncJobCheckInRequest) { + return func(r *ConnectorSyncJobCheckInRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorSyncJobCheckIn) WithFilterPath(v ...string) func(*ConnectorSyncJobCheckInRequest) { + return func(r *ConnectorSyncJobCheckInRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorSyncJobCheckIn) WithHeader(h map[string]string) func(*ConnectorSyncJobCheckInRequest) { + return func(r *ConnectorSyncJobCheckInRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorSyncJobCheckIn) WithOpaqueID(s string) func(*ConnectorSyncJobCheckInRequest) { + return func(r *ConnectorSyncJobCheckInRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector_sync_job.delete.go b/esapi/api.connector_sync_job.delete.go new file mode 100644 index 0000000000..1462fce943 --- /dev/null +++ b/esapi/api.connector_sync_job.delete.go @@ -0,0 +1,227 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "net/http" + "strings" +) + +func newConnectorSyncJobDeleteFunc(t Transport) ConnectorSyncJobDelete { + return func(connector_sync_job_id string, o ...func(*ConnectorSyncJobDeleteRequest)) (*Response, error) { + var r = ConnectorSyncJobDeleteRequest{ConnectorSyncJobID: connector_sync_job_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorSyncJobDelete deletes a connector sync job. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorSyncJobDelete func(connector_sync_job_id string, o ...func(*ConnectorSyncJobDeleteRequest)) (*Response, error) + +// ConnectorSyncJobDeleteRequest configures the Connector Sync Job Delete API request. +type ConnectorSyncJobDeleteRequest struct { + ConnectorSyncJobID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorSyncJobDeleteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector_sync_job.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "DELETE" + + path.Grow(7 + 1 + len("_connector") + 1 + len("_sync_job") + 1 + len(r.ConnectorSyncJobID)) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString("_sync_job") + path.WriteString("/") + path.WriteString(r.ConnectorSyncJobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_sync_job_id", r.ConnectorSyncJobID) + } + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), nil) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector_sync_job.delete") + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector_sync_job.delete") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorSyncJobDelete) WithContext(v context.Context) func(*ConnectorSyncJobDeleteRequest) { + return func(r *ConnectorSyncJobDeleteRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorSyncJobDelete) WithPretty() func(*ConnectorSyncJobDeleteRequest) { + return func(r *ConnectorSyncJobDeleteRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorSyncJobDelete) WithHuman() func(*ConnectorSyncJobDeleteRequest) { + return func(r *ConnectorSyncJobDeleteRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorSyncJobDelete) WithErrorTrace() func(*ConnectorSyncJobDeleteRequest) { + return func(r *ConnectorSyncJobDeleteRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorSyncJobDelete) WithFilterPath(v ...string) func(*ConnectorSyncJobDeleteRequest) { + return func(r *ConnectorSyncJobDeleteRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorSyncJobDelete) WithHeader(h map[string]string) func(*ConnectorSyncJobDeleteRequest) { + return func(r *ConnectorSyncJobDeleteRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorSyncJobDelete) WithOpaqueID(s string) func(*ConnectorSyncJobDeleteRequest) { + return func(r *ConnectorSyncJobDeleteRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector_sync_job.error.go b/esapi/api.connector_sync_job.error.go new file mode 100644 index 0000000000..e44bfc69a5 --- /dev/null +++ b/esapi/api.connector_sync_job.error.go @@ -0,0 +1,239 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorSyncJobErrorFunc(t Transport) ConnectorSyncJobError { + return func(body io.Reader, connector_sync_job_id string, o ...func(*ConnectorSyncJobErrorRequest)) (*Response, error) { + var r = ConnectorSyncJobErrorRequest{Body: body, ConnectorSyncJobID: connector_sync_job_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorSyncJobError sets an error for a connector sync job. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorSyncJobError func(body io.Reader, connector_sync_job_id string, o ...func(*ConnectorSyncJobErrorRequest)) (*Response, error) + +// ConnectorSyncJobErrorRequest configures the Connector Sync Job Error API request. +type ConnectorSyncJobErrorRequest struct { + Body io.Reader + + ConnectorSyncJobID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorSyncJobErrorRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector_sync_job.error") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len("_sync_job") + 1 + len(r.ConnectorSyncJobID) + 1 + len("_error")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString("_sync_job") + path.WriteString("/") + path.WriteString(r.ConnectorSyncJobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_sync_job_id", r.ConnectorSyncJobID) + } + path.WriteString("/") + path.WriteString("_error") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector_sync_job.error") + if reader := instrument.RecordRequestBody(ctx, "connector_sync_job.error", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector_sync_job.error") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorSyncJobError) WithContext(v context.Context) func(*ConnectorSyncJobErrorRequest) { + return func(r *ConnectorSyncJobErrorRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorSyncJobError) WithPretty() func(*ConnectorSyncJobErrorRequest) { + return func(r *ConnectorSyncJobErrorRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorSyncJobError) WithHuman() func(*ConnectorSyncJobErrorRequest) { + return func(r *ConnectorSyncJobErrorRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorSyncJobError) WithErrorTrace() func(*ConnectorSyncJobErrorRequest) { + return func(r *ConnectorSyncJobErrorRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorSyncJobError) WithFilterPath(v ...string) func(*ConnectorSyncJobErrorRequest) { + return func(r *ConnectorSyncJobErrorRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorSyncJobError) WithHeader(h map[string]string) func(*ConnectorSyncJobErrorRequest) { + return func(r *ConnectorSyncJobErrorRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorSyncJobError) WithOpaqueID(s string) func(*ConnectorSyncJobErrorRequest) { + return func(r *ConnectorSyncJobErrorRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector_sync_job.get.go b/esapi/api.connector_sync_job.get.go new file mode 100644 index 0000000000..bbd776fe08 --- /dev/null +++ b/esapi/api.connector_sync_job.get.go @@ -0,0 +1,227 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "net/http" + "strings" +) + +func newConnectorSyncJobGetFunc(t Transport) ConnectorSyncJobGet { + return func(connector_sync_job_id string, o ...func(*ConnectorSyncJobGetRequest)) (*Response, error) { + var r = ConnectorSyncJobGetRequest{ConnectorSyncJobID: connector_sync_job_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorSyncJobGet returns the details about a connector sync job. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorSyncJobGet func(connector_sync_job_id string, o ...func(*ConnectorSyncJobGetRequest)) (*Response, error) + +// ConnectorSyncJobGetRequest configures the Connector Sync Job Get API request. +type ConnectorSyncJobGetRequest struct { + ConnectorSyncJobID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorSyncJobGetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector_sync_job.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "GET" + + path.Grow(7 + 1 + len("_connector") + 1 + len("_sync_job") + 1 + len(r.ConnectorSyncJobID)) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString("_sync_job") + path.WriteString("/") + path.WriteString(r.ConnectorSyncJobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_sync_job_id", r.ConnectorSyncJobID) + } + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), nil) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector_sync_job.get") + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector_sync_job.get") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorSyncJobGet) WithContext(v context.Context) func(*ConnectorSyncJobGetRequest) { + return func(r *ConnectorSyncJobGetRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorSyncJobGet) WithPretty() func(*ConnectorSyncJobGetRequest) { + return func(r *ConnectorSyncJobGetRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorSyncJobGet) WithHuman() func(*ConnectorSyncJobGetRequest) { + return func(r *ConnectorSyncJobGetRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorSyncJobGet) WithErrorTrace() func(*ConnectorSyncJobGetRequest) { + return func(r *ConnectorSyncJobGetRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorSyncJobGet) WithFilterPath(v ...string) func(*ConnectorSyncJobGetRequest) { + return func(r *ConnectorSyncJobGetRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorSyncJobGet) WithHeader(h map[string]string) func(*ConnectorSyncJobGetRequest) { + return func(r *ConnectorSyncJobGetRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorSyncJobGet) WithOpaqueID(s string) func(*ConnectorSyncJobGetRequest) { + return func(r *ConnectorSyncJobGetRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector_sync_job.list.go b/esapi/api.connector_sync_job.list.go new file mode 100644 index 0000000000..a3aab44b79 --- /dev/null +++ b/esapi/api.connector_sync_job.list.go @@ -0,0 +1,267 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "net/http" + "strconv" + "strings" +) + +func newConnectorSyncJobListFunc(t Transport) ConnectorSyncJobList { + return func(o ...func(*ConnectorSyncJobListRequest)) (*Response, error) { + var r = ConnectorSyncJobListRequest{} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorSyncJobList lists all connector sync jobs. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorSyncJobList func(o ...func(*ConnectorSyncJobListRequest)) (*Response, error) + +// ConnectorSyncJobListRequest configures the Connector Sync Job List API request. +type ConnectorSyncJobListRequest struct { + ConnectorID string + From *int + Size *int + Status string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorSyncJobListRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector_sync_job.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "GET" + + path.Grow(7 + len("/_connector/_sync_job")) + path.WriteString("http://") + path.WriteString("/_connector/_sync_job") + + params = make(map[string]string) + + if r.ConnectorID != "" { + params["connector_id"] = r.ConnectorID + } + + if r.From != nil { + params["from"] = strconv.FormatInt(int64(*r.From), 10) + } + + if r.Size != nil { + params["size"] = strconv.FormatInt(int64(*r.Size), 10) + } + + if r.Status != "" { + params["status"] = r.Status + } + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), nil) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector_sync_job.list") + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector_sync_job.list") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorSyncJobList) WithContext(v context.Context) func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + r.ctx = v + } +} + +// WithConnectorID - ID of the connector to fetch the sync jobs for. +func (f ConnectorSyncJobList) WithConnectorID(v string) func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + r.ConnectorID = v + } +} + +// WithFrom - starting offset (default: 0). +func (f ConnectorSyncJobList) WithFrom(v int) func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + r.From = &v + } +} + +// WithSize - specifies a max number of results to get (default: 100). +func (f ConnectorSyncJobList) WithSize(v int) func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + r.Size = &v + } +} + +// WithStatus - sync job status, which sync jobs are fetched for. +func (f ConnectorSyncJobList) WithStatus(v string) func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + r.Status = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorSyncJobList) WithPretty() func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorSyncJobList) WithHuman() func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorSyncJobList) WithErrorTrace() func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorSyncJobList) WithFilterPath(v ...string) func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorSyncJobList) WithHeader(h map[string]string) func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorSyncJobList) WithOpaqueID(s string) func(*ConnectorSyncJobListRequest) { + return func(r *ConnectorSyncJobListRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector_sync_job.post.go b/esapi/api.connector_sync_job.post.go new file mode 100644 index 0000000000..cbeb94bd90 --- /dev/null +++ b/esapi/api.connector_sync_job.post.go @@ -0,0 +1,227 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorSyncJobPostFunc(t Transport) ConnectorSyncJobPost { + return func(body io.Reader, o ...func(*ConnectorSyncJobPostRequest)) (*Response, error) { + var r = ConnectorSyncJobPostRequest{Body: body} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorSyncJobPost creates a connector sync job. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorSyncJobPost func(body io.Reader, o ...func(*ConnectorSyncJobPostRequest)) (*Response, error) + +// ConnectorSyncJobPostRequest configures the Connector Sync Job Post API request. +type ConnectorSyncJobPostRequest struct { + Body io.Reader + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorSyncJobPostRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector_sync_job.post") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "POST" + + path.Grow(7 + len("/_connector/_sync_job")) + path.WriteString("http://") + path.WriteString("/_connector/_sync_job") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector_sync_job.post") + if reader := instrument.RecordRequestBody(ctx, "connector_sync_job.post", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector_sync_job.post") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorSyncJobPost) WithContext(v context.Context) func(*ConnectorSyncJobPostRequest) { + return func(r *ConnectorSyncJobPostRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorSyncJobPost) WithPretty() func(*ConnectorSyncJobPostRequest) { + return func(r *ConnectorSyncJobPostRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorSyncJobPost) WithHuman() func(*ConnectorSyncJobPostRequest) { + return func(r *ConnectorSyncJobPostRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorSyncJobPost) WithErrorTrace() func(*ConnectorSyncJobPostRequest) { + return func(r *ConnectorSyncJobPostRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorSyncJobPost) WithFilterPath(v ...string) func(*ConnectorSyncJobPostRequest) { + return func(r *ConnectorSyncJobPostRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorSyncJobPost) WithHeader(h map[string]string) func(*ConnectorSyncJobPostRequest) { + return func(r *ConnectorSyncJobPostRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorSyncJobPost) WithOpaqueID(s string) func(*ConnectorSyncJobPostRequest) { + return func(r *ConnectorSyncJobPostRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.connector_sync_job.update_stats.go b/esapi/api.connector_sync_job.update_stats.go new file mode 100644 index 0000000000..1d6d346180 --- /dev/null +++ b/esapi/api.connector_sync_job.update_stats.go @@ -0,0 +1,239 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newConnectorSyncJobUpdateStatsFunc(t Transport) ConnectorSyncJobUpdateStats { + return func(body io.Reader, connector_sync_job_id string, o ...func(*ConnectorSyncJobUpdateStatsRequest)) (*Response, error) { + var r = ConnectorSyncJobUpdateStatsRequest{Body: body, ConnectorSyncJobID: connector_sync_job_id} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// ConnectorSyncJobUpdateStats updates the stats fields in the connector sync job document. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/enterprise-search/current/connectors.html. +type ConnectorSyncJobUpdateStats func(body io.Reader, connector_sync_job_id string, o ...func(*ConnectorSyncJobUpdateStatsRequest)) (*Response, error) + +// ConnectorSyncJobUpdateStatsRequest configures the Connector Sync Job Update Stats API request. +type ConnectorSyncJobUpdateStatsRequest struct { + Body io.Reader + + ConnectorSyncJobID string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r ConnectorSyncJobUpdateStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "connector_sync_job.update_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "PUT" + + path.Grow(7 + 1 + len("_connector") + 1 + len("_sync_job") + 1 + len(r.ConnectorSyncJobID) + 1 + len("_stats")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_connector") + path.WriteString("/") + path.WriteString("_sync_job") + path.WriteString("/") + path.WriteString(r.ConnectorSyncJobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "connector_sync_job_id", r.ConnectorSyncJobID) + } + path.WriteString("/") + path.WriteString("_stats") + + params = make(map[string]string) + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "connector_sync_job.update_stats") + if reader := instrument.RecordRequestBody(ctx, "connector_sync_job.update_stats", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "connector_sync_job.update_stats") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f ConnectorSyncJobUpdateStats) WithContext(v context.Context) func(*ConnectorSyncJobUpdateStatsRequest) { + return func(r *ConnectorSyncJobUpdateStatsRequest) { + r.ctx = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f ConnectorSyncJobUpdateStats) WithPretty() func(*ConnectorSyncJobUpdateStatsRequest) { + return func(r *ConnectorSyncJobUpdateStatsRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f ConnectorSyncJobUpdateStats) WithHuman() func(*ConnectorSyncJobUpdateStatsRequest) { + return func(r *ConnectorSyncJobUpdateStatsRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f ConnectorSyncJobUpdateStats) WithErrorTrace() func(*ConnectorSyncJobUpdateStatsRequest) { + return func(r *ConnectorSyncJobUpdateStatsRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f ConnectorSyncJobUpdateStats) WithFilterPath(v ...string) func(*ConnectorSyncJobUpdateStatsRequest) { + return func(r *ConnectorSyncJobUpdateStatsRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f ConnectorSyncJobUpdateStats) WithHeader(h map[string]string) func(*ConnectorSyncJobUpdateStatsRequest) { + return func(r *ConnectorSyncJobUpdateStatsRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f ConnectorSyncJobUpdateStats) WithOpaqueID(s string) func(*ConnectorSyncJobUpdateStatsRequest) { + return func(r *ConnectorSyncJobUpdateStatsRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.count.go b/esapi/api.count.go index d1bacacae3..312e5dd262 100644 --- a/esapi/api.count.go +++ b/esapi/api.count.go @@ -33,6 +33,11 @@ func newCountFunc(t Transport) Count { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -73,16 +78,27 @@ type CountRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CountRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CountRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "count") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_count")) @@ -90,6 +106,9 @@ func (r CountRequest) Do(ctx context.Context, transport Transport) (*Response, e if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_count") @@ -170,6 +189,9 @@ func (r CountRequest) Do(ctx context.Context, transport Transport) (*Response, e req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -201,8 +223,20 @@ func (r CountRequest) Do(ctx context.Context, transport Transport) (*Response, e req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "count") + if reader := instrument.RecordRequestBody(ctx, "count", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "count") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.create.go b/esapi/api.create.go index 3d8c60d927..4b811a0593 100644 --- a/esapi/api.create.go +++ b/esapi/api.create.go @@ -34,6 +34,11 @@ func newCreateFunc(t Transport) Create { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -70,26 +75,43 @@ type CreateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CreateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CreateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "create") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len(r.Index) + 1 + len("_create") + 1 + len(r.DocumentID)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_create") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -139,6 +161,9 @@ func (r CreateRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -170,8 +195,20 @@ func (r CreateRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "create") + if reader := instrument.RecordRequestBody(ctx, "create", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "create") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.dangling_indices.delete_dangling_index.go b/esapi/api.dangling_indices.delete_dangling_index.go index 10ac79f522..01fb268552 100644 --- a/esapi/api.dangling_indices.delete_dangling_index.go +++ b/esapi/api.dangling_indices.delete_dangling_index.go @@ -33,6 +33,11 @@ func newDanglingIndicesDeleteDanglingIndexFunc(t Transport) DanglingIndicesDelet for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type DanglingIndicesDeleteDanglingIndexRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r DanglingIndicesDeleteDanglingIndexRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r DanglingIndicesDeleteDanglingIndexRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "dangling_indices.delete_dangling_index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_dangling") + 1 + len(r.IndexUUID)) @@ -78,6 +94,9 @@ func (r DanglingIndicesDeleteDanglingIndexRequest) Do(ctx context.Context, trans path.WriteString("_dangling") path.WriteString("/") path.WriteString(r.IndexUUID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index_uuid", r.IndexUUID) + } params = make(map[string]string) @@ -111,6 +130,9 @@ func (r DanglingIndicesDeleteDanglingIndexRequest) Do(ctx context.Context, trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +160,17 @@ func (r DanglingIndicesDeleteDanglingIndexRequest) Do(ctx context.Context, trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "dangling_indices.delete_dangling_index") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "dangling_indices.delete_dangling_index") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.dangling_indices.import_dangling_index.go b/esapi/api.dangling_indices.import_dangling_index.go index f4c18bbaff..c0a39de567 100644 --- a/esapi/api.dangling_indices.import_dangling_index.go +++ b/esapi/api.dangling_indices.import_dangling_index.go @@ -33,6 +33,11 @@ func newDanglingIndicesImportDanglingIndexFunc(t Transport) DanglingIndicesImpor for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type DanglingIndicesImportDanglingIndexRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r DanglingIndicesImportDanglingIndexRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r DanglingIndicesImportDanglingIndexRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "dangling_indices.import_dangling_index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_dangling") + 1 + len(r.IndexUUID)) @@ -78,6 +94,9 @@ func (r DanglingIndicesImportDanglingIndexRequest) Do(ctx context.Context, trans path.WriteString("_dangling") path.WriteString("/") path.WriteString(r.IndexUUID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index_uuid", r.IndexUUID) + } params = make(map[string]string) @@ -111,6 +130,9 @@ func (r DanglingIndicesImportDanglingIndexRequest) Do(ctx context.Context, trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +160,17 @@ func (r DanglingIndicesImportDanglingIndexRequest) Do(ctx context.Context, trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "dangling_indices.import_dangling_index") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "dangling_indices.import_dangling_index") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.dangling_indices.list_dangling_indices.go b/esapi/api.dangling_indices.list_dangling_indices.go index 6c554a003a..768d11f424 100644 --- a/esapi/api.dangling_indices.list_dangling_indices.go +++ b/esapi/api.dangling_indices.list_dangling_indices.go @@ -31,6 +31,11 @@ func newDanglingIndicesListDanglingIndicesFunc(t Transport) DanglingIndicesListD for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type DanglingIndicesListDanglingIndicesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r DanglingIndicesListDanglingIndicesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r DanglingIndicesListDanglingIndicesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "dangling_indices.list_dangling_indices") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_dangling")) @@ -88,6 +104,9 @@ func (r DanglingIndicesListDanglingIndicesRequest) Do(ctx context.Context, trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r DanglingIndicesListDanglingIndicesRequest) Do(ctx context.Context, trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "dangling_indices.list_dangling_indices") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "dangling_indices.list_dangling_indices") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.delete.go b/esapi/api.delete.go index 8229652845..1c1a185b90 100644 --- a/esapi/api.delete.go +++ b/esapi/api.delete.go @@ -33,6 +33,11 @@ func newDeleteFunc(t Transport) Delete { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,26 +71,43 @@ type DeleteRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r DeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r DeleteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len(r.Index) + 1 + len("_doc") + 1 + len(r.DocumentID)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_doc") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -139,6 +161,9 @@ func (r DeleteRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,8 +191,17 @@ func (r DeleteRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "delete") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "delete") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.delete_by_query.go b/esapi/api.delete_by_query.go index 29e882a933..601dca9b83 100644 --- a/esapi/api.delete_by_query.go +++ b/esapi/api.delete_by_query.go @@ -36,6 +36,11 @@ func newDeleteByQueryFunc(t Transport) DeleteByQuery { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -91,16 +96,27 @@ type DeleteByQueryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r DeleteByQueryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r DeleteByQueryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete_by_query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -111,6 +127,9 @@ func (r DeleteByQueryRequest) Do(ctx context.Context, transport Transport) (*Res path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_delete_by_query") @@ -250,6 +269,9 @@ func (r DeleteByQueryRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -281,8 +303,20 @@ func (r DeleteByQueryRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "delete_by_query") + if reader := instrument.RecordRequestBody(ctx, "delete_by_query", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "delete_by_query") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.delete_by_query_rethrottle.go b/esapi/api.delete_by_query_rethrottle.go index 3acb683084..71b9e79fb2 100644 --- a/esapi/api.delete_by_query_rethrottle.go +++ b/esapi/api.delete_by_query_rethrottle.go @@ -32,6 +32,11 @@ func newDeleteByQueryRethrottleFunc(t Transport) DeleteByQueryRethrottle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type DeleteByQueryRethrottleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r DeleteByQueryRethrottleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r DeleteByQueryRethrottleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete_by_query_rethrottle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_delete_by_query") + 1 + len(r.TaskID) + 1 + len("_rethrottle")) @@ -75,6 +91,9 @@ func (r DeleteByQueryRethrottleRequest) Do(ctx context.Context, transport Transp path.WriteString("_delete_by_query") path.WriteString("/") path.WriteString(r.TaskID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "task_id", r.TaskID) + } path.WriteString("/") path.WriteString("_rethrottle") @@ -102,6 +121,9 @@ func (r DeleteByQueryRethrottleRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,17 @@ func (r DeleteByQueryRethrottleRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "delete_by_query_rethrottle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "delete_by_query_rethrottle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.delete_script.go b/esapi/api.delete_script.go index 5b21b77c6d..5ef41c35d9 100644 --- a/esapi/api.delete_script.go +++ b/esapi/api.delete_script.go @@ -32,6 +32,11 @@ func newDeleteScriptFunc(t Transport) DeleteScript { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type DeleteScriptRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r DeleteScriptRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r DeleteScriptRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete_script") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_scripts") + 1 + len(r.ScriptID)) @@ -76,6 +92,9 @@ func (r DeleteScriptRequest) Do(ctx context.Context, transport Transport) (*Resp path.WriteString("_scripts") path.WriteString("/") path.WriteString(r.ScriptID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.ScriptID) + } params = make(map[string]string) @@ -105,6 +124,9 @@ func (r DeleteScriptRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -132,8 +154,17 @@ func (r DeleteScriptRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "delete_script") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "delete_script") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.exists.go b/esapi/api.exists.go index f56f5b614c..6137571d45 100644 --- a/esapi/api.exists.go +++ b/esapi/api.exists.go @@ -32,6 +32,11 @@ func newExistsFunc(t Transport) Exists { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -67,26 +72,43 @@ type ExistsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ExistsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ExistsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "exists") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "HEAD" path.Grow(7 + 1 + len(r.Index) + 1 + len("_doc") + 1 + len(r.DocumentID)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_doc") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -148,6 +170,9 @@ func (r ExistsRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,8 +200,17 @@ func (r ExistsRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "exists") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "exists") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.exists_source.go b/esapi/api.exists_source.go index 747e055bbd..274b180618 100644 --- a/esapi/api.exists_source.go +++ b/esapi/api.exists_source.go @@ -32,6 +32,11 @@ func newExistsSourceFunc(t Transport) ExistsSource { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,26 +71,43 @@ type ExistsSourceRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ExistsSourceRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ExistsSourceRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "exists_source") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "HEAD" path.Grow(7 + 1 + len(r.Index) + 1 + len("_source") + 1 + len(r.DocumentID)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_source") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -143,6 +165,9 @@ func (r ExistsSourceRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -170,8 +195,17 @@ func (r ExistsSourceRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "exists_source") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "exists_source") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.explain.go b/esapi/api.explain.go index 62b8b79514..716f9b5e4f 100644 --- a/esapi/api.explain.go +++ b/esapi/api.explain.go @@ -33,6 +33,11 @@ func newExplainFunc(t Transport) Explain { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -72,26 +77,43 @@ type ExplainRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ExplainRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ExplainRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "explain") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_explain") + 1 + len(r.DocumentID)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_explain") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -161,6 +183,9 @@ func (r ExplainRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,8 +217,20 @@ func (r ExplainRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "explain") + if reader := instrument.RecordRequestBody(ctx, "explain", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "explain") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.features.get_features.go b/esapi/api.features.get_features.go index b2086b551e..21f5f8359e 100644 --- a/esapi/api.features.get_features.go +++ b/esapi/api.features.get_features.go @@ -32,6 +32,11 @@ func newFeaturesGetFeaturesFunc(t Transport) FeaturesGetFeatures { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type FeaturesGetFeaturesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r FeaturesGetFeaturesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r FeaturesGetFeaturesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "features.get_features") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_features")) @@ -95,6 +111,9 @@ func (r FeaturesGetFeaturesRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,17 @@ func (r FeaturesGetFeaturesRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "features.get_features") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "features.get_features") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.features.reset_features.go b/esapi/api.features.reset_features.go index 5cb30552b5..6ca0610b0e 100644 --- a/esapi/api.features.reset_features.go +++ b/esapi/api.features.reset_features.go @@ -31,6 +31,11 @@ func newFeaturesResetFeaturesFunc(t Transport) FeaturesResetFeatures { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type FeaturesResetFeaturesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r FeaturesResetFeaturesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r FeaturesResetFeaturesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "features.reset_features") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_features/_reset")) @@ -90,6 +106,9 @@ func (r FeaturesResetFeaturesRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -117,8 +136,17 @@ func (r FeaturesResetFeaturesRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "features.reset_features") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "features.reset_features") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.field_caps.go b/esapi/api.field_caps.go index 84a43f946e..4b00e26b09 100644 --- a/esapi/api.field_caps.go +++ b/esapi/api.field_caps.go @@ -33,6 +33,11 @@ func newFieldCapsFunc(t Transport) FieldCaps { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,16 +71,27 @@ type FieldCapsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r FieldCapsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r FieldCapsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "field_caps") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_field_caps")) @@ -83,6 +99,9 @@ func (r FieldCapsRequest) Do(ctx context.Context, transport Transport) (*Respons if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_field_caps") @@ -135,6 +154,9 @@ func (r FieldCapsRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,8 +188,20 @@ func (r FieldCapsRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "field_caps") + if reader := instrument.RecordRequestBody(ctx, "field_caps", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "field_caps") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.fleet.delete_secret.go b/esapi/api.fleet.delete_secret.go index 181f8575b1..d661c11225 100644 --- a/esapi/api.fleet.delete_secret.go +++ b/esapi/api.fleet.delete_secret.go @@ -31,6 +31,11 @@ func newFleetDeleteSecretFunc(t Transport) FleetDeleteSecret { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type FleetDeleteSecretRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r FleetDeleteSecretRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r FleetDeleteSecretRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.delete_secret") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_fleet") + 1 + len("secret") + 1 + len(r.DocumentID)) @@ -74,6 +90,9 @@ func (r FleetDeleteSecretRequest) Do(ctx context.Context, transport Transport) ( path.WriteString("secret") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r FleetDeleteSecretRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r FleetDeleteSecretRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "fleet.delete_secret") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "fleet.delete_secret") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.fleet.get_secret.go b/esapi/api.fleet.get_secret.go index d3944faad0..8c21b4ebd0 100644 --- a/esapi/api.fleet.get_secret.go +++ b/esapi/api.fleet.get_secret.go @@ -31,6 +31,11 @@ func newFleetGetSecretFunc(t Transport) FleetGetSecret { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type FleetGetSecretRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r FleetGetSecretRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r FleetGetSecretRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.get_secret") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_fleet") + 1 + len("secret") + 1 + len(r.DocumentID)) @@ -74,6 +90,9 @@ func (r FleetGetSecretRequest) Do(ctx context.Context, transport Transport) (*Re path.WriteString("secret") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r FleetGetSecretRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r FleetGetSecretRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "fleet.get_secret") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "fleet.get_secret") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.fleet.global_checkpoints.go b/esapi/api.fleet.global_checkpoints.go index 0673189780..859624fda9 100644 --- a/esapi/api.fleet.global_checkpoints.go +++ b/esapi/api.fleet.global_checkpoints.go @@ -33,6 +33,11 @@ func newFleetGlobalCheckpointsFunc(t Transport) FleetGlobalCheckpoints { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,22 +66,36 @@ type FleetGlobalCheckpointsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r FleetGlobalCheckpointsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r FleetGlobalCheckpointsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.global_checkpoints") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(r.Index) + 1 + len("_fleet") + 1 + len("global_checkpoints")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_fleet") path.WriteString("/") @@ -118,6 +137,9 @@ func (r FleetGlobalCheckpointsRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -145,8 +167,17 @@ func (r FleetGlobalCheckpointsRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "fleet.global_checkpoints") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "fleet.global_checkpoints") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.fleet.msearch.go b/esapi/api.fleet.msearch.go index 48a9cf1bf0..cb5934ecdd 100644 --- a/esapi/api.fleet.msearch.go +++ b/esapi/api.fleet.msearch.go @@ -32,6 +32,11 @@ func newFleetMsearchFunc(t Transport) FleetMsearch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type FleetMsearchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r FleetMsearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r FleetMsearchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.msearch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_fleet") + 1 + len("_fleet_msearch")) @@ -74,6 +90,9 @@ func (r FleetMsearchRequest) Do(ctx context.Context, transport Transport) (*Resp if r.Index != "" { path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } } path.WriteString("/") path.WriteString("_fleet") @@ -100,6 +119,9 @@ func (r FleetMsearchRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,20 @@ func (r FleetMsearchRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "fleet.msearch") + if reader := instrument.RecordRequestBody(ctx, "fleet.msearch", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "fleet.msearch") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.fleet.post_secret.go b/esapi/api.fleet.post_secret.go index a1a9dabc65..c6a84d7479 100644 --- a/esapi/api.fleet.post_secret.go +++ b/esapi/api.fleet.post_secret.go @@ -32,6 +32,11 @@ func newFleetPostSecretFunc(t Transport) FleetPostSecret { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type FleetPostSecretRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r FleetPostSecretRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r FleetPostSecretRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.post_secret") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_fleet/secret")) @@ -91,6 +107,9 @@ func (r FleetPostSecretRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r FleetPostSecretRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "fleet.post_secret") + if reader := instrument.RecordRequestBody(ctx, "fleet.post_secret", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "fleet.post_secret") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.fleet.search.go b/esapi/api.fleet.search.go index ca2c16ec71..f6003d6441 100644 --- a/esapi/api.fleet.search.go +++ b/esapi/api.fleet.search.go @@ -34,6 +34,11 @@ func newFleetSearchFunc(t Transport) FleetSearch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,22 +68,36 @@ type FleetSearchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r FleetSearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r FleetSearchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_fleet") + 1 + len("_fleet_search")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_fleet") path.WriteString("/") @@ -116,6 +135,9 @@ func (r FleetSearchRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -147,8 +169,20 @@ func (r FleetSearchRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "fleet.search") + if reader := instrument.RecordRequestBody(ctx, "fleet.search", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "fleet.search") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.get.go b/esapi/api.get.go index a15affb770..27ef6acddc 100644 --- a/esapi/api.get.go +++ b/esapi/api.get.go @@ -32,6 +32,11 @@ func newGetFunc(t Transport) Get { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -68,26 +73,43 @@ type GetRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r GetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r GetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(r.Index) + 1 + len("_doc") + 1 + len(r.DocumentID)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_doc") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -153,6 +175,9 @@ func (r GetRequest) Do(ctx context.Context, transport Transport) (*Response, err req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,8 +205,17 @@ func (r GetRequest) Do(ctx context.Context, transport Transport) (*Response, err req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "get") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "get") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.get_script.go b/esapi/api.get_script.go index 177fef94d1..38e993f5e7 100644 --- a/esapi/api.get_script.go +++ b/esapi/api.get_script.go @@ -32,6 +32,11 @@ func newGetScriptFunc(t Transport) GetScript { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type GetScriptRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r GetScriptRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r GetScriptRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_script") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_scripts") + 1 + len(r.ScriptID)) @@ -75,6 +91,9 @@ func (r GetScriptRequest) Do(ctx context.Context, transport Transport) (*Respons path.WriteString("_scripts") path.WriteString("/") path.WriteString(r.ScriptID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.ScriptID) + } params = make(map[string]string) @@ -100,6 +119,9 @@ func (r GetScriptRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +149,17 @@ func (r GetScriptRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "get_script") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "get_script") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.get_script_context.go b/esapi/api.get_script_context.go index d815829840..1a3d776e18 100644 --- a/esapi/api.get_script_context.go +++ b/esapi/api.get_script_context.go @@ -31,6 +31,11 @@ func newGetScriptContextFunc(t Transport) GetScriptContext { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type GetScriptContextRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r GetScriptContextRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r GetScriptContextRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_script_context") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_script_context")) @@ -88,6 +104,9 @@ func (r GetScriptContextRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r GetScriptContextRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "get_script_context") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "get_script_context") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.get_script_languages.go b/esapi/api.get_script_languages.go index f03e5709bf..aee9443a67 100644 --- a/esapi/api.get_script_languages.go +++ b/esapi/api.get_script_languages.go @@ -31,6 +31,11 @@ func newGetScriptLanguagesFunc(t Transport) GetScriptLanguages { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type GetScriptLanguagesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r GetScriptLanguagesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r GetScriptLanguagesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_script_languages") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_script_language")) @@ -88,6 +104,9 @@ func (r GetScriptLanguagesRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r GetScriptLanguagesRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "get_script_languages") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "get_script_languages") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.get_source.go b/esapi/api.get_source.go index 6dcde18aa5..cdc5216eea 100644 --- a/esapi/api.get_source.go +++ b/esapi/api.get_source.go @@ -32,6 +32,11 @@ func newGetSourceFunc(t Transport) GetSource { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,26 +71,43 @@ type GetSourceRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r GetSourceRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r GetSourceRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_source") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(r.Index) + 1 + len("_source") + 1 + len(r.DocumentID)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_source") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -143,6 +165,9 @@ func (r GetSourceRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -170,8 +195,17 @@ func (r GetSourceRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "get_source") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "get_source") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.health_report.go b/esapi/api.health_report.go index ae1c2b4715..c59a68b9d2 100644 --- a/esapi/api.health_report.go +++ b/esapi/api.health_report.go @@ -33,6 +33,11 @@ func newHealthReportFunc(t Transport) HealthReport { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type HealthReportRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r HealthReportRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r HealthReportRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "health_report") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_health_report") + 1 + len(r.Feature)) @@ -79,6 +95,9 @@ func (r HealthReportRequest) Do(ctx context.Context, transport Transport) (*Resp if r.Feature != "" { path.WriteString("/") path.WriteString(r.Feature) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "feature", r.Feature) + } } params = make(map[string]string) @@ -113,6 +132,9 @@ func (r HealthReportRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +162,17 @@ func (r HealthReportRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "health_report") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "health_report") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.index.go b/esapi/api.index.go index d1bb98cc65..f4a8cd6922 100644 --- a/esapi/api.index.go +++ b/esapi/api.index.go @@ -34,6 +34,11 @@ func newIndexFunc(t Transport) Index { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -72,16 +77,27 @@ type IndexRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndexRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndexRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + if r.DocumentID != "" { method = "PUT" } else { @@ -92,11 +108,17 @@ func (r IndexRequest) Do(ctx context.Context, transport Transport) (*Response, e path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_doc") if r.DocumentID != "" { path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } } params = make(map[string]string) @@ -163,6 +185,9 @@ func (r IndexRequest) Do(ctx context.Context, transport Transport) (*Response, e req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -194,8 +219,20 @@ func (r IndexRequest) Do(ctx context.Context, transport Transport) (*Response, e req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "index") + if reader := instrument.RecordRequestBody(ctx, "index", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "index") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.add_block.go b/esapi/api.indices.add_block.go index 1fd53acf9d..1beca0374f 100644 --- a/esapi/api.indices.add_block.go +++ b/esapi/api.indices.add_block.go @@ -34,6 +34,11 @@ func newIndicesAddBlockFunc(t Transport) IndicesAddBlock { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -65,16 +70,27 @@ type IndicesAddBlockRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesAddBlockRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesAddBlockRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.add_block") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" if len(r.Index) == 0 { @@ -85,10 +101,16 @@ func (r IndicesAddBlockRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_block") path.WriteString("/") path.WriteString(r.Block) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "block", r.Block) + } params = make(map[string]string) @@ -130,6 +152,9 @@ func (r IndicesAddBlockRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -157,8 +182,17 @@ func (r IndicesAddBlockRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.add_block") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.add_block") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.analyze.go b/esapi/api.indices.analyze.go index 332ffbd96f..af7283bf5b 100644 --- a/esapi/api.indices.analyze.go +++ b/esapi/api.indices.analyze.go @@ -32,6 +32,11 @@ func newIndicesAnalyzeFunc(t Transport) IndicesAnalyze { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type IndicesAnalyzeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesAnalyzeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesAnalyzeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.analyze") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_analyze")) @@ -74,6 +90,9 @@ func (r IndicesAnalyzeRequest) Do(ctx context.Context, transport Transport) (*Re if r.Index != "" { path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } } path.WriteString("/") path.WriteString("_analyze") @@ -102,6 +121,9 @@ func (r IndicesAnalyzeRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,20 @@ func (r IndicesAnalyzeRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.analyze") + if reader := instrument.RecordRequestBody(ctx, "indices.analyze", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.analyze") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.clear_cache.go b/esapi/api.indices.clear_cache.go index 1b9bf3295e..4aae3a2eef 100644 --- a/esapi/api.indices.clear_cache.go +++ b/esapi/api.indices.clear_cache.go @@ -32,6 +32,11 @@ func newIndicesClearCacheFunc(t Transport) IndicesClearCache { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type IndicesClearCacheRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesClearCacheRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesClearCacheRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.clear_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_cache") + 1 + len("clear")) @@ -80,6 +96,9 @@ func (r IndicesClearCacheRequest) Do(ctx context.Context, transport Transport) ( if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_cache") @@ -138,6 +157,9 @@ func (r IndicesClearCacheRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -165,8 +187,17 @@ func (r IndicesClearCacheRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.clear_cache") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.clear_cache") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.clone.go b/esapi/api.indices.clone.go index c60482157b..f7fb01caaf 100644 --- a/esapi/api.indices.clone.go +++ b/esapi/api.indices.clone.go @@ -33,6 +33,11 @@ func newIndicesCloneFunc(t Transport) IndicesClone { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,26 +69,43 @@ type IndicesCloneRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesCloneRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesCloneRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.clone") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len(r.Index) + 1 + len("_clone") + 1 + len(r.Target)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_clone") path.WriteString("/") path.WriteString(r.Target) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "target", r.Target) + } params = make(map[string]string) @@ -117,6 +139,9 @@ func (r IndicesCloneRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -148,8 +173,20 @@ func (r IndicesCloneRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.clone") + if reader := instrument.RecordRequestBody(ctx, "indices.clone", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.clone") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.close.go b/esapi/api.indices.close.go index 7a0b97f0c7..41371240cd 100644 --- a/esapi/api.indices.close.go +++ b/esapi/api.indices.close.go @@ -34,6 +34,11 @@ func newIndicesCloseFunc(t Transport) IndicesClose { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type IndicesCloseRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesCloseRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesCloseRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.close") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -84,6 +100,9 @@ func (r IndicesCloseRequest) Do(ctx context.Context, transport Transport) (*Resp path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_close") @@ -131,6 +150,9 @@ func (r IndicesCloseRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -158,8 +180,17 @@ func (r IndicesCloseRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.close") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.close") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.create.go b/esapi/api.indices.create.go index fa22e8c9b3..4b8bd3466a 100644 --- a/esapi/api.indices.create.go +++ b/esapi/api.indices.create.go @@ -33,6 +33,11 @@ func newIndicesCreateFunc(t Transport) IndicesCreate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,22 +67,36 @@ type IndicesCreateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesCreateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesCreateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.create") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len(r.Index)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } params = make(map[string]string) @@ -111,6 +130,9 @@ func (r IndicesCreateRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -142,8 +164,20 @@ func (r IndicesCreateRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.create") + if reader := instrument.RecordRequestBody(ctx, "indices.create", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.create") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.delete.go b/esapi/api.indices.delete.go index 08223aa736..03595398cd 100644 --- a/esapi/api.indices.delete.go +++ b/esapi/api.indices.delete.go @@ -34,6 +34,11 @@ func newIndicesDeleteFunc(t Transport) IndicesDelete { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type IndicesDeleteRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesDeleteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" if len(r.Index) == 0 { @@ -83,6 +99,9 @@ func (r IndicesDeleteRequest) Do(ctx context.Context, transport Transport) (*Res path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } params = make(map[string]string) @@ -124,6 +143,9 @@ func (r IndicesDeleteRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -151,8 +173,17 @@ func (r IndicesDeleteRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.delete_alias.go b/esapi/api.indices.delete_alias.go index be1a4e4406..0d248d2d26 100644 --- a/esapi/api.indices.delete_alias.go +++ b/esapi/api.indices.delete_alias.go @@ -33,6 +33,11 @@ func newIndicesDeleteAliasFunc(t Transport) IndicesDeleteAlias { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type IndicesDeleteAliasRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesDeleteAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesDeleteAliasRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" if len(r.Index) == 0 { @@ -84,10 +100,16 @@ func (r IndicesDeleteAliasRequest) Do(ctx context.Context, transport Transport) path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_aliases") path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } params = make(map[string]string) @@ -117,6 +139,9 @@ func (r IndicesDeleteAliasRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -144,8 +169,17 @@ func (r IndicesDeleteAliasRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete_alias") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete_alias") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.delete_data_lifecycle.go b/esapi/api.indices.delete_data_lifecycle.go index 6dc2329433..a5703fc7ee 100644 --- a/esapi/api.indices.delete_data_lifecycle.go +++ b/esapi/api.indices.delete_data_lifecycle.go @@ -33,6 +33,11 @@ func newIndicesDeleteDataLifecycleFunc(t Transport) IndicesDeleteDataLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type IndicesDeleteDataLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesDeleteDataLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesDeleteDataLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" if len(r.Name) == 0 { @@ -84,6 +100,9 @@ func (r IndicesDeleteDataLifecycleRequest) Do(ctx context.Context, transport Tra path.WriteString("_data_stream") path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } path.WriteString("/") path.WriteString("_lifecycle") @@ -119,6 +138,9 @@ func (r IndicesDeleteDataLifecycleRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -146,8 +168,17 @@ func (r IndicesDeleteDataLifecycleRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete_data_lifecycle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete_data_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.delete_index_template.go b/esapi/api.indices.delete_index_template.go index 886d080ae1..e6c8136bfa 100644 --- a/esapi/api.indices.delete_index_template.go +++ b/esapi/api.indices.delete_index_template.go @@ -32,6 +32,11 @@ func newIndicesDeleteIndexTemplateFunc(t Transport) IndicesDeleteIndexTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type IndicesDeleteIndexTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesDeleteIndexTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesDeleteIndexTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_index_template") + 1 + len(r.Name)) @@ -76,6 +92,9 @@ func (r IndicesDeleteIndexTemplateRequest) Do(ctx context.Context, transport Tra path.WriteString("_index_template") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -105,6 +124,9 @@ func (r IndicesDeleteIndexTemplateRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -132,8 +154,17 @@ func (r IndicesDeleteIndexTemplateRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete_index_template") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete_index_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.delete_template.go b/esapi/api.indices.delete_template.go index 6fa2c90e54..46f41c0f48 100644 --- a/esapi/api.indices.delete_template.go +++ b/esapi/api.indices.delete_template.go @@ -32,6 +32,11 @@ func newIndicesDeleteTemplateFunc(t Transport) IndicesDeleteTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type IndicesDeleteTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesDeleteTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesDeleteTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_template") + 1 + len(r.Name)) @@ -76,6 +92,9 @@ func (r IndicesDeleteTemplateRequest) Do(ctx context.Context, transport Transpor path.WriteString("_template") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -105,6 +124,9 @@ func (r IndicesDeleteTemplateRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -132,8 +154,17 @@ func (r IndicesDeleteTemplateRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete_template") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.disk_usage.go b/esapi/api.indices.disk_usage.go index 2b0c34c28e..a1574fab92 100644 --- a/esapi/api.indices.disk_usage.go +++ b/esapi/api.indices.disk_usage.go @@ -32,6 +32,11 @@ func newIndicesDiskUsageFunc(t Transport) IndicesDiskUsage { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,22 +68,36 @@ type IndicesDiskUsageRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesDiskUsageRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesDiskUsageRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.disk_usage") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_disk_usage")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_disk_usage") @@ -122,6 +141,9 @@ func (r IndicesDiskUsageRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -149,8 +171,17 @@ func (r IndicesDiskUsageRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.disk_usage") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.disk_usage") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.downsample.go b/esapi/api.indices.downsample.go index 405ec5d287..c3c457289b 100644 --- a/esapi/api.indices.downsample.go +++ b/esapi/api.indices.downsample.go @@ -32,6 +32,11 @@ func newIndicesDownsampleFunc(t Transport) IndicesDownsample { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,26 +66,43 @@ type IndicesDownsampleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesDownsampleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesDownsampleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.downsample") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_downsample") + 1 + len(r.TargetIndex)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_downsample") path.WriteString("/") path.WriteString(r.TargetIndex) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "target_index", r.TargetIndex) + } params = make(map[string]string) @@ -102,6 +124,9 @@ func (r IndicesDownsampleRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +158,20 @@ func (r IndicesDownsampleRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.downsample") + if reader := instrument.RecordRequestBody(ctx, "indices.downsample", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.downsample") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.exists.go b/esapi/api.indices.exists.go index dbbda7e569..1da6e6bece 100644 --- a/esapi/api.indices.exists.go +++ b/esapi/api.indices.exists.go @@ -33,6 +33,11 @@ func newIndicesExistsFunc(t Transport) IndicesExists { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type IndicesExistsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesExistsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesExistsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.exists") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "HEAD" if len(r.Index) == 0 { @@ -83,6 +99,9 @@ func (r IndicesExistsRequest) Do(ctx context.Context, transport Transport) (*Res path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } params = make(map[string]string) @@ -128,6 +147,9 @@ func (r IndicesExistsRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -155,8 +177,17 @@ func (r IndicesExistsRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.exists") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.exists") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.exists_alias.go b/esapi/api.indices.exists_alias.go index 34c15b385e..76639c412b 100644 --- a/esapi/api.indices.exists_alias.go +++ b/esapi/api.indices.exists_alias.go @@ -33,6 +33,11 @@ func newIndicesExistsAliasFunc(t Transport) IndicesExistsAlias { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type IndicesExistsAliasRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesExistsAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesExistsAliasRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.exists_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "HEAD" if len(r.Name) == 0 { @@ -84,11 +100,17 @@ func (r IndicesExistsAliasRequest) Do(ctx context.Context, transport Transport) if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_alias") path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } params = make(map[string]string) @@ -126,6 +148,9 @@ func (r IndicesExistsAliasRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -153,8 +178,17 @@ func (r IndicesExistsAliasRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.exists_alias") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.exists_alias") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.exists_index_template.go b/esapi/api.indices.exists_index_template.go index 29d981b765..36be706323 100644 --- a/esapi/api.indices.exists_index_template.go +++ b/esapi/api.indices.exists_index_template.go @@ -33,6 +33,11 @@ func newIndicesExistsIndexTemplateFunc(t Transport) IndicesExistsIndexTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type IndicesExistsIndexTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesExistsIndexTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesExistsIndexTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.exists_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "HEAD" path.Grow(7 + 1 + len("_index_template") + 1 + len(r.Name)) @@ -78,6 +94,9 @@ func (r IndicesExistsIndexTemplateRequest) Do(ctx context.Context, transport Tra path.WriteString("_index_template") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -111,6 +130,9 @@ func (r IndicesExistsIndexTemplateRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +160,17 @@ func (r IndicesExistsIndexTemplateRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.exists_index_template") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.exists_index_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.exists_template.go b/esapi/api.indices.exists_template.go index dc7c668025..1ca331e8de 100644 --- a/esapi/api.indices.exists_template.go +++ b/esapi/api.indices.exists_template.go @@ -34,6 +34,11 @@ func newIndicesExistsTemplateFunc(t Transport) IndicesExistsTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type IndicesExistsTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesExistsTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesExistsTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.exists_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "HEAD" if len(r.Name) == 0 { @@ -83,6 +99,9 @@ func (r IndicesExistsTemplateRequest) Do(ctx context.Context, transport Transpor path.WriteString("_template") path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } params = make(map[string]string) @@ -116,6 +135,9 @@ func (r IndicesExistsTemplateRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -143,8 +165,17 @@ func (r IndicesExistsTemplateRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.exists_template") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.exists_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.explain_data_lifecycle.go b/esapi/api.indices.explain_data_lifecycle.go index 22053f6ead..324175c4de 100644 --- a/esapi/api.indices.explain_data_lifecycle.go +++ b/esapi/api.indices.explain_data_lifecycle.go @@ -33,6 +33,11 @@ func newIndicesExplainDataLifecycleFunc(t Transport) IndicesExplainDataLifecycle for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,22 +66,36 @@ type IndicesExplainDataLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesExplainDataLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesExplainDataLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.explain_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(r.Index) + 1 + len("_lifecycle") + 1 + len("explain")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_lifecycle") path.WriteString("/") @@ -110,6 +129,9 @@ func (r IndicesExplainDataLifecycleRequest) Do(ctx context.Context, transport Tr req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -137,8 +159,17 @@ func (r IndicesExplainDataLifecycleRequest) Do(ctx context.Context, transport Tr req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.explain_data_lifecycle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.explain_data_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.field_usage_stats.go b/esapi/api.indices.field_usage_stats.go index 2c166850df..fe0a823304 100644 --- a/esapi/api.indices.field_usage_stats.go +++ b/esapi/api.indices.field_usage_stats.go @@ -32,6 +32,11 @@ func newIndicesFieldUsageStatsFunc(t Transport) IndicesFieldUsageStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,22 +67,36 @@ type IndicesFieldUsageStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesFieldUsageStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesFieldUsageStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.field_usage_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(r.Index) + 1 + len("_field_usage_stats")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_field_usage_stats") @@ -117,6 +136,9 @@ func (r IndicesFieldUsageStatsRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -144,8 +166,17 @@ func (r IndicesFieldUsageStatsRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.field_usage_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.field_usage_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.flush.go b/esapi/api.indices.flush.go index 9031c4aedb..963945097d 100644 --- a/esapi/api.indices.flush.go +++ b/esapi/api.indices.flush.go @@ -32,6 +32,11 @@ func newIndicesFlushFunc(t Transport) IndicesFlush { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type IndicesFlushRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesFlushRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesFlushRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.flush") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_flush")) @@ -78,6 +94,9 @@ func (r IndicesFlushRequest) Do(ctx context.Context, transport Transport) (*Resp if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_flush") @@ -122,6 +141,9 @@ func (r IndicesFlushRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -149,8 +171,17 @@ func (r IndicesFlushRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.flush") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.flush") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.forcemerge.go b/esapi/api.indices.forcemerge.go index 602b779637..392aa6f322 100644 --- a/esapi/api.indices.forcemerge.go +++ b/esapi/api.indices.forcemerge.go @@ -32,6 +32,11 @@ func newIndicesForcemergeFunc(t Transport) IndicesForcemerge { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type IndicesForcemergeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesForcemergeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesForcemergeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.forcemerge") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_forcemerge")) @@ -80,6 +96,9 @@ func (r IndicesForcemergeRequest) Do(ctx context.Context, transport Transport) ( if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_forcemerge") @@ -132,6 +151,9 @@ func (r IndicesForcemergeRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -159,8 +181,17 @@ func (r IndicesForcemergeRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.forcemerge") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.forcemerge") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.get.go b/esapi/api.indices.get.go index 3c1e3a143c..0a479f1a75 100644 --- a/esapi/api.indices.get.go +++ b/esapi/api.indices.get.go @@ -34,6 +34,11 @@ func newIndicesGetFunc(t Transport) IndicesGet { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,16 +71,27 @@ type IndicesGetRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesGetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" if len(r.Index) == 0 { @@ -86,6 +102,9 @@ func (r IndicesGetRequest) Do(ctx context.Context, transport Transport) (*Respon path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } params = make(map[string]string) @@ -139,6 +158,9 @@ func (r IndicesGetRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,8 +188,17 @@ func (r IndicesGetRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.get_alias.go b/esapi/api.indices.get_alias.go index 37f3bbfe90..744935869d 100644 --- a/esapi/api.indices.get_alias.go +++ b/esapi/api.indices.get_alias.go @@ -32,6 +32,11 @@ func newIndicesGetAliasFunc(t Transport) IndicesGetAlias { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type IndicesGetAliasRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesGetAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesGetAliasRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_alias") + 1 + len(strings.Join(r.Name, ","))) @@ -79,12 +95,18 @@ func (r IndicesGetAliasRequest) Do(ctx context.Context, transport Transport) (*R if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_alias") if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } params = make(map[string]string) @@ -123,6 +145,9 @@ func (r IndicesGetAliasRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -150,8 +175,17 @@ func (r IndicesGetAliasRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_alias") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_alias") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.get_data_lifecycle.go b/esapi/api.indices.get_data_lifecycle.go index 4b2440b2eb..e440c55a98 100644 --- a/esapi/api.indices.get_data_lifecycle.go +++ b/esapi/api.indices.get_data_lifecycle.go @@ -33,6 +33,11 @@ func newIndicesGetDataLifecycleFunc(t Transport) IndicesGetDataLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type IndicesGetDataLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesGetDataLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesGetDataLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" if len(r.Name) == 0 { @@ -83,6 +99,9 @@ func (r IndicesGetDataLifecycleRequest) Do(ctx context.Context, transport Transp path.WriteString("_data_stream") path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } path.WriteString("/") path.WriteString("_lifecycle") @@ -114,6 +133,9 @@ func (r IndicesGetDataLifecycleRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -141,8 +163,17 @@ func (r IndicesGetDataLifecycleRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_data_lifecycle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_data_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.get_field_mapping.go b/esapi/api.indices.get_field_mapping.go index 362c7b35fe..d78f81a059 100644 --- a/esapi/api.indices.get_field_mapping.go +++ b/esapi/api.indices.get_field_mapping.go @@ -33,6 +33,11 @@ func newIndicesGetFieldMappingFunc(t Transport) IndicesGetFieldMapping { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type IndicesGetFieldMappingRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesGetFieldMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesGetFieldMappingRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_field_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" if len(r.Fields) == 0 { @@ -85,6 +101,9 @@ func (r IndicesGetFieldMappingRequest) Do(ctx context.Context, transport Transpo if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_mapping") @@ -92,6 +111,9 @@ func (r IndicesGetFieldMappingRequest) Do(ctx context.Context, transport Transpo path.WriteString("field") path.WriteString("/") path.WriteString(strings.Join(r.Fields, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "fields", strings.Join(r.Fields, ",")) + } params = make(map[string]string) @@ -133,6 +155,9 @@ func (r IndicesGetFieldMappingRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -160,8 +185,17 @@ func (r IndicesGetFieldMappingRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_field_mapping") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_field_mapping") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.get_index_template.go b/esapi/api.indices.get_index_template.go index 0a32a12034..227fb7ccd5 100644 --- a/esapi/api.indices.get_index_template.go +++ b/esapi/api.indices.get_index_template.go @@ -33,6 +33,11 @@ func newIndicesGetIndexTemplateFunc(t Transport) IndicesGetIndexTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type IndicesGetIndexTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesGetIndexTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesGetIndexTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_index_template") + 1 + len(r.Name)) @@ -80,6 +96,9 @@ func (r IndicesGetIndexTemplateRequest) Do(ctx context.Context, transport Transp if r.Name != "" { path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } } params = make(map[string]string) @@ -118,6 +137,9 @@ func (r IndicesGetIndexTemplateRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -145,8 +167,17 @@ func (r IndicesGetIndexTemplateRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_index_template") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_index_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.get_mapping.go b/esapi/api.indices.get_mapping.go index 69d41056e5..f4ec0dd51c 100644 --- a/esapi/api.indices.get_mapping.go +++ b/esapi/api.indices.get_mapping.go @@ -33,6 +33,11 @@ func newIndicesGetMappingFunc(t Transport) IndicesGetMapping { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type IndicesGetMappingRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesGetMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesGetMappingRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_mapping")) @@ -79,6 +95,9 @@ func (r IndicesGetMappingRequest) Do(ctx context.Context, transport Transport) ( if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_mapping") @@ -123,6 +142,9 @@ func (r IndicesGetMappingRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -150,8 +172,17 @@ func (r IndicesGetMappingRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_mapping") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_mapping") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.get_settings.go b/esapi/api.indices.get_settings.go index 2a30876771..dacc4a9224 100644 --- a/esapi/api.indices.get_settings.go +++ b/esapi/api.indices.get_settings.go @@ -33,6 +33,11 @@ func newIndicesGetSettingsFunc(t Transport) IndicesGetSettings { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,16 +71,27 @@ type IndicesGetSettingsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesGetSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesGetSettingsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_settings") + 1 + len(strings.Join(r.Name, ","))) @@ -83,12 +99,18 @@ func (r IndicesGetSettingsRequest) Do(ctx context.Context, transport Transport) if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_settings") if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } params = make(map[string]string) @@ -139,6 +161,9 @@ func (r IndicesGetSettingsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,8 +191,17 @@ func (r IndicesGetSettingsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_settings") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_settings") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.get_template.go b/esapi/api.indices.get_template.go index 5542c3972a..85dc1a0813 100644 --- a/esapi/api.indices.get_template.go +++ b/esapi/api.indices.get_template.go @@ -33,6 +33,11 @@ func newIndicesGetTemplateFunc(t Transport) IndicesGetTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type IndicesGetTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesGetTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesGetTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_template") + 1 + len(strings.Join(r.Name, ","))) @@ -79,6 +95,9 @@ func (r IndicesGetTemplateRequest) Do(ctx context.Context, transport Transport) if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } params = make(map[string]string) @@ -113,6 +132,9 @@ func (r IndicesGetTemplateRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +162,17 @@ func (r IndicesGetTemplateRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_template") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.modify_data_stream.go b/esapi/api.indices.modify_data_stream.go index 444660bda9..a1b872e3ed 100644 --- a/esapi/api.indices.modify_data_stream.go +++ b/esapi/api.indices.modify_data_stream.go @@ -32,6 +32,11 @@ func newIndicesModifyDataStreamFunc(t Transport) IndicesModifyDataStream { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type IndicesModifyDataStreamRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesModifyDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesModifyDataStreamRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.modify_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_data_stream/_modify")) @@ -91,6 +107,9 @@ func (r IndicesModifyDataStreamRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r IndicesModifyDataStreamRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.modify_data_stream") + if reader := instrument.RecordRequestBody(ctx, "indices.modify_data_stream", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.modify_data_stream") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.open.go b/esapi/api.indices.open.go index 2f34160083..b3d7713acf 100644 --- a/esapi/api.indices.open.go +++ b/esapi/api.indices.open.go @@ -34,6 +34,11 @@ func newIndicesOpenFunc(t Transport) IndicesOpen { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type IndicesOpenRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesOpenRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesOpenRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.open") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -84,6 +100,9 @@ func (r IndicesOpenRequest) Do(ctx context.Context, transport Transport) (*Respo path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_open") @@ -131,6 +150,9 @@ func (r IndicesOpenRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -158,8 +180,17 @@ func (r IndicesOpenRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.open") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.open") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.put_alias.go b/esapi/api.indices.put_alias.go index 227909c5e9..ff8675f2e3 100644 --- a/esapi/api.indices.put_alias.go +++ b/esapi/api.indices.put_alias.go @@ -34,6 +34,11 @@ func newIndicesPutAliasFunc(t Transport) IndicesPutAlias { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type IndicesPutAliasRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesPutAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesPutAliasRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" if len(r.Index) == 0 { @@ -84,10 +100,16 @@ func (r IndicesPutAliasRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_aliases") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -117,6 +139,9 @@ func (r IndicesPutAliasRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -148,8 +173,20 @@ func (r IndicesPutAliasRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_alias") + if reader := instrument.RecordRequestBody(ctx, "indices.put_alias", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_alias") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.put_data_lifecycle.go b/esapi/api.indices.put_data_lifecycle.go index 0feadf8eaa..eaa3982fb1 100644 --- a/esapi/api.indices.put_data_lifecycle.go +++ b/esapi/api.indices.put_data_lifecycle.go @@ -34,6 +34,11 @@ func newIndicesPutDataLifecycleFunc(t Transport) IndicesPutDataLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -65,16 +70,27 @@ type IndicesPutDataLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesPutDataLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesPutDataLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" if len(r.Name) == 0 { @@ -87,6 +103,9 @@ func (r IndicesPutDataLifecycleRequest) Do(ctx context.Context, transport Transp path.WriteString("_data_stream") path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } path.WriteString("/") path.WriteString("_lifecycle") @@ -122,6 +141,9 @@ func (r IndicesPutDataLifecycleRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -153,8 +175,20 @@ func (r IndicesPutDataLifecycleRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_data_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "indices.put_data_lifecycle", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_data_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.put_index_template.go b/esapi/api.indices.put_index_template.go index 920599136d..1f3ec6409f 100644 --- a/esapi/api.indices.put_index_template.go +++ b/esapi/api.indices.put_index_template.go @@ -34,6 +34,11 @@ func newIndicesPutIndexTemplateFunc(t Transport) IndicesPutIndexTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type IndicesPutIndexTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesPutIndexTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesPutIndexTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_index_template") + 1 + len(r.Name)) @@ -81,6 +97,9 @@ func (r IndicesPutIndexTemplateRequest) Do(ctx context.Context, transport Transp path.WriteString("_index_template") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -114,6 +133,9 @@ func (r IndicesPutIndexTemplateRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -145,8 +167,20 @@ func (r IndicesPutIndexTemplateRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_index_template") + if reader := instrument.RecordRequestBody(ctx, "indices.put_index_template", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_index_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.put_mapping.go b/esapi/api.indices.put_mapping.go index 783a505eb1..6456028ea6 100644 --- a/esapi/api.indices.put_mapping.go +++ b/esapi/api.indices.put_mapping.go @@ -34,6 +34,11 @@ func newIndicesPutMappingFunc(t Transport) IndicesPutMapping { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,16 +71,27 @@ type IndicesPutMappingRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesPutMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesPutMappingRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(len(strings.Join(r.Index, ",")) + len("/_mapping") + 1) @@ -130,6 +146,9 @@ func (r IndicesPutMappingRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -161,8 +180,20 @@ func (r IndicesPutMappingRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_mapping") + if reader := instrument.RecordRequestBody(ctx, "indices.put_mapping", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_mapping") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.put_settings.go b/esapi/api.indices.put_settings.go index b9e9bbf6b5..c55b64d2e5 100644 --- a/esapi/api.indices.put_settings.go +++ b/esapi/api.indices.put_settings.go @@ -34,6 +34,11 @@ func newIndicesPutSettingsFunc(t Transport) IndicesPutSettings { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,6 +62,7 @@ type IndicesPutSettingsRequest struct { IgnoreUnavailable *bool MasterTimeout time.Duration PreserveExisting *bool + Reopen *bool Timeout time.Duration Pretty bool @@ -67,16 +73,27 @@ type IndicesPutSettingsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesPutSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesPutSettingsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_settings")) @@ -84,6 +101,9 @@ func (r IndicesPutSettingsRequest) Do(ctx context.Context, transport Transport) if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_settings") @@ -114,6 +134,10 @@ func (r IndicesPutSettingsRequest) Do(ctx context.Context, transport Transport) params["preserve_existing"] = strconv.FormatBool(*r.PreserveExisting) } + if r.Reopen != nil { + params["reopen"] = strconv.FormatBool(*r.Reopen) + } + if r.Timeout != 0 { params["timeout"] = formatDuration(r.Timeout) } @@ -136,6 +160,9 @@ func (r IndicesPutSettingsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -167,8 +194,20 @@ func (r IndicesPutSettingsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_settings") + if reader := instrument.RecordRequestBody(ctx, "indices.put_settings", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_settings") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -237,6 +276,13 @@ func (f IndicesPutSettings) WithPreserveExisting(v bool) func(*IndicesPutSetting } } +// WithReopen - whether to close and reopen the index to apply non-dynamic settings. if set to `true` the indices to which the settings are being applied will be closed temporarily and then reopened in order to apply the changes. the default is `false`. +func (f IndicesPutSettings) WithReopen(v bool) func(*IndicesPutSettingsRequest) { + return func(r *IndicesPutSettingsRequest) { + r.Reopen = &v + } +} + // WithTimeout - explicit operation timeout. func (f IndicesPutSettings) WithTimeout(v time.Duration) func(*IndicesPutSettingsRequest) { return func(r *IndicesPutSettingsRequest) { diff --git a/esapi/api.indices.put_template.go b/esapi/api.indices.put_template.go index 0ee856596e..c8d768c78f 100644 --- a/esapi/api.indices.put_template.go +++ b/esapi/api.indices.put_template.go @@ -34,6 +34,11 @@ func newIndicesPutTemplateFunc(t Transport) IndicesPutTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type IndicesPutTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesPutTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesPutTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_template") + 1 + len(r.Name)) @@ -81,6 +97,9 @@ func (r IndicesPutTemplateRequest) Do(ctx context.Context, transport Transport) path.WriteString("_template") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -114,6 +133,9 @@ func (r IndicesPutTemplateRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -145,8 +167,20 @@ func (r IndicesPutTemplateRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_template") + if reader := instrument.RecordRequestBody(ctx, "indices.put_template", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.recovery.go b/esapi/api.indices.recovery.go index f1a9acda81..35cef83a84 100644 --- a/esapi/api.indices.recovery.go +++ b/esapi/api.indices.recovery.go @@ -32,6 +32,11 @@ func newIndicesRecoveryFunc(t Transport) IndicesRecovery { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type IndicesRecoveryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesRecoveryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesRecoveryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.recovery") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_recovery")) @@ -75,6 +91,9 @@ func (r IndicesRecoveryRequest) Do(ctx context.Context, transport Transport) (*R if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_recovery") @@ -107,6 +126,9 @@ func (r IndicesRecoveryRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +156,17 @@ func (r IndicesRecoveryRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.recovery") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.recovery") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.refresh.go b/esapi/api.indices.refresh.go index ac458a63b2..32dd5d52e6 100644 --- a/esapi/api.indices.refresh.go +++ b/esapi/api.indices.refresh.go @@ -32,6 +32,11 @@ func newIndicesRefreshFunc(t Transport) IndicesRefresh { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type IndicesRefreshRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesRefreshRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesRefreshRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.refresh") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_refresh")) @@ -76,6 +92,9 @@ func (r IndicesRefreshRequest) Do(ctx context.Context, transport Transport) (*Re if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_refresh") @@ -112,6 +131,9 @@ func (r IndicesRefreshRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -139,8 +161,17 @@ func (r IndicesRefreshRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.refresh") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.refresh") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.resolve_index.go b/esapi/api.indices.resolve_index.go index 752910d332..c045ca42c7 100644 --- a/esapi/api.indices.resolve_index.go +++ b/esapi/api.indices.resolve_index.go @@ -32,6 +32,11 @@ func newIndicesResolveIndexFunc(t Transport) IndicesResolveIndex { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type IndicesResolveIndexRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesResolveIndexRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesResolveIndexRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.resolve_index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" if len(r.Name) == 0 { @@ -81,6 +97,9 @@ func (r IndicesResolveIndexRequest) Do(ctx context.Context, transport Transport) path.WriteString("index") path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } params = make(map[string]string) @@ -106,6 +125,9 @@ func (r IndicesResolveIndexRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,17 @@ func (r IndicesResolveIndexRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.resolve_index") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.resolve_index") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.rollover.go b/esapi/api.indices.rollover.go index 1cdf1c4f89..13f1cafb16 100644 --- a/esapi/api.indices.rollover.go +++ b/esapi/api.indices.rollover.go @@ -34,6 +34,11 @@ func newIndicesRolloverFunc(t Transport) IndicesRollover { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,27 +71,44 @@ type IndicesRolloverRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesRolloverRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesRolloverRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.rollover") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Alias) + 1 + len("_rollover") + 1 + len(r.NewIndex)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Alias) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "alias", r.Alias) + } path.WriteString("/") path.WriteString("_rollover") if r.NewIndex != "" { path.WriteString("/") path.WriteString(r.NewIndex) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "new_index", r.NewIndex) + } } params = make(map[string]string) @@ -125,6 +147,9 @@ func (r IndicesRolloverRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -156,8 +181,20 @@ func (r IndicesRolloverRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.rollover") + if reader := instrument.RecordRequestBody(ctx, "indices.rollover", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.rollover") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.segments.go b/esapi/api.indices.segments.go index efff2e1059..d1af450e7b 100644 --- a/esapi/api.indices.segments.go +++ b/esapi/api.indices.segments.go @@ -32,6 +32,11 @@ func newIndicesSegmentsFunc(t Transport) IndicesSegments { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type IndicesSegmentsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesSegmentsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesSegmentsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.segments") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_segments")) @@ -77,6 +93,9 @@ func (r IndicesSegmentsRequest) Do(ctx context.Context, transport Transport) (*R if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_segments") @@ -117,6 +136,9 @@ func (r IndicesSegmentsRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -144,8 +166,17 @@ func (r IndicesSegmentsRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.segments") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.segments") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.shard_stores.go b/esapi/api.indices.shard_stores.go index b8a2469f38..9f27ae9b6e 100644 --- a/esapi/api.indices.shard_stores.go +++ b/esapi/api.indices.shard_stores.go @@ -32,6 +32,11 @@ func newIndicesShardStoresFunc(t Transport) IndicesShardStores { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type IndicesShardStoresRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesShardStoresRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesShardStoresRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.shard_stores") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_shard_stores")) @@ -77,6 +93,9 @@ func (r IndicesShardStoresRequest) Do(ctx context.Context, transport Transport) if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_shard_stores") @@ -117,6 +136,9 @@ func (r IndicesShardStoresRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -144,8 +166,17 @@ func (r IndicesShardStoresRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.shard_stores") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.shard_stores") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.shrink.go b/esapi/api.indices.shrink.go index fe1fee43f4..37a8e5249b 100644 --- a/esapi/api.indices.shrink.go +++ b/esapi/api.indices.shrink.go @@ -33,6 +33,11 @@ func newIndicesShrinkFunc(t Transport) IndicesShrink { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,26 +69,43 @@ type IndicesShrinkRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesShrinkRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesShrinkRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.shrink") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len(r.Index) + 1 + len("_shrink") + 1 + len(r.Target)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_shrink") path.WriteString("/") path.WriteString(r.Target) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "target", r.Target) + } params = make(map[string]string) @@ -117,6 +139,9 @@ func (r IndicesShrinkRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -148,8 +173,20 @@ func (r IndicesShrinkRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.shrink") + if reader := instrument.RecordRequestBody(ctx, "indices.shrink", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.shrink") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.simulate_index_template.go b/esapi/api.indices.simulate_index_template.go index ce708dd2aa..efc3a7882b 100644 --- a/esapi/api.indices.simulate_index_template.go +++ b/esapi/api.indices.simulate_index_template.go @@ -34,6 +34,11 @@ func newIndicesSimulateIndexTemplateFunc(t Transport) IndicesSimulateIndexTempla for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type IndicesSimulateIndexTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesSimulateIndexTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesSimulateIndexTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.simulate_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_index_template") + 1 + len("_simulate_index") + 1 + len(r.Name)) @@ -84,6 +100,9 @@ func (r IndicesSimulateIndexTemplateRequest) Do(ctx context.Context, transport T path.WriteString("_simulate_index") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -121,6 +140,9 @@ func (r IndicesSimulateIndexTemplateRequest) Do(ctx context.Context, transport T req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -152,8 +174,20 @@ func (r IndicesSimulateIndexTemplateRequest) Do(ctx context.Context, transport T req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.simulate_index_template") + if reader := instrument.RecordRequestBody(ctx, "indices.simulate_index_template", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.simulate_index_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.simulate_template.go b/esapi/api.indices.simulate_template.go index af40f8101c..50df5693a3 100644 --- a/esapi/api.indices.simulate_template.go +++ b/esapi/api.indices.simulate_template.go @@ -34,6 +34,11 @@ func newIndicesSimulateTemplateFunc(t Transport) IndicesSimulateTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type IndicesSimulateTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesSimulateTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesSimulateTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.simulate_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_index_template") + 1 + len("_simulate") + 1 + len(r.Name)) @@ -85,6 +101,9 @@ func (r IndicesSimulateTemplateRequest) Do(ctx context.Context, transport Transp if r.Name != "" { path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } } params = make(map[string]string) @@ -123,6 +142,9 @@ func (r IndicesSimulateTemplateRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -154,8 +176,20 @@ func (r IndicesSimulateTemplateRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.simulate_template") + if reader := instrument.RecordRequestBody(ctx, "indices.simulate_template", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.simulate_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.split.go b/esapi/api.indices.split.go index c1cd219067..9c2b067e42 100644 --- a/esapi/api.indices.split.go +++ b/esapi/api.indices.split.go @@ -33,6 +33,11 @@ func newIndicesSplitFunc(t Transport) IndicesSplit { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,26 +69,43 @@ type IndicesSplitRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesSplitRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesSplitRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.split") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len(r.Index) + 1 + len("_split") + 1 + len(r.Target)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_split") path.WriteString("/") path.WriteString(r.Target) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "target", r.Target) + } params = make(map[string]string) @@ -117,6 +139,9 @@ func (r IndicesSplitRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -148,8 +173,20 @@ func (r IndicesSplitRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.split") + if reader := instrument.RecordRequestBody(ctx, "indices.split", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.split") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.stats.go b/esapi/api.indices.stats.go index b2945ac47d..d8da8ae0d3 100644 --- a/esapi/api.indices.stats.go +++ b/esapi/api.indices.stats.go @@ -32,6 +32,11 @@ func newIndicesStatsFunc(t Transport) IndicesStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -67,16 +72,27 @@ type IndicesStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_stats") + 1 + len(strings.Join(r.Metric, ","))) @@ -84,12 +100,18 @@ func (r IndicesStatsRequest) Do(ctx context.Context, transport Transport) (*Resp if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_stats") if len(r.Metric) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Metric, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", strings.Join(r.Metric, ",")) + } } params = make(map[string]string) @@ -148,6 +170,9 @@ func (r IndicesStatsRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,8 +200,17 @@ func (r IndicesStatsRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.update_aliases.go b/esapi/api.indices.update_aliases.go index e79b889f52..32a9a7629c 100644 --- a/esapi/api.indices.update_aliases.go +++ b/esapi/api.indices.update_aliases.go @@ -33,6 +33,11 @@ func newIndicesUpdateAliasesFunc(t Transport) IndicesUpdateAliases { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type IndicesUpdateAliasesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesUpdateAliasesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesUpdateAliasesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.update_aliases") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_aliases")) @@ -103,6 +119,9 @@ func (r IndicesUpdateAliasesRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +153,20 @@ func (r IndicesUpdateAliasesRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.update_aliases") + if reader := instrument.RecordRequestBody(ctx, "indices.update_aliases", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.update_aliases") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.indices.validate_query.go b/esapi/api.indices.validate_query.go index 93015b05cd..c9532ae017 100644 --- a/esapi/api.indices.validate_query.go +++ b/esapi/api.indices.validate_query.go @@ -33,6 +33,11 @@ func newIndicesValidateQueryFunc(t Transport) IndicesValidateQuery { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -71,16 +76,27 @@ type IndicesValidateQueryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesValidateQueryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesValidateQueryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.validate_query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_validate") + 1 + len("query")) @@ -88,6 +104,9 @@ func (r IndicesValidateQueryRequest) Do(ctx context.Context, transport Transport if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_validate") @@ -162,6 +181,9 @@ func (r IndicesValidateQueryRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -193,8 +215,20 @@ func (r IndicesValidateQueryRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.validate_query") + if reader := instrument.RecordRequestBody(ctx, "indices.validate_query", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.validate_query") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.inference.delete_model.go b/esapi/api.inference.delete_model.go index 4bc87adbf9..c6c3c8ec88 100644 --- a/esapi/api.inference.delete_model.go +++ b/esapi/api.inference.delete_model.go @@ -31,6 +31,11 @@ func newInferenceDeleteModelFunc(t Transport) InferenceDeleteModel { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type InferenceDeleteModelRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r InferenceDeleteModelRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r InferenceDeleteModelRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "inference.delete_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_inference") + 1 + len(r.TaskType) + 1 + len(r.ModelID)) @@ -75,8 +91,14 @@ func (r InferenceDeleteModelRequest) Do(ctx context.Context, transport Transport path.WriteString("_inference") path.WriteString("/") path.WriteString(r.TaskType) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "task_type", r.TaskType) + } path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } params = make(map[string]string) @@ -98,6 +120,9 @@ func (r InferenceDeleteModelRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -125,8 +150,17 @@ func (r InferenceDeleteModelRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "inference.delete_model") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "inference.delete_model") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.inference.get_model.go b/esapi/api.inference.get_model.go index a6fb52a1e2..be1590dcbc 100644 --- a/esapi/api.inference.get_model.go +++ b/esapi/api.inference.get_model.go @@ -31,6 +31,11 @@ func newInferenceGetModelFunc(t Transport) InferenceGetModel { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type InferenceGetModelRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r InferenceGetModelRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r InferenceGetModelRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "inference.get_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_inference") + 1 + len(r.TaskType) + 1 + len(r.ModelID)) @@ -75,8 +91,14 @@ func (r InferenceGetModelRequest) Do(ctx context.Context, transport Transport) ( path.WriteString("_inference") path.WriteString("/") path.WriteString(r.TaskType) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "task_type", r.TaskType) + } path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } params = make(map[string]string) @@ -98,6 +120,9 @@ func (r InferenceGetModelRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -125,8 +150,17 @@ func (r InferenceGetModelRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "inference.get_model") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "inference.get_model") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.inference.inference.go b/esapi/api.inference.inference.go index 72f423a1e3..5b5748f661 100644 --- a/esapi/api.inference.inference.go +++ b/esapi/api.inference.inference.go @@ -32,6 +32,11 @@ func newInferenceInferenceFunc(t Transport) InferenceInference { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type InferenceInferenceRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r InferenceInferenceRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r InferenceInferenceRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "inference.inference") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_inference") + 1 + len(r.TaskType) + 1 + len(r.ModelID)) @@ -78,8 +94,14 @@ func (r InferenceInferenceRequest) Do(ctx context.Context, transport Transport) path.WriteString("_inference") path.WriteString("/") path.WriteString(r.TaskType) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "task_type", r.TaskType) + } path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } params = make(map[string]string) @@ -101,6 +123,9 @@ func (r InferenceInferenceRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -132,8 +157,20 @@ func (r InferenceInferenceRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "inference.inference") + if reader := instrument.RecordRequestBody(ctx, "inference.inference", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "inference.inference") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.inference.put_model.go b/esapi/api.inference.put_model.go index 334f3f0570..faa3c1c7aa 100644 --- a/esapi/api.inference.put_model.go +++ b/esapi/api.inference.put_model.go @@ -32,6 +32,11 @@ func newInferencePutModelFunc(t Transport) InferencePutModel { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type InferencePutModelRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r InferencePutModelRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r InferencePutModelRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "inference.put_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_inference") + 1 + len(r.TaskType) + 1 + len(r.ModelID)) @@ -78,8 +94,14 @@ func (r InferencePutModelRequest) Do(ctx context.Context, transport Transport) ( path.WriteString("_inference") path.WriteString("/") path.WriteString(r.TaskType) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "task_type", r.TaskType) + } path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } params = make(map[string]string) @@ -101,6 +123,9 @@ func (r InferencePutModelRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -132,8 +157,20 @@ func (r InferencePutModelRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "inference.put_model") + if reader := instrument.RecordRequestBody(ctx, "inference.put_model", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "inference.put_model") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.info.go b/esapi/api.info.go index 55af32df8b..92a7f1cb6d 100644 --- a/esapi/api.info.go +++ b/esapi/api.info.go @@ -31,6 +31,11 @@ func newInfoFunc(t Transport) Info { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type InfoRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r InfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r InfoRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/")) @@ -88,6 +104,9 @@ func (r InfoRequest) Do(ctx context.Context, transport Transport) (*Response, er req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r InfoRequest) Do(ctx context.Context, transport Transport) (*Response, er req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "info") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "info") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.ingest.delete_pipeline.go b/esapi/api.ingest.delete_pipeline.go index 55caad8ab0..770c39a889 100644 --- a/esapi/api.ingest.delete_pipeline.go +++ b/esapi/api.ingest.delete_pipeline.go @@ -32,6 +32,11 @@ func newIngestDeletePipelineFunc(t Transport) IngestDeletePipeline { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type IngestDeletePipelineRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IngestDeletePipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IngestDeletePipelineRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.delete_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ingest") + 1 + len("pipeline") + 1 + len(r.PipelineID)) @@ -78,6 +94,9 @@ func (r IngestDeletePipelineRequest) Do(ctx context.Context, transport Transport path.WriteString("pipeline") path.WriteString("/") path.WriteString(r.PipelineID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.PipelineID) + } params = make(map[string]string) @@ -107,6 +126,9 @@ func (r IngestDeletePipelineRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +156,17 @@ func (r IngestDeletePipelineRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.delete_pipeline") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.delete_pipeline") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.ingest.geo_ip_stats.go b/esapi/api.ingest.geo_ip_stats.go index 23ee14ded3..dc2eef010e 100644 --- a/esapi/api.ingest.geo_ip_stats.go +++ b/esapi/api.ingest.geo_ip_stats.go @@ -31,6 +31,11 @@ func newIngestGeoIPStatsFunc(t Transport) IngestGeoIPStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type IngestGeoIPStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IngestGeoIPStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IngestGeoIPStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.geo_ip_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_ingest/geoip/stats")) @@ -88,6 +104,9 @@ func (r IngestGeoIPStatsRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r IngestGeoIPStatsRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.geo_ip_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.geo_ip_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.ingest.get_pipeline.go b/esapi/api.ingest.get_pipeline.go index a8a08361f2..82977b9db7 100644 --- a/esapi/api.ingest.get_pipeline.go +++ b/esapi/api.ingest.get_pipeline.go @@ -33,6 +33,11 @@ func newIngestGetPipelineFunc(t Transport) IngestGetPipeline { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type IngestGetPipelineRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IngestGetPipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IngestGetPipelineRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.get_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ingest") + 1 + len("pipeline") + 1 + len(r.PipelineID)) @@ -80,6 +96,9 @@ func (r IngestGetPipelineRequest) Do(ctx context.Context, transport Transport) ( if r.PipelineID != "" { path.WriteString("/") path.WriteString(r.PipelineID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.PipelineID) + } } params = make(map[string]string) @@ -110,6 +129,9 @@ func (r IngestGetPipelineRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -137,8 +159,17 @@ func (r IngestGetPipelineRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.get_pipeline") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.get_pipeline") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.ingest.processor_grok.go b/esapi/api.ingest.processor_grok.go index 486d6285aa..a3ecf9ea9d 100644 --- a/esapi/api.ingest.processor_grok.go +++ b/esapi/api.ingest.processor_grok.go @@ -31,6 +31,11 @@ func newIngestProcessorGrokFunc(t Transport) IngestProcessorGrok { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type IngestProcessorGrokRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IngestProcessorGrokRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IngestProcessorGrokRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.processor_grok") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_ingest/processor/grok")) @@ -88,6 +104,9 @@ func (r IngestProcessorGrokRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r IngestProcessorGrokRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.processor_grok") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.processor_grok") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.ingest.put_pipeline.go b/esapi/api.ingest.put_pipeline.go index 12e2b16d14..e10755885f 100644 --- a/esapi/api.ingest.put_pipeline.go +++ b/esapi/api.ingest.put_pipeline.go @@ -34,6 +34,11 @@ func newIngestPutPipelineFunc(t Transport) IngestPutPipeline { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type IngestPutPipelineRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IngestPutPipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IngestPutPipelineRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.put_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ingest") + 1 + len("pipeline") + 1 + len(r.PipelineID)) @@ -83,6 +99,9 @@ func (r IngestPutPipelineRequest) Do(ctx context.Context, transport Transport) ( path.WriteString("pipeline") path.WriteString("/") path.WriteString(r.PipelineID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.PipelineID) + } params = make(map[string]string) @@ -116,6 +135,9 @@ func (r IngestPutPipelineRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -147,8 +169,20 @@ func (r IngestPutPipelineRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.put_pipeline") + if reader := instrument.RecordRequestBody(ctx, "ingest.put_pipeline", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.put_pipeline") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.ingest.simulate.go b/esapi/api.ingest.simulate.go index e873e48f0e..153a8b1fab 100644 --- a/esapi/api.ingest.simulate.go +++ b/esapi/api.ingest.simulate.go @@ -33,6 +33,11 @@ func newIngestSimulateFunc(t Transport) IngestSimulate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type IngestSimulateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IngestSimulateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IngestSimulateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.simulate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ingest") + 1 + len("pipeline") + 1 + len(r.PipelineID) + 1 + len("_simulate")) @@ -81,6 +97,9 @@ func (r IngestSimulateRequest) Do(ctx context.Context, transport Transport) (*Re if r.PipelineID != "" { path.WriteString("/") path.WriteString(r.PipelineID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.PipelineID) + } } path.WriteString("/") path.WriteString("_simulate") @@ -109,6 +128,9 @@ func (r IngestSimulateRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +162,20 @@ func (r IngestSimulateRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.simulate") + if reader := instrument.RecordRequestBody(ctx, "ingest.simulate", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.simulate") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.knn_search.go b/esapi/api.knn_search.go index 0477630a7f..9b775510b8 100644 --- a/esapi/api.knn_search.go +++ b/esapi/api.knn_search.go @@ -33,6 +33,11 @@ func newKnnSearchFunc(t Transport) KnnSearch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type KnnSearchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r KnnSearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r KnnSearchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "knn_search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -82,6 +98,9 @@ func (r KnnSearchRequest) Do(ctx context.Context, transport Transport) (*Respons path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_knn_search") @@ -109,6 +128,9 @@ func (r KnnSearchRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +162,20 @@ func (r KnnSearchRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "knn_search") + if reader := instrument.RecordRequestBody(ctx, "knn_search", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "knn_search") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.mget.go b/esapi/api.mget.go index 6bf0beb914..cf00011a55 100644 --- a/esapi/api.mget.go +++ b/esapi/api.mget.go @@ -33,6 +33,11 @@ func newMgetFunc(t Transport) Mget { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -68,16 +73,27 @@ type MgetRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MgetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MgetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "mget") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_mget")) @@ -85,6 +101,9 @@ func (r MgetRequest) Do(ctx context.Context, transport Transport) (*Response, er if r.Index != "" { path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } } path.WriteString("/") path.WriteString("_mget") @@ -145,6 +164,9 @@ func (r MgetRequest) Do(ctx context.Context, transport Transport) (*Response, er req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,8 +198,20 @@ func (r MgetRequest) Do(ctx context.Context, transport Transport) (*Response, er req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "mget") + if reader := instrument.RecordRequestBody(ctx, "mget", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "mget") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.msearch.go b/esapi/api.msearch.go index 153893160b..5c3f1032cd 100644 --- a/esapi/api.msearch.go +++ b/esapi/api.msearch.go @@ -33,6 +33,11 @@ func newMsearchFunc(t Transport) Msearch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,16 +71,27 @@ type MsearchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MsearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MsearchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "msearch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_msearch")) @@ -83,6 +99,9 @@ func (r MsearchRequest) Do(ctx context.Context, transport Transport) (*Response, if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_msearch") @@ -135,6 +154,9 @@ func (r MsearchRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,8 +188,20 @@ func (r MsearchRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "msearch") + if reader := instrument.RecordRequestBody(ctx, "msearch", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "msearch") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.msearch_template.go b/esapi/api.msearch_template.go index 6b5a04298b..cf3dff32bf 100644 --- a/esapi/api.msearch_template.go +++ b/esapi/api.msearch_template.go @@ -33,6 +33,11 @@ func newMsearchTemplateFunc(t Transport) MsearchTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type MsearchTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MsearchTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MsearchTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "msearch_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_msearch") + 1 + len("template")) @@ -81,6 +97,9 @@ func (r MsearchTemplateRequest) Do(ctx context.Context, transport Transport) (*R if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_msearch") @@ -127,6 +146,9 @@ func (r MsearchTemplateRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -158,8 +180,20 @@ func (r MsearchTemplateRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "msearch_template") + if reader := instrument.RecordRequestBody(ctx, "msearch_template", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "msearch_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.mtermvectors.go b/esapi/api.mtermvectors.go index 7039638c82..6cb1109f99 100644 --- a/esapi/api.mtermvectors.go +++ b/esapi/api.mtermvectors.go @@ -33,6 +33,11 @@ func newMtermvectorsFunc(t Transport) Mtermvectors { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -71,16 +76,27 @@ type MtermvectorsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MtermvectorsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MtermvectorsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "mtermvectors") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_mtermvectors")) @@ -88,6 +104,9 @@ func (r MtermvectorsRequest) Do(ctx context.Context, transport Transport) (*Resp if r.Index != "" { path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } } path.WriteString("/") path.WriteString("_mtermvectors") @@ -160,6 +179,9 @@ func (r MtermvectorsRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -191,8 +213,20 @@ func (r MtermvectorsRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "mtermvectors") + if reader := instrument.RecordRequestBody(ctx, "mtermvectors", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "mtermvectors") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.nodes.clear_repositories_metering_archive.go b/esapi/api.nodes.clear_repositories_metering_archive.go index 12430e1455..72da992cbb 100644 --- a/esapi/api.nodes.clear_repositories_metering_archive.go +++ b/esapi/api.nodes.clear_repositories_metering_archive.go @@ -33,6 +33,11 @@ func newNodesClearRepositoriesMeteringArchiveFunc(t Transport) NodesClearReposit for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type NodesClearRepositoriesMeteringArchiveRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r NodesClearRepositoriesMeteringArchiveRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r NodesClearRepositoriesMeteringArchiveRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.clear_repositories_metering_archive") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" if len(r.NodeID) == 0 { @@ -84,10 +100,16 @@ func (r NodesClearRepositoriesMeteringArchiveRequest) Do(ctx context.Context, tr path.WriteString("_nodes") path.WriteString("/") path.WriteString(strings.Join(r.NodeID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", strings.Join(r.NodeID, ",")) + } path.WriteString("/") path.WriteString("_repositories_metering") path.WriteString("/") path.WriteString(strconv.Itoa(*r.MaxArchiveVersion)) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "max_archive_version", strconv.Itoa(*r.MaxArchiveVersion)) + } params = make(map[string]string) @@ -109,6 +131,9 @@ func (r NodesClearRepositoriesMeteringArchiveRequest) Do(ctx context.Context, tr req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -136,8 +161,17 @@ func (r NodesClearRepositoriesMeteringArchiveRequest) Do(ctx context.Context, tr req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.clear_repositories_metering_archive") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.clear_repositories_metering_archive") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.nodes.get_repositories_metering_info.go b/esapi/api.nodes.get_repositories_metering_info.go index c7a9b545b0..67a9f1a49b 100644 --- a/esapi/api.nodes.get_repositories_metering_info.go +++ b/esapi/api.nodes.get_repositories_metering_info.go @@ -32,6 +32,11 @@ func newNodesGetRepositoriesMeteringInfoFunc(t Transport) NodesGetRepositoriesMe for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type NodesGetRepositoriesMeteringInfoRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r NodesGetRepositoriesMeteringInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r NodesGetRepositoriesMeteringInfoRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.get_repositories_metering_info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" if len(r.NodeID) == 0 { @@ -79,6 +95,9 @@ func (r NodesGetRepositoriesMeteringInfoRequest) Do(ctx context.Context, transpo path.WriteString("_nodes") path.WriteString("/") path.WriteString(strings.Join(r.NodeID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", strings.Join(r.NodeID, ",")) + } path.WriteString("/") path.WriteString("_repositories_metering") @@ -102,6 +121,9 @@ func (r NodesGetRepositoriesMeteringInfoRequest) Do(ctx context.Context, transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,17 @@ func (r NodesGetRepositoriesMeteringInfoRequest) Do(ctx context.Context, transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.get_repositories_metering_info") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.get_repositories_metering_info") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.nodes.hot_threads.go b/esapi/api.nodes.hot_threads.go index bd943f1b10..899a33d958 100644 --- a/esapi/api.nodes.hot_threads.go +++ b/esapi/api.nodes.hot_threads.go @@ -33,6 +33,11 @@ func newNodesHotThreadsFunc(t Transport) NodesHotThreads { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type NodesHotThreadsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r NodesHotThreadsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r NodesHotThreadsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.hot_threads") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_nodes") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len("hot_threads")) @@ -83,6 +99,9 @@ func (r NodesHotThreadsRequest) Do(ctx context.Context, transport Transport) (*R if len(r.NodeID) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.NodeID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", strings.Join(r.NodeID, ",")) + } } path.WriteString("/") path.WriteString("hot_threads") @@ -135,6 +154,9 @@ func (r NodesHotThreadsRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -162,8 +184,17 @@ func (r NodesHotThreadsRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.hot_threads") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.hot_threads") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.nodes.info.go b/esapi/api.nodes.info.go index df64d34bb5..5273b65bd8 100644 --- a/esapi/api.nodes.info.go +++ b/esapi/api.nodes.info.go @@ -33,6 +33,11 @@ func newNodesInfoFunc(t Transport) NodesInfo { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type NodesInfoRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r NodesInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r NodesInfoRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_nodes") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len(strings.Join(r.Metric, ","))) @@ -79,10 +95,16 @@ func (r NodesInfoRequest) Do(ctx context.Context, transport Transport) (*Respons if len(r.NodeID) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.NodeID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", strings.Join(r.NodeID, ",")) + } } if len(r.Metric) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Metric, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", strings.Join(r.Metric, ",")) + } } params = make(map[string]string) @@ -113,6 +135,9 @@ func (r NodesInfoRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +165,17 @@ func (r NodesInfoRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.info") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.info") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.nodes.reload_secure_settings.go b/esapi/api.nodes.reload_secure_settings.go index 9b1500461f..a38ed50799 100644 --- a/esapi/api.nodes.reload_secure_settings.go +++ b/esapi/api.nodes.reload_secure_settings.go @@ -33,6 +33,11 @@ func newNodesReloadSecureSettingsFunc(t Transport) NodesReloadSecureSettings { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type NodesReloadSecureSettingsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r NodesReloadSecureSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r NodesReloadSecureSettingsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.reload_secure_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_nodes") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len("reload_secure_settings")) @@ -79,6 +95,9 @@ func (r NodesReloadSecureSettingsRequest) Do(ctx context.Context, transport Tran if len(r.NodeID) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.NodeID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", strings.Join(r.NodeID, ",")) + } } path.WriteString("/") path.WriteString("reload_secure_settings") @@ -107,6 +126,9 @@ func (r NodesReloadSecureSettingsRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +160,20 @@ func (r NodesReloadSecureSettingsRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.reload_secure_settings") + if reader := instrument.RecordRequestBody(ctx, "nodes.reload_secure_settings", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.reload_secure_settings") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.nodes.stats.go b/esapi/api.nodes.stats.go index 31b77952c3..24ceb4e78e 100644 --- a/esapi/api.nodes.stats.go +++ b/esapi/api.nodes.stats.go @@ -33,6 +33,11 @@ func newNodesStatsFunc(t Transport) NodesStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -68,16 +73,27 @@ type NodesStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r NodesStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r NodesStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_nodes") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len("stats") + 1 + len(strings.Join(r.Metric, ",")) + 1 + len(strings.Join(r.IndexMetric, ","))) @@ -87,16 +103,25 @@ func (r NodesStatsRequest) Do(ctx context.Context, transport Transport) (*Respon if len(r.NodeID) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.NodeID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", strings.Join(r.NodeID, ",")) + } } path.WriteString("/") path.WriteString("stats") if len(r.Metric) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Metric, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", strings.Join(r.Metric, ",")) + } } if len(r.IndexMetric) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.IndexMetric, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index_metric", strings.Join(r.IndexMetric, ",")) + } } params = make(map[string]string) @@ -155,6 +180,9 @@ func (r NodesStatsRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,8 +210,17 @@ func (r NodesStatsRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.nodes.usage.go b/esapi/api.nodes.usage.go index f45715488d..0ca62442be 100644 --- a/esapi/api.nodes.usage.go +++ b/esapi/api.nodes.usage.go @@ -32,6 +32,11 @@ func newNodesUsageFunc(t Transport) NodesUsage { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type NodesUsageRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r NodesUsageRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r NodesUsageRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.usage") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_nodes") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len("usage") + 1 + len(strings.Join(r.Metric, ","))) @@ -77,12 +93,18 @@ func (r NodesUsageRequest) Do(ctx context.Context, transport Transport) (*Respon if len(r.NodeID) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.NodeID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", strings.Join(r.NodeID, ",")) + } } path.WriteString("/") path.WriteString("usage") if len(r.Metric) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Metric, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", strings.Join(r.Metric, ",")) + } } params = make(map[string]string) @@ -109,6 +131,9 @@ func (r NodesUsageRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -136,8 +161,17 @@ func (r NodesUsageRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.usage") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.usage") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.ping.go b/esapi/api.ping.go index 0b13554a61..291502feb1 100644 --- a/esapi/api.ping.go +++ b/esapi/api.ping.go @@ -31,6 +31,11 @@ func newPingFunc(t Transport) Ping { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type PingRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r PingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r PingRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "HEAD" path.Grow(7 + len("/")) @@ -88,6 +104,9 @@ func (r PingRequest) Do(ctx context.Context, transport Transport) (*Response, er req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r PingRequest) Do(ctx context.Context, transport Transport) (*Response, er req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ping") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ping") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.profiling.status.go b/esapi/api.profiling.status.go index 3449b7050d..d8530335c8 100644 --- a/esapi/api.profiling.status.go +++ b/esapi/api.profiling.status.go @@ -33,6 +33,11 @@ func newProfilingStatusFunc(t Transport) ProfilingStatus { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type ProfilingStatusRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ProfilingStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ProfilingStatusRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "profiling.status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_profiling/status")) @@ -106,6 +122,9 @@ func (r ProfilingStatusRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +152,17 @@ func (r ProfilingStatusRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "profiling.status") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "profiling.status") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.put_script.go b/esapi/api.put_script.go index 4681a7a59e..a33a7f5d58 100644 --- a/esapi/api.put_script.go +++ b/esapi/api.put_script.go @@ -33,6 +33,11 @@ func newPutScriptFunc(t Transport) PutScript { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type PutScriptRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r PutScriptRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r PutScriptRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "put_script") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_scripts") + 1 + len(r.ScriptID) + 1 + len(r.ScriptContext)) @@ -81,9 +97,15 @@ func (r PutScriptRequest) Do(ctx context.Context, transport Transport) (*Respons path.WriteString("_scripts") path.WriteString("/") path.WriteString(r.ScriptID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.ScriptID) + } if r.ScriptContext != "" { path.WriteString("/") path.WriteString(r.ScriptContext) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "context", r.ScriptContext) + } } params = make(map[string]string) @@ -118,6 +140,9 @@ func (r PutScriptRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -149,8 +174,20 @@ func (r PutScriptRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "put_script") + if reader := instrument.RecordRequestBody(ctx, "put_script", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "put_script") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.query_ruleset.delete.go b/esapi/api.query_ruleset.delete.go index 66f7e5f4d1..eb94e933df 100644 --- a/esapi/api.query_ruleset.delete.go +++ b/esapi/api.query_ruleset.delete.go @@ -31,6 +31,11 @@ func newQueryRulesetDeleteFunc(t Transport) QueryRulesetDelete { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type QueryRulesetDeleteRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r QueryRulesetDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r QueryRulesetDeleteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_query_rules") + 1 + len(r.RulesetID)) @@ -74,6 +90,9 @@ func (r QueryRulesetDeleteRequest) Do(ctx context.Context, transport Transport) path.WriteString("_query_rules") path.WriteString("/") path.WriteString(r.RulesetID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "ruleset_id", r.RulesetID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r QueryRulesetDeleteRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r QueryRulesetDeleteRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "query_ruleset.delete") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "query_ruleset.delete") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.query_ruleset.get.go b/esapi/api.query_ruleset.get.go index aa839ce3e1..ec935d3a93 100644 --- a/esapi/api.query_ruleset.get.go +++ b/esapi/api.query_ruleset.get.go @@ -31,6 +31,11 @@ func newQueryRulesetGetFunc(t Transport) QueryRulesetGet { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type QueryRulesetGetRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r QueryRulesetGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r QueryRulesetGetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_query_rules") + 1 + len(r.RulesetID)) @@ -74,6 +90,9 @@ func (r QueryRulesetGetRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("_query_rules") path.WriteString("/") path.WriteString(r.RulesetID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "ruleset_id", r.RulesetID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r QueryRulesetGetRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r QueryRulesetGetRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "query_ruleset.get") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "query_ruleset.get") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.query_ruleset.list.go b/esapi/api.query_ruleset.list.go index 1d882f7417..71090969b8 100644 --- a/esapi/api.query_ruleset.list.go +++ b/esapi/api.query_ruleset.list.go @@ -32,6 +32,11 @@ func newQueryRulesetListFunc(t Transport) QueryRulesetList { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type QueryRulesetListRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r QueryRulesetListRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r QueryRulesetListRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_query_rules")) @@ -102,6 +118,9 @@ func (r QueryRulesetListRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +148,17 @@ func (r QueryRulesetListRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "query_ruleset.list") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "query_ruleset.list") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.query_ruleset.put.go b/esapi/api.query_ruleset.put.go index 37396da593..5c385d2a5a 100644 --- a/esapi/api.query_ruleset.put.go +++ b/esapi/api.query_ruleset.put.go @@ -32,6 +32,11 @@ func newQueryRulesetPutFunc(t Transport) QueryRulesetPut { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type QueryRulesetPutRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r QueryRulesetPutRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r QueryRulesetPutRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.put") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_query_rules") + 1 + len(r.RulesetID)) @@ -77,6 +93,9 @@ func (r QueryRulesetPutRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("_query_rules") path.WriteString("/") path.WriteString(r.RulesetID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "ruleset_id", r.RulesetID) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r QueryRulesetPutRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r QueryRulesetPutRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "query_ruleset.put") + if reader := instrument.RecordRequestBody(ctx, "query_ruleset.put", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "query_ruleset.put") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.rank_eval.go b/esapi/api.rank_eval.go index 5b94027d30..0f616d6996 100644 --- a/esapi/api.rank_eval.go +++ b/esapi/api.rank_eval.go @@ -33,6 +33,11 @@ func newRankEvalFunc(t Transport) RankEval { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type RankEvalRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r RankEvalRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r RankEvalRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rank_eval") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_rank_eval")) @@ -80,6 +96,9 @@ func (r RankEvalRequest) Do(ctx context.Context, transport Transport) (*Response if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_rank_eval") @@ -120,6 +139,9 @@ func (r RankEvalRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -151,8 +173,20 @@ func (r RankEvalRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "rank_eval") + if reader := instrument.RecordRequestBody(ctx, "rank_eval", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rank_eval") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.reindex.go b/esapi/api.reindex.go index 9787bc5eb8..a7fd0db7ef 100644 --- a/esapi/api.reindex.go +++ b/esapi/api.reindex.go @@ -35,6 +35,11 @@ func newReindexFunc(t Transport) Reindex { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -69,16 +74,27 @@ type ReindexRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ReindexRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ReindexRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "reindex") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_reindex")) @@ -137,6 +153,9 @@ func (r ReindexRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -168,8 +187,20 @@ func (r ReindexRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "reindex") + if reader := instrument.RecordRequestBody(ctx, "reindex", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "reindex") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.reindex_rethrottle.go b/esapi/api.reindex_rethrottle.go index 2b46c6bcff..5d60fa8693 100644 --- a/esapi/api.reindex_rethrottle.go +++ b/esapi/api.reindex_rethrottle.go @@ -32,6 +32,11 @@ func newReindexRethrottleFunc(t Transport) ReindexRethrottle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type ReindexRethrottleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ReindexRethrottleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ReindexRethrottleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "reindex_rethrottle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_reindex") + 1 + len(r.TaskID) + 1 + len("_rethrottle")) @@ -75,6 +91,9 @@ func (r ReindexRethrottleRequest) Do(ctx context.Context, transport Transport) ( path.WriteString("_reindex") path.WriteString("/") path.WriteString(r.TaskID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "task_id", r.TaskID) + } path.WriteString("/") path.WriteString("_rethrottle") @@ -102,6 +121,9 @@ func (r ReindexRethrottleRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,17 @@ func (r ReindexRethrottleRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "reindex_rethrottle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "reindex_rethrottle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.render_search_template.go b/esapi/api.render_search_template.go index 47d116329e..d3184bb408 100644 --- a/esapi/api.render_search_template.go +++ b/esapi/api.render_search_template.go @@ -32,6 +32,11 @@ func newRenderSearchTemplateFunc(t Transport) RenderSearchTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type RenderSearchTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r RenderSearchTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r RenderSearchTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "render_search_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_render") + 1 + len("template") + 1 + len(r.TemplateID)) @@ -78,6 +94,9 @@ func (r RenderSearchTemplateRequest) Do(ctx context.Context, transport Transport if r.TemplateID != "" { path.WriteString("/") path.WriteString(r.TemplateID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.TemplateID) + } } params = make(map[string]string) @@ -100,6 +119,9 @@ func (r RenderSearchTemplateRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,20 @@ func (r RenderSearchTemplateRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "render_search_template") + if reader := instrument.RecordRequestBody(ctx, "render_search_template", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "render_search_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.scripts_painless_execute.go b/esapi/api.scripts_painless_execute.go index 43eaee42dc..debfe9ad4d 100644 --- a/esapi/api.scripts_painless_execute.go +++ b/esapi/api.scripts_painless_execute.go @@ -32,6 +32,11 @@ func newScriptsPainlessExecuteFunc(t Transport) ScriptsPainlessExecute { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type ScriptsPainlessExecuteRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ScriptsPainlessExecuteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ScriptsPainlessExecuteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "scripts_painless_execute") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_scripts/painless/_execute")) @@ -93,6 +109,9 @@ func (r ScriptsPainlessExecuteRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +143,20 @@ func (r ScriptsPainlessExecuteRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "scripts_painless_execute") + if reader := instrument.RecordRequestBody(ctx, "scripts_painless_execute", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "scripts_painless_execute") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.scroll.go b/esapi/api.scroll.go index b24dce21b4..cb413e7d07 100644 --- a/esapi/api.scroll.go +++ b/esapi/api.scroll.go @@ -34,6 +34,11 @@ func newScrollFunc(t Transport) Scroll { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type ScrollRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ScrollRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ScrollRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "scroll") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(len("/_search/scroll")) @@ -109,6 +125,9 @@ func (r ScrollRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +159,20 @@ func (r ScrollRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "scroll") + if reader := instrument.RecordRequestBody(ctx, "scroll", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "scroll") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search.go b/esapi/api.search.go index 41e2b7350d..d01c248327 100644 --- a/esapi/api.search.go +++ b/esapi/api.search.go @@ -35,6 +35,11 @@ func newSearchFunc(t Transport) Search { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -106,16 +111,27 @@ type SearchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_search")) @@ -123,6 +139,9 @@ func (r SearchRequest) Do(ctx context.Context, transport Transport) (*Response, if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_search") @@ -327,6 +346,9 @@ func (r SearchRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -358,8 +380,20 @@ func (r SearchRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search") + if reader := instrument.RecordRequestBody(ctx, "search", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_application.delete.go b/esapi/api.search_application.delete.go index 8d70054f65..8e20d52824 100644 --- a/esapi/api.search_application.delete.go +++ b/esapi/api.search_application.delete.go @@ -31,6 +31,11 @@ func newSearchApplicationDeleteFunc(t Transport) SearchApplicationDelete { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SearchApplicationDeleteRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchApplicationDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchApplicationDeleteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_application") + 1 + len("search_application") + 1 + len(r.Name)) @@ -76,6 +92,9 @@ func (r SearchApplicationDeleteRequest) Do(ctx context.Context, transport Transp path.WriteString("search_application") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r SearchApplicationDeleteRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SearchApplicationDeleteRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.delete") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.delete") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_application.delete_behavioral_analytics.go b/esapi/api.search_application.delete_behavioral_analytics.go index d362dab1b0..329f0576bc 100644 --- a/esapi/api.search_application.delete_behavioral_analytics.go +++ b/esapi/api.search_application.delete_behavioral_analytics.go @@ -31,6 +31,11 @@ func newSearchApplicationDeleteBehavioralAnalyticsFunc(t Transport) SearchApplic for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SearchApplicationDeleteBehavioralAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchApplicationDeleteBehavioralAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchApplicationDeleteBehavioralAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.delete_behavioral_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_application") + 1 + len("analytics") + 1 + len(r.Name)) @@ -76,6 +92,9 @@ func (r SearchApplicationDeleteBehavioralAnalyticsRequest) Do(ctx context.Contex path.WriteString("analytics") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r SearchApplicationDeleteBehavioralAnalyticsRequest) Do(ctx context.Contex req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SearchApplicationDeleteBehavioralAnalyticsRequest) Do(ctx context.Contex req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.delete_behavioral_analytics") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.delete_behavioral_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_application.get.go b/esapi/api.search_application.get.go index 655b3c3eb5..4619d6b3cf 100644 --- a/esapi/api.search_application.get.go +++ b/esapi/api.search_application.get.go @@ -31,6 +31,11 @@ func newSearchApplicationGetFunc(t Transport) SearchApplicationGet { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SearchApplicationGetRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchApplicationGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchApplicationGetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_application") + 1 + len("search_application") + 1 + len(r.Name)) @@ -76,6 +92,9 @@ func (r SearchApplicationGetRequest) Do(ctx context.Context, transport Transport path.WriteString("search_application") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r SearchApplicationGetRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SearchApplicationGetRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.get") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.get") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_application.get_behavioral_analytics.go b/esapi/api.search_application.get_behavioral_analytics.go index f50b2092ab..cba2e12986 100644 --- a/esapi/api.search_application.get_behavioral_analytics.go +++ b/esapi/api.search_application.get_behavioral_analytics.go @@ -31,6 +31,11 @@ func newSearchApplicationGetBehavioralAnalyticsFunc(t Transport) SearchApplicati for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SearchApplicationGetBehavioralAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchApplicationGetBehavioralAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchApplicationGetBehavioralAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.get_behavioral_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_application") + 1 + len("analytics") + 1 + len(strings.Join(r.Name, ","))) @@ -77,6 +93,9 @@ func (r SearchApplicationGetBehavioralAnalyticsRequest) Do(ctx context.Context, if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } params = make(map[string]string) @@ -99,6 +118,9 @@ func (r SearchApplicationGetBehavioralAnalyticsRequest) Do(ctx context.Context, req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -126,8 +148,17 @@ func (r SearchApplicationGetBehavioralAnalyticsRequest) Do(ctx context.Context, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.get_behavioral_analytics") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.get_behavioral_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_application.list.go b/esapi/api.search_application.list.go index 5c4b8e11f9..99fdc1e9ed 100644 --- a/esapi/api.search_application.list.go +++ b/esapi/api.search_application.list.go @@ -32,6 +32,11 @@ func newSearchApplicationListFunc(t Transport) SearchApplicationList { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SearchApplicationListRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchApplicationListRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchApplicationListRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_application/search_application")) @@ -107,6 +123,9 @@ func (r SearchApplicationListRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +153,17 @@ func (r SearchApplicationListRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.list") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.list") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_application.post_behavioral_analytics_event.go b/esapi/api.search_application.post_behavioral_analytics_event.go index 4346817598..65e56e5eff 100644 --- a/esapi/api.search_application.post_behavioral_analytics_event.go +++ b/esapi/api.search_application.post_behavioral_analytics_event.go @@ -33,6 +33,11 @@ func newSearchApplicationPostBehavioralAnalyticsEventFunc(t Transport) SearchApp for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type SearchApplicationPostBehavioralAnalyticsEventRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchApplicationPostBehavioralAnalyticsEventRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchApplicationPostBehavioralAnalyticsEventRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.post_behavioral_analytics_event") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_application") + 1 + len("analytics") + 1 + len(r.CollectionName) + 1 + len("event") + 1 + len(r.EventType)) @@ -83,10 +99,16 @@ func (r SearchApplicationPostBehavioralAnalyticsEventRequest) Do(ctx context.Con path.WriteString("analytics") path.WriteString("/") path.WriteString(r.CollectionName) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "collection_name", r.CollectionName) + } path.WriteString("/") path.WriteString("event") path.WriteString("/") path.WriteString(r.EventType) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "event_type", r.EventType) + } params = make(map[string]string) @@ -112,6 +134,9 @@ func (r SearchApplicationPostBehavioralAnalyticsEventRequest) Do(ctx context.Con req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -143,8 +168,20 @@ func (r SearchApplicationPostBehavioralAnalyticsEventRequest) Do(ctx context.Con req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.post_behavioral_analytics_event") + if reader := instrument.RecordRequestBody(ctx, "search_application.post_behavioral_analytics_event", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.post_behavioral_analytics_event") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_application.put.go b/esapi/api.search_application.put.go index cb61a25536..5836dac4d2 100644 --- a/esapi/api.search_application.put.go +++ b/esapi/api.search_application.put.go @@ -33,6 +33,11 @@ func newSearchApplicationPutFunc(t Transport) SearchApplicationPut { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type SearchApplicationPutRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchApplicationPutRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchApplicationPutRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.put") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_application") + 1 + len("search_application") + 1 + len(r.Name)) @@ -82,6 +98,9 @@ func (r SearchApplicationPutRequest) Do(ctx context.Context, transport Transport path.WriteString("search_application") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -107,6 +126,9 @@ func (r SearchApplicationPutRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +160,20 @@ func (r SearchApplicationPutRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.put") + if reader := instrument.RecordRequestBody(ctx, "search_application.put", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.put") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_application.put_behavioral_analytics.go b/esapi/api.search_application.put_behavioral_analytics.go index 5ec1ba707b..bf1d577034 100644 --- a/esapi/api.search_application.put_behavioral_analytics.go +++ b/esapi/api.search_application.put_behavioral_analytics.go @@ -31,6 +31,11 @@ func newSearchApplicationPutBehavioralAnalyticsFunc(t Transport) SearchApplicati for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SearchApplicationPutBehavioralAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchApplicationPutBehavioralAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchApplicationPutBehavioralAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.put_behavioral_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_application") + 1 + len("analytics") + 1 + len(r.Name)) @@ -76,6 +92,9 @@ func (r SearchApplicationPutBehavioralAnalyticsRequest) Do(ctx context.Context, path.WriteString("analytics") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r SearchApplicationPutBehavioralAnalyticsRequest) Do(ctx context.Context, req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SearchApplicationPutBehavioralAnalyticsRequest) Do(ctx context.Context, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.put_behavioral_analytics") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.put_behavioral_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_application.render_query.go b/esapi/api.search_application.render_query.go index d247c81760..70ccbc7f27 100644 --- a/esapi/api.search_application.render_query.go +++ b/esapi/api.search_application.render_query.go @@ -32,6 +32,11 @@ func newSearchApplicationRenderQueryFunc(t Transport) SearchApplicationRenderQue for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SearchApplicationRenderQueryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchApplicationRenderQueryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchApplicationRenderQueryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.render_query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_application") + 1 + len("search_application") + 1 + len(r.Name) + 1 + len("_render_query")) @@ -79,6 +95,9 @@ func (r SearchApplicationRenderQueryRequest) Do(ctx context.Context, transport T path.WriteString("search_application") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } path.WriteString("/") path.WriteString("_render_query") @@ -102,6 +121,9 @@ func (r SearchApplicationRenderQueryRequest) Do(ctx context.Context, transport T req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,20 @@ func (r SearchApplicationRenderQueryRequest) Do(ctx context.Context, transport T req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.render_query") + if reader := instrument.RecordRequestBody(ctx, "search_application.render_query", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.render_query") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_application.search.go b/esapi/api.search_application.search.go index a8ca18a509..a86f2e5467 100644 --- a/esapi/api.search_application.search.go +++ b/esapi/api.search_application.search.go @@ -32,6 +32,11 @@ func newSearchApplicationSearchFunc(t Transport) SearchApplicationSearch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SearchApplicationSearchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchApplicationSearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchApplicationSearchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_application") + 1 + len("search_application") + 1 + len(r.Name) + 1 + len("_search")) @@ -79,6 +95,9 @@ func (r SearchApplicationSearchRequest) Do(ctx context.Context, transport Transp path.WriteString("search_application") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } path.WriteString("/") path.WriteString("_search") @@ -102,6 +121,9 @@ func (r SearchApplicationSearchRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,20 @@ func (r SearchApplicationSearchRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.search") + if reader := instrument.RecordRequestBody(ctx, "search_application.search", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.search") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_mvt.go b/esapi/api.search_mvt.go index eb0c700cde..499d9bb972 100644 --- a/esapi/api.search_mvt.go +++ b/esapi/api.search_mvt.go @@ -35,6 +35,11 @@ func newSearchMvtFunc(t Transport) SearchMvt { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -75,16 +80,27 @@ type SearchMvtRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchMvtRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchMvtRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_mvt") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -104,16 +120,31 @@ func (r SearchMvtRequest) Do(ctx context.Context, transport Transport) (*Respons path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_mvt") path.WriteString("/") path.WriteString(r.Field) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "field", r.Field) + } path.WriteString("/") path.WriteString(strconv.Itoa(*r.Zoom)) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "zoom", strconv.Itoa(*r.Zoom)) + } path.WriteString("/") path.WriteString(strconv.Itoa(*r.X)) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "x", strconv.Itoa(*r.X)) + } path.WriteString("/") path.WriteString(strconv.Itoa(*r.Y)) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "y", strconv.Itoa(*r.Y)) + } params = make(map[string]string) @@ -163,6 +194,9 @@ func (r SearchMvtRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -194,8 +228,20 @@ func (r SearchMvtRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_mvt") + if reader := instrument.RecordRequestBody(ctx, "search_mvt", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_mvt") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_shards.go b/esapi/api.search_shards.go index 7dbd159e2c..7ff40dce36 100644 --- a/esapi/api.search_shards.go +++ b/esapi/api.search_shards.go @@ -32,6 +32,11 @@ func newSearchShardsFunc(t Transport) SearchShards { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type SearchShardsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchShardsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchShardsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_shards") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_search_shards")) @@ -79,6 +95,9 @@ func (r SearchShardsRequest) Do(ctx context.Context, transport Transport) (*Resp if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_search_shards") @@ -127,6 +146,9 @@ func (r SearchShardsRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -154,8 +176,17 @@ func (r SearchShardsRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_shards") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_shards") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.search_template.go b/esapi/api.search_template.go index 81a7fdff7a..9adcc223ac 100644 --- a/esapi/api.search_template.go +++ b/esapi/api.search_template.go @@ -34,6 +34,11 @@ func newSearchTemplateFunc(t Transport) SearchTemplate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -73,16 +78,27 @@ type SearchTemplateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchTemplateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_search") + 1 + len("template")) @@ -90,6 +106,9 @@ func (r SearchTemplateRequest) Do(ctx context.Context, transport Transport) (*Re if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_search") @@ -168,6 +187,9 @@ func (r SearchTemplateRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -199,8 +221,20 @@ func (r SearchTemplateRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "search_template") + if reader := instrument.RecordRequestBody(ctx, "search_template", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_template") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.shutdown.delete_node.go b/esapi/api.shutdown.delete_node.go index 05978df85a..297afa1289 100644 --- a/esapi/api.shutdown.delete_node.go +++ b/esapi/api.shutdown.delete_node.go @@ -31,6 +31,11 @@ func newShutdownDeleteNodeFunc(t Transport) ShutdownDeleteNode { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type ShutdownDeleteNodeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ShutdownDeleteNodeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ShutdownDeleteNodeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "shutdown.delete_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_nodes") + 1 + len(r.NodeID) + 1 + len("shutdown")) @@ -72,6 +88,9 @@ func (r ShutdownDeleteNodeRequest) Do(ctx context.Context, transport Transport) path.WriteString("_nodes") path.WriteString("/") path.WriteString(r.NodeID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", r.NodeID) + } path.WriteString("/") path.WriteString("shutdown") @@ -95,6 +114,9 @@ func (r ShutdownDeleteNodeRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r ShutdownDeleteNodeRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "shutdown.delete_node") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "shutdown.delete_node") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.shutdown.get_node.go b/esapi/api.shutdown.get_node.go index 124f8b9799..c57ebf0e9d 100644 --- a/esapi/api.shutdown.get_node.go +++ b/esapi/api.shutdown.get_node.go @@ -31,6 +31,11 @@ func newShutdownGetNodeFunc(t Transport) ShutdownGetNode { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type ShutdownGetNodeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ShutdownGetNodeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ShutdownGetNodeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "shutdown.get_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_nodes") + 1 + len(r.NodeID) + 1 + len("shutdown")) @@ -73,6 +89,9 @@ func (r ShutdownGetNodeRequest) Do(ctx context.Context, transport Transport) (*R if r.NodeID != "" { path.WriteString("/") path.WriteString(r.NodeID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", r.NodeID) + } } path.WriteString("/") path.WriteString("shutdown") @@ -97,6 +116,9 @@ func (r ShutdownGetNodeRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r ShutdownGetNodeRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "shutdown.get_node") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "shutdown.get_node") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.shutdown.put_node.go b/esapi/api.shutdown.put_node.go index 4b4cef15f2..42606d828f 100644 --- a/esapi/api.shutdown.put_node.go +++ b/esapi/api.shutdown.put_node.go @@ -32,6 +32,11 @@ func newShutdownPutNodeFunc(t Transport) ShutdownPutNode { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type ShutdownPutNodeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ShutdownPutNodeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ShutdownPutNodeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "shutdown.put_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_nodes") + 1 + len(r.NodeID) + 1 + len("shutdown")) @@ -75,6 +91,9 @@ func (r ShutdownPutNodeRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("_nodes") path.WriteString("/") path.WriteString(r.NodeID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", r.NodeID) + } path.WriteString("/") path.WriteString("shutdown") @@ -98,6 +117,9 @@ func (r ShutdownPutNodeRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r ShutdownPutNodeRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "shutdown.put_node") + if reader := instrument.RecordRequestBody(ctx, "shutdown.put_node", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "shutdown.put_node") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.simulate.ingest.go b/esapi/api.simulate.ingest.go new file mode 100644 index 0000000000..8bce848649 --- /dev/null +++ b/esapi/api.simulate.ingest.go @@ -0,0 +1,259 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Code generated from specification version 8.12.0: DO NOT EDIT + +package esapi + +import ( + "context" + "io" + "net/http" + "strings" +) + +func newSimulateIngestFunc(t Transport) SimulateIngest { + return func(body io.Reader, o ...func(*SimulateIngestRequest)) (*Response, error) { + var r = SimulateIngestRequest{Body: body} + for _, f := range o { + f(&r) + } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + + return r.Do(r.ctx, t) + } +} + +// ----- API Definition ------------------------------------------------------- + +// SimulateIngest simulates running ingest with example documents. +// +// This API is experimental. +// +// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-ingest-api.html. +type SimulateIngest func(body io.Reader, o ...func(*SimulateIngestRequest)) (*Response, error) + +// SimulateIngestRequest configures the Simulate Ingest API request. +type SimulateIngestRequest struct { + Index string + + Body io.Reader + + Pipeline string + + Pretty bool + Human bool + ErrorTrace bool + FilterPath []string + + Header http.Header + + ctx context.Context + + instrument Instrumentation +} + +// Do executes the request and returns response or error. +func (r SimulateIngestRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { + var ( + method string + path strings.Builder + params map[string]string + ctx context.Context + ) + + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "simulate.ingest") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + method = "POST" + + path.Grow(7 + 1 + len("_ingest") + 1 + len(r.Index) + 1 + len("_simulate")) + path.WriteString("http://") + path.WriteString("/") + path.WriteString("_ingest") + if r.Index != "" { + path.WriteString("/") + path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } + } + path.WriteString("/") + path.WriteString("_simulate") + + params = make(map[string]string) + + if r.Pipeline != "" { + params["pipeline"] = r.Pipeline + } + + if r.Pretty { + params["pretty"] = "true" + } + + if r.Human { + params["human"] = "true" + } + + if r.ErrorTrace { + params["error_trace"] = "true" + } + + if len(r.FilterPath) > 0 { + params["filter_path"] = strings.Join(r.FilterPath, ",") + } + + req, err := newRequest(method, path.String(), r.Body) + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if len(params) > 0 { + q := req.URL.Query() + for k, v := range params { + q.Set(k, v) + } + req.URL.RawQuery = q.Encode() + } + + if len(r.Header) > 0 { + if len(req.Header) == 0 { + req.Header = r.Header + } else { + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + } + } + + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + + if ctx != nil { + req = req.WithContext(ctx) + } + + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "simulate.ingest") + if reader := instrument.RecordRequestBody(ctx, "simulate.ingest", r.Body); reader != nil { + req.Body = reader + } + } + res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "simulate.ingest") + } + if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + response := Response{ + StatusCode: res.StatusCode, + Body: res.Body, + Header: res.Header, + } + + return &response, nil +} + +// WithContext sets the request context. +func (f SimulateIngest) WithContext(v context.Context) func(*SimulateIngestRequest) { + return func(r *SimulateIngestRequest) { + r.ctx = v + } +} + +// WithIndex - default index for docs which don't provide one. +func (f SimulateIngest) WithIndex(v string) func(*SimulateIngestRequest) { + return func(r *SimulateIngestRequest) { + r.Index = v + } +} + +// WithPipeline - the pipeline ID to preprocess incoming documents with if no pipeline is given for a particular document. +func (f SimulateIngest) WithPipeline(v string) func(*SimulateIngestRequest) { + return func(r *SimulateIngestRequest) { + r.Pipeline = v + } +} + +// WithPretty makes the response body pretty-printed. +func (f SimulateIngest) WithPretty() func(*SimulateIngestRequest) { + return func(r *SimulateIngestRequest) { + r.Pretty = true + } +} + +// WithHuman makes statistical values human-readable. +func (f SimulateIngest) WithHuman() func(*SimulateIngestRequest) { + return func(r *SimulateIngestRequest) { + r.Human = true + } +} + +// WithErrorTrace includes the stack trace for errors in the response body. +func (f SimulateIngest) WithErrorTrace() func(*SimulateIngestRequest) { + return func(r *SimulateIngestRequest) { + r.ErrorTrace = true + } +} + +// WithFilterPath filters the properties of the response body. +func (f SimulateIngest) WithFilterPath(v ...string) func(*SimulateIngestRequest) { + return func(r *SimulateIngestRequest) { + r.FilterPath = v + } +} + +// WithHeader adds the headers to the HTTP request. +func (f SimulateIngest) WithHeader(h map[string]string) func(*SimulateIngestRequest) { + return func(r *SimulateIngestRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + for k, v := range h { + r.Header.Add(k, v) + } + } +} + +// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. +func (f SimulateIngest) WithOpaqueID(s string) func(*SimulateIngestRequest) { + return func(r *SimulateIngestRequest) { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set("X-Opaque-Id", s) + } +} diff --git a/esapi/api.snapshot.cleanup_repository.go b/esapi/api.snapshot.cleanup_repository.go index d950add9ff..412229dde1 100644 --- a/esapi/api.snapshot.cleanup_repository.go +++ b/esapi/api.snapshot.cleanup_repository.go @@ -32,6 +32,11 @@ func newSnapshotCleanupRepositoryFunc(t Transport) SnapshotCleanupRepository { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type SnapshotCleanupRepositoryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotCleanupRepositoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotCleanupRepositoryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.cleanup_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len("_cleanup")) @@ -76,6 +92,9 @@ func (r SnapshotCleanupRepositoryRequest) Do(ctx context.Context, transport Tran path.WriteString("_snapshot") path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } path.WriteString("/") path.WriteString("_cleanup") @@ -107,6 +126,9 @@ func (r SnapshotCleanupRepositoryRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +156,17 @@ func (r SnapshotCleanupRepositoryRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.cleanup_repository") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.cleanup_repository") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.clone.go b/esapi/api.snapshot.clone.go index 33d7c29741..ae81f6c738 100644 --- a/esapi/api.snapshot.clone.go +++ b/esapi/api.snapshot.clone.go @@ -33,6 +33,11 @@ func newSnapshotCloneFunc(t Transport) SnapshotClone { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type SnapshotCloneRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotCloneRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotCloneRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.clone") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(r.Snapshot) + 1 + len("_clone") + 1 + len(r.TargetSnapshot)) @@ -80,12 +96,21 @@ func (r SnapshotCloneRequest) Do(ctx context.Context, transport Transport) (*Res path.WriteString("_snapshot") path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } path.WriteString("/") path.WriteString(r.Snapshot) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.Snapshot) + } path.WriteString("/") path.WriteString("_clone") path.WriteString("/") path.WriteString(r.TargetSnapshot) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "target_snapshot", r.TargetSnapshot) + } params = make(map[string]string) @@ -111,6 +136,9 @@ func (r SnapshotCloneRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -142,8 +170,20 @@ func (r SnapshotCloneRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.clone") + if reader := instrument.RecordRequestBody(ctx, "snapshot.clone", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.clone") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.create.go b/esapi/api.snapshot.create.go index 050d4045a5..1e5ef66d76 100644 --- a/esapi/api.snapshot.create.go +++ b/esapi/api.snapshot.create.go @@ -34,6 +34,11 @@ func newSnapshotCreateFunc(t Transport) SnapshotCreate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type SnapshotCreateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotCreateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotCreateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.create") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(r.Snapshot)) @@ -81,8 +97,14 @@ func (r SnapshotCreateRequest) Do(ctx context.Context, transport Transport) (*Re path.WriteString("_snapshot") path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } path.WriteString("/") path.WriteString(r.Snapshot) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.Snapshot) + } params = make(map[string]string) @@ -112,6 +134,9 @@ func (r SnapshotCreateRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -143,8 +168,20 @@ func (r SnapshotCreateRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.create") + if reader := instrument.RecordRequestBody(ctx, "snapshot.create", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.create") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.create_repository.go b/esapi/api.snapshot.create_repository.go index 20ab47bc89..b00d3e8280 100644 --- a/esapi/api.snapshot.create_repository.go +++ b/esapi/api.snapshot.create_repository.go @@ -34,6 +34,11 @@ func newSnapshotCreateRepositoryFunc(t Transport) SnapshotCreateRepository { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type SnapshotCreateRepositoryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotCreateRepositoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotCreateRepositoryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.create_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_snapshot") + 1 + len(r.Repository)) @@ -81,6 +97,9 @@ func (r SnapshotCreateRepositoryRequest) Do(ctx context.Context, transport Trans path.WriteString("_snapshot") path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } params = make(map[string]string) @@ -114,6 +133,9 @@ func (r SnapshotCreateRepositoryRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -145,8 +167,20 @@ func (r SnapshotCreateRepositoryRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.create_repository") + if reader := instrument.RecordRequestBody(ctx, "snapshot.create_repository", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.create_repository") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.delete.go b/esapi/api.snapshot.delete.go index ec84c3d990..9db0b1e710 100644 --- a/esapi/api.snapshot.delete.go +++ b/esapi/api.snapshot.delete.go @@ -33,6 +33,11 @@ func newSnapshotDeleteFunc(t Transport) SnapshotDelete { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SnapshotDeleteRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotDeleteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" if len(r.Snapshot) == 0 { @@ -81,8 +97,14 @@ func (r SnapshotDeleteRequest) Do(ctx context.Context, transport Transport) (*Re path.WriteString("_snapshot") path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } path.WriteString("/") path.WriteString(strings.Join(r.Snapshot, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", strings.Join(r.Snapshot, ",")) + } params = make(map[string]string) @@ -108,6 +130,9 @@ func (r SnapshotDeleteRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +160,17 @@ func (r SnapshotDeleteRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.delete") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.delete") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.delete_repository.go b/esapi/api.snapshot.delete_repository.go index 312e72735d..4a3824e523 100644 --- a/esapi/api.snapshot.delete_repository.go +++ b/esapi/api.snapshot.delete_repository.go @@ -33,6 +33,11 @@ func newSnapshotDeleteRepositoryFunc(t Transport) SnapshotDeleteRepository { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SnapshotDeleteRepositoryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotDeleteRepositoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotDeleteRepositoryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.delete_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" if len(r.Repository) == 0 { @@ -81,6 +97,9 @@ func (r SnapshotDeleteRepositoryRequest) Do(ctx context.Context, transport Trans path.WriteString("_snapshot") path.WriteString("/") path.WriteString(strings.Join(r.Repository, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", strings.Join(r.Repository, ",")) + } params = make(map[string]string) @@ -110,6 +129,9 @@ func (r SnapshotDeleteRepositoryRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -137,8 +159,17 @@ func (r SnapshotDeleteRepositoryRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.delete_repository") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.delete_repository") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.get.go b/esapi/api.snapshot.get.go index 549d8c5c63..66e13afec6 100644 --- a/esapi/api.snapshot.get.go +++ b/esapi/api.snapshot.get.go @@ -34,6 +34,11 @@ func newSnapshotGetFunc(t Transport) SnapshotGet { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -72,16 +77,27 @@ type SnapshotGetRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotGetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" if len(r.Snapshot) == 0 { @@ -94,8 +110,14 @@ func (r SnapshotGetRequest) Do(ctx context.Context, transport Transport) (*Respo path.WriteString("_snapshot") path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } path.WriteString("/") path.WriteString(strings.Join(r.Snapshot, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", strings.Join(r.Snapshot, ",")) + } params = make(map[string]string) @@ -169,6 +191,9 @@ func (r SnapshotGetRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -196,8 +221,17 @@ func (r SnapshotGetRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.get") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.get") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.get_repository.go b/esapi/api.snapshot.get_repository.go index 25d34c0ad1..b96e24fe30 100644 --- a/esapi/api.snapshot.get_repository.go +++ b/esapi/api.snapshot.get_repository.go @@ -33,6 +33,11 @@ func newSnapshotGetRepositoryFunc(t Transport) SnapshotGetRepository { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SnapshotGetRepositoryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotGetRepositoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotGetRepositoryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.get_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_snapshot") + 1 + len(strings.Join(r.Repository, ","))) @@ -78,6 +94,9 @@ func (r SnapshotGetRepositoryRequest) Do(ctx context.Context, transport Transpor if len(r.Repository) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Repository, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", strings.Join(r.Repository, ",")) + } } params = make(map[string]string) @@ -108,6 +127,9 @@ func (r SnapshotGetRepositoryRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,17 @@ func (r SnapshotGetRepositoryRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.get_repository") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.get_repository") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.repository_analyze.go b/esapi/api.snapshot.repository_analyze.go index 185f7bd901..6b4d84867f 100644 --- a/esapi/api.snapshot.repository_analyze.go +++ b/esapi/api.snapshot.repository_analyze.go @@ -33,6 +33,11 @@ func newSnapshotRepositoryAnalyzeFunc(t Transport) SnapshotRepositoryAnalyze { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -68,16 +73,27 @@ type SnapshotRepositoryAnalyzeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotRepositoryAnalyzeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotRepositoryAnalyzeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.repository_analyze") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len("_analyze")) @@ -86,6 +102,9 @@ func (r SnapshotRepositoryAnalyzeRequest) Do(ctx context.Context, transport Tran path.WriteString("_snapshot") path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } path.WriteString("/") path.WriteString("_analyze") @@ -153,6 +172,9 @@ func (r SnapshotRepositoryAnalyzeRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,8 +202,17 @@ func (r SnapshotRepositoryAnalyzeRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.repository_analyze") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.repository_analyze") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.restore.go b/esapi/api.snapshot.restore.go index 199fd76757..650840ec0f 100644 --- a/esapi/api.snapshot.restore.go +++ b/esapi/api.snapshot.restore.go @@ -34,6 +34,11 @@ func newSnapshotRestoreFunc(t Transport) SnapshotRestore { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type SnapshotRestoreRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotRestoreRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotRestoreRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.restore") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(r.Snapshot) + 1 + len("_restore")) @@ -81,8 +97,14 @@ func (r SnapshotRestoreRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("_snapshot") path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } path.WriteString("/") path.WriteString(r.Snapshot) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.Snapshot) + } path.WriteString("/") path.WriteString("_restore") @@ -114,6 +136,9 @@ func (r SnapshotRestoreRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -145,8 +170,20 @@ func (r SnapshotRestoreRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.restore") + if reader := instrument.RecordRequestBody(ctx, "snapshot.restore", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.restore") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.status.go b/esapi/api.snapshot.status.go index 5c15c83ed1..37f452f048 100644 --- a/esapi/api.snapshot.status.go +++ b/esapi/api.snapshot.status.go @@ -33,6 +33,11 @@ func newSnapshotStatusFunc(t Transport) SnapshotStatus { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type SnapshotStatusRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotStatusRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(strings.Join(r.Snapshot, ",")) + 1 + len("_status")) @@ -79,10 +95,16 @@ func (r SnapshotStatusRequest) Do(ctx context.Context, transport Transport) (*Re if r.Repository != "" { path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } } if len(r.Snapshot) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Snapshot, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", strings.Join(r.Snapshot, ",")) + } } path.WriteString("/") path.WriteString("_status") @@ -115,6 +137,9 @@ func (r SnapshotStatusRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -142,8 +167,17 @@ func (r SnapshotStatusRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.status") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.status") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.snapshot.verify_repository.go b/esapi/api.snapshot.verify_repository.go index 809098f05d..036d6342c4 100644 --- a/esapi/api.snapshot.verify_repository.go +++ b/esapi/api.snapshot.verify_repository.go @@ -32,6 +32,11 @@ func newSnapshotVerifyRepositoryFunc(t Transport) SnapshotVerifyRepository { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type SnapshotVerifyRepositoryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SnapshotVerifyRepositoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SnapshotVerifyRepositoryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.verify_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len("_verify")) @@ -76,6 +92,9 @@ func (r SnapshotVerifyRepositoryRequest) Do(ctx context.Context, transport Trans path.WriteString("_snapshot") path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } path.WriteString("/") path.WriteString("_verify") @@ -107,6 +126,9 @@ func (r SnapshotVerifyRepositoryRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +156,17 @@ func (r SnapshotVerifyRepositoryRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.verify_repository") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.verify_repository") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.synonyms.delete_synonym.go b/esapi/api.synonyms.delete_synonym.go index 599cfa3cc2..da700a7292 100644 --- a/esapi/api.synonyms.delete_synonym.go +++ b/esapi/api.synonyms.delete_synonym.go @@ -31,6 +31,11 @@ func newSynonymsDeleteSynonymFunc(t Transport) SynonymsDeleteSynonym { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SynonymsDeleteSynonymRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SynonymsDeleteSynonymRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SynonymsDeleteSynonymRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.delete_synonym") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_synonyms") + 1 + len(r.DocumentID)) @@ -74,6 +90,9 @@ func (r SynonymsDeleteSynonymRequest) Do(ctx context.Context, transport Transpor path.WriteString("_synonyms") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r SynonymsDeleteSynonymRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r SynonymsDeleteSynonymRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.delete_synonym") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.delete_synonym") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.synonyms.delete_synonym_rule.go b/esapi/api.synonyms.delete_synonym_rule.go index 8637d4a1d3..cd11870f0c 100644 --- a/esapi/api.synonyms.delete_synonym_rule.go +++ b/esapi/api.synonyms.delete_synonym_rule.go @@ -31,6 +31,11 @@ func newSynonymsDeleteSynonymRuleFunc(t Transport) SynonymsDeleteSynonymRule { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SynonymsDeleteSynonymRuleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SynonymsDeleteSynonymRuleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SynonymsDeleteSynonymRuleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.delete_synonym_rule") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_synonyms") + 1 + len(r.SetID) + 1 + len(r.RuleID)) @@ -75,8 +91,14 @@ func (r SynonymsDeleteSynonymRuleRequest) Do(ctx context.Context, transport Tran path.WriteString("_synonyms") path.WriteString("/") path.WriteString(r.SetID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "set_id", r.SetID) + } path.WriteString("/") path.WriteString(r.RuleID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "rule_id", r.RuleID) + } params = make(map[string]string) @@ -98,6 +120,9 @@ func (r SynonymsDeleteSynonymRuleRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -125,8 +150,17 @@ func (r SynonymsDeleteSynonymRuleRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.delete_synonym_rule") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.delete_synonym_rule") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.synonyms.get_synonym.go b/esapi/api.synonyms.get_synonym.go index d171a86d29..5b405a33df 100644 --- a/esapi/api.synonyms.get_synonym.go +++ b/esapi/api.synonyms.get_synonym.go @@ -32,6 +32,11 @@ func newSynonymsGetSynonymFunc(t Transport) SynonymsGetSynonym { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type SynonymsGetSynonymRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SynonymsGetSynonymRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SynonymsGetSynonymRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.get_synonym") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_synonyms") + 1 + len(r.DocumentID)) @@ -78,6 +94,9 @@ func (r SynonymsGetSynonymRequest) Do(ctx context.Context, transport Transport) path.WriteString("_synonyms") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -107,6 +126,9 @@ func (r SynonymsGetSynonymRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +156,17 @@ func (r SynonymsGetSynonymRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.get_synonym") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.get_synonym") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.synonyms.get_synonym_rule.go b/esapi/api.synonyms.get_synonym_rule.go index 52c4e54a1e..d54fb8dcc0 100644 --- a/esapi/api.synonyms.get_synonym_rule.go +++ b/esapi/api.synonyms.get_synonym_rule.go @@ -31,6 +31,11 @@ func newSynonymsGetSynonymRuleFunc(t Transport) SynonymsGetSynonymRule { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SynonymsGetSynonymRuleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SynonymsGetSynonymRuleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SynonymsGetSynonymRuleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.get_synonym_rule") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_synonyms") + 1 + len(r.SetID) + 1 + len(r.RuleID)) @@ -75,8 +91,14 @@ func (r SynonymsGetSynonymRuleRequest) Do(ctx context.Context, transport Transpo path.WriteString("_synonyms") path.WriteString("/") path.WriteString(r.SetID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "set_id", r.SetID) + } path.WriteString("/") path.WriteString(r.RuleID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "rule_id", r.RuleID) + } params = make(map[string]string) @@ -98,6 +120,9 @@ func (r SynonymsGetSynonymRuleRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -125,8 +150,17 @@ func (r SynonymsGetSynonymRuleRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.get_synonym_rule") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.get_synonym_rule") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.synonyms.get_synonyms_sets.go b/esapi/api.synonyms.get_synonyms_sets.go index fe49e8e834..fd9828e5f1 100644 --- a/esapi/api.synonyms.get_synonyms_sets.go +++ b/esapi/api.synonyms.get_synonyms_sets.go @@ -32,6 +32,11 @@ func newSynonymsGetSynonymsSetsFunc(t Transport) SynonymsGetSynonymsSets { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type SynonymsGetSynonymsSetsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SynonymsGetSynonymsSetsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SynonymsGetSynonymsSetsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.get_synonyms_sets") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_synonyms")) @@ -102,6 +118,9 @@ func (r SynonymsGetSynonymsSetsRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +148,17 @@ func (r SynonymsGetSynonymsSetsRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.get_synonyms_sets") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.get_synonyms_sets") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.synonyms.put_synonym.go b/esapi/api.synonyms.put_synonym.go index 206d4e3eeb..d0274042b4 100644 --- a/esapi/api.synonyms.put_synonym.go +++ b/esapi/api.synonyms.put_synonym.go @@ -32,6 +32,11 @@ func newSynonymsPutSynonymFunc(t Transport) SynonymsPutSynonym { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SynonymsPutSynonymRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SynonymsPutSynonymRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SynonymsPutSynonymRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.put_synonym") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_synonyms") + 1 + len(r.DocumentID)) @@ -77,6 +93,9 @@ func (r SynonymsPutSynonymRequest) Do(ctx context.Context, transport Transport) path.WriteString("_synonyms") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r SynonymsPutSynonymRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r SynonymsPutSynonymRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.put_synonym") + if reader := instrument.RecordRequestBody(ctx, "synonyms.put_synonym", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.put_synonym") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.synonyms.put_synonym_rule.go b/esapi/api.synonyms.put_synonym_rule.go index dad0ff0ba6..787ea534da 100644 --- a/esapi/api.synonyms.put_synonym_rule.go +++ b/esapi/api.synonyms.put_synonym_rule.go @@ -32,6 +32,11 @@ func newSynonymsPutSynonymRuleFunc(t Transport) SynonymsPutSynonymRule { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type SynonymsPutSynonymRuleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SynonymsPutSynonymRuleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SynonymsPutSynonymRuleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.put_synonym_rule") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_synonyms") + 1 + len(r.SetID) + 1 + len(r.RuleID)) @@ -78,8 +94,14 @@ func (r SynonymsPutSynonymRuleRequest) Do(ctx context.Context, transport Transpo path.WriteString("_synonyms") path.WriteString("/") path.WriteString(r.SetID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "set_id", r.SetID) + } path.WriteString("/") path.WriteString(r.RuleID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "rule_id", r.RuleID) + } params = make(map[string]string) @@ -101,6 +123,9 @@ func (r SynonymsPutSynonymRuleRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -132,8 +157,20 @@ func (r SynonymsPutSynonymRuleRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.put_synonym_rule") + if reader := instrument.RecordRequestBody(ctx, "synonyms.put_synonym_rule", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.put_synonym_rule") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.tasks.cancel.go b/esapi/api.tasks.cancel.go index 5b600ad1da..1f5db90a1a 100644 --- a/esapi/api.tasks.cancel.go +++ b/esapi/api.tasks.cancel.go @@ -32,6 +32,11 @@ func newTasksCancelFunc(t Transport) TasksCancel { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type TasksCancelRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TasksCancelRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TasksCancelRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "tasks.cancel") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_tasks") + 1 + len(r.TaskID) + 1 + len("_cancel")) @@ -81,6 +97,9 @@ func (r TasksCancelRequest) Do(ctx context.Context, transport Transport) (*Respo if r.TaskID != "" { path.WriteString("/") path.WriteString(r.TaskID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "task_id", r.TaskID) + } } path.WriteString("/") path.WriteString("_cancel") @@ -121,6 +140,9 @@ func (r TasksCancelRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -148,8 +170,17 @@ func (r TasksCancelRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "tasks.cancel") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "tasks.cancel") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.tasks.get.go b/esapi/api.tasks.get.go index d8ac4fe722..06db008b49 100644 --- a/esapi/api.tasks.get.go +++ b/esapi/api.tasks.get.go @@ -33,6 +33,11 @@ func newTasksGetFunc(t Transport) TasksGet { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type TasksGetRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TasksGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TasksGetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "tasks.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_tasks") + 1 + len(r.TaskID)) @@ -79,6 +95,9 @@ func (r TasksGetRequest) Do(ctx context.Context, transport Transport) (*Response path.WriteString("_tasks") path.WriteString("/") path.WriteString(r.TaskID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "task_id", r.TaskID) + } params = make(map[string]string) @@ -108,6 +127,9 @@ func (r TasksGetRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,17 @@ func (r TasksGetRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "tasks.get") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "tasks.get") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.tasks.list.go b/esapi/api.tasks.list.go index 40cf5652f3..c2a8e6ce17 100644 --- a/esapi/api.tasks.list.go +++ b/esapi/api.tasks.list.go @@ -33,6 +33,11 @@ func newTasksListFunc(t Transport) TasksList { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type TasksListRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TasksListRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TasksListRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "tasks.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_tasks")) @@ -128,6 +144,9 @@ func (r TasksListRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -155,8 +174,17 @@ func (r TasksListRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "tasks.list") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "tasks.list") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.terms_enum.go b/esapi/api.terms_enum.go index 0cebe34d82..2592a24d35 100644 --- a/esapi/api.terms_enum.go +++ b/esapi/api.terms_enum.go @@ -33,6 +33,11 @@ func newTermsEnumFunc(t Transport) TermsEnum { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type TermsEnumRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TermsEnumRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TermsEnumRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "terms_enum") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -78,6 +94,9 @@ func (r TermsEnumRequest) Do(ctx context.Context, transport Transport) (*Respons path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_terms_enum") @@ -101,6 +120,9 @@ func (r TermsEnumRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -132,8 +154,20 @@ func (r TermsEnumRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "terms_enum") + if reader := instrument.RecordRequestBody(ctx, "terms_enum", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "terms_enum") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.termvectors.go b/esapi/api.termvectors.go index 3ca0e4f15a..4661d937a8 100644 --- a/esapi/api.termvectors.go +++ b/esapi/api.termvectors.go @@ -33,6 +33,11 @@ func newTermvectorsFunc(t Transport) Termvectors { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -71,27 +76,44 @@ type TermvectorsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TermvectorsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TermvectorsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "termvectors") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_termvectors") + 1 + len(r.DocumentID)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_termvectors") if r.DocumentID != "" { path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } } params = make(map[string]string) @@ -158,6 +180,9 @@ func (r TermvectorsRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,8 +214,20 @@ func (r TermvectorsRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "termvectors") + if reader := instrument.RecordRequestBody(ctx, "termvectors", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "termvectors") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.update.go b/esapi/api.update.go index 912af57706..154ec58d6c 100644 --- a/esapi/api.update.go +++ b/esapi/api.update.go @@ -34,6 +34,11 @@ func newUpdateFunc(t Transport) Update { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -73,26 +78,43 @@ type UpdateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r UpdateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r UpdateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "update") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_update") + 1 + len(r.DocumentID)) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_update") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -162,6 +184,9 @@ func (r UpdateRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -193,8 +218,20 @@ func (r UpdateRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "update") + if reader := instrument.RecordRequestBody(ctx, "update", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "update") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.update_by_query.go b/esapi/api.update_by_query.go index 89e30c6415..21fda91eed 100644 --- a/esapi/api.update_by_query.go +++ b/esapi/api.update_by_query.go @@ -36,6 +36,11 @@ func newUpdateByQueryFunc(t Transport) UpdateByQuery { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -94,16 +99,27 @@ type UpdateByQueryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r UpdateByQueryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r UpdateByQueryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "update_by_query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -114,6 +130,9 @@ func (r UpdateByQueryRequest) Do(ctx context.Context, transport Transport) (*Res path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_update_by_query") @@ -261,6 +280,9 @@ func (r UpdateByQueryRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -292,8 +314,20 @@ func (r UpdateByQueryRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "update_by_query") + if reader := instrument.RecordRequestBody(ctx, "update_by_query", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "update_by_query") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.update_by_query_rethrottle.go b/esapi/api.update_by_query_rethrottle.go index acc62f0aac..a117997c11 100644 --- a/esapi/api.update_by_query_rethrottle.go +++ b/esapi/api.update_by_query_rethrottle.go @@ -32,6 +32,11 @@ func newUpdateByQueryRethrottleFunc(t Transport) UpdateByQueryRethrottle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type UpdateByQueryRethrottleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r UpdateByQueryRethrottleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r UpdateByQueryRethrottleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "update_by_query_rethrottle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_update_by_query") + 1 + len(r.TaskID) + 1 + len("_rethrottle")) @@ -75,6 +91,9 @@ func (r UpdateByQueryRethrottleRequest) Do(ctx context.Context, transport Transp path.WriteString("_update_by_query") path.WriteString("/") path.WriteString(r.TaskID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "task_id", r.TaskID) + } path.WriteString("/") path.WriteString("_rethrottle") @@ -102,6 +121,9 @@ func (r UpdateByQueryRethrottleRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,17 @@ func (r UpdateByQueryRethrottleRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "update_by_query_rethrottle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "update_by_query_rethrottle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.async_search.delete.go b/esapi/api.xpack.async_search.delete.go index 5ce29f3ce4..c383fb1fde 100644 --- a/esapi/api.xpack.async_search.delete.go +++ b/esapi/api.xpack.async_search.delete.go @@ -31,6 +31,11 @@ func newAsyncSearchDeleteFunc(t Transport) AsyncSearchDelete { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type AsyncSearchDeleteRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r AsyncSearchDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r AsyncSearchDeleteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_async_search") + 1 + len(r.DocumentID)) @@ -72,6 +88,9 @@ func (r AsyncSearchDeleteRequest) Do(ctx context.Context, transport Transport) ( path.WriteString("_async_search") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -93,6 +112,9 @@ func (r AsyncSearchDeleteRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -120,8 +142,17 @@ func (r AsyncSearchDeleteRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "async_search.delete") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "async_search.delete") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.async_search.get.go b/esapi/api.xpack.async_search.get.go index 524a5ec3dd..667c3599b8 100644 --- a/esapi/api.xpack.async_search.get.go +++ b/esapi/api.xpack.async_search.get.go @@ -33,6 +33,11 @@ func newAsyncSearchGetFunc(t Transport) AsyncSearchGet { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type AsyncSearchGetRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r AsyncSearchGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r AsyncSearchGetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_async_search") + 1 + len(r.DocumentID)) @@ -78,6 +94,9 @@ func (r AsyncSearchGetRequest) Do(ctx context.Context, transport Transport) (*Re path.WriteString("_async_search") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -111,6 +130,9 @@ func (r AsyncSearchGetRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +160,17 @@ func (r AsyncSearchGetRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "async_search.get") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "async_search.get") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.async_search.status.go b/esapi/api.xpack.async_search.status.go index 4b9fce849d..81bbcd4671 100644 --- a/esapi/api.xpack.async_search.status.go +++ b/esapi/api.xpack.async_search.status.go @@ -31,6 +31,11 @@ func newAsyncSearchStatusFunc(t Transport) AsyncSearchStatus { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type AsyncSearchStatusRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r AsyncSearchStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r AsyncSearchStatusRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_async_search") + 1 + len("status") + 1 + len(r.DocumentID)) @@ -74,6 +90,9 @@ func (r AsyncSearchStatusRequest) Do(ctx context.Context, transport Transport) ( path.WriteString("status") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r AsyncSearchStatusRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r AsyncSearchStatusRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "async_search.status") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "async_search.status") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.async_search.submit.go b/esapi/api.xpack.async_search.submit.go index 72d44d1a32..e0d157599e 100644 --- a/esapi/api.xpack.async_search.submit.go +++ b/esapi/api.xpack.async_search.submit.go @@ -35,6 +35,11 @@ func newAsyncSearchSubmitFunc(t Transport) AsyncSearchSubmit { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -102,16 +107,27 @@ type AsyncSearchSubmitRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r AsyncSearchSubmitRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r AsyncSearchSubmitRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.submit") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_async_search")) @@ -119,6 +135,9 @@ func (r AsyncSearchSubmitRequest) Do(ctx context.Context, transport Transport) ( if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_async_search") @@ -307,6 +326,9 @@ func (r AsyncSearchSubmitRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -338,8 +360,20 @@ func (r AsyncSearchSubmitRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "async_search.submit") + if reader := instrument.RecordRequestBody(ctx, "async_search.submit", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "async_search.submit") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.autoscaling.delete_autoscaling_policy.go b/esapi/api.xpack.autoscaling.delete_autoscaling_policy.go index 3a3a3af0f3..e42a81cd24 100644 --- a/esapi/api.xpack.autoscaling.delete_autoscaling_policy.go +++ b/esapi/api.xpack.autoscaling.delete_autoscaling_policy.go @@ -31,6 +31,11 @@ func newAutoscalingDeleteAutoscalingPolicyFunc(t Transport) AutoscalingDeleteAut for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type AutoscalingDeleteAutoscalingPolicyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r AutoscalingDeleteAutoscalingPolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r AutoscalingDeleteAutoscalingPolicyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.delete_autoscaling_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_autoscaling") + 1 + len("policy") + 1 + len(r.Name)) @@ -74,6 +90,9 @@ func (r AutoscalingDeleteAutoscalingPolicyRequest) Do(ctx context.Context, trans path.WriteString("policy") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r AutoscalingDeleteAutoscalingPolicyRequest) Do(ctx context.Context, trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r AutoscalingDeleteAutoscalingPolicyRequest) Do(ctx context.Context, trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "autoscaling.delete_autoscaling_policy") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "autoscaling.delete_autoscaling_policy") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.autoscaling.get_autoscaling_capacity.go b/esapi/api.xpack.autoscaling.get_autoscaling_capacity.go index 880bcb7a29..ce59f21c7c 100644 --- a/esapi/api.xpack.autoscaling.get_autoscaling_capacity.go +++ b/esapi/api.xpack.autoscaling.get_autoscaling_capacity.go @@ -31,6 +31,11 @@ func newAutoscalingGetAutoscalingCapacityFunc(t Transport) AutoscalingGetAutosca for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type AutoscalingGetAutoscalingCapacityRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r AutoscalingGetAutoscalingCapacityRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r AutoscalingGetAutoscalingCapacityRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.get_autoscaling_capacity") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_autoscaling/capacity")) @@ -88,6 +104,9 @@ func (r AutoscalingGetAutoscalingCapacityRequest) Do(ctx context.Context, transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r AutoscalingGetAutoscalingCapacityRequest) Do(ctx context.Context, transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "autoscaling.get_autoscaling_capacity") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "autoscaling.get_autoscaling_capacity") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.autoscaling.get_autoscaling_policy.go b/esapi/api.xpack.autoscaling.get_autoscaling_policy.go index 203839e94e..2f37533483 100644 --- a/esapi/api.xpack.autoscaling.get_autoscaling_policy.go +++ b/esapi/api.xpack.autoscaling.get_autoscaling_policy.go @@ -31,6 +31,11 @@ func newAutoscalingGetAutoscalingPolicyFunc(t Transport) AutoscalingGetAutoscali for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type AutoscalingGetAutoscalingPolicyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r AutoscalingGetAutoscalingPolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r AutoscalingGetAutoscalingPolicyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.get_autoscaling_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_autoscaling") + 1 + len("policy") + 1 + len(r.Name)) @@ -74,6 +90,9 @@ func (r AutoscalingGetAutoscalingPolicyRequest) Do(ctx context.Context, transpor path.WriteString("policy") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r AutoscalingGetAutoscalingPolicyRequest) Do(ctx context.Context, transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r AutoscalingGetAutoscalingPolicyRequest) Do(ctx context.Context, transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "autoscaling.get_autoscaling_policy") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "autoscaling.get_autoscaling_policy") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.autoscaling.put_autoscaling_policy.go b/esapi/api.xpack.autoscaling.put_autoscaling_policy.go index 8a1a2d572d..8848c727fe 100644 --- a/esapi/api.xpack.autoscaling.put_autoscaling_policy.go +++ b/esapi/api.xpack.autoscaling.put_autoscaling_policy.go @@ -32,6 +32,11 @@ func newAutoscalingPutAutoscalingPolicyFunc(t Transport) AutoscalingPutAutoscali for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type AutoscalingPutAutoscalingPolicyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r AutoscalingPutAutoscalingPolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r AutoscalingPutAutoscalingPolicyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.put_autoscaling_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_autoscaling") + 1 + len("policy") + 1 + len(r.Name)) @@ -77,6 +93,9 @@ func (r AutoscalingPutAutoscalingPolicyRequest) Do(ctx context.Context, transpor path.WriteString("policy") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r AutoscalingPutAutoscalingPolicyRequest) Do(ctx context.Context, transpor req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r AutoscalingPutAutoscalingPolicyRequest) Do(ctx context.Context, transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "autoscaling.put_autoscaling_policy") + if reader := instrument.RecordRequestBody(ctx, "autoscaling.put_autoscaling_policy", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "autoscaling.put_autoscaling_policy") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.cat.ml_data_frame_analytics.go b/esapi/api.xpack.cat.ml_data_frame_analytics.go index b6f4761190..59b1c3f2ef 100644 --- a/esapi/api.xpack.cat.ml_data_frame_analytics.go +++ b/esapi/api.xpack.cat.ml_data_frame_analytics.go @@ -32,6 +32,11 @@ func newCatMLDataFrameAnalyticsFunc(t Transport) CatMLDataFrameAnalytics { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type CatMLDataFrameAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatMLDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatMLDataFrameAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.DocumentID)) @@ -89,6 +105,9 @@ func (r CatMLDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transp if r.DocumentID != "" { path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } } params = make(map[string]string) @@ -143,6 +162,9 @@ func (r CatMLDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -170,8 +192,17 @@ func (r CatMLDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.ml_data_frame_analytics") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.ml_data_frame_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.cat.ml_datafeeds.go b/esapi/api.xpack.cat.ml_datafeeds.go index 2889bc02c8..23455c8484 100644 --- a/esapi/api.xpack.cat.ml_datafeeds.go +++ b/esapi/api.xpack.cat.ml_datafeeds.go @@ -32,6 +32,11 @@ func newCatMLDatafeedsFunc(t Transport) CatMLDatafeeds { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type CatMLDatafeedsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatMLDatafeedsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatMLDatafeedsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_datafeeds") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID)) @@ -86,6 +102,9 @@ func (r CatMLDatafeedsRequest) Do(ctx context.Context, transport Transport) (*Re if r.DatafeedID != "" { path.WriteString("/") path.WriteString(r.DatafeedID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeed_id", r.DatafeedID) + } } params = make(map[string]string) @@ -136,6 +155,9 @@ func (r CatMLDatafeedsRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -163,8 +185,17 @@ func (r CatMLDatafeedsRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.ml_datafeeds") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.ml_datafeeds") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.cat.ml_jobs.go b/esapi/api.xpack.cat.ml_jobs.go index 29fbae193c..c507506860 100644 --- a/esapi/api.xpack.cat.ml_jobs.go +++ b/esapi/api.xpack.cat.ml_jobs.go @@ -32,6 +32,11 @@ func newCatMLJobsFunc(t Transport) CatMLJobs { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type CatMLJobsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatMLJobsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatMLJobsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_jobs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID)) @@ -87,6 +103,9 @@ func (r CatMLJobsRequest) Do(ctx context.Context, transport Transport) (*Respons if r.JobID != "" { path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } } params = make(map[string]string) @@ -141,6 +160,9 @@ func (r CatMLJobsRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -168,8 +190,17 @@ func (r CatMLJobsRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.ml_jobs") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.ml_jobs") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.cat.ml_trained_models.go b/esapi/api.xpack.cat.ml_trained_models.go index e5a107f90a..f418fc9507 100644 --- a/esapi/api.xpack.cat.ml_trained_models.go +++ b/esapi/api.xpack.cat.ml_trained_models.go @@ -32,6 +32,11 @@ func newCatMLTrainedModelsFunc(t Transport) CatMLTrainedModels { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -66,16 +71,27 @@ type CatMLTrainedModelsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatMLTrainedModelsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatMLTrainedModelsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_trained_models") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("ml") + 1 + len("trained_models") + 1 + len(r.ModelID)) @@ -89,6 +105,9 @@ func (r CatMLTrainedModelsRequest) Do(ctx context.Context, transport Transport) if r.ModelID != "" { path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } } params = make(map[string]string) @@ -151,6 +170,9 @@ func (r CatMLTrainedModelsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,8 +200,17 @@ func (r CatMLTrainedModelsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.ml_trained_models") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.ml_trained_models") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.cat.transforms.go b/esapi/api.xpack.cat.transforms.go index 75b9d6fd97..1421e0a492 100644 --- a/esapi/api.xpack.cat.transforms.go +++ b/esapi/api.xpack.cat.transforms.go @@ -32,6 +32,11 @@ func newCatTransformsFunc(t Transport) CatTransforms { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -65,16 +70,27 @@ type CatTransformsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CatTransformsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CatTransformsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.transforms") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_cat") + 1 + len("transforms") + 1 + len(r.TransformID)) @@ -86,6 +102,9 @@ func (r CatTransformsRequest) Do(ctx context.Context, transport Transport) (*Res if r.TransformID != "" { path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } } params = make(map[string]string) @@ -144,6 +163,9 @@ func (r CatTransformsRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,8 +193,17 @@ func (r CatTransformsRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "cat.transforms") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.transforms") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.delete_auto_follow_pattern.go b/esapi/api.xpack.ccr.delete_auto_follow_pattern.go index 033b2ef951..ad367987ee 100644 --- a/esapi/api.xpack.ccr.delete_auto_follow_pattern.go +++ b/esapi/api.xpack.ccr.delete_auto_follow_pattern.go @@ -31,6 +31,11 @@ func newCCRDeleteAutoFollowPatternFunc(t Transport) CCRDeleteAutoFollowPattern { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type CCRDeleteAutoFollowPatternRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRDeleteAutoFollowPatternRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRDeleteAutoFollowPatternRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.delete_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ccr") + 1 + len("auto_follow") + 1 + len(r.Name)) @@ -74,6 +90,9 @@ func (r CCRDeleteAutoFollowPatternRequest) Do(ctx context.Context, transport Tra path.WriteString("auto_follow") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r CCRDeleteAutoFollowPatternRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r CCRDeleteAutoFollowPatternRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.delete_auto_follow_pattern") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.delete_auto_follow_pattern") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.follow.go b/esapi/api.xpack.ccr.follow.go index e0b616cadd..487b9c1ddd 100644 --- a/esapi/api.xpack.ccr.follow.go +++ b/esapi/api.xpack.ccr.follow.go @@ -32,6 +32,11 @@ func newCCRFollowFunc(t Transport) CCRFollow { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,22 +64,36 @@ type CCRFollowRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRFollowRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRFollowRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.follow") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len(r.Index) + 1 + len("_ccr") + 1 + len("follow")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_ccr") path.WriteString("/") @@ -104,6 +123,9 @@ func (r CCRFollowRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,20 @@ func (r CCRFollowRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.follow") + if reader := instrument.RecordRequestBody(ctx, "ccr.follow", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.follow") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.follow_info.go b/esapi/api.xpack.ccr.follow_info.go index 3c2d71cadd..795525d822 100644 --- a/esapi/api.xpack.ccr.follow_info.go +++ b/esapi/api.xpack.ccr.follow_info.go @@ -32,6 +32,11 @@ func newCCRFollowInfoFunc(t Transport) CCRFollowInfo { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type CCRFollowInfoRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRFollowInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRFollowInfoRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.follow_info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" if len(r.Index) == 0 { @@ -75,6 +91,9 @@ func (r CCRFollowInfoRequest) Do(ctx context.Context, transport Transport) (*Res path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_ccr") path.WriteString("/") @@ -100,6 +119,9 @@ func (r CCRFollowInfoRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +149,17 @@ func (r CCRFollowInfoRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.follow_info") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.follow_info") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.follow_stats.go b/esapi/api.xpack.ccr.follow_stats.go index c095584754..420c0d41c2 100644 --- a/esapi/api.xpack.ccr.follow_stats.go +++ b/esapi/api.xpack.ccr.follow_stats.go @@ -32,6 +32,11 @@ func newCCRFollowStatsFunc(t Transport) CCRFollowStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type CCRFollowStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRFollowStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRFollowStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.follow_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" if len(r.Index) == 0 { @@ -75,6 +91,9 @@ func (r CCRFollowStatsRequest) Do(ctx context.Context, transport Transport) (*Re path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_ccr") path.WriteString("/") @@ -100,6 +119,9 @@ func (r CCRFollowStatsRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +149,17 @@ func (r CCRFollowStatsRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.follow_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.follow_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.forget_follower.go b/esapi/api.xpack.ccr.forget_follower.go index 5d854e483f..91024de73b 100644 --- a/esapi/api.xpack.ccr.forget_follower.go +++ b/esapi/api.xpack.ccr.forget_follower.go @@ -32,6 +32,11 @@ func newCCRForgetFollowerFunc(t Transport) CCRForgetFollower { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,22 +62,36 @@ type CCRForgetFollowerRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRForgetFollowerRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRForgetFollowerRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.forget_follower") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_ccr") + 1 + len("forget_follower")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_ccr") path.WriteString("/") @@ -98,6 +117,9 @@ func (r CCRForgetFollowerRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r CCRForgetFollowerRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.forget_follower") + if reader := instrument.RecordRequestBody(ctx, "ccr.forget_follower", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.forget_follower") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.get_auto_follow_pattern.go b/esapi/api.xpack.ccr.get_auto_follow_pattern.go index c02288b39c..8922a37b4f 100644 --- a/esapi/api.xpack.ccr.get_auto_follow_pattern.go +++ b/esapi/api.xpack.ccr.get_auto_follow_pattern.go @@ -31,6 +31,11 @@ func newCCRGetAutoFollowPatternFunc(t Transport) CCRGetAutoFollowPattern { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type CCRGetAutoFollowPatternRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRGetAutoFollowPatternRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRGetAutoFollowPatternRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.get_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ccr") + 1 + len("auto_follow") + 1 + len(r.Name)) @@ -75,6 +91,9 @@ func (r CCRGetAutoFollowPatternRequest) Do(ctx context.Context, transport Transp if r.Name != "" { path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r CCRGetAutoFollowPatternRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r CCRGetAutoFollowPatternRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.get_auto_follow_pattern") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.get_auto_follow_pattern") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.pause_auto_follow_pattern.go b/esapi/api.xpack.ccr.pause_auto_follow_pattern.go index c122edec2b..7722767073 100644 --- a/esapi/api.xpack.ccr.pause_auto_follow_pattern.go +++ b/esapi/api.xpack.ccr.pause_auto_follow_pattern.go @@ -31,6 +31,11 @@ func newCCRPauseAutoFollowPatternFunc(t Transport) CCRPauseAutoFollowPattern { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type CCRPauseAutoFollowPatternRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRPauseAutoFollowPatternRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRPauseAutoFollowPatternRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.pause_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ccr") + 1 + len("auto_follow") + 1 + len(r.Name) + 1 + len("pause")) @@ -74,6 +90,9 @@ func (r CCRPauseAutoFollowPatternRequest) Do(ctx context.Context, transport Tran path.WriteString("auto_follow") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } path.WriteString("/") path.WriteString("pause") @@ -97,6 +116,9 @@ func (r CCRPauseAutoFollowPatternRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r CCRPauseAutoFollowPatternRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.pause_auto_follow_pattern") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.pause_auto_follow_pattern") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.pause_follow.go b/esapi/api.xpack.ccr.pause_follow.go index 9ae6a14ac6..a44e9fccbc 100644 --- a/esapi/api.xpack.ccr.pause_follow.go +++ b/esapi/api.xpack.ccr.pause_follow.go @@ -31,6 +31,11 @@ func newCCRPauseFollowFunc(t Transport) CCRPauseFollow { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,22 +59,36 @@ type CCRPauseFollowRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRPauseFollowRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRPauseFollowRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.pause_follow") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_ccr") + 1 + len("pause_follow")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_ccr") path.WriteString("/") @@ -95,6 +114,9 @@ func (r CCRPauseFollowRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r CCRPauseFollowRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.pause_follow") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.pause_follow") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.put_auto_follow_pattern.go b/esapi/api.xpack.ccr.put_auto_follow_pattern.go index f8a9bfb209..47d85c6c28 100644 --- a/esapi/api.xpack.ccr.put_auto_follow_pattern.go +++ b/esapi/api.xpack.ccr.put_auto_follow_pattern.go @@ -32,6 +32,11 @@ func newCCRPutAutoFollowPatternFunc(t Transport) CCRPutAutoFollowPattern { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type CCRPutAutoFollowPatternRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRPutAutoFollowPatternRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRPutAutoFollowPatternRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.put_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ccr") + 1 + len("auto_follow") + 1 + len(r.Name)) @@ -77,6 +93,9 @@ func (r CCRPutAutoFollowPatternRequest) Do(ctx context.Context, transport Transp path.WriteString("auto_follow") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r CCRPutAutoFollowPatternRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r CCRPutAutoFollowPatternRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.put_auto_follow_pattern") + if reader := instrument.RecordRequestBody(ctx, "ccr.put_auto_follow_pattern", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.put_auto_follow_pattern") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.resume_auto_follow_pattern.go b/esapi/api.xpack.ccr.resume_auto_follow_pattern.go index 217a7c6a9b..17f4fd0fc2 100644 --- a/esapi/api.xpack.ccr.resume_auto_follow_pattern.go +++ b/esapi/api.xpack.ccr.resume_auto_follow_pattern.go @@ -31,6 +31,11 @@ func newCCRResumeAutoFollowPatternFunc(t Transport) CCRResumeAutoFollowPattern { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type CCRResumeAutoFollowPatternRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRResumeAutoFollowPatternRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRResumeAutoFollowPatternRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.resume_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ccr") + 1 + len("auto_follow") + 1 + len(r.Name) + 1 + len("resume")) @@ -74,6 +90,9 @@ func (r CCRResumeAutoFollowPatternRequest) Do(ctx context.Context, transport Tra path.WriteString("auto_follow") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } path.WriteString("/") path.WriteString("resume") @@ -97,6 +116,9 @@ func (r CCRResumeAutoFollowPatternRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r CCRResumeAutoFollowPatternRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.resume_auto_follow_pattern") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.resume_auto_follow_pattern") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.resume_follow.go b/esapi/api.xpack.ccr.resume_follow.go index 2a6a1cca29..7c654961df 100644 --- a/esapi/api.xpack.ccr.resume_follow.go +++ b/esapi/api.xpack.ccr.resume_follow.go @@ -32,6 +32,11 @@ func newCCRResumeFollowFunc(t Transport) CCRResumeFollow { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,22 +62,36 @@ type CCRResumeFollowRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRResumeFollowRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRResumeFollowRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.resume_follow") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_ccr") + 1 + len("resume_follow")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_ccr") path.WriteString("/") @@ -98,6 +117,9 @@ func (r CCRResumeFollowRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r CCRResumeFollowRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.resume_follow") + if reader := instrument.RecordRequestBody(ctx, "ccr.resume_follow", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.resume_follow") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.stats.go b/esapi/api.xpack.ccr.stats.go index a4e9bf045a..701e8ecd74 100644 --- a/esapi/api.xpack.ccr.stats.go +++ b/esapi/api.xpack.ccr.stats.go @@ -31,6 +31,11 @@ func newCCRStatsFunc(t Transport) CCRStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type CCRStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_ccr/stats")) @@ -88,6 +104,9 @@ func (r CCRStatsRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r CCRStatsRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ccr.unfollow.go b/esapi/api.xpack.ccr.unfollow.go index 76c9eb2bf1..fc1ec6dff2 100644 --- a/esapi/api.xpack.ccr.unfollow.go +++ b/esapi/api.xpack.ccr.unfollow.go @@ -31,6 +31,11 @@ func newCCRUnfollowFunc(t Transport) CCRUnfollow { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,22 +59,36 @@ type CCRUnfollowRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r CCRUnfollowRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r CCRUnfollowRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.unfollow") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_ccr") + 1 + len("unfollow")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_ccr") path.WriteString("/") @@ -95,6 +114,9 @@ func (r CCRUnfollowRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r CCRUnfollowRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.unfollow") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.unfollow") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.close_point_in_time.go b/esapi/api.xpack.close_point_in_time.go index c22ccbe983..00503ce032 100644 --- a/esapi/api.xpack.close_point_in_time.go +++ b/esapi/api.xpack.close_point_in_time.go @@ -32,6 +32,11 @@ func newClosePointInTimeFunc(t Transport) ClosePointInTime { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type ClosePointInTimeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ClosePointInTimeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ClosePointInTimeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "close_point_in_time") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + len("/_pit")) @@ -91,6 +107,9 @@ func (r ClosePointInTimeRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r ClosePointInTimeRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "close_point_in_time") + if reader := instrument.RecordRequestBody(ctx, "close_point_in_time", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "close_point_in_time") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.enrich.delete_policy.go b/esapi/api.xpack.enrich.delete_policy.go index fc5ea53d9f..ae661a788d 100644 --- a/esapi/api.xpack.enrich.delete_policy.go +++ b/esapi/api.xpack.enrich.delete_policy.go @@ -31,6 +31,11 @@ func newEnrichDeletePolicyFunc(t Transport) EnrichDeletePolicy { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type EnrichDeletePolicyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r EnrichDeletePolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r EnrichDeletePolicyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.delete_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_enrich") + 1 + len("policy") + 1 + len(r.Name)) @@ -74,6 +90,9 @@ func (r EnrichDeletePolicyRequest) Do(ctx context.Context, transport Transport) path.WriteString("policy") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r EnrichDeletePolicyRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r EnrichDeletePolicyRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "enrich.delete_policy") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "enrich.delete_policy") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.enrich.execute_policy.go b/esapi/api.xpack.enrich.execute_policy.go index 1cb2701c47..e1be21fd1c 100644 --- a/esapi/api.xpack.enrich.execute_policy.go +++ b/esapi/api.xpack.enrich.execute_policy.go @@ -32,6 +32,11 @@ func newEnrichExecutePolicyFunc(t Transport) EnrichExecutePolicy { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type EnrichExecutePolicyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r EnrichExecutePolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r EnrichExecutePolicyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.execute_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_enrich") + 1 + len("policy") + 1 + len(r.Name) + 1 + len("_execute")) @@ -77,6 +93,9 @@ func (r EnrichExecutePolicyRequest) Do(ctx context.Context, transport Transport) path.WriteString("policy") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } path.WriteString("/") path.WriteString("_execute") @@ -104,6 +123,9 @@ func (r EnrichExecutePolicyRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,17 @@ func (r EnrichExecutePolicyRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "enrich.execute_policy") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "enrich.execute_policy") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.enrich.get_policy.go b/esapi/api.xpack.enrich.get_policy.go index 68aeec8692..cfee7ae2b6 100644 --- a/esapi/api.xpack.enrich.get_policy.go +++ b/esapi/api.xpack.enrich.get_policy.go @@ -31,6 +31,11 @@ func newEnrichGetPolicyFunc(t Transport) EnrichGetPolicy { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type EnrichGetPolicyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r EnrichGetPolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r EnrichGetPolicyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.get_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_enrich") + 1 + len("policy") + 1 + len(strings.Join(r.Name, ","))) @@ -75,6 +91,9 @@ func (r EnrichGetPolicyRequest) Do(ctx context.Context, transport Transport) (*R if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r EnrichGetPolicyRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r EnrichGetPolicyRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "enrich.get_policy") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "enrich.get_policy") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.enrich.put_policy.go b/esapi/api.xpack.enrich.put_policy.go index b6ca4aac51..bae375ce37 100644 --- a/esapi/api.xpack.enrich.put_policy.go +++ b/esapi/api.xpack.enrich.put_policy.go @@ -32,6 +32,11 @@ func newEnrichPutPolicyFunc(t Transport) EnrichPutPolicy { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type EnrichPutPolicyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r EnrichPutPolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r EnrichPutPolicyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.put_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_enrich") + 1 + len("policy") + 1 + len(r.Name)) @@ -77,6 +93,9 @@ func (r EnrichPutPolicyRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("policy") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r EnrichPutPolicyRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r EnrichPutPolicyRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "enrich.put_policy") + if reader := instrument.RecordRequestBody(ctx, "enrich.put_policy", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "enrich.put_policy") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.enrich.stats.go b/esapi/api.xpack.enrich.stats.go index 79e98914fb..7184653910 100644 --- a/esapi/api.xpack.enrich.stats.go +++ b/esapi/api.xpack.enrich.stats.go @@ -31,6 +31,11 @@ func newEnrichStatsFunc(t Transport) EnrichStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type EnrichStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r EnrichStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r EnrichStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_enrich/_stats")) @@ -88,6 +104,9 @@ func (r EnrichStatsRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r EnrichStatsRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "enrich.stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "enrich.stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.eql.delete.go b/esapi/api.xpack.eql.delete.go index 645873f5b0..10aaff33a2 100644 --- a/esapi/api.xpack.eql.delete.go +++ b/esapi/api.xpack.eql.delete.go @@ -31,6 +31,11 @@ func newEqlDeleteFunc(t Transport) EqlDelete { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type EqlDeleteRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r EqlDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r EqlDeleteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_eql") + 1 + len("search") + 1 + len(r.DocumentID)) @@ -74,6 +90,9 @@ func (r EqlDeleteRequest) Do(ctx context.Context, transport Transport) (*Respons path.WriteString("search") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r EqlDeleteRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r EqlDeleteRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "eql.delete") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "eql.delete") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.eql.get.go b/esapi/api.xpack.eql.get.go index bb26f37e6d..518aafec83 100644 --- a/esapi/api.xpack.eql.get.go +++ b/esapi/api.xpack.eql.get.go @@ -32,6 +32,11 @@ func newEqlGetFunc(t Transport) EqlGet { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type EqlGetRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r EqlGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r EqlGetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_eql") + 1 + len("search") + 1 + len(r.DocumentID)) @@ -78,6 +94,9 @@ func (r EqlGetRequest) Do(ctx context.Context, transport Transport) (*Response, path.WriteString("search") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -107,6 +126,9 @@ func (r EqlGetRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +156,17 @@ func (r EqlGetRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "eql.get") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "eql.get") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.eql.get_status.go b/esapi/api.xpack.eql.get_status.go index f5af4ae300..f11e6e75c9 100644 --- a/esapi/api.xpack.eql.get_status.go +++ b/esapi/api.xpack.eql.get_status.go @@ -31,6 +31,11 @@ func newEqlGetStatusFunc(t Transport) EqlGetStatus { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type EqlGetStatusRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r EqlGetStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r EqlGetStatusRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.get_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_eql") + 1 + len("search") + 1 + len("status") + 1 + len(r.DocumentID)) @@ -76,6 +92,9 @@ func (r EqlGetStatusRequest) Do(ctx context.Context, transport Transport) (*Resp path.WriteString("status") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r EqlGetStatusRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r EqlGetStatusRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "eql.get_status") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "eql.get_status") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.eql.search.go b/esapi/api.xpack.eql.search.go index 132f91d794..07df8ddc8f 100644 --- a/esapi/api.xpack.eql.search.go +++ b/esapi/api.xpack.eql.search.go @@ -34,6 +34,11 @@ func newEqlSearchFunc(t Transport) EqlSearch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,22 +68,36 @@ type EqlSearchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r EqlSearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r EqlSearchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_eql") + 1 + len("search")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_eql") path.WriteString("/") @@ -116,6 +135,9 @@ func (r EqlSearchRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -147,8 +169,20 @@ func (r EqlSearchRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "eql.search") + if reader := instrument.RecordRequestBody(ctx, "eql.search", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "eql.search") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.esql.query.go b/esapi/api.xpack.esql.query.go index efe440027c..9fc4dfd727 100644 --- a/esapi/api.xpack.esql.query.go +++ b/esapi/api.xpack.esql.query.go @@ -32,6 +32,11 @@ func newEsqlQueryFunc(t Transport) EsqlQuery { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type EsqlQueryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r EsqlQueryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r EsqlQueryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "esql.query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_query")) @@ -104,6 +120,9 @@ func (r EsqlQueryRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +154,20 @@ func (r EsqlQueryRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "esql.query") + if reader := instrument.RecordRequestBody(ctx, "esql.query", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "esql.query") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.graph.explore.go b/esapi/api.xpack.graph.explore.go index e03381ea6c..868fa9fb20 100644 --- a/esapi/api.xpack.graph.explore.go +++ b/esapi/api.xpack.graph.explore.go @@ -34,6 +34,11 @@ func newGraphExploreFunc(t Transport) GraphExplore { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type GraphExploreRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r GraphExploreRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r GraphExploreRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "graph.explore") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -82,6 +98,9 @@ func (r GraphExploreRequest) Do(ctx context.Context, transport Transport) (*Resp path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_graph") path.WriteString("/") @@ -115,6 +134,9 @@ func (r GraphExploreRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -146,8 +168,20 @@ func (r GraphExploreRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "graph.explore") + if reader := instrument.RecordRequestBody(ctx, "graph.explore", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "graph.explore") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.delete_lifecycle.go b/esapi/api.xpack.ilm.delete_lifecycle.go index 31a890c85a..51b1baba62 100644 --- a/esapi/api.xpack.ilm.delete_lifecycle.go +++ b/esapi/api.xpack.ilm.delete_lifecycle.go @@ -31,6 +31,11 @@ func newILMDeleteLifecycleFunc(t Transport) ILMDeleteLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type ILMDeleteLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMDeleteLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMDeleteLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.delete_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ilm") + 1 + len("policy") + 1 + len(r.Policy)) @@ -74,6 +90,9 @@ func (r ILMDeleteLifecycleRequest) Do(ctx context.Context, transport Transport) path.WriteString("policy") path.WriteString("/") path.WriteString(r.Policy) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "policy", r.Policy) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r ILMDeleteLifecycleRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r ILMDeleteLifecycleRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.delete_lifecycle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.delete_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.explain_lifecycle.go b/esapi/api.xpack.ilm.explain_lifecycle.go index f6636c7efe..a4e0d87a27 100644 --- a/esapi/api.xpack.ilm.explain_lifecycle.go +++ b/esapi/api.xpack.ilm.explain_lifecycle.go @@ -32,6 +32,11 @@ func newILMExplainLifecycleFunc(t Transport) ILMExplainLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,22 +63,36 @@ type ILMExplainLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMExplainLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMExplainLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.explain_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(r.Index) + 1 + len("_ilm") + 1 + len("explain")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_ilm") path.WriteString("/") @@ -107,6 +126,9 @@ func (r ILMExplainLifecycleRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +156,17 @@ func (r ILMExplainLifecycleRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.explain_lifecycle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.explain_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.get_lifecycle.go b/esapi/api.xpack.ilm.get_lifecycle.go index 5c8ba86c40..e427fa7d67 100644 --- a/esapi/api.xpack.ilm.get_lifecycle.go +++ b/esapi/api.xpack.ilm.get_lifecycle.go @@ -31,6 +31,11 @@ func newILMGetLifecycleFunc(t Transport) ILMGetLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type ILMGetLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMGetLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMGetLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.get_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ilm") + 1 + len("policy") + 1 + len(r.Policy)) @@ -75,6 +91,9 @@ func (r ILMGetLifecycleRequest) Do(ctx context.Context, transport Transport) (*R if r.Policy != "" { path.WriteString("/") path.WriteString(r.Policy) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "policy", r.Policy) + } } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r ILMGetLifecycleRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r ILMGetLifecycleRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.get_lifecycle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.get_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.get_status.go b/esapi/api.xpack.ilm.get_status.go index 5dec9455cc..92422ead1f 100644 --- a/esapi/api.xpack.ilm.get_status.go +++ b/esapi/api.xpack.ilm.get_status.go @@ -31,6 +31,11 @@ func newILMGetStatusFunc(t Transport) ILMGetStatus { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type ILMGetStatusRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMGetStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMGetStatusRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.get_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_ilm/status")) @@ -88,6 +104,9 @@ func (r ILMGetStatusRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r ILMGetStatusRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.get_status") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.get_status") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.migrate_to_data_tiers.go b/esapi/api.xpack.ilm.migrate_to_data_tiers.go index 2a0bb6bd58..d00ad3c7e4 100644 --- a/esapi/api.xpack.ilm.migrate_to_data_tiers.go +++ b/esapi/api.xpack.ilm.migrate_to_data_tiers.go @@ -33,6 +33,11 @@ func newILMMigrateToDataTiersFunc(t Transport) ILMMigrateToDataTiers { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type ILMMigrateToDataTiersRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMMigrateToDataTiersRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMMigrateToDataTiersRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.migrate_to_data_tiers") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_ilm/migrate_to_data_tiers")) @@ -98,6 +114,9 @@ func (r ILMMigrateToDataTiersRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +148,20 @@ func (r ILMMigrateToDataTiersRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.migrate_to_data_tiers") + if reader := instrument.RecordRequestBody(ctx, "ilm.migrate_to_data_tiers", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.migrate_to_data_tiers") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.move_to_step.go b/esapi/api.xpack.ilm.move_to_step.go index 9fbf9ddcaa..09c1a405fa 100644 --- a/esapi/api.xpack.ilm.move_to_step.go +++ b/esapi/api.xpack.ilm.move_to_step.go @@ -32,6 +32,11 @@ func newILMMoveToStepFunc(t Transport) ILMMoveToStep { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type ILMMoveToStepRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMMoveToStepRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMMoveToStepRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.move_to_step") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ilm") + 1 + len("move") + 1 + len(r.Index)) @@ -77,6 +93,9 @@ func (r ILMMoveToStepRequest) Do(ctx context.Context, transport Transport) (*Res path.WriteString("move") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r ILMMoveToStepRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r ILMMoveToStepRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.move_to_step") + if reader := instrument.RecordRequestBody(ctx, "ilm.move_to_step", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.move_to_step") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.put_lifecycle.go b/esapi/api.xpack.ilm.put_lifecycle.go index e65bc6e261..e5db200fa1 100644 --- a/esapi/api.xpack.ilm.put_lifecycle.go +++ b/esapi/api.xpack.ilm.put_lifecycle.go @@ -32,6 +32,11 @@ func newILMPutLifecycleFunc(t Transport) ILMPutLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type ILMPutLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMPutLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMPutLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.put_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ilm") + 1 + len("policy") + 1 + len(r.Policy)) @@ -77,6 +93,9 @@ func (r ILMPutLifecycleRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("policy") path.WriteString("/") path.WriteString(r.Policy) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "policy", r.Policy) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r ILMPutLifecycleRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r ILMPutLifecycleRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.put_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "ilm.put_lifecycle", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.put_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.remove_policy.go b/esapi/api.xpack.ilm.remove_policy.go index 56f2485f20..1af1d7d388 100644 --- a/esapi/api.xpack.ilm.remove_policy.go +++ b/esapi/api.xpack.ilm.remove_policy.go @@ -31,6 +31,11 @@ func newILMRemovePolicyFunc(t Transport) ILMRemovePolicy { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,22 +59,36 @@ type ILMRemovePolicyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMRemovePolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMRemovePolicyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.remove_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_ilm") + 1 + len("remove")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_ilm") path.WriteString("/") @@ -95,6 +114,9 @@ func (r ILMRemovePolicyRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r ILMRemovePolicyRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.remove_policy") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.remove_policy") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.retry.go b/esapi/api.xpack.ilm.retry.go index 783e9fb8e6..629221e271 100644 --- a/esapi/api.xpack.ilm.retry.go +++ b/esapi/api.xpack.ilm.retry.go @@ -31,6 +31,11 @@ func newILMRetryFunc(t Transport) ILMRetry { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,22 +59,36 @@ type ILMRetryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMRetryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMRetryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.retry") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_ilm") + 1 + len("retry")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_ilm") path.WriteString("/") @@ -95,6 +114,9 @@ func (r ILMRetryRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r ILMRetryRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.retry") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.retry") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.start.go b/esapi/api.xpack.ilm.start.go index b42f2823b3..05dbae2066 100644 --- a/esapi/api.xpack.ilm.start.go +++ b/esapi/api.xpack.ilm.start.go @@ -31,6 +31,11 @@ func newILMStartFunc(t Transport) ILMStart { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type ILMStartRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMStartRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMStartRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.start") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_ilm/start")) @@ -88,6 +104,9 @@ func (r ILMStartRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r ILMStartRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.start") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.start") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ilm.stop.go b/esapi/api.xpack.ilm.stop.go index 862f312c68..37bca4ba4e 100644 --- a/esapi/api.xpack.ilm.stop.go +++ b/esapi/api.xpack.ilm.stop.go @@ -31,6 +31,11 @@ func newILMStopFunc(t Transport) ILMStop { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type ILMStopRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r ILMStopRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ILMStopRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.stop") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_ilm/stop")) @@ -88,6 +104,9 @@ func (r ILMStopRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r ILMStopRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.stop") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.stop") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.indices.create_data_stream.go b/esapi/api.xpack.indices.create_data_stream.go index dd58d3d6b6..719b456a96 100644 --- a/esapi/api.xpack.indices.create_data_stream.go +++ b/esapi/api.xpack.indices.create_data_stream.go @@ -31,6 +31,11 @@ func newIndicesCreateDataStreamFunc(t Transport) IndicesCreateDataStream { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type IndicesCreateDataStreamRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesCreateDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesCreateDataStreamRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.create_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_data_stream") + 1 + len(r.Name)) @@ -72,6 +88,9 @@ func (r IndicesCreateDataStreamRequest) Do(ctx context.Context, transport Transp path.WriteString("_data_stream") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -93,6 +112,9 @@ func (r IndicesCreateDataStreamRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -120,8 +142,17 @@ func (r IndicesCreateDataStreamRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.create_data_stream") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.create_data_stream") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.indices.data_streams_stats.go b/esapi/api.xpack.indices.data_streams_stats.go index 49a471e352..d66be82916 100644 --- a/esapi/api.xpack.indices.data_streams_stats.go +++ b/esapi/api.xpack.indices.data_streams_stats.go @@ -31,6 +31,11 @@ func newIndicesDataStreamsStatsFunc(t Transport) IndicesDataStreamsStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type IndicesDataStreamsStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesDataStreamsStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesDataStreamsStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.data_streams_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_data_stream") + 1 + len(strings.Join(r.Name, ",")) + 1 + len("_stats")) @@ -73,6 +89,9 @@ func (r IndicesDataStreamsStatsRequest) Do(ctx context.Context, transport Transp if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } path.WriteString("/") path.WriteString("_stats") @@ -97,6 +116,9 @@ func (r IndicesDataStreamsStatsRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r IndicesDataStreamsStatsRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.data_streams_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.data_streams_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.indices.delete_data_stream.go b/esapi/api.xpack.indices.delete_data_stream.go index 06ad3bec3f..12f64b4bae 100644 --- a/esapi/api.xpack.indices.delete_data_stream.go +++ b/esapi/api.xpack.indices.delete_data_stream.go @@ -32,6 +32,11 @@ func newIndicesDeleteDataStreamFunc(t Transport) IndicesDeleteDataStream { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type IndicesDeleteDataStreamRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesDeleteDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesDeleteDataStreamRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" if len(r.Name) == 0 { @@ -79,6 +95,9 @@ func (r IndicesDeleteDataStreamRequest) Do(ctx context.Context, transport Transp path.WriteString("_data_stream") path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } params = make(map[string]string) @@ -104,6 +123,9 @@ func (r IndicesDeleteDataStreamRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,17 @@ func (r IndicesDeleteDataStreamRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete_data_stream") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete_data_stream") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.indices.get_data_stream.go b/esapi/api.xpack.indices.get_data_stream.go index 675fb94215..9de2c37088 100644 --- a/esapi/api.xpack.indices.get_data_stream.go +++ b/esapi/api.xpack.indices.get_data_stream.go @@ -32,6 +32,11 @@ func newIndicesGetDataStreamFunc(t Transport) IndicesGetDataStream { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type IndicesGetDataStreamRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesGetDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesGetDataStreamRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_data_stream") + 1 + len(strings.Join(r.Name, ","))) @@ -77,6 +93,9 @@ func (r IndicesGetDataStreamRequest) Do(ctx context.Context, transport Transport if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } params = make(map[string]string) @@ -107,6 +126,9 @@ func (r IndicesGetDataStreamRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +156,17 @@ func (r IndicesGetDataStreamRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_data_stream") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_data_stream") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.indices.migrate_to_data_stream.go b/esapi/api.xpack.indices.migrate_to_data_stream.go index df2173fb4b..c67026cc52 100644 --- a/esapi/api.xpack.indices.migrate_to_data_stream.go +++ b/esapi/api.xpack.indices.migrate_to_data_stream.go @@ -31,6 +31,11 @@ func newIndicesMigrateToDataStreamFunc(t Transport) IndicesMigrateToDataStream { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type IndicesMigrateToDataStreamRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesMigrateToDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesMigrateToDataStreamRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.migrate_to_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_data_stream") + 1 + len("_migrate") + 1 + len(r.Name)) @@ -74,6 +90,9 @@ func (r IndicesMigrateToDataStreamRequest) Do(ctx context.Context, transport Tra path.WriteString("_migrate") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r IndicesMigrateToDataStreamRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r IndicesMigrateToDataStreamRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.migrate_to_data_stream") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.migrate_to_data_stream") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.indices.promote_data_stream.go b/esapi/api.xpack.indices.promote_data_stream.go index e1074296df..b9b7404e15 100644 --- a/esapi/api.xpack.indices.promote_data_stream.go +++ b/esapi/api.xpack.indices.promote_data_stream.go @@ -31,6 +31,11 @@ func newIndicesPromoteDataStreamFunc(t Transport) IndicesPromoteDataStream { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type IndicesPromoteDataStreamRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesPromoteDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesPromoteDataStreamRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.promote_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_data_stream") + 1 + len("_promote") + 1 + len(r.Name)) @@ -74,6 +90,9 @@ func (r IndicesPromoteDataStreamRequest) Do(ctx context.Context, transport Trans path.WriteString("_promote") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r IndicesPromoteDataStreamRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r IndicesPromoteDataStreamRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.promote_data_stream") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.promote_data_stream") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.indices.reload_search_analyzers.go b/esapi/api.xpack.indices.reload_search_analyzers.go index d06d522cac..88b8e223d9 100644 --- a/esapi/api.xpack.indices.reload_search_analyzers.go +++ b/esapi/api.xpack.indices.reload_search_analyzers.go @@ -33,6 +33,11 @@ func newIndicesReloadSearchAnalyzersFunc(t Transport) IndicesReloadSearchAnalyze for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type IndicesReloadSearchAnalyzersRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesReloadSearchAnalyzersRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesReloadSearchAnalyzersRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.reload_search_analyzers") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -81,6 +97,9 @@ func (r IndicesReloadSearchAnalyzersRequest) Do(ctx context.Context, transport T path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_reload_search_analyzers") @@ -120,6 +139,9 @@ func (r IndicesReloadSearchAnalyzersRequest) Do(ctx context.Context, transport T req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -147,8 +169,17 @@ func (r IndicesReloadSearchAnalyzersRequest) Do(ctx context.Context, transport T req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.reload_search_analyzers") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.reload_search_analyzers") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.indices.unfreeze.go b/esapi/api.xpack.indices.unfreeze.go index 1cfefff868..0608671b66 100644 --- a/esapi/api.xpack.indices.unfreeze.go +++ b/esapi/api.xpack.indices.unfreeze.go @@ -33,6 +33,11 @@ func newIndicesUnfreezeFunc(t Transport) IndicesUnfreeze { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,22 +68,36 @@ type IndicesUnfreezeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r IndicesUnfreezeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r IndicesUnfreezeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.unfreeze") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(r.Index) + 1 + len("_unfreeze")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_unfreeze") @@ -126,6 +145,9 @@ func (r IndicesUnfreezeRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -153,8 +175,17 @@ func (r IndicesUnfreezeRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "indices.unfreeze") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.unfreeze") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.license.delete.go b/esapi/api.xpack.license.delete.go index 2a36fd3bdd..75f6d1a0c0 100644 --- a/esapi/api.xpack.license.delete.go +++ b/esapi/api.xpack.license.delete.go @@ -31,6 +31,11 @@ func newLicenseDeleteFunc(t Transport) LicenseDelete { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type LicenseDeleteRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r LicenseDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r LicenseDeleteRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + len("/_license")) @@ -88,6 +104,9 @@ func (r LicenseDeleteRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r LicenseDeleteRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "license.delete") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.delete") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.license.get.go b/esapi/api.xpack.license.get.go index dd226c74b0..1a9a903007 100644 --- a/esapi/api.xpack.license.get.go +++ b/esapi/api.xpack.license.get.go @@ -32,6 +32,11 @@ func newLicenseGetFunc(t Transport) LicenseGet { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type LicenseGetRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r LicenseGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r LicenseGetRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_license")) @@ -100,6 +116,9 @@ func (r LicenseGetRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +146,17 @@ func (r LicenseGetRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "license.get") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.get") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.license.get_basic_status.go b/esapi/api.xpack.license.get_basic_status.go index 2337962ec8..638c5a6d7c 100644 --- a/esapi/api.xpack.license.get_basic_status.go +++ b/esapi/api.xpack.license.get_basic_status.go @@ -31,6 +31,11 @@ func newLicenseGetBasicStatusFunc(t Transport) LicenseGetBasicStatus { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type LicenseGetBasicStatusRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r LicenseGetBasicStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r LicenseGetBasicStatusRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.get_basic_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_license/basic_status")) @@ -88,6 +104,9 @@ func (r LicenseGetBasicStatusRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r LicenseGetBasicStatusRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "license.get_basic_status") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.get_basic_status") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.license.get_trial_status.go b/esapi/api.xpack.license.get_trial_status.go index 28056a652f..9f5d750e2a 100644 --- a/esapi/api.xpack.license.get_trial_status.go +++ b/esapi/api.xpack.license.get_trial_status.go @@ -31,6 +31,11 @@ func newLicenseGetTrialStatusFunc(t Transport) LicenseGetTrialStatus { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type LicenseGetTrialStatusRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r LicenseGetTrialStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r LicenseGetTrialStatusRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.get_trial_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_license/trial_status")) @@ -88,6 +104,9 @@ func (r LicenseGetTrialStatusRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r LicenseGetTrialStatusRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "license.get_trial_status") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.get_trial_status") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.license.post.go b/esapi/api.xpack.license.post.go index 2941960003..95055bf6f4 100644 --- a/esapi/api.xpack.license.post.go +++ b/esapi/api.xpack.license.post.go @@ -33,6 +33,11 @@ func newLicensePostFunc(t Transport) LicensePost { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type LicensePostRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r LicensePostRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r LicensePostRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.post") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + len("/_license")) @@ -98,6 +114,9 @@ func (r LicensePostRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +148,20 @@ func (r LicensePostRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "license.post") + if reader := instrument.RecordRequestBody(ctx, "license.post", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.post") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.license.post_start_basic.go b/esapi/api.xpack.license.post_start_basic.go index b6b9019fa2..7d830a82fe 100644 --- a/esapi/api.xpack.license.post_start_basic.go +++ b/esapi/api.xpack.license.post_start_basic.go @@ -32,6 +32,11 @@ func newLicensePostStartBasicFunc(t Transport) LicensePostStartBasic { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type LicensePostStartBasicRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r LicensePostStartBasicRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r LicensePostStartBasicRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.post_start_basic") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_license/start_basic")) @@ -95,6 +111,9 @@ func (r LicensePostStartBasicRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,17 @@ func (r LicensePostStartBasicRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "license.post_start_basic") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.post_start_basic") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.license.post_start_trial.go b/esapi/api.xpack.license.post_start_trial.go index d65f2b9097..3f2e1fe090 100644 --- a/esapi/api.xpack.license.post_start_trial.go +++ b/esapi/api.xpack.license.post_start_trial.go @@ -32,6 +32,11 @@ func newLicensePostStartTrialFunc(t Transport) LicensePostStartTrial { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type LicensePostStartTrialRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r LicensePostStartTrialRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r LicensePostStartTrialRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.post_start_trial") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_license/start_trial")) @@ -100,6 +116,9 @@ func (r LicensePostStartTrialRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +146,17 @@ func (r LicensePostStartTrialRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "license.post_start_trial") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.post_start_trial") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.logstash.delete_pipeline.go b/esapi/api.xpack.logstash.delete_pipeline.go index 8c403a4629..4567b09cec 100644 --- a/esapi/api.xpack.logstash.delete_pipeline.go +++ b/esapi/api.xpack.logstash.delete_pipeline.go @@ -31,6 +31,11 @@ func newLogstashDeletePipelineFunc(t Transport) LogstashDeletePipeline { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type LogstashDeletePipelineRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r LogstashDeletePipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r LogstashDeletePipelineRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "logstash.delete_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_logstash") + 1 + len("pipeline") + 1 + len(r.DocumentID)) @@ -74,6 +90,9 @@ func (r LogstashDeletePipelineRequest) Do(ctx context.Context, transport Transpo path.WriteString("pipeline") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r LogstashDeletePipelineRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r LogstashDeletePipelineRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "logstash.delete_pipeline") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "logstash.delete_pipeline") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.logstash.get_pipeline.go b/esapi/api.xpack.logstash.get_pipeline.go index 9bf5609f7a..770d956eae 100644 --- a/esapi/api.xpack.logstash.get_pipeline.go +++ b/esapi/api.xpack.logstash.get_pipeline.go @@ -31,6 +31,11 @@ func newLogstashGetPipelineFunc(t Transport) LogstashGetPipeline { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type LogstashGetPipelineRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r LogstashGetPipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r LogstashGetPipelineRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "logstash.get_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_logstash") + 1 + len("pipeline") + 1 + len(r.DocumentID)) @@ -75,6 +91,9 @@ func (r LogstashGetPipelineRequest) Do(ctx context.Context, transport Transport) if r.DocumentID != "" { path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r LogstashGetPipelineRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r LogstashGetPipelineRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "logstash.get_pipeline") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "logstash.get_pipeline") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.logstash.put_pipeline.go b/esapi/api.xpack.logstash.put_pipeline.go index 33713d7e30..13553e20bc 100644 --- a/esapi/api.xpack.logstash.put_pipeline.go +++ b/esapi/api.xpack.logstash.put_pipeline.go @@ -32,6 +32,11 @@ func newLogstashPutPipelineFunc(t Transport) LogstashPutPipeline { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type LogstashPutPipelineRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r LogstashPutPipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r LogstashPutPipelineRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "logstash.put_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_logstash") + 1 + len("pipeline") + 1 + len(r.DocumentID)) @@ -77,6 +93,9 @@ func (r LogstashPutPipelineRequest) Do(ctx context.Context, transport Transport) path.WriteString("pipeline") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r LogstashPutPipelineRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r LogstashPutPipelineRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "logstash.put_pipeline") + if reader := instrument.RecordRequestBody(ctx, "logstash.put_pipeline", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "logstash.put_pipeline") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.migration.deprecations.go b/esapi/api.xpack.migration.deprecations.go index c8f8826870..1837ea5be4 100644 --- a/esapi/api.xpack.migration.deprecations.go +++ b/esapi/api.xpack.migration.deprecations.go @@ -31,6 +31,11 @@ func newMigrationDeprecationsFunc(t Transport) MigrationDeprecations { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type MigrationDeprecationsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MigrationDeprecationsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MigrationDeprecationsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "migration.deprecations") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(r.Index) + 1 + len("_migration") + 1 + len("deprecations")) @@ -71,6 +87,9 @@ func (r MigrationDeprecationsRequest) Do(ctx context.Context, transport Transpor if r.Index != "" { path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } } path.WriteString("/") path.WriteString("_migration") @@ -97,6 +116,9 @@ func (r MigrationDeprecationsRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r MigrationDeprecationsRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "migration.deprecations") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "migration.deprecations") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.migration.get_feature_upgrade_status.go b/esapi/api.xpack.migration.get_feature_upgrade_status.go index faaab43d95..e7fb42ca01 100644 --- a/esapi/api.xpack.migration.get_feature_upgrade_status.go +++ b/esapi/api.xpack.migration.get_feature_upgrade_status.go @@ -31,6 +31,11 @@ func newMigrationGetFeatureUpgradeStatusFunc(t Transport) MigrationGetFeatureUpg for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type MigrationGetFeatureUpgradeStatusRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MigrationGetFeatureUpgradeStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MigrationGetFeatureUpgradeStatusRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "migration.get_feature_upgrade_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_migration/system_features")) @@ -88,6 +104,9 @@ func (r MigrationGetFeatureUpgradeStatusRequest) Do(ctx context.Context, transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r MigrationGetFeatureUpgradeStatusRequest) Do(ctx context.Context, transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "migration.get_feature_upgrade_status") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "migration.get_feature_upgrade_status") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.migration.post_feature_upgrade.go b/esapi/api.xpack.migration.post_feature_upgrade.go index 6b6f56b67b..72b5dbb5e2 100644 --- a/esapi/api.xpack.migration.post_feature_upgrade.go +++ b/esapi/api.xpack.migration.post_feature_upgrade.go @@ -31,6 +31,11 @@ func newMigrationPostFeatureUpgradeFunc(t Transport) MigrationPostFeatureUpgrade for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type MigrationPostFeatureUpgradeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MigrationPostFeatureUpgradeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MigrationPostFeatureUpgradeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "migration.post_feature_upgrade") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_migration/system_features")) @@ -88,6 +104,9 @@ func (r MigrationPostFeatureUpgradeRequest) Do(ctx context.Context, transport Tr req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r MigrationPostFeatureUpgradeRequest) Do(ctx context.Context, transport Tr req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "migration.post_feature_upgrade") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "migration.post_feature_upgrade") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.clear_trained_model_deployment_cache.go b/esapi/api.xpack.ml.clear_trained_model_deployment_cache.go index 12606b2065..66a3594d77 100644 --- a/esapi/api.xpack.ml.clear_trained_model_deployment_cache.go +++ b/esapi/api.xpack.ml.clear_trained_model_deployment_cache.go @@ -31,6 +31,11 @@ func newMLClearTrainedModelDeploymentCacheFunc(t Transport) MLClearTrainedModelD for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type MLClearTrainedModelDeploymentCacheRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLClearTrainedModelDeploymentCacheRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLClearTrainedModelDeploymentCacheRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.clear_trained_model_deployment_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("deployment") + 1 + len("cache") + 1 + len("_clear")) @@ -74,6 +90,9 @@ func (r MLClearTrainedModelDeploymentCacheRequest) Do(ctx context.Context, trans path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } path.WriteString("/") path.WriteString("deployment") path.WriteString("/") @@ -101,6 +120,9 @@ func (r MLClearTrainedModelDeploymentCacheRequest) Do(ctx context.Context, trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +150,17 @@ func (r MLClearTrainedModelDeploymentCacheRequest) Do(ctx context.Context, trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.clear_trained_model_deployment_cache") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.clear_trained_model_deployment_cache") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.close_job.go b/esapi/api.xpack.ml.close_job.go index 19d12567aa..dbb041ed79 100644 --- a/esapi/api.xpack.ml.close_job.go +++ b/esapi/api.xpack.ml.close_job.go @@ -34,6 +34,11 @@ func newMLCloseJobFunc(t Transport) MLCloseJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type MLCloseJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLCloseJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLCloseJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.close_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_close")) @@ -83,6 +99,9 @@ func (r MLCloseJobRequest) Do(ctx context.Context, transport Transport) (*Respon path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("_close") @@ -118,6 +137,9 @@ func (r MLCloseJobRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -149,8 +171,20 @@ func (r MLCloseJobRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.close_job") + if reader := instrument.RecordRequestBody(ctx, "ml.close_job", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.close_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_calendar.go b/esapi/api.xpack.ml.delete_calendar.go index e64161ca14..7261ea2ad4 100644 --- a/esapi/api.xpack.ml.delete_calendar.go +++ b/esapi/api.xpack.ml.delete_calendar.go @@ -31,6 +31,11 @@ func newMLDeleteCalendarFunc(t Transport) MLDeleteCalendar { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type MLDeleteCalendarRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteCalendarRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteCalendarRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_calendar") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID)) @@ -74,6 +90,9 @@ func (r MLDeleteCalendarRequest) Do(ctx context.Context, transport Transport) (* path.WriteString("calendars") path.WriteString("/") path.WriteString(r.CalendarID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendar_id", r.CalendarID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r MLDeleteCalendarRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r MLDeleteCalendarRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_calendar") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_calendar") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_calendar_event.go b/esapi/api.xpack.ml.delete_calendar_event.go index d3353f397b..6604a80d45 100644 --- a/esapi/api.xpack.ml.delete_calendar_event.go +++ b/esapi/api.xpack.ml.delete_calendar_event.go @@ -31,6 +31,11 @@ func newMLDeleteCalendarEventFunc(t Transport) MLDeleteCalendarEvent { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type MLDeleteCalendarEventRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteCalendarEventRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteCalendarEventRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_calendar_event") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID) + 1 + len("events") + 1 + len(r.EventID)) @@ -75,10 +91,16 @@ func (r MLDeleteCalendarEventRequest) Do(ctx context.Context, transport Transpor path.WriteString("calendars") path.WriteString("/") path.WriteString(r.CalendarID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendar_id", r.CalendarID) + } path.WriteString("/") path.WriteString("events") path.WriteString("/") path.WriteString(r.EventID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "event_id", r.EventID) + } params = make(map[string]string) @@ -100,6 +122,9 @@ func (r MLDeleteCalendarEventRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +152,17 @@ func (r MLDeleteCalendarEventRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_calendar_event") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_calendar_event") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_calendar_job.go b/esapi/api.xpack.ml.delete_calendar_job.go index a96f210d77..f15a266b25 100644 --- a/esapi/api.xpack.ml.delete_calendar_job.go +++ b/esapi/api.xpack.ml.delete_calendar_job.go @@ -31,6 +31,11 @@ func newMLDeleteCalendarJobFunc(t Transport) MLDeleteCalendarJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type MLDeleteCalendarJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteCalendarJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteCalendarJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_calendar_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID) + 1 + len("jobs") + 1 + len(r.JobID)) @@ -75,10 +91,16 @@ func (r MLDeleteCalendarJobRequest) Do(ctx context.Context, transport Transport) path.WriteString("calendars") path.WriteString("/") path.WriteString(r.CalendarID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendar_id", r.CalendarID) + } path.WriteString("/") path.WriteString("jobs") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } params = make(map[string]string) @@ -100,6 +122,9 @@ func (r MLDeleteCalendarJobRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +152,17 @@ func (r MLDeleteCalendarJobRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_calendar_job") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_calendar_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_data_frame_analytics.go b/esapi/api.xpack.ml.delete_data_frame_analytics.go index 488b7d21db..2538cb4f2d 100644 --- a/esapi/api.xpack.ml.delete_data_frame_analytics.go +++ b/esapi/api.xpack.ml.delete_data_frame_analytics.go @@ -33,6 +33,11 @@ func newMLDeleteDataFrameAnalyticsFunc(t Transport) MLDeleteDataFrameAnalytics { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type MLDeleteDataFrameAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteDataFrameAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID)) @@ -81,6 +97,9 @@ func (r MLDeleteDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tra path.WriteString("analytics") path.WriteString("/") path.WriteString(r.ID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.ID) + } params = make(map[string]string) @@ -110,6 +129,9 @@ func (r MLDeleteDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -137,8 +159,17 @@ func (r MLDeleteDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_data_frame_analytics") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_data_frame_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_datafeed.go b/esapi/api.xpack.ml.delete_datafeed.go index 00ae7f04dc..09012b24b9 100644 --- a/esapi/api.xpack.ml.delete_datafeed.go +++ b/esapi/api.xpack.ml.delete_datafeed.go @@ -32,6 +32,11 @@ func newMLDeleteDatafeedFunc(t Transport) MLDeleteDatafeed { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLDeleteDatafeedRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteDatafeedRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID)) @@ -77,6 +93,9 @@ func (r MLDeleteDatafeedRequest) Do(ctx context.Context, transport Transport) (* path.WriteString("datafeeds") path.WriteString("/") path.WriteString(r.DatafeedID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeed_id", r.DatafeedID) + } params = make(map[string]string) @@ -102,6 +121,9 @@ func (r MLDeleteDatafeedRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,17 @@ func (r MLDeleteDatafeedRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_datafeed") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_datafeed") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_expired_data.go b/esapi/api.xpack.ml.delete_expired_data.go index 89460d9731..868c365101 100644 --- a/esapi/api.xpack.ml.delete_expired_data.go +++ b/esapi/api.xpack.ml.delete_expired_data.go @@ -34,6 +34,11 @@ func newMLDeleteExpiredDataFunc(t Transport) MLDeleteExpiredData { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type MLDeleteExpiredDataRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteExpiredDataRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteExpiredDataRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_expired_data") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("_delete_expired_data") + 1 + len(r.JobID)) @@ -83,6 +99,9 @@ func (r MLDeleteExpiredDataRequest) Do(ctx context.Context, transport Transport) if r.JobID != "" { path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } } params = make(map[string]string) @@ -113,6 +132,9 @@ func (r MLDeleteExpiredDataRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -144,8 +166,20 @@ func (r MLDeleteExpiredDataRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_expired_data") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_expired_data", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_expired_data") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_filter.go b/esapi/api.xpack.ml.delete_filter.go index cd03e2570f..e88ba7d8d4 100644 --- a/esapi/api.xpack.ml.delete_filter.go +++ b/esapi/api.xpack.ml.delete_filter.go @@ -31,6 +31,11 @@ func newMLDeleteFilterFunc(t Transport) MLDeleteFilter { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type MLDeleteFilterRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteFilterRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteFilterRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_filter") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("filters") + 1 + len(r.FilterID)) @@ -74,6 +90,9 @@ func (r MLDeleteFilterRequest) Do(ctx context.Context, transport Transport) (*Re path.WriteString("filters") path.WriteString("/") path.WriteString(r.FilterID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "filter_id", r.FilterID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r MLDeleteFilterRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r MLDeleteFilterRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_filter") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_filter") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_forecast.go b/esapi/api.xpack.ml.delete_forecast.go index 544566100e..9667840e7b 100644 --- a/esapi/api.xpack.ml.delete_forecast.go +++ b/esapi/api.xpack.ml.delete_forecast.go @@ -33,6 +33,11 @@ func newMLDeleteForecastFunc(t Transport) MLDeleteForecast { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type MLDeleteForecastRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteForecastRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteForecastRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_forecast") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_forecast") + 1 + len(r.ForecastID)) @@ -80,11 +96,17 @@ func (r MLDeleteForecastRequest) Do(ctx context.Context, transport Transport) (* path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("_forecast") if r.ForecastID != "" { path.WriteString("/") path.WriteString(r.ForecastID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "forecast_id", r.ForecastID) + } } params = make(map[string]string) @@ -115,6 +137,9 @@ func (r MLDeleteForecastRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -142,8 +167,17 @@ func (r MLDeleteForecastRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_forecast") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_forecast") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_job.go b/esapi/api.xpack.ml.delete_job.go index c899b1fb27..b4c82a97b8 100644 --- a/esapi/api.xpack.ml.delete_job.go +++ b/esapi/api.xpack.ml.delete_job.go @@ -32,6 +32,11 @@ func newMLDeleteJobFunc(t Transport) MLDeleteJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type MLDeleteJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID)) @@ -79,6 +95,9 @@ func (r MLDeleteJobRequest) Do(ctx context.Context, transport Transport) (*Respo path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } params = make(map[string]string) @@ -112,6 +131,9 @@ func (r MLDeleteJobRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -139,8 +161,17 @@ func (r MLDeleteJobRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_job") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_model_snapshot.go b/esapi/api.xpack.ml.delete_model_snapshot.go index dcd5a43bc1..0ecbc34cb1 100644 --- a/esapi/api.xpack.ml.delete_model_snapshot.go +++ b/esapi/api.xpack.ml.delete_model_snapshot.go @@ -31,6 +31,11 @@ func newMLDeleteModelSnapshotFunc(t Transport) MLDeleteModelSnapshot { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type MLDeleteModelSnapshotRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteModelSnapshotRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteModelSnapshotRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_model_snapshot") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID)) @@ -75,10 +91,16 @@ func (r MLDeleteModelSnapshotRequest) Do(ctx context.Context, transport Transpor path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") path.WriteString(r.SnapshotID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot_id", r.SnapshotID) + } params = make(map[string]string) @@ -100,6 +122,9 @@ func (r MLDeleteModelSnapshotRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +152,17 @@ func (r MLDeleteModelSnapshotRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_model_snapshot") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_model_snapshot") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_trained_model.go b/esapi/api.xpack.ml.delete_trained_model.go index 1a248115e1..38a299e708 100644 --- a/esapi/api.xpack.ml.delete_trained_model.go +++ b/esapi/api.xpack.ml.delete_trained_model.go @@ -33,6 +33,11 @@ func newMLDeleteTrainedModelFunc(t Transport) MLDeleteTrainedModel { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type MLDeleteTrainedModelRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteTrainedModelRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteTrainedModelRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_trained_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID)) @@ -79,6 +95,9 @@ func (r MLDeleteTrainedModelRequest) Do(ctx context.Context, transport Transport path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } params = make(map[string]string) @@ -108,6 +127,9 @@ func (r MLDeleteTrainedModelRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,17 @@ func (r MLDeleteTrainedModelRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_trained_model") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_trained_model") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.delete_trained_model_alias.go b/esapi/api.xpack.ml.delete_trained_model_alias.go index c57ed94689..37a0cab977 100644 --- a/esapi/api.xpack.ml.delete_trained_model_alias.go +++ b/esapi/api.xpack.ml.delete_trained_model_alias.go @@ -31,6 +31,11 @@ func newMLDeleteTrainedModelAliasFunc(t Transport) MLDeleteTrainedModelAlias { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type MLDeleteTrainedModelAliasRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLDeleteTrainedModelAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLDeleteTrainedModelAliasRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_trained_model_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("model_aliases") + 1 + len(r.ModelAlias)) @@ -75,10 +91,16 @@ func (r MLDeleteTrainedModelAliasRequest) Do(ctx context.Context, transport Tran path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } path.WriteString("/") path.WriteString("model_aliases") path.WriteString("/") path.WriteString(r.ModelAlias) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_alias", r.ModelAlias) + } params = make(map[string]string) @@ -100,6 +122,9 @@ func (r MLDeleteTrainedModelAliasRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +152,17 @@ func (r MLDeleteTrainedModelAliasRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_trained_model_alias") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_trained_model_alias") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.estimate_model_memory.go b/esapi/api.xpack.ml.estimate_model_memory.go index a2e58504df..9aac0ac624 100644 --- a/esapi/api.xpack.ml.estimate_model_memory.go +++ b/esapi/api.xpack.ml.estimate_model_memory.go @@ -32,6 +32,11 @@ func newMLEstimateModelMemoryFunc(t Transport) MLEstimateModelMemory { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type MLEstimateModelMemoryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLEstimateModelMemoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLEstimateModelMemoryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.estimate_model_memory") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_ml/anomaly_detectors/_estimate_model_memory")) @@ -91,6 +107,9 @@ func (r MLEstimateModelMemoryRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r MLEstimateModelMemoryRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.estimate_model_memory") + if reader := instrument.RecordRequestBody(ctx, "ml.estimate_model_memory", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.estimate_model_memory") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.evaluate_data_frame.go b/esapi/api.xpack.ml.evaluate_data_frame.go index afc5b35447..d2da56d5e1 100644 --- a/esapi/api.xpack.ml.evaluate_data_frame.go +++ b/esapi/api.xpack.ml.evaluate_data_frame.go @@ -32,6 +32,11 @@ func newMLEvaluateDataFrameFunc(t Transport) MLEvaluateDataFrame { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type MLEvaluateDataFrameRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLEvaluateDataFrameRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLEvaluateDataFrameRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.evaluate_data_frame") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_ml/data_frame/_evaluate")) @@ -91,6 +107,9 @@ func (r MLEvaluateDataFrameRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r MLEvaluateDataFrameRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.evaluate_data_frame") + if reader := instrument.RecordRequestBody(ctx, "ml.evaluate_data_frame", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.evaluate_data_frame") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.explain_data_frame_analytics.go b/esapi/api.xpack.ml.explain_data_frame_analytics.go index 4d3f791562..5b990b2cbd 100644 --- a/esapi/api.xpack.ml.explain_data_frame_analytics.go +++ b/esapi/api.xpack.ml.explain_data_frame_analytics.go @@ -32,6 +32,11 @@ func newMLExplainDataFrameAnalyticsFunc(t Transport) MLExplainDataFrameAnalytics for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLExplainDataFrameAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLExplainDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLExplainDataFrameAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.explain_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.DocumentID) + 1 + len("_explain")) @@ -80,6 +96,9 @@ func (r MLExplainDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tr if r.DocumentID != "" { path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } } path.WriteString("/") path.WriteString("_explain") @@ -104,6 +123,9 @@ func (r MLExplainDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tr req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,20 @@ func (r MLExplainDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tr req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.explain_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.explain_data_frame_analytics", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.explain_data_frame_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.flush_job.go b/esapi/api.xpack.ml.flush_job.go index fb506512b6..73f8315557 100644 --- a/esapi/api.xpack.ml.flush_job.go +++ b/esapi/api.xpack.ml.flush_job.go @@ -33,6 +33,11 @@ func newMLFlushJobFunc(t Transport) MLFlushJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type MLFlushJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLFlushJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLFlushJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.flush_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_flush")) @@ -84,6 +100,9 @@ func (r MLFlushJobRequest) Do(ctx context.Context, transport Transport) (*Respon path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("_flush") @@ -127,6 +146,9 @@ func (r MLFlushJobRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -158,8 +180,20 @@ func (r MLFlushJobRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.flush_job") + if reader := instrument.RecordRequestBody(ctx, "ml.flush_job", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.flush_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.forecast.go b/esapi/api.xpack.ml.forecast.go index 7f3063b46a..74908ad3f1 100644 --- a/esapi/api.xpack.ml.forecast.go +++ b/esapi/api.xpack.ml.forecast.go @@ -33,6 +33,11 @@ func newMLForecastFunc(t Transport) MLForecast { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type MLForecastRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLForecastRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLForecastRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.forecast") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_forecast")) @@ -82,6 +98,9 @@ func (r MLForecastRequest) Do(ctx context.Context, transport Transport) (*Respon path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("_forecast") @@ -117,6 +136,9 @@ func (r MLForecastRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -148,8 +170,20 @@ func (r MLForecastRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.forecast") + if reader := instrument.RecordRequestBody(ctx, "ml.forecast", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.forecast") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_buckets.go b/esapi/api.xpack.ml.get_buckets.go index 3409b4cfca..eb59ba4c7f 100644 --- a/esapi/api.xpack.ml.get_buckets.go +++ b/esapi/api.xpack.ml.get_buckets.go @@ -34,6 +34,11 @@ func newMLGetBucketsFunc(t Transport) MLGetBuckets { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -70,16 +75,27 @@ type MLGetBucketsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetBucketsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetBucketsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_buckets") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("results") + 1 + len("buckets") + 1 + len(r.Timestamp)) @@ -90,6 +106,9 @@ func (r MLGetBucketsRequest) Do(ctx context.Context, transport Transport) (*Resp path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("results") path.WriteString("/") @@ -97,6 +116,9 @@ func (r MLGetBucketsRequest) Do(ctx context.Context, transport Transport) (*Resp if r.Timestamp != "" { path.WriteString("/") path.WriteString(r.Timestamp) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "timestamp", r.Timestamp) + } } params = make(map[string]string) @@ -155,6 +177,9 @@ func (r MLGetBucketsRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -186,8 +211,20 @@ func (r MLGetBucketsRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_buckets") + if reader := instrument.RecordRequestBody(ctx, "ml.get_buckets", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_buckets") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_calendar_events.go b/esapi/api.xpack.ml.get_calendar_events.go index 16ddcc8850..ea3287894b 100644 --- a/esapi/api.xpack.ml.get_calendar_events.go +++ b/esapi/api.xpack.ml.get_calendar_events.go @@ -33,6 +33,11 @@ func newMLGetCalendarEventsFunc(t Transport) MLGetCalendarEvents { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type MLGetCalendarEventsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetCalendarEventsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetCalendarEventsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_calendar_events") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID) + 1 + len("events")) @@ -82,6 +98,9 @@ func (r MLGetCalendarEventsRequest) Do(ctx context.Context, transport Transport) path.WriteString("calendars") path.WriteString("/") path.WriteString(r.CalendarID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendar_id", r.CalendarID) + } path.WriteString("/") path.WriteString("events") @@ -125,6 +144,9 @@ func (r MLGetCalendarEventsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -152,8 +174,17 @@ func (r MLGetCalendarEventsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_calendar_events") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_calendar_events") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_calendars.go b/esapi/api.xpack.ml.get_calendars.go index 15f2aa360e..a1584e629d 100644 --- a/esapi/api.xpack.ml.get_calendars.go +++ b/esapi/api.xpack.ml.get_calendars.go @@ -33,6 +33,11 @@ func newMLGetCalendarsFunc(t Transport) MLGetCalendars { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type MLGetCalendarsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetCalendarsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetCalendarsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_calendars") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID)) @@ -82,6 +98,9 @@ func (r MLGetCalendarsRequest) Do(ctx context.Context, transport Transport) (*Re if r.CalendarID != "" { path.WriteString("/") path.WriteString(r.CalendarID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendar_id", r.CalendarID) + } } params = make(map[string]string) @@ -112,6 +131,9 @@ func (r MLGetCalendarsRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -143,8 +165,20 @@ func (r MLGetCalendarsRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_calendars") + if reader := instrument.RecordRequestBody(ctx, "ml.get_calendars", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_calendars") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_categories.go b/esapi/api.xpack.ml.get_categories.go index 5442ea2ab1..6929c2e892 100644 --- a/esapi/api.xpack.ml.get_categories.go +++ b/esapi/api.xpack.ml.get_categories.go @@ -33,6 +33,11 @@ func newMLGetCategoriesFunc(t Transport) MLGetCategories { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type MLGetCategoriesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetCategoriesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetCategoriesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_categories") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("results") + 1 + len("categories")) @@ -83,6 +99,9 @@ func (r MLGetCategoriesRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("results") path.WriteString("/") @@ -92,6 +111,9 @@ func (r MLGetCategoriesRequest) Do(ctx context.Context, transport Transport) (*R path.Grow(1 + len(value)) path.WriteString("/") path.WriteString(value) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "category_id", value) + } } params = make(map[string]string) @@ -126,6 +148,9 @@ func (r MLGetCategoriesRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -157,8 +182,20 @@ func (r MLGetCategoriesRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_categories") + if reader := instrument.RecordRequestBody(ctx, "ml.get_categories", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_categories") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_data_frame_analytics.go b/esapi/api.xpack.ml.get_data_frame_analytics.go index d9b89d235d..4c5bc2e1e5 100644 --- a/esapi/api.xpack.ml.get_data_frame_analytics.go +++ b/esapi/api.xpack.ml.get_data_frame_analytics.go @@ -32,6 +32,11 @@ func newMLGetDataFrameAnalyticsFunc(t Transport) MLGetDataFrameAnalytics { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type MLGetDataFrameAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetDataFrameAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID)) @@ -83,6 +99,9 @@ func (r MLGetDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transp if r.ID != "" { path.WriteString("/") path.WriteString(r.ID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.ID) + } } params = make(map[string]string) @@ -121,6 +140,9 @@ func (r MLGetDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -148,8 +170,17 @@ func (r MLGetDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_data_frame_analytics") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_data_frame_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_data_frame_analytics_stats.go b/esapi/api.xpack.ml.get_data_frame_analytics_stats.go index 5935aa368d..694afae3eb 100644 --- a/esapi/api.xpack.ml.get_data_frame_analytics_stats.go +++ b/esapi/api.xpack.ml.get_data_frame_analytics_stats.go @@ -32,6 +32,11 @@ func newMLGetDataFrameAnalyticsStatsFunc(t Transport) MLGetDataFrameAnalyticsSta for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type MLGetDataFrameAnalyticsStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetDataFrameAnalyticsStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetDataFrameAnalyticsStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_data_frame_analytics_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID) + 1 + len("_stats")) @@ -83,6 +99,9 @@ func (r MLGetDataFrameAnalyticsStatsRequest) Do(ctx context.Context, transport T if r.ID != "" { path.WriteString("/") path.WriteString(r.ID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.ID) + } } path.WriteString("/") path.WriteString("_stats") @@ -123,6 +142,9 @@ func (r MLGetDataFrameAnalyticsStatsRequest) Do(ctx context.Context, transport T req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -150,8 +172,17 @@ func (r MLGetDataFrameAnalyticsStatsRequest) Do(ctx context.Context, transport T req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_data_frame_analytics_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_data_frame_analytics_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_datafeed_stats.go b/esapi/api.xpack.ml.get_datafeed_stats.go index d98c922274..2c647426c7 100644 --- a/esapi/api.xpack.ml.get_datafeed_stats.go +++ b/esapi/api.xpack.ml.get_datafeed_stats.go @@ -32,6 +32,11 @@ func newMLGetDatafeedStatsFunc(t Transport) MLGetDatafeedStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLGetDatafeedStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetDatafeedStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetDatafeedStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_datafeed_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID) + 1 + len("_stats")) @@ -78,6 +94,9 @@ func (r MLGetDatafeedStatsRequest) Do(ctx context.Context, transport Transport) if r.DatafeedID != "" { path.WriteString("/") path.WriteString(r.DatafeedID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeed_id", r.DatafeedID) + } } path.WriteString("/") path.WriteString("_stats") @@ -106,6 +125,9 @@ func (r MLGetDatafeedStatsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,17 @@ func (r MLGetDatafeedStatsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_datafeed_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_datafeed_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_datafeeds.go b/esapi/api.xpack.ml.get_datafeeds.go index bcb33e7c26..1c1171bdee 100644 --- a/esapi/api.xpack.ml.get_datafeeds.go +++ b/esapi/api.xpack.ml.get_datafeeds.go @@ -32,6 +32,11 @@ func newMLGetDatafeedsFunc(t Transport) MLGetDatafeeds { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type MLGetDatafeedsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetDatafeedsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetDatafeedsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_datafeeds") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID)) @@ -79,6 +95,9 @@ func (r MLGetDatafeedsRequest) Do(ctx context.Context, transport Transport) (*Re if r.DatafeedID != "" { path.WriteString("/") path.WriteString(r.DatafeedID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeed_id", r.DatafeedID) + } } params = make(map[string]string) @@ -109,6 +128,9 @@ func (r MLGetDatafeedsRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -136,8 +158,17 @@ func (r MLGetDatafeedsRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_datafeeds") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_datafeeds") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_filters.go b/esapi/api.xpack.ml.get_filters.go index b1a6a70965..db045cba61 100644 --- a/esapi/api.xpack.ml.get_filters.go +++ b/esapi/api.xpack.ml.get_filters.go @@ -32,6 +32,11 @@ func newMLGetFiltersFunc(t Transport) MLGetFilters { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type MLGetFiltersRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetFiltersRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetFiltersRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_filters") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("filters") + 1 + len(r.FilterID)) @@ -79,6 +95,9 @@ func (r MLGetFiltersRequest) Do(ctx context.Context, transport Transport) (*Resp if r.FilterID != "" { path.WriteString("/") path.WriteString(r.FilterID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "filter_id", r.FilterID) + } } params = make(map[string]string) @@ -109,6 +128,9 @@ func (r MLGetFiltersRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -136,8 +158,17 @@ func (r MLGetFiltersRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_filters") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_filters") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_influencers.go b/esapi/api.xpack.ml.get_influencers.go index 7f97064238..743702b641 100644 --- a/esapi/api.xpack.ml.get_influencers.go +++ b/esapi/api.xpack.ml.get_influencers.go @@ -34,6 +34,11 @@ func newMLGetInfluencersFunc(t Transport) MLGetInfluencers { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -68,16 +73,27 @@ type MLGetInfluencersRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetInfluencersRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetInfluencersRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_influencers") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("results") + 1 + len("influencers")) @@ -88,6 +104,9 @@ func (r MLGetInfluencersRequest) Do(ctx context.Context, transport Transport) (* path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("results") path.WriteString("/") @@ -145,6 +164,9 @@ func (r MLGetInfluencersRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,8 +198,20 @@ func (r MLGetInfluencersRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_influencers") + if reader := instrument.RecordRequestBody(ctx, "ml.get_influencers", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_influencers") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_job_stats.go b/esapi/api.xpack.ml.get_job_stats.go index b02d0ed96f..066654e4de 100644 --- a/esapi/api.xpack.ml.get_job_stats.go +++ b/esapi/api.xpack.ml.get_job_stats.go @@ -32,6 +32,11 @@ func newMLGetJobStatsFunc(t Transport) MLGetJobStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLGetJobStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetJobStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetJobStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_job_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_stats")) @@ -78,6 +94,9 @@ func (r MLGetJobStatsRequest) Do(ctx context.Context, transport Transport) (*Res if r.JobID != "" { path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } } path.WriteString("/") path.WriteString("_stats") @@ -106,6 +125,9 @@ func (r MLGetJobStatsRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,17 @@ func (r MLGetJobStatsRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_job_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_job_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_jobs.go b/esapi/api.xpack.ml.get_jobs.go index d59dd853e3..6b345a5e8d 100644 --- a/esapi/api.xpack.ml.get_jobs.go +++ b/esapi/api.xpack.ml.get_jobs.go @@ -32,6 +32,11 @@ func newMLGetJobsFunc(t Transport) MLGetJobs { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type MLGetJobsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetJobsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetJobsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_jobs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID)) @@ -79,6 +95,9 @@ func (r MLGetJobsRequest) Do(ctx context.Context, transport Transport) (*Respons if r.JobID != "" { path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } } params = make(map[string]string) @@ -109,6 +128,9 @@ func (r MLGetJobsRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -136,8 +158,17 @@ func (r MLGetJobsRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_jobs") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_jobs") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_memory_stats.go b/esapi/api.xpack.ml.get_memory_stats.go index f266fd0ae5..07c5bbfc4a 100644 --- a/esapi/api.xpack.ml.get_memory_stats.go +++ b/esapi/api.xpack.ml.get_memory_stats.go @@ -32,6 +32,11 @@ func newMLGetMemoryStatsFunc(t Transport) MLGetMemoryStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type MLGetMemoryStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetMemoryStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetMemoryStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_memory_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("memory") + 1 + len(r.NodeID) + 1 + len("_stats")) @@ -79,6 +95,9 @@ func (r MLGetMemoryStatsRequest) Do(ctx context.Context, transport Transport) (* if r.NodeID != "" { path.WriteString("/") path.WriteString(r.NodeID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", r.NodeID) + } } path.WriteString("/") path.WriteString("_stats") @@ -111,6 +130,9 @@ func (r MLGetMemoryStatsRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +160,17 @@ func (r MLGetMemoryStatsRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_memory_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_memory_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_model_snapshot_upgrade_stats.go b/esapi/api.xpack.ml.get_model_snapshot_upgrade_stats.go index 8fc776e98a..edfefed824 100644 --- a/esapi/api.xpack.ml.get_model_snapshot_upgrade_stats.go +++ b/esapi/api.xpack.ml.get_model_snapshot_upgrade_stats.go @@ -32,6 +32,11 @@ func newMLGetModelSnapshotUpgradeStatsFunc(t Transport) MLGetModelSnapshotUpgrad for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type MLGetModelSnapshotUpgradeStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetModelSnapshotUpgradeStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetModelSnapshotUpgradeStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_model_snapshot_upgrade_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID) + 1 + len("_upgrade") + 1 + len("_stats")) @@ -78,10 +94,16 @@ func (r MLGetModelSnapshotUpgradeStatsRequest) Do(ctx context.Context, transport path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") path.WriteString(r.SnapshotID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot_id", r.SnapshotID) + } path.WriteString("/") path.WriteString("_upgrade") path.WriteString("/") @@ -111,6 +133,9 @@ func (r MLGetModelSnapshotUpgradeStatsRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +163,17 @@ func (r MLGetModelSnapshotUpgradeStatsRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_model_snapshot_upgrade_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_model_snapshot_upgrade_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_model_snapshots.go b/esapi/api.xpack.ml.get_model_snapshots.go index e7db49527f..14001c279d 100644 --- a/esapi/api.xpack.ml.get_model_snapshots.go +++ b/esapi/api.xpack.ml.get_model_snapshots.go @@ -34,6 +34,11 @@ func newMLGetModelSnapshotsFunc(t Transport) MLGetModelSnapshots { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -67,16 +72,27 @@ type MLGetModelSnapshotsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetModelSnapshotsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetModelSnapshotsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_model_snapshots") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID)) @@ -87,11 +103,17 @@ func (r MLGetModelSnapshotsRequest) Do(ctx context.Context, transport Transport) path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("model_snapshots") if r.SnapshotID != "" { path.WriteString("/") path.WriteString(r.SnapshotID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot_id", r.SnapshotID) + } } params = make(map[string]string) @@ -138,6 +160,9 @@ func (r MLGetModelSnapshotsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -169,8 +194,20 @@ func (r MLGetModelSnapshotsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_model_snapshots") + if reader := instrument.RecordRequestBody(ctx, "ml.get_model_snapshots", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_model_snapshots") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_overall_buckets.go b/esapi/api.xpack.ml.get_overall_buckets.go index 57821aaa19..bf5d5c0423 100644 --- a/esapi/api.xpack.ml.get_overall_buckets.go +++ b/esapi/api.xpack.ml.get_overall_buckets.go @@ -34,6 +34,11 @@ func newMLGetOverallBucketsFunc(t Transport) MLGetOverallBuckets { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -67,16 +72,27 @@ type MLGetOverallBucketsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetOverallBucketsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetOverallBucketsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_overall_buckets") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("results") + 1 + len("overall_buckets")) @@ -87,6 +103,9 @@ func (r MLGetOverallBucketsRequest) Do(ctx context.Context, transport Transport) path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("results") path.WriteString("/") @@ -140,6 +159,9 @@ func (r MLGetOverallBucketsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,8 +193,20 @@ func (r MLGetOverallBucketsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_overall_buckets") + if reader := instrument.RecordRequestBody(ctx, "ml.get_overall_buckets", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_overall_buckets") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_records.go b/esapi/api.xpack.ml.get_records.go index a3ed13968f..6b19524518 100644 --- a/esapi/api.xpack.ml.get_records.go +++ b/esapi/api.xpack.ml.get_records.go @@ -34,6 +34,11 @@ func newMLGetRecordsFunc(t Transport) MLGetRecords { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -68,16 +73,27 @@ type MLGetRecordsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetRecordsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetRecordsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_records") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("results") + 1 + len("records")) @@ -88,6 +104,9 @@ func (r MLGetRecordsRequest) Do(ctx context.Context, transport Transport) (*Resp path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("results") path.WriteString("/") @@ -145,6 +164,9 @@ func (r MLGetRecordsRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,8 +198,20 @@ func (r MLGetRecordsRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_records") + if reader := instrument.RecordRequestBody(ctx, "ml.get_records", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_records") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_trained_models.go b/esapi/api.xpack.ml.get_trained_models.go index 6e46c77c4d..f584692204 100644 --- a/esapi/api.xpack.ml.get_trained_models.go +++ b/esapi/api.xpack.ml.get_trained_models.go @@ -32,6 +32,11 @@ func newMLGetTrainedModelsFunc(t Transport) MLGetTrainedModels { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type MLGetTrainedModelsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetTrainedModelsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetTrainedModelsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_trained_models") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID)) @@ -85,6 +101,9 @@ func (r MLGetTrainedModelsRequest) Do(ctx context.Context, transport Transport) if r.ModelID != "" { path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } } params = make(map[string]string) @@ -139,6 +158,9 @@ func (r MLGetTrainedModelsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,8 +188,17 @@ func (r MLGetTrainedModelsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_trained_models") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_trained_models") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.get_trained_models_stats.go b/esapi/api.xpack.ml.get_trained_models_stats.go index 637e8f0e29..8c3de9267e 100644 --- a/esapi/api.xpack.ml.get_trained_models_stats.go +++ b/esapi/api.xpack.ml.get_trained_models_stats.go @@ -32,6 +32,11 @@ func newMLGetTrainedModelsStatsFunc(t Transport) MLGetTrainedModelsStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type MLGetTrainedModelsStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLGetTrainedModelsStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLGetTrainedModelsStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_trained_models_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("_stats")) @@ -80,6 +96,9 @@ func (r MLGetTrainedModelsStatsRequest) Do(ctx context.Context, transport Transp if r.ModelID != "" { path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } } path.WriteString("/") path.WriteString("_stats") @@ -116,6 +135,9 @@ func (r MLGetTrainedModelsStatsRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -143,8 +165,17 @@ func (r MLGetTrainedModelsStatsRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_trained_models_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_trained_models_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.infer_trained_model.go b/esapi/api.xpack.ml.infer_trained_model.go index 442772c1bb..e96b60d422 100644 --- a/esapi/api.xpack.ml.infer_trained_model.go +++ b/esapi/api.xpack.ml.infer_trained_model.go @@ -33,6 +33,11 @@ func newMLInferTrainedModelFunc(t Transport) MLInferTrainedModel { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type MLInferTrainedModelRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLInferTrainedModelRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLInferTrainedModelRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.infer_trained_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("deployment") + 1 + len("_infer")) @@ -80,6 +96,9 @@ func (r MLInferTrainedModelRequest) Do(ctx context.Context, transport Transport) path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } path.WriteString("/") path.WriteString("deployment") path.WriteString("/") @@ -109,6 +128,9 @@ func (r MLInferTrainedModelRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +162,20 @@ func (r MLInferTrainedModelRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.infer_trained_model") + if reader := instrument.RecordRequestBody(ctx, "ml.infer_trained_model", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.infer_trained_model") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.info.go b/esapi/api.xpack.ml.info.go index 6e34b9268c..5da35baf25 100644 --- a/esapi/api.xpack.ml.info.go +++ b/esapi/api.xpack.ml.info.go @@ -31,6 +31,11 @@ func newMLInfoFunc(t Transport) MLInfo { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type MLInfoRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLInfoRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_ml/info")) @@ -88,6 +104,9 @@ func (r MLInfoRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r MLInfoRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.info") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.info") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.open_job.go b/esapi/api.xpack.ml.open_job.go index 5194164173..a7dfe23663 100644 --- a/esapi/api.xpack.ml.open_job.go +++ b/esapi/api.xpack.ml.open_job.go @@ -32,6 +32,11 @@ func newMLOpenJobFunc(t Transport) MLOpenJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLOpenJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLOpenJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLOpenJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.open_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_open")) @@ -77,6 +93,9 @@ func (r MLOpenJobRequest) Do(ctx context.Context, transport Transport) (*Respons path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("_open") @@ -100,6 +119,9 @@ func (r MLOpenJobRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,20 @@ func (r MLOpenJobRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.open_job") + if reader := instrument.RecordRequestBody(ctx, "ml.open_job", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.open_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.post_calendar_events.go b/esapi/api.xpack.ml.post_calendar_events.go index e92c410b85..f78de1a613 100644 --- a/esapi/api.xpack.ml.post_calendar_events.go +++ b/esapi/api.xpack.ml.post_calendar_events.go @@ -32,6 +32,11 @@ func newMLPostCalendarEventsFunc(t Transport) MLPostCalendarEvents { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLPostCalendarEventsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPostCalendarEventsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPostCalendarEventsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.post_calendar_events") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID) + 1 + len("events")) @@ -77,6 +93,9 @@ func (r MLPostCalendarEventsRequest) Do(ctx context.Context, transport Transport path.WriteString("calendars") path.WriteString("/") path.WriteString(r.CalendarID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendar_id", r.CalendarID) + } path.WriteString("/") path.WriteString("events") @@ -100,6 +119,9 @@ func (r MLPostCalendarEventsRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,20 @@ func (r MLPostCalendarEventsRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.post_calendar_events") + if reader := instrument.RecordRequestBody(ctx, "ml.post_calendar_events", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.post_calendar_events") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.post_data.go b/esapi/api.xpack.ml.post_data.go index 1ec949bb91..1ee00fe557 100644 --- a/esapi/api.xpack.ml.post_data.go +++ b/esapi/api.xpack.ml.post_data.go @@ -32,6 +32,11 @@ func newMLPostDataFunc(t Transport) MLPostData { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type MLPostDataRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPostDataRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPostDataRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.post_data") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_data")) @@ -80,6 +96,9 @@ func (r MLPostDataRequest) Do(ctx context.Context, transport Transport) (*Respon path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("_data") @@ -111,6 +130,9 @@ func (r MLPostDataRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -142,8 +164,20 @@ func (r MLPostDataRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.post_data") + if reader := instrument.RecordRequestBody(ctx, "ml.post_data", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.post_data") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.preview_data_frame_analytics.go b/esapi/api.xpack.ml.preview_data_frame_analytics.go index 27feb1caaa..a1a5334cd3 100644 --- a/esapi/api.xpack.ml.preview_data_frame_analytics.go +++ b/esapi/api.xpack.ml.preview_data_frame_analytics.go @@ -32,6 +32,11 @@ func newMLPreviewDataFrameAnalyticsFunc(t Transport) MLPreviewDataFrameAnalytics for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLPreviewDataFrameAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPreviewDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPreviewDataFrameAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.preview_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.DocumentID) + 1 + len("_preview")) @@ -80,6 +96,9 @@ func (r MLPreviewDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tr if r.DocumentID != "" { path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } } path.WriteString("/") path.WriteString("_preview") @@ -104,6 +123,9 @@ func (r MLPreviewDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tr req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,20 @@ func (r MLPreviewDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tr req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.preview_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.preview_data_frame_analytics", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.preview_data_frame_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.preview_datafeed.go b/esapi/api.xpack.ml.preview_datafeed.go index 4ca5023d0b..9926ad4d85 100644 --- a/esapi/api.xpack.ml.preview_datafeed.go +++ b/esapi/api.xpack.ml.preview_datafeed.go @@ -32,6 +32,11 @@ func newMLPreviewDatafeedFunc(t Transport) MLPreviewDatafeed { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type MLPreviewDatafeedRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPreviewDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPreviewDatafeedRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.preview_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID) + 1 + len("_preview")) @@ -81,6 +97,9 @@ func (r MLPreviewDatafeedRequest) Do(ctx context.Context, transport Transport) ( if r.DatafeedID != "" { path.WriteString("/") path.WriteString(r.DatafeedID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeed_id", r.DatafeedID) + } } path.WriteString("/") path.WriteString("_preview") @@ -113,6 +132,9 @@ func (r MLPreviewDatafeedRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -144,8 +166,20 @@ func (r MLPreviewDatafeedRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.preview_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.preview_datafeed", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.preview_datafeed") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.put_calendar.go b/esapi/api.xpack.ml.put_calendar.go index 0d2579763d..5f74bff437 100644 --- a/esapi/api.xpack.ml.put_calendar.go +++ b/esapi/api.xpack.ml.put_calendar.go @@ -32,6 +32,11 @@ func newMLPutCalendarFunc(t Transport) MLPutCalendar { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLPutCalendarRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPutCalendarRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPutCalendarRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_calendar") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID)) @@ -77,6 +93,9 @@ func (r MLPutCalendarRequest) Do(ctx context.Context, transport Transport) (*Res path.WriteString("calendars") path.WriteString("/") path.WriteString(r.CalendarID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendar_id", r.CalendarID) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r MLPutCalendarRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r MLPutCalendarRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_calendar") + if reader := instrument.RecordRequestBody(ctx, "ml.put_calendar", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_calendar") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.put_calendar_job.go b/esapi/api.xpack.ml.put_calendar_job.go index 0e3aea1f0c..8ea651648c 100644 --- a/esapi/api.xpack.ml.put_calendar_job.go +++ b/esapi/api.xpack.ml.put_calendar_job.go @@ -31,6 +31,11 @@ func newMLPutCalendarJobFunc(t Transport) MLPutCalendarJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type MLPutCalendarJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPutCalendarJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPutCalendarJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_calendar_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID) + 1 + len("jobs") + 1 + len(r.JobID)) @@ -75,10 +91,16 @@ func (r MLPutCalendarJobRequest) Do(ctx context.Context, transport Transport) (* path.WriteString("calendars") path.WriteString("/") path.WriteString(r.CalendarID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendar_id", r.CalendarID) + } path.WriteString("/") path.WriteString("jobs") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } params = make(map[string]string) @@ -100,6 +122,9 @@ func (r MLPutCalendarJobRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +152,17 @@ func (r MLPutCalendarJobRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_calendar_job") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_calendar_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.put_data_frame_analytics.go b/esapi/api.xpack.ml.put_data_frame_analytics.go index 9def1ced82..26c0e19c12 100644 --- a/esapi/api.xpack.ml.put_data_frame_analytics.go +++ b/esapi/api.xpack.ml.put_data_frame_analytics.go @@ -32,6 +32,11 @@ func newMLPutDataFrameAnalyticsFunc(t Transport) MLPutDataFrameAnalytics { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLPutDataFrameAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPutDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPutDataFrameAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID)) @@ -79,6 +95,9 @@ func (r MLPutDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transp path.WriteString("analytics") path.WriteString("/") path.WriteString(r.ID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.ID) + } params = make(map[string]string) @@ -100,6 +119,9 @@ func (r MLPutDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,20 @@ func (r MLPutDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.put_data_frame_analytics", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_data_frame_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.put_datafeed.go b/esapi/api.xpack.ml.put_datafeed.go index 247d2f9a4b..f130425d77 100644 --- a/esapi/api.xpack.ml.put_datafeed.go +++ b/esapi/api.xpack.ml.put_datafeed.go @@ -33,6 +33,11 @@ func newMLPutDatafeedFunc(t Transport) MLPutDatafeed { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type MLPutDatafeedRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPutDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPutDatafeedRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID)) @@ -83,6 +99,9 @@ func (r MLPutDatafeedRequest) Do(ctx context.Context, transport Transport) (*Res path.WriteString("datafeeds") path.WriteString("/") path.WriteString(r.DatafeedID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeed_id", r.DatafeedID) + } params = make(map[string]string) @@ -120,6 +139,9 @@ func (r MLPutDatafeedRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -151,8 +173,20 @@ func (r MLPutDatafeedRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.put_datafeed", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_datafeed") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.put_filter.go b/esapi/api.xpack.ml.put_filter.go index dcc6554800..9e2b0e3ff6 100644 --- a/esapi/api.xpack.ml.put_filter.go +++ b/esapi/api.xpack.ml.put_filter.go @@ -32,6 +32,11 @@ func newMLPutFilterFunc(t Transport) MLPutFilter { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLPutFilterRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPutFilterRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPutFilterRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_filter") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ml") + 1 + len("filters") + 1 + len(r.FilterID)) @@ -77,6 +93,9 @@ func (r MLPutFilterRequest) Do(ctx context.Context, transport Transport) (*Respo path.WriteString("filters") path.WriteString("/") path.WriteString(r.FilterID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "filter_id", r.FilterID) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r MLPutFilterRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r MLPutFilterRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_filter") + if reader := instrument.RecordRequestBody(ctx, "ml.put_filter", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_filter") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.put_job.go b/esapi/api.xpack.ml.put_job.go index 896b235cf0..ff3193deec 100644 --- a/esapi/api.xpack.ml.put_job.go +++ b/esapi/api.xpack.ml.put_job.go @@ -33,6 +33,11 @@ func newMLPutJobFunc(t Transport) MLPutJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type MLPutJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPutJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPutJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID)) @@ -83,6 +99,9 @@ func (r MLPutJobRequest) Do(ctx context.Context, transport Transport) (*Response path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } params = make(map[string]string) @@ -120,6 +139,9 @@ func (r MLPutJobRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -151,8 +173,20 @@ func (r MLPutJobRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_job") + if reader := instrument.RecordRequestBody(ctx, "ml.put_job", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.put_trained_model.go b/esapi/api.xpack.ml.put_trained_model.go index 3b89104a3c..b5c5890949 100644 --- a/esapi/api.xpack.ml.put_trained_model.go +++ b/esapi/api.xpack.ml.put_trained_model.go @@ -33,6 +33,11 @@ func newMLPutTrainedModelFunc(t Transport) MLPutTrainedModel { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type MLPutTrainedModelRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPutTrainedModelRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPutTrainedModelRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_trained_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID)) @@ -81,6 +97,9 @@ func (r MLPutTrainedModelRequest) Do(ctx context.Context, transport Transport) ( path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } params = make(map[string]string) @@ -110,6 +129,9 @@ func (r MLPutTrainedModelRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -141,8 +163,20 @@ func (r MLPutTrainedModelRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_trained_model") + if reader := instrument.RecordRequestBody(ctx, "ml.put_trained_model", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_trained_model") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.put_trained_model_alias.go b/esapi/api.xpack.ml.put_trained_model_alias.go index ad9037bcc9..e3d2cd54d6 100644 --- a/esapi/api.xpack.ml.put_trained_model_alias.go +++ b/esapi/api.xpack.ml.put_trained_model_alias.go @@ -32,6 +32,11 @@ func newMLPutTrainedModelAliasFunc(t Transport) MLPutTrainedModelAlias { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type MLPutTrainedModelAliasRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPutTrainedModelAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPutTrainedModelAliasRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_trained_model_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("model_aliases") + 1 + len(r.ModelAlias)) @@ -78,10 +94,16 @@ func (r MLPutTrainedModelAliasRequest) Do(ctx context.Context, transport Transpo path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } path.WriteString("/") path.WriteString("model_aliases") path.WriteString("/") path.WriteString(r.ModelAlias) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_alias", r.ModelAlias) + } params = make(map[string]string) @@ -107,6 +129,9 @@ func (r MLPutTrainedModelAliasRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +159,17 @@ func (r MLPutTrainedModelAliasRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_trained_model_alias") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_trained_model_alias") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.put_trained_model_definition_part.go b/esapi/api.xpack.ml.put_trained_model_definition_part.go index 71f74b232c..9a99013850 100644 --- a/esapi/api.xpack.ml.put_trained_model_definition_part.go +++ b/esapi/api.xpack.ml.put_trained_model_definition_part.go @@ -34,6 +34,11 @@ func newMLPutTrainedModelDefinitionPartFunc(t Transport) MLPutTrainedModelDefini for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type MLPutTrainedModelDefinitionPartRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPutTrainedModelDefinitionPartRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPutTrainedModelDefinitionPartRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_trained_model_definition_part") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" if r.Part == nil { @@ -84,10 +100,16 @@ func (r MLPutTrainedModelDefinitionPartRequest) Do(ctx context.Context, transpor path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } path.WriteString("/") path.WriteString("definition") path.WriteString("/") path.WriteString(strconv.Itoa(*r.Part)) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "part", strconv.Itoa(*r.Part)) + } params = make(map[string]string) @@ -109,6 +131,9 @@ func (r MLPutTrainedModelDefinitionPartRequest) Do(ctx context.Context, transpor req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +165,20 @@ func (r MLPutTrainedModelDefinitionPartRequest) Do(ctx context.Context, transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_trained_model_definition_part") + if reader := instrument.RecordRequestBody(ctx, "ml.put_trained_model_definition_part", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_trained_model_definition_part") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.put_trained_model_vocabulary.go b/esapi/api.xpack.ml.put_trained_model_vocabulary.go index beff128816..9cf69609bd 100644 --- a/esapi/api.xpack.ml.put_trained_model_vocabulary.go +++ b/esapi/api.xpack.ml.put_trained_model_vocabulary.go @@ -32,6 +32,11 @@ func newMLPutTrainedModelVocabularyFunc(t Transport) MLPutTrainedModelVocabulary for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLPutTrainedModelVocabularyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLPutTrainedModelVocabularyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLPutTrainedModelVocabularyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_trained_model_vocabulary") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("vocabulary")) @@ -77,6 +93,9 @@ func (r MLPutTrainedModelVocabularyRequest) Do(ctx context.Context, transport Tr path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } path.WriteString("/") path.WriteString("vocabulary") @@ -100,6 +119,9 @@ func (r MLPutTrainedModelVocabularyRequest) Do(ctx context.Context, transport Tr req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,20 @@ func (r MLPutTrainedModelVocabularyRequest) Do(ctx context.Context, transport Tr req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_trained_model_vocabulary") + if reader := instrument.RecordRequestBody(ctx, "ml.put_trained_model_vocabulary", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_trained_model_vocabulary") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.reset_job.go b/esapi/api.xpack.ml.reset_job.go index c828c5b974..0ca13a6de3 100644 --- a/esapi/api.xpack.ml.reset_job.go +++ b/esapi/api.xpack.ml.reset_job.go @@ -32,6 +32,11 @@ func newMLResetJobFunc(t Transport) MLResetJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type MLResetJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLResetJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLResetJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.reset_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_reset")) @@ -78,6 +94,9 @@ func (r MLResetJobRequest) Do(ctx context.Context, transport Transport) (*Respon path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("_reset") @@ -109,6 +128,9 @@ func (r MLResetJobRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -136,8 +158,17 @@ func (r MLResetJobRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.reset_job") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.reset_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.revert_model_snapshot.go b/esapi/api.xpack.ml.revert_model_snapshot.go index f555ee8ae7..273565b34f 100644 --- a/esapi/api.xpack.ml.revert_model_snapshot.go +++ b/esapi/api.xpack.ml.revert_model_snapshot.go @@ -33,6 +33,11 @@ func newMLRevertModelSnapshotFunc(t Transport) MLRevertModelSnapshot { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type MLRevertModelSnapshotRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLRevertModelSnapshotRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLRevertModelSnapshotRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.revert_model_snapshot") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID) + 1 + len("_revert")) @@ -81,10 +97,16 @@ func (r MLRevertModelSnapshotRequest) Do(ctx context.Context, transport Transpor path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") path.WriteString(r.SnapshotID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot_id", r.SnapshotID) + } path.WriteString("/") path.WriteString("_revert") @@ -112,6 +134,9 @@ func (r MLRevertModelSnapshotRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -143,8 +168,20 @@ func (r MLRevertModelSnapshotRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.revert_model_snapshot") + if reader := instrument.RecordRequestBody(ctx, "ml.revert_model_snapshot", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.revert_model_snapshot") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.set_upgrade_mode.go b/esapi/api.xpack.ml.set_upgrade_mode.go index 0365e13fa1..feff58a26c 100644 --- a/esapi/api.xpack.ml.set_upgrade_mode.go +++ b/esapi/api.xpack.ml.set_upgrade_mode.go @@ -33,6 +33,11 @@ func newMLSetUpgradeModeFunc(t Transport) MLSetUpgradeMode { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLSetUpgradeModeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLSetUpgradeModeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLSetUpgradeModeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.set_upgrade_mode") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_ml/set_upgrade_mode")) @@ -101,6 +117,9 @@ func (r MLSetUpgradeModeRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +147,17 @@ func (r MLSetUpgradeModeRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.set_upgrade_mode") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.set_upgrade_mode") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.start_data_frame_analytics.go b/esapi/api.xpack.ml.start_data_frame_analytics.go index ae5da9ef93..a4b6458a52 100644 --- a/esapi/api.xpack.ml.start_data_frame_analytics.go +++ b/esapi/api.xpack.ml.start_data_frame_analytics.go @@ -33,6 +33,11 @@ func newMLStartDataFrameAnalyticsFunc(t Transport) MLStartDataFrameAnalytics { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type MLStartDataFrameAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLStartDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLStartDataFrameAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.start_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID) + 1 + len("_start")) @@ -82,6 +98,9 @@ func (r MLStartDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tran path.WriteString("analytics") path.WriteString("/") path.WriteString(r.ID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.ID) + } path.WriteString("/") path.WriteString("_start") @@ -109,6 +128,9 @@ func (r MLStartDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +162,20 @@ func (r MLStartDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.start_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.start_data_frame_analytics", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.start_data_frame_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.start_datafeed.go b/esapi/api.xpack.ml.start_datafeed.go index adc1b3c0fa..9b62119ceb 100644 --- a/esapi/api.xpack.ml.start_datafeed.go +++ b/esapi/api.xpack.ml.start_datafeed.go @@ -33,6 +33,11 @@ func newMLStartDatafeedFunc(t Transport) MLStartDatafeed { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type MLStartDatafeedRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLStartDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLStartDatafeedRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.start_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID) + 1 + len("_start")) @@ -82,6 +98,9 @@ func (r MLStartDatafeedRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("datafeeds") path.WriteString("/") path.WriteString(r.DatafeedID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeed_id", r.DatafeedID) + } path.WriteString("/") path.WriteString("_start") @@ -117,6 +136,9 @@ func (r MLStartDatafeedRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -148,8 +170,20 @@ func (r MLStartDatafeedRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.start_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.start_datafeed", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.start_datafeed") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.start_trained_model_deployment.go b/esapi/api.xpack.ml.start_trained_model_deployment.go index 15b4a0ccc2..6ff6639367 100644 --- a/esapi/api.xpack.ml.start_trained_model_deployment.go +++ b/esapi/api.xpack.ml.start_trained_model_deployment.go @@ -33,6 +33,11 @@ func newMLStartTrainedModelDeploymentFunc(t Transport) MLStartTrainedModelDeploy for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -65,16 +70,27 @@ type MLStartTrainedModelDeploymentRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLStartTrainedModelDeploymentRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLStartTrainedModelDeploymentRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.start_trained_model_deployment") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("deployment") + 1 + len("_start")) @@ -85,6 +101,9 @@ func (r MLStartTrainedModelDeploymentRequest) Do(ctx context.Context, transport path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } path.WriteString("/") path.WriteString("deployment") path.WriteString("/") @@ -142,6 +161,9 @@ func (r MLStartTrainedModelDeploymentRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -169,8 +191,17 @@ func (r MLStartTrainedModelDeploymentRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.start_trained_model_deployment") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.start_trained_model_deployment") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.stop_data_frame_analytics.go b/esapi/api.xpack.ml.stop_data_frame_analytics.go index 70aec9aebe..b150427270 100644 --- a/esapi/api.xpack.ml.stop_data_frame_analytics.go +++ b/esapi/api.xpack.ml.stop_data_frame_analytics.go @@ -34,6 +34,11 @@ func newMLStopDataFrameAnalyticsFunc(t Transport) MLStopDataFrameAnalytics { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type MLStopDataFrameAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLStopDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLStopDataFrameAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.stop_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID) + 1 + len("_stop")) @@ -85,6 +101,9 @@ func (r MLStopDataFrameAnalyticsRequest) Do(ctx context.Context, transport Trans path.WriteString("analytics") path.WriteString("/") path.WriteString(r.ID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.ID) + } path.WriteString("/") path.WriteString("_stop") @@ -120,6 +139,9 @@ func (r MLStopDataFrameAnalyticsRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -151,8 +173,20 @@ func (r MLStopDataFrameAnalyticsRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.stop_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.stop_data_frame_analytics", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.stop_data_frame_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.stop_datafeed.go b/esapi/api.xpack.ml.stop_datafeed.go index ecf72e9ffc..f178a34c4a 100644 --- a/esapi/api.xpack.ml.stop_datafeed.go +++ b/esapi/api.xpack.ml.stop_datafeed.go @@ -34,6 +34,11 @@ func newMLStopDatafeedFunc(t Transport) MLStopDatafeed { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type MLStopDatafeedRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLStopDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLStopDatafeedRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.stop_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID) + 1 + len("_stop")) @@ -84,6 +100,9 @@ func (r MLStopDatafeedRequest) Do(ctx context.Context, transport Transport) (*Re path.WriteString("datafeeds") path.WriteString("/") path.WriteString(r.DatafeedID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeed_id", r.DatafeedID) + } path.WriteString("/") path.WriteString("_stop") @@ -123,6 +142,9 @@ func (r MLStopDatafeedRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -154,8 +176,20 @@ func (r MLStopDatafeedRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.stop_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.stop_datafeed", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.stop_datafeed") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.stop_trained_model_deployment.go b/esapi/api.xpack.ml.stop_trained_model_deployment.go index a660047616..42a3808ef3 100644 --- a/esapi/api.xpack.ml.stop_trained_model_deployment.go +++ b/esapi/api.xpack.ml.stop_trained_model_deployment.go @@ -33,6 +33,11 @@ func newMLStopTrainedModelDeploymentFunc(t Transport) MLStopTrainedModelDeployme for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type MLStopTrainedModelDeploymentRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLStopTrainedModelDeploymentRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLStopTrainedModelDeploymentRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.stop_trained_model_deployment") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("deployment") + 1 + len("_stop")) @@ -81,6 +97,9 @@ func (r MLStopTrainedModelDeploymentRequest) Do(ctx context.Context, transport T path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } path.WriteString("/") path.WriteString("deployment") path.WriteString("/") @@ -114,6 +133,9 @@ func (r MLStopTrainedModelDeploymentRequest) Do(ctx context.Context, transport T req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -145,8 +167,20 @@ func (r MLStopTrainedModelDeploymentRequest) Do(ctx context.Context, transport T req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.stop_trained_model_deployment") + if reader := instrument.RecordRequestBody(ctx, "ml.stop_trained_model_deployment", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.stop_trained_model_deployment") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.update_data_frame_analytics.go b/esapi/api.xpack.ml.update_data_frame_analytics.go index 7ae9130a2a..f5795c61e3 100644 --- a/esapi/api.xpack.ml.update_data_frame_analytics.go +++ b/esapi/api.xpack.ml.update_data_frame_analytics.go @@ -32,6 +32,11 @@ func newMLUpdateDataFrameAnalyticsFunc(t Transport) MLUpdateDataFrameAnalytics { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLUpdateDataFrameAnalyticsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLUpdateDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLUpdateDataFrameAnalyticsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.DocumentID) + 1 + len("_update")) @@ -79,6 +95,9 @@ func (r MLUpdateDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tra path.WriteString("analytics") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } path.WriteString("/") path.WriteString("_update") @@ -102,6 +121,9 @@ func (r MLUpdateDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,20 @@ func (r MLUpdateDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.update_data_frame_analytics", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_data_frame_analytics") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.update_datafeed.go b/esapi/api.xpack.ml.update_datafeed.go index 7b4bd45bdb..2f0efb5573 100644 --- a/esapi/api.xpack.ml.update_datafeed.go +++ b/esapi/api.xpack.ml.update_datafeed.go @@ -33,6 +33,11 @@ func newMLUpdateDatafeedFunc(t Transport) MLUpdateDatafeed { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type MLUpdateDatafeedRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLUpdateDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLUpdateDatafeedRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID) + 1 + len("_update")) @@ -83,6 +99,9 @@ func (r MLUpdateDatafeedRequest) Do(ctx context.Context, transport Transport) (* path.WriteString("datafeeds") path.WriteString("/") path.WriteString(r.DatafeedID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeed_id", r.DatafeedID) + } path.WriteString("/") path.WriteString("_update") @@ -122,6 +141,9 @@ func (r MLUpdateDatafeedRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -153,8 +175,20 @@ func (r MLUpdateDatafeedRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.update_datafeed", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_datafeed") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.update_filter.go b/esapi/api.xpack.ml.update_filter.go index a6ce56716b..e35fd196a9 100644 --- a/esapi/api.xpack.ml.update_filter.go +++ b/esapi/api.xpack.ml.update_filter.go @@ -32,6 +32,11 @@ func newMLUpdateFilterFunc(t Transport) MLUpdateFilter { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLUpdateFilterRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLUpdateFilterRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLUpdateFilterRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_filter") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("filters") + 1 + len(r.FilterID) + 1 + len("_update")) @@ -77,6 +93,9 @@ func (r MLUpdateFilterRequest) Do(ctx context.Context, transport Transport) (*Re path.WriteString("filters") path.WriteString("/") path.WriteString(r.FilterID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "filter_id", r.FilterID) + } path.WriteString("/") path.WriteString("_update") @@ -100,6 +119,9 @@ func (r MLUpdateFilterRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,20 @@ func (r MLUpdateFilterRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_filter") + if reader := instrument.RecordRequestBody(ctx, "ml.update_filter", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_filter") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.update_job.go b/esapi/api.xpack.ml.update_job.go index 16db52cc4c..fbd935b3e6 100644 --- a/esapi/api.xpack.ml.update_job.go +++ b/esapi/api.xpack.ml.update_job.go @@ -32,6 +32,11 @@ func newMLUpdateJobFunc(t Transport) MLUpdateJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type MLUpdateJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLUpdateJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLUpdateJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_update")) @@ -77,6 +93,9 @@ func (r MLUpdateJobRequest) Do(ctx context.Context, transport Transport) (*Respo path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("_update") @@ -100,6 +119,9 @@ func (r MLUpdateJobRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,20 @@ func (r MLUpdateJobRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_job") + if reader := instrument.RecordRequestBody(ctx, "ml.update_job", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.update_model_snapshot.go b/esapi/api.xpack.ml.update_model_snapshot.go index 6e39e97313..e428a7702d 100644 --- a/esapi/api.xpack.ml.update_model_snapshot.go +++ b/esapi/api.xpack.ml.update_model_snapshot.go @@ -32,6 +32,11 @@ func newMLUpdateModelSnapshotFunc(t Transport) MLUpdateModelSnapshot { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type MLUpdateModelSnapshotRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLUpdateModelSnapshotRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLUpdateModelSnapshotRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_model_snapshot") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID) + 1 + len("_update")) @@ -78,10 +94,16 @@ func (r MLUpdateModelSnapshotRequest) Do(ctx context.Context, transport Transpor path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") path.WriteString(r.SnapshotID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot_id", r.SnapshotID) + } path.WriteString("/") path.WriteString("_update") @@ -105,6 +127,9 @@ func (r MLUpdateModelSnapshotRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -136,8 +161,20 @@ func (r MLUpdateModelSnapshotRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_model_snapshot") + if reader := instrument.RecordRequestBody(ctx, "ml.update_model_snapshot", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_model_snapshot") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.update_trained_model_deployment.go b/esapi/api.xpack.ml.update_trained_model_deployment.go index e006c38f2b..72d963fc30 100644 --- a/esapi/api.xpack.ml.update_trained_model_deployment.go +++ b/esapi/api.xpack.ml.update_trained_model_deployment.go @@ -32,6 +32,11 @@ func newMLUpdateTrainedModelDeploymentFunc(t Transport) MLUpdateTrainedModelDepl for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type MLUpdateTrainedModelDeploymentRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLUpdateTrainedModelDeploymentRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLUpdateTrainedModelDeploymentRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_trained_model_deployment") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("deployment") + 1 + len("_update")) @@ -79,6 +95,9 @@ func (r MLUpdateTrainedModelDeploymentRequest) Do(ctx context.Context, transport path.WriteString("trained_models") path.WriteString("/") path.WriteString(r.ModelID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "model_id", r.ModelID) + } path.WriteString("/") path.WriteString("deployment") path.WriteString("/") @@ -104,6 +123,9 @@ func (r MLUpdateTrainedModelDeploymentRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,20 @@ func (r MLUpdateTrainedModelDeploymentRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_trained_model_deployment") + if reader := instrument.RecordRequestBody(ctx, "ml.update_trained_model_deployment", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_trained_model_deployment") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.upgrade_job_snapshot.go b/esapi/api.xpack.ml.upgrade_job_snapshot.go index 85e7a4b7f7..718eb1e3e7 100644 --- a/esapi/api.xpack.ml.upgrade_job_snapshot.go +++ b/esapi/api.xpack.ml.upgrade_job_snapshot.go @@ -33,6 +33,11 @@ func newMLUpgradeJobSnapshotFunc(t Transport) MLUpgradeJobSnapshot { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type MLUpgradeJobSnapshotRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLUpgradeJobSnapshotRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLUpgradeJobSnapshotRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.upgrade_job_snapshot") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID) + 1 + len("_upgrade")) @@ -80,10 +96,16 @@ func (r MLUpgradeJobSnapshotRequest) Do(ctx context.Context, transport Transport path.WriteString("anomaly_detectors") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "job_id", r.JobID) + } path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") path.WriteString(r.SnapshotID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot_id", r.SnapshotID) + } path.WriteString("/") path.WriteString("_upgrade") @@ -115,6 +137,9 @@ func (r MLUpgradeJobSnapshotRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -142,8 +167,17 @@ func (r MLUpgradeJobSnapshotRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.upgrade_job_snapshot") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.upgrade_job_snapshot") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.validate.go b/esapi/api.xpack.ml.validate.go index 13b3ff6839..f4a4ec0438 100644 --- a/esapi/api.xpack.ml.validate.go +++ b/esapi/api.xpack.ml.validate.go @@ -32,6 +32,11 @@ func newMLValidateFunc(t Transport) MLValidate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type MLValidateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLValidateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLValidateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.validate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_ml/anomaly_detectors/_validate")) @@ -91,6 +107,9 @@ func (r MLValidateRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r MLValidateRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.validate") + if reader := instrument.RecordRequestBody(ctx, "ml.validate", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.validate") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ml.validate_detector.go b/esapi/api.xpack.ml.validate_detector.go index bb86285f80..7820849551 100644 --- a/esapi/api.xpack.ml.validate_detector.go +++ b/esapi/api.xpack.ml.validate_detector.go @@ -32,6 +32,11 @@ func newMLValidateDetectorFunc(t Transport) MLValidateDetector { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type MLValidateDetectorRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MLValidateDetectorRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MLValidateDetectorRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.validate_detector") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_ml/anomaly_detectors/_validate/detector")) @@ -91,6 +107,9 @@ func (r MLValidateDetectorRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r MLValidateDetectorRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ml.validate_detector") + if reader := instrument.RecordRequestBody(ctx, "ml.validate_detector", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.validate_detector") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.monitoring.bulk.go b/esapi/api.xpack.monitoring.bulk.go index 517b4c606b..3390ecf912 100644 --- a/esapi/api.xpack.monitoring.bulk.go +++ b/esapi/api.xpack.monitoring.bulk.go @@ -32,6 +32,11 @@ func newMonitoringBulkFunc(t Transport) MonitoringBulk { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type MonitoringBulkRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r MonitoringBulkRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r MonitoringBulkRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "monitoring.bulk") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_monitoring") + 1 + len(r.DocumentType) + 1 + len("bulk")) @@ -80,6 +96,9 @@ func (r MonitoringBulkRequest) Do(ctx context.Context, transport Transport) (*Re if r.DocumentType != "" { path.WriteString("/") path.WriteString(r.DocumentType) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "type", r.DocumentType) + } } path.WriteString("/") path.WriteString("bulk") @@ -116,6 +135,9 @@ func (r MonitoringBulkRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -147,8 +169,20 @@ func (r MonitoringBulkRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "monitoring.bulk") + if reader := instrument.RecordRequestBody(ctx, "monitoring.bulk", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "monitoring.bulk") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.open_point_in_time.go b/esapi/api.xpack.open_point_in_time.go index d1e3a644fe..9913771cf9 100644 --- a/esapi/api.xpack.open_point_in_time.go +++ b/esapi/api.xpack.open_point_in_time.go @@ -22,6 +22,7 @@ package esapi import ( "context" "errors" + "io" "net/http" "strconv" "strings" @@ -33,6 +34,11 @@ func newOpenPointInTimeFunc(t Transport) OpenPointInTime { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -48,6 +54,8 @@ type OpenPointInTime func(index []string, keep_alive string, o ...func(*OpenPoin type OpenPointInTimeRequest struct { Index []string + Body io.Reader + ExpandWildcards string IgnoreUnavailable *bool KeepAlive string @@ -62,16 +70,27 @@ type OpenPointInTimeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r OpenPointInTimeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r OpenPointInTimeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "open_point_in_time") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -82,6 +101,9 @@ func (r OpenPointInTimeRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_pit") @@ -123,8 +145,11 @@ func (r OpenPointInTimeRequest) Do(ctx context.Context, transport Transport) (*R params["filter_path"] = strings.Join(r.FilterPath, ",") } - req, err := newRequest(method, path.String(), nil) + req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -148,12 +173,28 @@ func (r OpenPointInTimeRequest) Do(ctx context.Context, transport Transport) (*R } } + if r.Body != nil && req.Header.Get(headerContentType) == "" { + req.Header[headerContentType] = headerContentTypeJSON + } + if ctx != nil { req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "open_point_in_time") + if reader := instrument.RecordRequestBody(ctx, "open_point_in_time", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "open_point_in_time") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +214,13 @@ func (f OpenPointInTime) WithContext(v context.Context) func(*OpenPointInTimeReq } } +// WithBody - An index_filter specified with the Query DSL. +func (f OpenPointInTime) WithBody(v io.Reader) func(*OpenPointInTimeRequest) { + return func(r *OpenPointInTimeRequest) { + r.Body = v + } +} + // WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. func (f OpenPointInTime) WithExpandWildcards(v string) func(*OpenPointInTimeRequest) { return func(r *OpenPointInTimeRequest) { diff --git a/esapi/api.xpack.rollup.delete_job.go b/esapi/api.xpack.rollup.delete_job.go index ec78aef7d9..c265ac9a05 100644 --- a/esapi/api.xpack.rollup.delete_job.go +++ b/esapi/api.xpack.rollup.delete_job.go @@ -31,6 +31,11 @@ func newRollupDeleteJobFunc(t Transport) RollupDeleteJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type RollupDeleteJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r RollupDeleteJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r RollupDeleteJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.delete_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_rollup") + 1 + len("job") + 1 + len(r.JobID)) @@ -76,6 +92,9 @@ func (r RollupDeleteJobRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("job") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.JobID) + } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r RollupDeleteJobRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r RollupDeleteJobRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.delete_job") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.delete_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.rollup.get_jobs.go b/esapi/api.xpack.rollup.get_jobs.go index 7926d99082..46baf8177d 100644 --- a/esapi/api.xpack.rollup.get_jobs.go +++ b/esapi/api.xpack.rollup.get_jobs.go @@ -31,6 +31,11 @@ func newRollupGetJobsFunc(t Transport) RollupGetJobs { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type RollupGetJobsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r RollupGetJobsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r RollupGetJobsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.get_jobs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_rollup") + 1 + len("job") + 1 + len(r.JobID)) @@ -77,6 +93,9 @@ func (r RollupGetJobsRequest) Do(ctx context.Context, transport Transport) (*Res if r.JobID != "" { path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.JobID) + } } params = make(map[string]string) @@ -99,6 +118,9 @@ func (r RollupGetJobsRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -126,8 +148,17 @@ func (r RollupGetJobsRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.get_jobs") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.get_jobs") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.rollup.get_rollup_caps.go b/esapi/api.xpack.rollup.get_rollup_caps.go index c6a1c0bb9b..5e3a01263a 100644 --- a/esapi/api.xpack.rollup.get_rollup_caps.go +++ b/esapi/api.xpack.rollup.get_rollup_caps.go @@ -31,6 +31,11 @@ func newRollupGetRollupCapsFunc(t Transport) RollupGetRollupCaps { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type RollupGetRollupCapsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r RollupGetRollupCapsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r RollupGetRollupCapsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.get_rollup_caps") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_rollup") + 1 + len("data") + 1 + len(r.Index)) @@ -77,6 +93,9 @@ func (r RollupGetRollupCapsRequest) Do(ctx context.Context, transport Transport) if r.Index != "" { path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.Index) + } } params = make(map[string]string) @@ -99,6 +118,9 @@ func (r RollupGetRollupCapsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -126,8 +148,17 @@ func (r RollupGetRollupCapsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.get_rollup_caps") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.get_rollup_caps") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.rollup.get_rollup_index_caps.go b/esapi/api.xpack.rollup.get_rollup_index_caps.go index ebda16fca6..a0d7dd12e9 100644 --- a/esapi/api.xpack.rollup.get_rollup_index_caps.go +++ b/esapi/api.xpack.rollup.get_rollup_index_caps.go @@ -31,6 +31,11 @@ func newRollupGetRollupIndexCapsFunc(t Transport) RollupGetRollupIndexCaps { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,22 +61,36 @@ type RollupGetRollupIndexCapsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r RollupGetRollupIndexCapsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r RollupGetRollupIndexCapsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.get_rollup_index_caps") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(r.Index) + 1 + len("_rollup") + 1 + len("data")) path.WriteString("http://") path.WriteString("/") path.WriteString(r.Index) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.Index) + } path.WriteString("/") path.WriteString("_rollup") path.WriteString("/") @@ -97,6 +116,9 @@ func (r RollupGetRollupIndexCapsRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r RollupGetRollupIndexCapsRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.get_rollup_index_caps") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.get_rollup_index_caps") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.rollup.put_job.go b/esapi/api.xpack.rollup.put_job.go index 07630f5b93..c1e7a2e258 100644 --- a/esapi/api.xpack.rollup.put_job.go +++ b/esapi/api.xpack.rollup.put_job.go @@ -32,6 +32,11 @@ func newRollupPutJobFunc(t Transport) RollupPutJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type RollupPutJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r RollupPutJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r RollupPutJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.put_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_rollup") + 1 + len("job") + 1 + len(r.JobID)) @@ -79,6 +95,9 @@ func (r RollupPutJobRequest) Do(ctx context.Context, transport Transport) (*Resp path.WriteString("job") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.JobID) + } params = make(map[string]string) @@ -100,6 +119,9 @@ func (r RollupPutJobRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,20 @@ func (r RollupPutJobRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.put_job") + if reader := instrument.RecordRequestBody(ctx, "rollup.put_job", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.put_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.rollup.rollup_search.go b/esapi/api.xpack.rollup.rollup_search.go index b735ad0130..6f2e8fec8a 100644 --- a/esapi/api.xpack.rollup.rollup_search.go +++ b/esapi/api.xpack.rollup.rollup_search.go @@ -34,6 +34,11 @@ func newRollupRollupSearchFunc(t Transport) RollupRollupSearch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type RollupRollupSearchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r RollupRollupSearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r RollupRollupSearchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.rollup_search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Index) == 0 { @@ -84,6 +100,9 @@ func (r RollupRollupSearchRequest) Do(ctx context.Context, transport Transport) path.WriteString("http://") path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } path.WriteString("/") path.WriteString("_rollup_search") @@ -115,6 +134,9 @@ func (r RollupRollupSearchRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -146,8 +168,20 @@ func (r RollupRollupSearchRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.rollup_search") + if reader := instrument.RecordRequestBody(ctx, "rollup.rollup_search", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.rollup_search") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.rollup.start_job.go b/esapi/api.xpack.rollup.start_job.go index 6b1757e1d8..dadb878111 100644 --- a/esapi/api.xpack.rollup.start_job.go +++ b/esapi/api.xpack.rollup.start_job.go @@ -31,6 +31,11 @@ func newRollupStartJobFunc(t Transport) RollupStartJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type RollupStartJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r RollupStartJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r RollupStartJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.start_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_rollup") + 1 + len("job") + 1 + len(r.JobID) + 1 + len("_start")) @@ -76,6 +92,9 @@ func (r RollupStartJobRequest) Do(ctx context.Context, transport Transport) (*Re path.WriteString("job") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.JobID) + } path.WriteString("/") path.WriteString("_start") @@ -99,6 +118,9 @@ func (r RollupStartJobRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -126,8 +148,17 @@ func (r RollupStartJobRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.start_job") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.start_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.rollup.stop_job.go b/esapi/api.xpack.rollup.stop_job.go index aa794769a4..2a06233cd2 100644 --- a/esapi/api.xpack.rollup.stop_job.go +++ b/esapi/api.xpack.rollup.stop_job.go @@ -33,6 +33,11 @@ func newRollupStopJobFunc(t Transport) RollupStopJob { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type RollupStopJobRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r RollupStopJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r RollupStopJobRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.stop_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_rollup") + 1 + len("job") + 1 + len(r.JobID) + 1 + len("_stop")) @@ -81,6 +97,9 @@ func (r RollupStopJobRequest) Do(ctx context.Context, transport Transport) (*Res path.WriteString("job") path.WriteString("/") path.WriteString(r.JobID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.JobID) + } path.WriteString("/") path.WriteString("_stop") @@ -112,6 +131,9 @@ func (r RollupStopJobRequest) Do(ctx context.Context, transport Transport) (*Res req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -139,8 +161,17 @@ func (r RollupStopJobRequest) Do(ctx context.Context, transport Transport) (*Res req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.stop_job") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.stop_job") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.searchable_snapshots.cache_stats.go b/esapi/api.xpack.searchable_snapshots.cache_stats.go index 45ad507f7b..1660a2a058 100644 --- a/esapi/api.xpack.searchable_snapshots.cache_stats.go +++ b/esapi/api.xpack.searchable_snapshots.cache_stats.go @@ -31,6 +31,11 @@ func newSearchableSnapshotsCacheStatsFunc(t Transport) SearchableSnapshotsCacheS for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SearchableSnapshotsCacheStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchableSnapshotsCacheStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchableSnapshotsCacheStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.cache_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_searchable_snapshots") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len("cache") + 1 + len("stats")) @@ -75,6 +91,9 @@ func (r SearchableSnapshotsCacheStatsRequest) Do(ctx context.Context, transport if len(r.NodeID) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.NodeID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "node_id", strings.Join(r.NodeID, ",")) + } } path.WriteString("/") path.WriteString("cache") @@ -101,6 +120,9 @@ func (r SearchableSnapshotsCacheStatsRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +150,17 @@ func (r SearchableSnapshotsCacheStatsRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "searchable_snapshots.cache_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "searchable_snapshots.cache_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.searchable_snapshots.clear_cache.go b/esapi/api.xpack.searchable_snapshots.clear_cache.go index 33c2fb948c..0644725529 100644 --- a/esapi/api.xpack.searchable_snapshots.clear_cache.go +++ b/esapi/api.xpack.searchable_snapshots.clear_cache.go @@ -32,6 +32,11 @@ func newSearchableSnapshotsClearCacheFunc(t Transport) SearchableSnapshotsClearC for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type SearchableSnapshotsClearCacheRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchableSnapshotsClearCacheRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchableSnapshotsClearCacheRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.clear_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_searchable_snapshots") + 1 + len("cache") + 1 + len("clear")) @@ -78,6 +94,9 @@ func (r SearchableSnapshotsClearCacheRequest) Do(ctx context.Context, transport if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_searchable_snapshots") @@ -122,6 +141,9 @@ func (r SearchableSnapshotsClearCacheRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -149,8 +171,17 @@ func (r SearchableSnapshotsClearCacheRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "searchable_snapshots.clear_cache") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "searchable_snapshots.clear_cache") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.searchable_snapshots.mount.go b/esapi/api.xpack.searchable_snapshots.mount.go index 27c2fffa85..28cff3e768 100644 --- a/esapi/api.xpack.searchable_snapshots.mount.go +++ b/esapi/api.xpack.searchable_snapshots.mount.go @@ -34,6 +34,11 @@ func newSearchableSnapshotsMountFunc(t Transport) SearchableSnapshotsMount { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -64,16 +69,27 @@ type SearchableSnapshotsMountRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchableSnapshotsMountRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchableSnapshotsMountRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.mount") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(r.Snapshot) + 1 + len("_mount")) @@ -82,8 +98,14 @@ func (r SearchableSnapshotsMountRequest) Do(ctx context.Context, transport Trans path.WriteString("_snapshot") path.WriteString("/") path.WriteString(r.Repository) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.Repository) + } path.WriteString("/") path.WriteString(r.Snapshot) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.Snapshot) + } path.WriteString("/") path.WriteString("_mount") @@ -119,6 +141,9 @@ func (r SearchableSnapshotsMountRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -150,8 +175,20 @@ func (r SearchableSnapshotsMountRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "searchable_snapshots.mount") + if reader := instrument.RecordRequestBody(ctx, "searchable_snapshots.mount", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "searchable_snapshots.mount") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.searchable_snapshots.stats.go b/esapi/api.xpack.searchable_snapshots.stats.go index 4fd3ea7fa2..944154ea0d 100644 --- a/esapi/api.xpack.searchable_snapshots.stats.go +++ b/esapi/api.xpack.searchable_snapshots.stats.go @@ -31,6 +31,11 @@ func newSearchableSnapshotsStatsFunc(t Transport) SearchableSnapshotsStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SearchableSnapshotsStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SearchableSnapshotsStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SearchableSnapshotsStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len(strings.Join(r.Index, ",")) + 1 + len("_searchable_snapshots") + 1 + len("stats")) @@ -73,6 +89,9 @@ func (r SearchableSnapshotsStatsRequest) Do(ctx context.Context, transport Trans if len(r.Index) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Index, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", strings.Join(r.Index, ",")) + } } path.WriteString("/") path.WriteString("_searchable_snapshots") @@ -103,6 +122,9 @@ func (r SearchableSnapshotsStatsRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -130,8 +152,17 @@ func (r SearchableSnapshotsStatsRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "searchable_snapshots.stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "searchable_snapshots.stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.activate_user_profile.go b/esapi/api.xpack.security.activate_user_profile.go index 2287e79b73..b4879481ed 100644 --- a/esapi/api.xpack.security.activate_user_profile.go +++ b/esapi/api.xpack.security.activate_user_profile.go @@ -32,6 +32,11 @@ func newSecurityActivateUserProfileFunc(t Transport) SecurityActivateUserProfile for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityActivateUserProfileRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityActivateUserProfileRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityActivateUserProfileRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.activate_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/profile/_activate")) @@ -91,6 +107,9 @@ func (r SecurityActivateUserProfileRequest) Do(ctx context.Context, transport Tr req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecurityActivateUserProfileRequest) Do(ctx context.Context, transport Tr req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.activate_user_profile") + if reader := instrument.RecordRequestBody(ctx, "security.activate_user_profile", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.activate_user_profile") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.authenticate.go b/esapi/api.xpack.security.authenticate.go index 28480c1bdc..97cf419a03 100644 --- a/esapi/api.xpack.security.authenticate.go +++ b/esapi/api.xpack.security.authenticate.go @@ -31,6 +31,11 @@ func newSecurityAuthenticateFunc(t Transport) SecurityAuthenticate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SecurityAuthenticateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityAuthenticateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityAuthenticateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.authenticate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_security/_authenticate")) @@ -88,6 +104,9 @@ func (r SecurityAuthenticateRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SecurityAuthenticateRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.authenticate") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.authenticate") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.bulk_update_api_keys.go b/esapi/api.xpack.security.bulk_update_api_keys.go index fe575e3a0a..ed03b9bbd4 100644 --- a/esapi/api.xpack.security.bulk_update_api_keys.go +++ b/esapi/api.xpack.security.bulk_update_api_keys.go @@ -32,6 +32,11 @@ func newSecurityBulkUpdateAPIKeysFunc(t Transport) SecurityBulkUpdateAPIKeys { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityBulkUpdateAPIKeysRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityBulkUpdateAPIKeysRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityBulkUpdateAPIKeysRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.bulk_update_api_keys") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/api_key/_bulk_update")) @@ -91,6 +107,9 @@ func (r SecurityBulkUpdateAPIKeysRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecurityBulkUpdateAPIKeysRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.bulk_update_api_keys") + if reader := instrument.RecordRequestBody(ctx, "security.bulk_update_api_keys", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.bulk_update_api_keys") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.change_password.go b/esapi/api.xpack.security.change_password.go index 59b4a47a2d..827acda025 100644 --- a/esapi/api.xpack.security.change_password.go +++ b/esapi/api.xpack.security.change_password.go @@ -32,6 +32,11 @@ func newSecurityChangePasswordFunc(t Transport) SecurityChangePassword { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SecurityChangePasswordRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityChangePasswordRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityChangePasswordRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.change_password") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("user") + 1 + len(r.Username) + 1 + len("_password")) @@ -80,6 +96,9 @@ func (r SecurityChangePasswordRequest) Do(ctx context.Context, transport Transpo if r.Username != "" { path.WriteString("/") path.WriteString(r.Username) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.Username) + } } path.WriteString("/") path.WriteString("_password") @@ -108,6 +127,9 @@ func (r SecurityChangePasswordRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -139,8 +161,20 @@ func (r SecurityChangePasswordRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.change_password") + if reader := instrument.RecordRequestBody(ctx, "security.change_password", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.change_password") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.clear_api_key_cache.go b/esapi/api.xpack.security.clear_api_key_cache.go index a87fb0640e..e67dd9c5e5 100644 --- a/esapi/api.xpack.security.clear_api_key_cache.go +++ b/esapi/api.xpack.security.clear_api_key_cache.go @@ -32,6 +32,11 @@ func newSecurityClearAPIKeyCacheFunc(t Transport) SecurityClearAPIKeyCache { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityClearAPIKeyCacheRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityClearAPIKeyCacheRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityClearAPIKeyCacheRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_api_key_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Ids) == 0 { @@ -79,6 +95,9 @@ func (r SecurityClearAPIKeyCacheRequest) Do(ctx context.Context, transport Trans path.WriteString("api_key") path.WriteString("/") path.WriteString(strings.Join(r.Ids, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "ids", strings.Join(r.Ids, ",")) + } path.WriteString("/") path.WriteString("_clear_cache") @@ -102,6 +121,9 @@ func (r SecurityClearAPIKeyCacheRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,17 @@ func (r SecurityClearAPIKeyCacheRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.clear_api_key_cache") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.clear_api_key_cache") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.clear_cached_privileges.go b/esapi/api.xpack.security.clear_cached_privileges.go index 828f9d5326..0f86ff349d 100644 --- a/esapi/api.xpack.security.clear_cached_privileges.go +++ b/esapi/api.xpack.security.clear_cached_privileges.go @@ -32,6 +32,11 @@ func newSecurityClearCachedPrivilegesFunc(t Transport) SecurityClearCachedPrivil for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityClearCachedPrivilegesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityClearCachedPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityClearCachedPrivilegesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Application) == 0 { @@ -79,6 +95,9 @@ func (r SecurityClearCachedPrivilegesRequest) Do(ctx context.Context, transport path.WriteString("privilege") path.WriteString("/") path.WriteString(strings.Join(r.Application, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "application", strings.Join(r.Application, ",")) + } path.WriteString("/") path.WriteString("_clear_cache") @@ -102,6 +121,9 @@ func (r SecurityClearCachedPrivilegesRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,17 @@ func (r SecurityClearCachedPrivilegesRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.clear_cached_privileges") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.clear_cached_privileges") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.clear_cached_realms.go b/esapi/api.xpack.security.clear_cached_realms.go index 5bc35da26d..a92a29606e 100644 --- a/esapi/api.xpack.security.clear_cached_realms.go +++ b/esapi/api.xpack.security.clear_cached_realms.go @@ -32,6 +32,11 @@ func newSecurityClearCachedRealmsFunc(t Transport) SecurityClearCachedRealms { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityClearCachedRealmsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityClearCachedRealmsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityClearCachedRealmsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_realms") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Realms) == 0 { @@ -81,6 +97,9 @@ func (r SecurityClearCachedRealmsRequest) Do(ctx context.Context, transport Tran path.WriteString("realm") path.WriteString("/") path.WriteString(strings.Join(r.Realms, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "realms", strings.Join(r.Realms, ",")) + } path.WriteString("/") path.WriteString("_clear_cache") @@ -108,6 +127,9 @@ func (r SecurityClearCachedRealmsRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,17 @@ func (r SecurityClearCachedRealmsRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.clear_cached_realms") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.clear_cached_realms") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.clear_cached_roles.go b/esapi/api.xpack.security.clear_cached_roles.go index f185df9381..4c236fdb80 100644 --- a/esapi/api.xpack.security.clear_cached_roles.go +++ b/esapi/api.xpack.security.clear_cached_roles.go @@ -32,6 +32,11 @@ func newSecurityClearCachedRolesFunc(t Transport) SecurityClearCachedRoles { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityClearCachedRolesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityClearCachedRolesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityClearCachedRolesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_roles") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Name) == 0 { @@ -79,6 +95,9 @@ func (r SecurityClearCachedRolesRequest) Do(ctx context.Context, transport Trans path.WriteString("role") path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } path.WriteString("/") path.WriteString("_clear_cache") @@ -102,6 +121,9 @@ func (r SecurityClearCachedRolesRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,17 @@ func (r SecurityClearCachedRolesRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.clear_cached_roles") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.clear_cached_roles") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.clear_cached_service_tokens.go b/esapi/api.xpack.security.clear_cached_service_tokens.go index fb1af35ce3..e32a0c1cdf 100644 --- a/esapi/api.xpack.security.clear_cached_service_tokens.go +++ b/esapi/api.xpack.security.clear_cached_service_tokens.go @@ -32,6 +32,11 @@ func newSecurityClearCachedServiceTokensFunc(t Transport) SecurityClearCachedSer for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityClearCachedServiceTokensRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityClearCachedServiceTokensRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityClearCachedServiceTokensRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_service_tokens") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" if len(r.Name) == 0 { @@ -81,14 +97,23 @@ func (r SecurityClearCachedServiceTokensRequest) Do(ctx context.Context, transpo path.WriteString("service") path.WriteString("/") path.WriteString(r.Namespace) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.Namespace) + } path.WriteString("/") path.WriteString(r.Service) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.Service) + } path.WriteString("/") path.WriteString("credential") path.WriteString("/") path.WriteString("token") path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } path.WriteString("/") path.WriteString("_clear_cache") @@ -112,6 +137,9 @@ func (r SecurityClearCachedServiceTokensRequest) Do(ctx context.Context, transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -139,8 +167,17 @@ func (r SecurityClearCachedServiceTokensRequest) Do(ctx context.Context, transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.clear_cached_service_tokens") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.clear_cached_service_tokens") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.create_api_key.go b/esapi/api.xpack.security.create_api_key.go index 2b2236fb07..5d3b98be0c 100644 --- a/esapi/api.xpack.security.create_api_key.go +++ b/esapi/api.xpack.security.create_api_key.go @@ -32,6 +32,11 @@ func newSecurityCreateAPIKeyFunc(t Transport) SecurityCreateAPIKey { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityCreateAPIKeyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityCreateAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityCreateAPIKeyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.create_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + len("/_security/api_key")) @@ -97,6 +113,9 @@ func (r SecurityCreateAPIKeyRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +147,20 @@ func (r SecurityCreateAPIKeyRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.create_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.create_api_key", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.create_api_key") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.create_cross_cluster_api_key.go b/esapi/api.xpack.security.create_cross_cluster_api_key.go index e449868c45..35cdb9e466 100644 --- a/esapi/api.xpack.security.create_cross_cluster_api_key.go +++ b/esapi/api.xpack.security.create_cross_cluster_api_key.go @@ -32,6 +32,11 @@ func newSecurityCreateCrossClusterAPIKeyFunc(t Transport) SecurityCreateCrossClu for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityCreateCrossClusterAPIKeyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityCreateCrossClusterAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityCreateCrossClusterAPIKeyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.create_cross_cluster_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/cross_cluster/api_key")) @@ -93,6 +109,9 @@ func (r SecurityCreateCrossClusterAPIKeyRequest) Do(ctx context.Context, transpo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +143,20 @@ func (r SecurityCreateCrossClusterAPIKeyRequest) Do(ctx context.Context, transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.create_cross_cluster_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.create_cross_cluster_api_key", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.create_cross_cluster_api_key") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.create_service_token.go b/esapi/api.xpack.security.create_service_token.go index 2898a11445..5f5c876927 100644 --- a/esapi/api.xpack.security.create_service_token.go +++ b/esapi/api.xpack.security.create_service_token.go @@ -31,6 +31,11 @@ func newSecurityCreateServiceTokenFunc(t Transport) SecurityCreateServiceToken { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type SecurityCreateServiceTokenRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityCreateServiceTokenRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityCreateServiceTokenRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.create_service_token") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("service") + 1 + len(r.Namespace) + 1 + len(r.Service) + 1 + len("credential") + 1 + len("token") + 1 + len(r.Name)) @@ -78,8 +94,14 @@ func (r SecurityCreateServiceTokenRequest) Do(ctx context.Context, transport Tra path.WriteString("service") path.WriteString("/") path.WriteString(r.Namespace) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.Namespace) + } path.WriteString("/") path.WriteString(r.Service) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.Service) + } path.WriteString("/") path.WriteString("credential") path.WriteString("/") @@ -87,6 +109,9 @@ func (r SecurityCreateServiceTokenRequest) Do(ctx context.Context, transport Tra if r.Name != "" { path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } } params = make(map[string]string) @@ -113,6 +138,9 @@ func (r SecurityCreateServiceTokenRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +168,17 @@ func (r SecurityCreateServiceTokenRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.create_service_token") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.create_service_token") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.delete_privileges.go b/esapi/api.xpack.security.delete_privileges.go index f487676322..a79452a127 100644 --- a/esapi/api.xpack.security.delete_privileges.go +++ b/esapi/api.xpack.security.delete_privileges.go @@ -31,6 +31,11 @@ func newSecurityDeletePrivilegesFunc(t Transport) SecurityDeletePrivileges { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityDeletePrivilegesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityDeletePrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityDeletePrivilegesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_security") + 1 + len("privilege") + 1 + len(r.Application) + 1 + len(r.Name)) @@ -77,8 +93,14 @@ func (r SecurityDeletePrivilegesRequest) Do(ctx context.Context, transport Trans path.WriteString("privilege") path.WriteString("/") path.WriteString(r.Application) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "application", r.Application) + } path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -104,6 +126,9 @@ func (r SecurityDeletePrivilegesRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +156,17 @@ func (r SecurityDeletePrivilegesRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.delete_privileges") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.delete_privileges") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.delete_role.go b/esapi/api.xpack.security.delete_role.go index 03b5ef0408..d91251d0f9 100644 --- a/esapi/api.xpack.security.delete_role.go +++ b/esapi/api.xpack.security.delete_role.go @@ -31,6 +31,11 @@ func newSecurityDeleteRoleFunc(t Transport) SecurityDeleteRole { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SecurityDeleteRoleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityDeleteRoleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityDeleteRoleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_role") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_security") + 1 + len("role") + 1 + len(r.Name)) @@ -76,6 +92,9 @@ func (r SecurityDeleteRoleRequest) Do(ctx context.Context, transport Transport) path.WriteString("role") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -101,6 +120,9 @@ func (r SecurityDeleteRoleRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +150,17 @@ func (r SecurityDeleteRoleRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.delete_role") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.delete_role") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.delete_role_mapping.go b/esapi/api.xpack.security.delete_role_mapping.go index 9a7d1eb6e6..1c34caea0d 100644 --- a/esapi/api.xpack.security.delete_role_mapping.go +++ b/esapi/api.xpack.security.delete_role_mapping.go @@ -31,6 +31,11 @@ func newSecurityDeleteRoleMappingFunc(t Transport) SecurityDeleteRoleMapping { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SecurityDeleteRoleMappingRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityDeleteRoleMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityDeleteRoleMappingRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_role_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_security") + 1 + len("role_mapping") + 1 + len(r.Name)) @@ -76,6 +92,9 @@ func (r SecurityDeleteRoleMappingRequest) Do(ctx context.Context, transport Tran path.WriteString("role_mapping") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -101,6 +120,9 @@ func (r SecurityDeleteRoleMappingRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +150,17 @@ func (r SecurityDeleteRoleMappingRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.delete_role_mapping") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.delete_role_mapping") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.delete_service_token.go b/esapi/api.xpack.security.delete_service_token.go index 344669ad48..33ce1bc659 100644 --- a/esapi/api.xpack.security.delete_service_token.go +++ b/esapi/api.xpack.security.delete_service_token.go @@ -31,6 +31,11 @@ func newSecurityDeleteServiceTokenFunc(t Transport) SecurityDeleteServiceToken { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type SecurityDeleteServiceTokenRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityDeleteServiceTokenRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityDeleteServiceTokenRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_service_token") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_security") + 1 + len("service") + 1 + len(r.Namespace) + 1 + len(r.Service) + 1 + len("credential") + 1 + len("token") + 1 + len(r.Name)) @@ -78,14 +94,23 @@ func (r SecurityDeleteServiceTokenRequest) Do(ctx context.Context, transport Tra path.WriteString("service") path.WriteString("/") path.WriteString(r.Namespace) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.Namespace) + } path.WriteString("/") path.WriteString(r.Service) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.Service) + } path.WriteString("/") path.WriteString("credential") path.WriteString("/") path.WriteString("token") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -111,6 +136,9 @@ func (r SecurityDeleteServiceTokenRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +166,17 @@ func (r SecurityDeleteServiceTokenRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.delete_service_token") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.delete_service_token") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.delete_user.go b/esapi/api.xpack.security.delete_user.go index c262860c4c..02ebbdf8da 100644 --- a/esapi/api.xpack.security.delete_user.go +++ b/esapi/api.xpack.security.delete_user.go @@ -31,6 +31,11 @@ func newSecurityDeleteUserFunc(t Transport) SecurityDeleteUser { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SecurityDeleteUserRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityDeleteUserRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityDeleteUserRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_security") + 1 + len("user") + 1 + len(r.Username)) @@ -76,6 +92,9 @@ func (r SecurityDeleteUserRequest) Do(ctx context.Context, transport Transport) path.WriteString("user") path.WriteString("/") path.WriteString(r.Username) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.Username) + } params = make(map[string]string) @@ -101,6 +120,9 @@ func (r SecurityDeleteUserRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +150,17 @@ func (r SecurityDeleteUserRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.delete_user") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.delete_user") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.disable_user.go b/esapi/api.xpack.security.disable_user.go index a87f2bdd95..43de78f59d 100644 --- a/esapi/api.xpack.security.disable_user.go +++ b/esapi/api.xpack.security.disable_user.go @@ -31,6 +31,11 @@ func newSecurityDisableUserFunc(t Transport) SecurityDisableUser { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SecurityDisableUserRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityDisableUserRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityDisableUserRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.disable_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("user") + 1 + len(r.Username) + 1 + len("_disable")) @@ -76,6 +92,9 @@ func (r SecurityDisableUserRequest) Do(ctx context.Context, transport Transport) path.WriteString("user") path.WriteString("/") path.WriteString(r.Username) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.Username) + } path.WriteString("/") path.WriteString("_disable") @@ -103,6 +122,9 @@ func (r SecurityDisableUserRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -130,8 +152,17 @@ func (r SecurityDisableUserRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.disable_user") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.disable_user") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.disable_user_profile.go b/esapi/api.xpack.security.disable_user_profile.go index adf04bede7..00964416f3 100644 --- a/esapi/api.xpack.security.disable_user_profile.go +++ b/esapi/api.xpack.security.disable_user_profile.go @@ -31,6 +31,11 @@ func newSecurityDisableUserProfileFunc(t Transport) SecurityDisableUserProfile { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SecurityDisableUserProfileRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityDisableUserProfileRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityDisableUserProfileRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.disable_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("profile") + 1 + len(r.UID) + 1 + len("_disable")) @@ -76,6 +92,9 @@ func (r SecurityDisableUserProfileRequest) Do(ctx context.Context, transport Tra path.WriteString("profile") path.WriteString("/") path.WriteString(r.UID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "uid", r.UID) + } path.WriteString("/") path.WriteString("_disable") @@ -103,6 +122,9 @@ func (r SecurityDisableUserProfileRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -130,8 +152,17 @@ func (r SecurityDisableUserProfileRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.disable_user_profile") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.disable_user_profile") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.enable_user.go b/esapi/api.xpack.security.enable_user.go index 5baeecfec9..a6dd2c79a3 100644 --- a/esapi/api.xpack.security.enable_user.go +++ b/esapi/api.xpack.security.enable_user.go @@ -31,6 +31,11 @@ func newSecurityEnableUserFunc(t Transport) SecurityEnableUser { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SecurityEnableUserRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityEnableUserRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityEnableUserRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enable_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("user") + 1 + len(r.Username) + 1 + len("_enable")) @@ -76,6 +92,9 @@ func (r SecurityEnableUserRequest) Do(ctx context.Context, transport Transport) path.WriteString("user") path.WriteString("/") path.WriteString(r.Username) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.Username) + } path.WriteString("/") path.WriteString("_enable") @@ -103,6 +122,9 @@ func (r SecurityEnableUserRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -130,8 +152,17 @@ func (r SecurityEnableUserRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.enable_user") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.enable_user") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.enable_user_profile.go b/esapi/api.xpack.security.enable_user_profile.go index c1d55b7804..e7ec866aaf 100644 --- a/esapi/api.xpack.security.enable_user_profile.go +++ b/esapi/api.xpack.security.enable_user_profile.go @@ -31,6 +31,11 @@ func newSecurityEnableUserProfileFunc(t Transport) SecurityEnableUserProfile { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type SecurityEnableUserProfileRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityEnableUserProfileRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityEnableUserProfileRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enable_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("profile") + 1 + len(r.UID) + 1 + len("_enable")) @@ -76,6 +92,9 @@ func (r SecurityEnableUserProfileRequest) Do(ctx context.Context, transport Tran path.WriteString("profile") path.WriteString("/") path.WriteString(r.UID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "uid", r.UID) + } path.WriteString("/") path.WriteString("_enable") @@ -103,6 +122,9 @@ func (r SecurityEnableUserProfileRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -130,8 +152,17 @@ func (r SecurityEnableUserProfileRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.enable_user_profile") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.enable_user_profile") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.enroll_kibana.go b/esapi/api.xpack.security.enroll_kibana.go index 2d7db55cb9..136aac3765 100644 --- a/esapi/api.xpack.security.enroll_kibana.go +++ b/esapi/api.xpack.security.enroll_kibana.go @@ -31,6 +31,11 @@ func newSecurityEnrollKibanaFunc(t Transport) SecurityEnrollKibana { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SecurityEnrollKibanaRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityEnrollKibanaRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityEnrollKibanaRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enroll_kibana") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_security/enroll/kibana")) @@ -88,6 +104,9 @@ func (r SecurityEnrollKibanaRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SecurityEnrollKibanaRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.enroll_kibana") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.enroll_kibana") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.enroll_node.go b/esapi/api.xpack.security.enroll_node.go index 6d97cf4921..baae57aa04 100644 --- a/esapi/api.xpack.security.enroll_node.go +++ b/esapi/api.xpack.security.enroll_node.go @@ -31,6 +31,11 @@ func newSecurityEnrollNodeFunc(t Transport) SecurityEnrollNode { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SecurityEnrollNodeRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityEnrollNodeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityEnrollNodeRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enroll_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_security/enroll/node")) @@ -88,6 +104,9 @@ func (r SecurityEnrollNodeRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SecurityEnrollNodeRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.enroll_node") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.enroll_node") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_api_key.go b/esapi/api.xpack.security.get_api_key.go index 04ee9d7dee..bdae286701 100644 --- a/esapi/api.xpack.security.get_api_key.go +++ b/esapi/api.xpack.security.get_api_key.go @@ -32,6 +32,11 @@ func newSecurityGetAPIKeyFunc(t Transport) SecurityGetAPIKey { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type SecurityGetAPIKeyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetAPIKeyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_security/api_key")) @@ -120,6 +136,9 @@ func (r SecurityGetAPIKeyRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -147,8 +166,17 @@ func (r SecurityGetAPIKeyRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_api_key") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_api_key") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_builtin_privileges.go b/esapi/api.xpack.security.get_builtin_privileges.go index 0b398174bc..e50c0094b9 100644 --- a/esapi/api.xpack.security.get_builtin_privileges.go +++ b/esapi/api.xpack.security.get_builtin_privileges.go @@ -31,6 +31,11 @@ func newSecurityGetBuiltinPrivilegesFunc(t Transport) SecurityGetBuiltinPrivileg for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SecurityGetBuiltinPrivilegesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetBuiltinPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetBuiltinPrivilegesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_builtin_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_security/privilege/_builtin")) @@ -88,6 +104,9 @@ func (r SecurityGetBuiltinPrivilegesRequest) Do(ctx context.Context, transport T req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SecurityGetBuiltinPrivilegesRequest) Do(ctx context.Context, transport T req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_builtin_privileges") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_builtin_privileges") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_privileges.go b/esapi/api.xpack.security.get_privileges.go index 2eb0eae317..fe963f03a6 100644 --- a/esapi/api.xpack.security.get_privileges.go +++ b/esapi/api.xpack.security.get_privileges.go @@ -31,6 +31,11 @@ func newSecurityGetPrivilegesFunc(t Transport) SecurityGetPrivileges { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityGetPrivilegesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetPrivilegesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_security") + 1 + len("privilege") + 1 + len(r.Application) + 1 + len(r.Name)) @@ -76,10 +92,16 @@ func (r SecurityGetPrivilegesRequest) Do(ctx context.Context, transport Transpor if r.Application != "" { path.WriteString("/") path.WriteString(r.Application) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "application", r.Application) + } } if r.Name != "" { path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } } params = make(map[string]string) @@ -102,6 +124,9 @@ func (r SecurityGetPrivilegesRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +154,17 @@ func (r SecurityGetPrivilegesRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_privileges") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_privileges") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_role.go b/esapi/api.xpack.security.get_role.go index 08bda6d369..ee55fce0bb 100644 --- a/esapi/api.xpack.security.get_role.go +++ b/esapi/api.xpack.security.get_role.go @@ -31,6 +31,11 @@ func newSecurityGetRoleFunc(t Transport) SecurityGetRole { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type SecurityGetRoleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetRoleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetRoleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_role") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_security") + 1 + len("role") + 1 + len(strings.Join(r.Name, ","))) @@ -75,6 +91,9 @@ func (r SecurityGetRoleRequest) Do(ctx context.Context, transport Transport) (*R if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r SecurityGetRoleRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SecurityGetRoleRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_role") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_role") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_role_mapping.go b/esapi/api.xpack.security.get_role_mapping.go index fc8707f199..c41e722fb4 100644 --- a/esapi/api.xpack.security.get_role_mapping.go +++ b/esapi/api.xpack.security.get_role_mapping.go @@ -31,6 +31,11 @@ func newSecurityGetRoleMappingFunc(t Transport) SecurityGetRoleMapping { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type SecurityGetRoleMappingRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetRoleMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetRoleMappingRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_role_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_security") + 1 + len("role_mapping") + 1 + len(strings.Join(r.Name, ","))) @@ -75,6 +91,9 @@ func (r SecurityGetRoleMappingRequest) Do(ctx context.Context, transport Transpo if len(r.Name) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Name, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", strings.Join(r.Name, ",")) + } } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r SecurityGetRoleMappingRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SecurityGetRoleMappingRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_role_mapping") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_role_mapping") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_service_accounts.go b/esapi/api.xpack.security.get_service_accounts.go index c2f35e2e74..c3b29eb941 100644 --- a/esapi/api.xpack.security.get_service_accounts.go +++ b/esapi/api.xpack.security.get_service_accounts.go @@ -31,6 +31,11 @@ func newSecurityGetServiceAccountsFunc(t Transport) SecurityGetServiceAccounts { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityGetServiceAccountsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetServiceAccountsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetServiceAccountsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_service_accounts") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_security") + 1 + len("service") + 1 + len(r.Namespace) + 1 + len(r.Service)) @@ -76,10 +92,16 @@ func (r SecurityGetServiceAccountsRequest) Do(ctx context.Context, transport Tra if r.Namespace != "" { path.WriteString("/") path.WriteString(r.Namespace) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.Namespace) + } } if r.Service != "" { path.WriteString("/") path.WriteString(r.Service) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.Service) + } } params = make(map[string]string) @@ -102,6 +124,9 @@ func (r SecurityGetServiceAccountsRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +154,17 @@ func (r SecurityGetServiceAccountsRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_service_accounts") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_service_accounts") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_service_credentials.go b/esapi/api.xpack.security.get_service_credentials.go index 2640e165d3..67bd6e2882 100644 --- a/esapi/api.xpack.security.get_service_credentials.go +++ b/esapi/api.xpack.security.get_service_credentials.go @@ -31,6 +31,11 @@ func newSecurityGetServiceCredentialsFunc(t Transport) SecurityGetServiceCredent for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityGetServiceCredentialsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetServiceCredentialsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetServiceCredentialsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_service_credentials") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_security") + 1 + len("service") + 1 + len(r.Namespace) + 1 + len(r.Service) + 1 + len("credential")) @@ -75,8 +91,14 @@ func (r SecurityGetServiceCredentialsRequest) Do(ctx context.Context, transport path.WriteString("service") path.WriteString("/") path.WriteString(r.Namespace) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.Namespace) + } path.WriteString("/") path.WriteString(r.Service) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.Service) + } path.WriteString("/") path.WriteString("credential") @@ -100,6 +122,9 @@ func (r SecurityGetServiceCredentialsRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +152,17 @@ func (r SecurityGetServiceCredentialsRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_service_credentials") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_service_credentials") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_settings.go b/esapi/api.xpack.security.get_settings.go index 4fad94b5a7..36ade7bcde 100644 --- a/esapi/api.xpack.security.get_settings.go +++ b/esapi/api.xpack.security.get_settings.go @@ -31,6 +31,11 @@ func newSecurityGetSettingsFunc(t Transport) SecurityGetSettings { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SecurityGetSettingsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetSettingsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_security/settings")) @@ -88,6 +104,9 @@ func (r SecurityGetSettingsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SecurityGetSettingsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_settings") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_settings") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_token.go b/esapi/api.xpack.security.get_token.go index eb6b298dc8..1fdbf2dd45 100644 --- a/esapi/api.xpack.security.get_token.go +++ b/esapi/api.xpack.security.get_token.go @@ -32,6 +32,11 @@ func newSecurityGetTokenFunc(t Transport) SecurityGetToken { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityGetTokenRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetTokenRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetTokenRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_token") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/oauth2/token")) @@ -91,6 +107,9 @@ func (r SecurityGetTokenRequest) Do(ctx context.Context, transport Transport) (* req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecurityGetTokenRequest) Do(ctx context.Context, transport Transport) (* req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_token") + if reader := instrument.RecordRequestBody(ctx, "security.get_token", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_token") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_user.go b/esapi/api.xpack.security.get_user.go index 6e4ba771e0..719215435c 100644 --- a/esapi/api.xpack.security.get_user.go +++ b/esapi/api.xpack.security.get_user.go @@ -32,6 +32,11 @@ func newSecurityGetUserFunc(t Transport) SecurityGetUser { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityGetUserRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetUserRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetUserRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_security") + 1 + len("user") + 1 + len(strings.Join(r.Username, ","))) @@ -78,6 +94,9 @@ func (r SecurityGetUserRequest) Do(ctx context.Context, transport Transport) (*R if len(r.Username) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Username, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", strings.Join(r.Username, ",")) + } } params = make(map[string]string) @@ -104,6 +123,9 @@ func (r SecurityGetUserRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -131,8 +153,17 @@ func (r SecurityGetUserRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_user") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_user") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_user_privileges.go b/esapi/api.xpack.security.get_user_privileges.go index 8b5dac7b67..5511de0f38 100644 --- a/esapi/api.xpack.security.get_user_privileges.go +++ b/esapi/api.xpack.security.get_user_privileges.go @@ -31,6 +31,11 @@ func newSecurityGetUserPrivilegesFunc(t Transport) SecurityGetUserPrivileges { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SecurityGetUserPrivilegesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetUserPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetUserPrivilegesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_user_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_security/user/_privileges")) @@ -88,6 +104,9 @@ func (r SecurityGetUserPrivilegesRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SecurityGetUserPrivilegesRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_user_privileges") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_user_privileges") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.get_user_profile.go b/esapi/api.xpack.security.get_user_profile.go index a812c5f581..38e017ee60 100644 --- a/esapi/api.xpack.security.get_user_profile.go +++ b/esapi/api.xpack.security.get_user_profile.go @@ -32,6 +32,11 @@ func newSecurityGetUserProfileFunc(t Transport) SecurityGetUserProfile { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityGetUserProfileRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGetUserProfileRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGetUserProfileRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" if len(r.UID) == 0 { @@ -81,6 +97,9 @@ func (r SecurityGetUserProfileRequest) Do(ctx context.Context, transport Transpo path.WriteString("profile") path.WriteString("/") path.WriteString(strings.Join(r.UID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "uid", strings.Join(r.UID, ",")) + } params = make(map[string]string) @@ -106,6 +125,9 @@ func (r SecurityGetUserProfileRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,17 @@ func (r SecurityGetUserProfileRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_user_profile") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_user_profile") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.grant_api_key.go b/esapi/api.xpack.security.grant_api_key.go index 67f5c89874..e8ca7bb0e9 100644 --- a/esapi/api.xpack.security.grant_api_key.go +++ b/esapi/api.xpack.security.grant_api_key.go @@ -32,6 +32,11 @@ func newSecurityGrantAPIKeyFunc(t Transport) SecurityGrantAPIKey { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityGrantAPIKeyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityGrantAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityGrantAPIKeyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.grant_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/api_key/grant")) @@ -97,6 +113,9 @@ func (r SecurityGrantAPIKeyRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +147,20 @@ func (r SecurityGrantAPIKeyRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.grant_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.grant_api_key", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.grant_api_key") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.has_privileges.go b/esapi/api.xpack.security.has_privileges.go index 4798c057c4..ecb6977817 100644 --- a/esapi/api.xpack.security.has_privileges.go +++ b/esapi/api.xpack.security.has_privileges.go @@ -32,6 +32,11 @@ func newSecurityHasPrivilegesFunc(t Transport) SecurityHasPrivileges { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityHasPrivilegesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityHasPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityHasPrivilegesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.has_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_security") + 1 + len("user") + 1 + len(r.User) + 1 + len("_has_privileges")) @@ -78,6 +94,9 @@ func (r SecurityHasPrivilegesRequest) Do(ctx context.Context, transport Transpor if r.User != "" { path.WriteString("/") path.WriteString(r.User) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "user", r.User) + } } path.WriteString("/") path.WriteString("_has_privileges") @@ -102,6 +121,9 @@ func (r SecurityHasPrivilegesRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,20 @@ func (r SecurityHasPrivilegesRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.has_privileges") + if reader := instrument.RecordRequestBody(ctx, "security.has_privileges", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.has_privileges") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.has_privileges_user_profile.go b/esapi/api.xpack.security.has_privileges_user_profile.go index 62e1c8af4f..04614156e6 100644 --- a/esapi/api.xpack.security.has_privileges_user_profile.go +++ b/esapi/api.xpack.security.has_privileges_user_profile.go @@ -32,6 +32,11 @@ func newSecurityHasPrivilegesUserProfileFunc(t Transport) SecurityHasPrivilegesU for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityHasPrivilegesUserProfileRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityHasPrivilegesUserProfileRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityHasPrivilegesUserProfileRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.has_privileges_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/profile/_has_privileges")) @@ -91,6 +107,9 @@ func (r SecurityHasPrivilegesUserProfileRequest) Do(ctx context.Context, transpo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecurityHasPrivilegesUserProfileRequest) Do(ctx context.Context, transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.has_privileges_user_profile") + if reader := instrument.RecordRequestBody(ctx, "security.has_privileges_user_profile", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.has_privileges_user_profile") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.invalidate_api_key.go b/esapi/api.xpack.security.invalidate_api_key.go index 5b3f6451c1..6a790fdb04 100644 --- a/esapi/api.xpack.security.invalidate_api_key.go +++ b/esapi/api.xpack.security.invalidate_api_key.go @@ -32,6 +32,11 @@ func newSecurityInvalidateAPIKeyFunc(t Transport) SecurityInvalidateAPIKey { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityInvalidateAPIKeyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityInvalidateAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityInvalidateAPIKeyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.invalidate_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + len("/_security/api_key")) @@ -91,6 +107,9 @@ func (r SecurityInvalidateAPIKeyRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecurityInvalidateAPIKeyRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.invalidate_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.invalidate_api_key", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.invalidate_api_key") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.invalidate_token.go b/esapi/api.xpack.security.invalidate_token.go index 9aa30b12cb..c0369ed9fd 100644 --- a/esapi/api.xpack.security.invalidate_token.go +++ b/esapi/api.xpack.security.invalidate_token.go @@ -32,6 +32,11 @@ func newSecurityInvalidateTokenFunc(t Transport) SecurityInvalidateToken { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityInvalidateTokenRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityInvalidateTokenRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityInvalidateTokenRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.invalidate_token") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + len("/_security/oauth2/token")) @@ -91,6 +107,9 @@ func (r SecurityInvalidateTokenRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecurityInvalidateTokenRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.invalidate_token") + if reader := instrument.RecordRequestBody(ctx, "security.invalidate_token", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.invalidate_token") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.oidc_authenticate.go b/esapi/api.xpack.security.oidc_authenticate.go index b7e72f5297..7e91ceb8e0 100644 --- a/esapi/api.xpack.security.oidc_authenticate.go +++ b/esapi/api.xpack.security.oidc_authenticate.go @@ -32,6 +32,11 @@ func newSecurityOidcAuthenticateFunc(t Transport) SecurityOidcAuthenticate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityOidcAuthenticateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityOidcAuthenticateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityOidcAuthenticateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.oidc_authenticate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/oidc/authenticate")) @@ -91,6 +107,9 @@ func (r SecurityOidcAuthenticateRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecurityOidcAuthenticateRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.oidc_authenticate") + if reader := instrument.RecordRequestBody(ctx, "security.oidc_authenticate", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.oidc_authenticate") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.oidc_logout.go b/esapi/api.xpack.security.oidc_logout.go index 590fec8460..15fe0e565b 100644 --- a/esapi/api.xpack.security.oidc_logout.go +++ b/esapi/api.xpack.security.oidc_logout.go @@ -32,6 +32,11 @@ func newSecurityOidcLogoutFunc(t Transport) SecurityOidcLogout { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityOidcLogoutRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityOidcLogoutRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityOidcLogoutRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.oidc_logout") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/oidc/logout")) @@ -91,6 +107,9 @@ func (r SecurityOidcLogoutRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecurityOidcLogoutRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.oidc_logout") + if reader := instrument.RecordRequestBody(ctx, "security.oidc_logout", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.oidc_logout") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.oidc_prepare_authentication.go b/esapi/api.xpack.security.oidc_prepare_authentication.go index eb70bfafed..f5f4ac2a52 100644 --- a/esapi/api.xpack.security.oidc_prepare_authentication.go +++ b/esapi/api.xpack.security.oidc_prepare_authentication.go @@ -32,6 +32,11 @@ func newSecurityOidcPrepareAuthenticationFunc(t Transport) SecurityOidcPrepareAu for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityOidcPrepareAuthenticationRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityOidcPrepareAuthenticationRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityOidcPrepareAuthenticationRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.oidc_prepare_authentication") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/oidc/prepare")) @@ -91,6 +107,9 @@ func (r SecurityOidcPrepareAuthenticationRequest) Do(ctx context.Context, transp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecurityOidcPrepareAuthenticationRequest) Do(ctx context.Context, transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.oidc_prepare_authentication") + if reader := instrument.RecordRequestBody(ctx, "security.oidc_prepare_authentication", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.oidc_prepare_authentication") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.put_privileges.go b/esapi/api.xpack.security.put_privileges.go index ea14738b4d..1ccea19507 100644 --- a/esapi/api.xpack.security.put_privileges.go +++ b/esapi/api.xpack.security.put_privileges.go @@ -32,6 +32,11 @@ func newSecurityPutPrivilegesFunc(t Transport) SecurityPutPrivileges { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityPutPrivilegesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityPutPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityPutPrivilegesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.put_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + len("/_security/privilege/")) @@ -97,6 +113,9 @@ func (r SecurityPutPrivilegesRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +147,20 @@ func (r SecurityPutPrivilegesRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.put_privileges") + if reader := instrument.RecordRequestBody(ctx, "security.put_privileges", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.put_privileges") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.put_role.go b/esapi/api.xpack.security.put_role.go index 571ba76359..5d4e516907 100644 --- a/esapi/api.xpack.security.put_role.go +++ b/esapi/api.xpack.security.put_role.go @@ -32,6 +32,11 @@ func newSecurityPutRoleFunc(t Transport) SecurityPutRole { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SecurityPutRoleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityPutRoleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityPutRoleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.put_role") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("role") + 1 + len(r.Name)) @@ -79,6 +95,9 @@ func (r SecurityPutRoleRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("role") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -104,6 +123,9 @@ func (r SecurityPutRoleRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,20 @@ func (r SecurityPutRoleRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.put_role") + if reader := instrument.RecordRequestBody(ctx, "security.put_role", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.put_role") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.put_role_mapping.go b/esapi/api.xpack.security.put_role_mapping.go index 046729d41c..0e8378bfcc 100644 --- a/esapi/api.xpack.security.put_role_mapping.go +++ b/esapi/api.xpack.security.put_role_mapping.go @@ -32,6 +32,11 @@ func newSecurityPutRoleMappingFunc(t Transport) SecurityPutRoleMapping { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SecurityPutRoleMappingRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityPutRoleMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityPutRoleMappingRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.put_role_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("role_mapping") + 1 + len(r.Name)) @@ -79,6 +95,9 @@ func (r SecurityPutRoleMappingRequest) Do(ctx context.Context, transport Transpo path.WriteString("role_mapping") path.WriteString("/") path.WriteString(r.Name) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.Name) + } params = make(map[string]string) @@ -104,6 +123,9 @@ func (r SecurityPutRoleMappingRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,20 @@ func (r SecurityPutRoleMappingRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.put_role_mapping") + if reader := instrument.RecordRequestBody(ctx, "security.put_role_mapping", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.put_role_mapping") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.put_user.go b/esapi/api.xpack.security.put_user.go index ce90e53fd3..6b21ce4a66 100644 --- a/esapi/api.xpack.security.put_user.go +++ b/esapi/api.xpack.security.put_user.go @@ -32,6 +32,11 @@ func newSecurityPutUserFunc(t Transport) SecurityPutUser { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SecurityPutUserRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityPutUserRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityPutUserRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.put_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("user") + 1 + len(r.Username)) @@ -79,6 +95,9 @@ func (r SecurityPutUserRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("user") path.WriteString("/") path.WriteString(r.Username) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.Username) + } params = make(map[string]string) @@ -104,6 +123,9 @@ func (r SecurityPutUserRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,20 @@ func (r SecurityPutUserRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.put_user") + if reader := instrument.RecordRequestBody(ctx, "security.put_user", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.put_user") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.query_api_keys.go b/esapi/api.xpack.security.query_api_keys.go index 0f07436915..026c178be2 100644 --- a/esapi/api.xpack.security.query_api_keys.go +++ b/esapi/api.xpack.security.query_api_keys.go @@ -33,6 +33,11 @@ func newSecurityQueryAPIKeysFunc(t Transport) SecurityQueryAPIKeys { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type SecurityQueryAPIKeysRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityQueryAPIKeysRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityQueryAPIKeysRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.query_api_keys") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/_query/api_key")) @@ -98,6 +114,9 @@ func (r SecurityQueryAPIKeysRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +148,20 @@ func (r SecurityQueryAPIKeysRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.query_api_keys") + if reader := instrument.RecordRequestBody(ctx, "security.query_api_keys", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.query_api_keys") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.saml_authenticate.go b/esapi/api.xpack.security.saml_authenticate.go index a039baa8a1..7a42cf9080 100644 --- a/esapi/api.xpack.security.saml_authenticate.go +++ b/esapi/api.xpack.security.saml_authenticate.go @@ -32,6 +32,11 @@ func newSecuritySamlAuthenticateFunc(t Transport) SecuritySamlAuthenticate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecuritySamlAuthenticateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecuritySamlAuthenticateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecuritySamlAuthenticateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_authenticate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/saml/authenticate")) @@ -91,6 +107,9 @@ func (r SecuritySamlAuthenticateRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecuritySamlAuthenticateRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_authenticate") + if reader := instrument.RecordRequestBody(ctx, "security.saml_authenticate", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_authenticate") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.saml_complete_logout.go b/esapi/api.xpack.security.saml_complete_logout.go index 30118858cb..085dd22094 100644 --- a/esapi/api.xpack.security.saml_complete_logout.go +++ b/esapi/api.xpack.security.saml_complete_logout.go @@ -32,6 +32,11 @@ func newSecuritySamlCompleteLogoutFunc(t Transport) SecuritySamlCompleteLogout { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecuritySamlCompleteLogoutRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecuritySamlCompleteLogoutRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecuritySamlCompleteLogoutRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_complete_logout") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/saml/complete_logout")) @@ -91,6 +107,9 @@ func (r SecuritySamlCompleteLogoutRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecuritySamlCompleteLogoutRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_complete_logout") + if reader := instrument.RecordRequestBody(ctx, "security.saml_complete_logout", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_complete_logout") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.saml_invalidate.go b/esapi/api.xpack.security.saml_invalidate.go index 9a27946563..02c9ac803f 100644 --- a/esapi/api.xpack.security.saml_invalidate.go +++ b/esapi/api.xpack.security.saml_invalidate.go @@ -32,6 +32,11 @@ func newSecuritySamlInvalidateFunc(t Transport) SecuritySamlInvalidate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecuritySamlInvalidateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecuritySamlInvalidateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecuritySamlInvalidateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_invalidate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/saml/invalidate")) @@ -91,6 +107,9 @@ func (r SecuritySamlInvalidateRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecuritySamlInvalidateRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_invalidate") + if reader := instrument.RecordRequestBody(ctx, "security.saml_invalidate", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_invalidate") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.saml_logout.go b/esapi/api.xpack.security.saml_logout.go index 704c843368..2a301c5a6e 100644 --- a/esapi/api.xpack.security.saml_logout.go +++ b/esapi/api.xpack.security.saml_logout.go @@ -32,6 +32,11 @@ func newSecuritySamlLogoutFunc(t Transport) SecuritySamlLogout { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecuritySamlLogoutRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecuritySamlLogoutRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecuritySamlLogoutRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_logout") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/saml/logout")) @@ -91,6 +107,9 @@ func (r SecuritySamlLogoutRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecuritySamlLogoutRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_logout") + if reader := instrument.RecordRequestBody(ctx, "security.saml_logout", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_logout") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.saml_prepare_authentication.go b/esapi/api.xpack.security.saml_prepare_authentication.go index bc77f7f4b1..afe82c9e1b 100644 --- a/esapi/api.xpack.security.saml_prepare_authentication.go +++ b/esapi/api.xpack.security.saml_prepare_authentication.go @@ -32,6 +32,11 @@ func newSecuritySamlPrepareAuthenticationFunc(t Transport) SecuritySamlPrepareAu for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecuritySamlPrepareAuthenticationRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecuritySamlPrepareAuthenticationRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecuritySamlPrepareAuthenticationRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_prepare_authentication") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/saml/prepare")) @@ -91,6 +107,9 @@ func (r SecuritySamlPrepareAuthenticationRequest) Do(ctx context.Context, transp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecuritySamlPrepareAuthenticationRequest) Do(ctx context.Context, transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_prepare_authentication") + if reader := instrument.RecordRequestBody(ctx, "security.saml_prepare_authentication", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_prepare_authentication") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.saml_service_provider_metadata.go b/esapi/api.xpack.security.saml_service_provider_metadata.go index 7847c93cb1..7165e08008 100644 --- a/esapi/api.xpack.security.saml_service_provider_metadata.go +++ b/esapi/api.xpack.security.saml_service_provider_metadata.go @@ -31,6 +31,11 @@ func newSecuritySamlServiceProviderMetadataFunc(t Transport) SecuritySamlService for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type SecuritySamlServiceProviderMetadataRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecuritySamlServiceProviderMetadataRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecuritySamlServiceProviderMetadataRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_service_provider_metadata") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_security") + 1 + len("saml") + 1 + len("metadata") + 1 + len(r.RealmName)) @@ -76,6 +92,9 @@ func (r SecuritySamlServiceProviderMetadataRequest) Do(ctx context.Context, tran path.WriteString("metadata") path.WriteString("/") path.WriteString(r.RealmName) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "realm_name", r.RealmName) + } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r SecuritySamlServiceProviderMetadataRequest) Do(ctx context.Context, tran req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SecuritySamlServiceProviderMetadataRequest) Do(ctx context.Context, tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_service_provider_metadata") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_service_provider_metadata") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.suggest_user_profiles.go b/esapi/api.xpack.security.suggest_user_profiles.go index 6a2d8974dd..d6a36212d4 100644 --- a/esapi/api.xpack.security.suggest_user_profiles.go +++ b/esapi/api.xpack.security.suggest_user_profiles.go @@ -32,6 +32,11 @@ func newSecuritySuggestUserProfilesFunc(t Transport) SecuritySuggestUserProfiles for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecuritySuggestUserProfilesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecuritySuggestUserProfilesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecuritySuggestUserProfilesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.suggest_user_profiles") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_security/profile/_suggest")) @@ -97,6 +113,9 @@ func (r SecuritySuggestUserProfilesRequest) Do(ctx context.Context, transport Tr req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +147,20 @@ func (r SecuritySuggestUserProfilesRequest) Do(ctx context.Context, transport Tr req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.suggest_user_profiles") + if reader := instrument.RecordRequestBody(ctx, "security.suggest_user_profiles", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.suggest_user_profiles") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.update_api_key.go b/esapi/api.xpack.security.update_api_key.go index 9ed3b556ee..2a97dc5c02 100644 --- a/esapi/api.xpack.security.update_api_key.go +++ b/esapi/api.xpack.security.update_api_key.go @@ -32,6 +32,11 @@ func newSecurityUpdateAPIKeyFunc(t Transport) SecurityUpdateAPIKey { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SecurityUpdateAPIKeyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityUpdateAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityUpdateAPIKeyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.update_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("api_key") + 1 + len(r.DocumentID)) @@ -77,6 +93,9 @@ func (r SecurityUpdateAPIKeyRequest) Do(ctx context.Context, transport Transport path.WriteString("api_key") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r SecurityUpdateAPIKeyRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r SecurityUpdateAPIKeyRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.update_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.update_api_key", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.update_api_key") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.update_cross_cluster_api_key.go b/esapi/api.xpack.security.update_cross_cluster_api_key.go index 8a25d1ff7d..83ce6b7c61 100644 --- a/esapi/api.xpack.security.update_cross_cluster_api_key.go +++ b/esapi/api.xpack.security.update_cross_cluster_api_key.go @@ -32,6 +32,11 @@ func newSecurityUpdateCrossClusterAPIKeyFunc(t Transport) SecurityUpdateCrossClu for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type SecurityUpdateCrossClusterAPIKeyRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityUpdateCrossClusterAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityUpdateCrossClusterAPIKeyRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.update_cross_cluster_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("cross_cluster") + 1 + len("api_key") + 1 + len(r.DocumentID)) @@ -81,6 +97,9 @@ func (r SecurityUpdateCrossClusterAPIKeyRequest) Do(ctx context.Context, transpo path.WriteString("api_key") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -102,6 +121,9 @@ func (r SecurityUpdateCrossClusterAPIKeyRequest) Do(ctx context.Context, transpo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -133,8 +155,20 @@ func (r SecurityUpdateCrossClusterAPIKeyRequest) Do(ctx context.Context, transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.update_cross_cluster_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.update_cross_cluster_api_key", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.update_cross_cluster_api_key") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.update_settings.go b/esapi/api.xpack.security.update_settings.go index abe169ddd4..799ac690c4 100644 --- a/esapi/api.xpack.security.update_settings.go +++ b/esapi/api.xpack.security.update_settings.go @@ -32,6 +32,11 @@ func newSecurityUpdateSettingsFunc(t Transport) SecurityUpdateSettings { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SecurityUpdateSettingsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityUpdateSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityUpdateSettingsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.update_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + len("/_security/settings")) @@ -91,6 +107,9 @@ func (r SecurityUpdateSettingsRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SecurityUpdateSettingsRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.update_settings") + if reader := instrument.RecordRequestBody(ctx, "security.update_settings", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.update_settings") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.security.update_user_profile_data.go b/esapi/api.xpack.security.update_user_profile_data.go index 6fe3c715f9..46eab4e6a7 100644 --- a/esapi/api.xpack.security.update_user_profile_data.go +++ b/esapi/api.xpack.security.update_user_profile_data.go @@ -33,6 +33,11 @@ func newSecurityUpdateUserProfileDataFunc(t Transport) SecurityUpdateUserProfile for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type SecurityUpdateUserProfileDataRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SecurityUpdateUserProfileDataRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SecurityUpdateUserProfileDataRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.update_user_profile_data") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_security") + 1 + len("profile") + 1 + len(r.UID) + 1 + len("_data")) @@ -82,6 +98,9 @@ func (r SecurityUpdateUserProfileDataRequest) Do(ctx context.Context, transport path.WriteString("profile") path.WriteString("/") path.WriteString(r.UID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "uid", r.UID) + } path.WriteString("/") path.WriteString("_data") @@ -117,6 +136,9 @@ func (r SecurityUpdateUserProfileDataRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -148,8 +170,20 @@ func (r SecurityUpdateUserProfileDataRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "security.update_user_profile_data") + if reader := instrument.RecordRequestBody(ctx, "security.update_user_profile_data", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.update_user_profile_data") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.slm.delete_lifecycle.go b/esapi/api.xpack.slm.delete_lifecycle.go index 7a00a6f635..f9290829fd 100644 --- a/esapi/api.xpack.slm.delete_lifecycle.go +++ b/esapi/api.xpack.slm.delete_lifecycle.go @@ -31,6 +31,11 @@ func newSlmDeleteLifecycleFunc(t Transport) SlmDeleteLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type SlmDeleteLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SlmDeleteLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SlmDeleteLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.delete_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_slm") + 1 + len("policy") + 1 + len(r.PolicyID)) @@ -74,6 +90,9 @@ func (r SlmDeleteLifecycleRequest) Do(ctx context.Context, transport Transport) path.WriteString("policy") path.WriteString("/") path.WriteString(r.PolicyID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "policy_id", r.PolicyID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r SlmDeleteLifecycleRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r SlmDeleteLifecycleRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "slm.delete_lifecycle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.delete_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.slm.execute_lifecycle.go b/esapi/api.xpack.slm.execute_lifecycle.go index 06dab29deb..7c4a1aa5ae 100644 --- a/esapi/api.xpack.slm.execute_lifecycle.go +++ b/esapi/api.xpack.slm.execute_lifecycle.go @@ -31,6 +31,11 @@ func newSlmExecuteLifecycleFunc(t Transport) SlmExecuteLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type SlmExecuteLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SlmExecuteLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SlmExecuteLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.execute_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_slm") + 1 + len("policy") + 1 + len(r.PolicyID) + 1 + len("_execute")) @@ -74,6 +90,9 @@ func (r SlmExecuteLifecycleRequest) Do(ctx context.Context, transport Transport) path.WriteString("policy") path.WriteString("/") path.WriteString(r.PolicyID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "policy_id", r.PolicyID) + } path.WriteString("/") path.WriteString("_execute") @@ -97,6 +116,9 @@ func (r SlmExecuteLifecycleRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SlmExecuteLifecycleRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "slm.execute_lifecycle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.execute_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.slm.execute_retention.go b/esapi/api.xpack.slm.execute_retention.go index bb4255303f..b6fb31f3e7 100644 --- a/esapi/api.xpack.slm.execute_retention.go +++ b/esapi/api.xpack.slm.execute_retention.go @@ -31,6 +31,11 @@ func newSlmExecuteRetentionFunc(t Transport) SlmExecuteRetention { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SlmExecuteRetentionRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SlmExecuteRetentionRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SlmExecuteRetentionRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.execute_retention") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_slm/_execute_retention")) @@ -88,6 +104,9 @@ func (r SlmExecuteRetentionRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SlmExecuteRetentionRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "slm.execute_retention") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.execute_retention") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.slm.get_lifecycle.go b/esapi/api.xpack.slm.get_lifecycle.go index 12a4edca24..8cae902bf0 100644 --- a/esapi/api.xpack.slm.get_lifecycle.go +++ b/esapi/api.xpack.slm.get_lifecycle.go @@ -31,6 +31,11 @@ func newSlmGetLifecycleFunc(t Transport) SlmGetLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type SlmGetLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SlmGetLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SlmGetLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.get_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_slm") + 1 + len("policy") + 1 + len(strings.Join(r.PolicyID, ","))) @@ -75,6 +91,9 @@ func (r SlmGetLifecycleRequest) Do(ctx context.Context, transport Transport) (*R if len(r.PolicyID) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.PolicyID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "policy_id", strings.Join(r.PolicyID, ",")) + } } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r SlmGetLifecycleRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SlmGetLifecycleRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "slm.get_lifecycle") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.get_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.slm.get_stats.go b/esapi/api.xpack.slm.get_stats.go index 7d45089279..8a327584f6 100644 --- a/esapi/api.xpack.slm.get_stats.go +++ b/esapi/api.xpack.slm.get_stats.go @@ -31,6 +31,11 @@ func newSlmGetStatsFunc(t Transport) SlmGetStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SlmGetStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SlmGetStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SlmGetStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.get_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_slm/stats")) @@ -88,6 +104,9 @@ func (r SlmGetStatsRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SlmGetStatsRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "slm.get_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.get_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.slm.get_status.go b/esapi/api.xpack.slm.get_status.go index 80350b8d2b..f341e228eb 100644 --- a/esapi/api.xpack.slm.get_status.go +++ b/esapi/api.xpack.slm.get_status.go @@ -31,6 +31,11 @@ func newSlmGetStatusFunc(t Transport) SlmGetStatus { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SlmGetStatusRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SlmGetStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SlmGetStatusRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.get_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_slm/status")) @@ -88,6 +104,9 @@ func (r SlmGetStatusRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SlmGetStatusRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "slm.get_status") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.get_status") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.slm.put_lifecycle.go b/esapi/api.xpack.slm.put_lifecycle.go index c7cce0897d..ba58a7ab0c 100644 --- a/esapi/api.xpack.slm.put_lifecycle.go +++ b/esapi/api.xpack.slm.put_lifecycle.go @@ -32,6 +32,11 @@ func newSlmPutLifecycleFunc(t Transport) SlmPutLifecycle { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SlmPutLifecycleRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SlmPutLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SlmPutLifecycleRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.put_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_slm") + 1 + len("policy") + 1 + len(r.PolicyID)) @@ -77,6 +93,9 @@ func (r SlmPutLifecycleRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("policy") path.WriteString("/") path.WriteString(r.PolicyID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "policy_id", r.PolicyID) + } params = make(map[string]string) @@ -98,6 +117,9 @@ func (r SlmPutLifecycleRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,20 @@ func (r SlmPutLifecycleRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "slm.put_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "slm.put_lifecycle", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.put_lifecycle") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.slm.start.go b/esapi/api.xpack.slm.start.go index fd31f94405..c5b9f3e46e 100644 --- a/esapi/api.xpack.slm.start.go +++ b/esapi/api.xpack.slm.start.go @@ -31,6 +31,11 @@ func newSlmStartFunc(t Transport) SlmStart { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SlmStartRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SlmStartRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SlmStartRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.start") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_slm/start")) @@ -88,6 +104,9 @@ func (r SlmStartRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SlmStartRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "slm.start") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.start") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.slm.stop.go b/esapi/api.xpack.slm.stop.go index 724f1ebeb9..ef43f8ea43 100644 --- a/esapi/api.xpack.slm.stop.go +++ b/esapi/api.xpack.slm.stop.go @@ -31,6 +31,11 @@ func newSlmStopFunc(t Transport) SlmStop { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SlmStopRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SlmStopRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SlmStopRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.stop") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_slm/stop")) @@ -88,6 +104,9 @@ func (r SlmStopRequest) Do(ctx context.Context, transport Transport) (*Response, req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SlmStopRequest) Do(ctx context.Context, transport Transport) (*Response, req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "slm.stop") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.stop") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.sql.clear_cursor.go b/esapi/api.xpack.sql.clear_cursor.go index e24d2cca7d..3c048e7a0e 100644 --- a/esapi/api.xpack.sql.clear_cursor.go +++ b/esapi/api.xpack.sql.clear_cursor.go @@ -32,6 +32,11 @@ func newSQLClearCursorFunc(t Transport) SQLClearCursor { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SQLClearCursorRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SQLClearCursorRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SQLClearCursorRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.clear_cursor") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_sql/close")) @@ -91,6 +107,9 @@ func (r SQLClearCursorRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SQLClearCursorRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "sql.clear_cursor") + if reader := instrument.RecordRequestBody(ctx, "sql.clear_cursor", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.clear_cursor") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.sql.delete_async.go b/esapi/api.xpack.sql.delete_async.go index 5e06bfc0f1..9cfccd8883 100644 --- a/esapi/api.xpack.sql.delete_async.go +++ b/esapi/api.xpack.sql.delete_async.go @@ -31,6 +31,11 @@ func newSQLDeleteAsyncFunc(t Transport) SQLDeleteAsync { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type SQLDeleteAsyncRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SQLDeleteAsyncRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SQLDeleteAsyncRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.delete_async") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_sql") + 1 + len("async") + 1 + len("delete") + 1 + len(r.DocumentID)) @@ -76,6 +92,9 @@ func (r SQLDeleteAsyncRequest) Do(ctx context.Context, transport Transport) (*Re path.WriteString("delete") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r SQLDeleteAsyncRequest) Do(ctx context.Context, transport Transport) (*Re req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SQLDeleteAsyncRequest) Do(ctx context.Context, transport Transport) (*Re req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "sql.delete_async") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.delete_async") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.sql.get_async.go b/esapi/api.xpack.sql.get_async.go index 46c296d662..d7a5013791 100644 --- a/esapi/api.xpack.sql.get_async.go +++ b/esapi/api.xpack.sql.get_async.go @@ -32,6 +32,11 @@ func newSQLGetAsyncFunc(t Transport) SQLGetAsync { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type SQLGetAsyncRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SQLGetAsyncRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SQLGetAsyncRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.get_async") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_sql") + 1 + len("async") + 1 + len(r.DocumentID)) @@ -80,6 +96,9 @@ func (r SQLGetAsyncRequest) Do(ctx context.Context, transport Transport) (*Respo path.WriteString("async") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -117,6 +136,9 @@ func (r SQLGetAsyncRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -144,8 +166,17 @@ func (r SQLGetAsyncRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "sql.get_async") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.get_async") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.sql.get_async_status.go b/esapi/api.xpack.sql.get_async_status.go index 46fdff6392..81dafd9842 100644 --- a/esapi/api.xpack.sql.get_async_status.go +++ b/esapi/api.xpack.sql.get_async_status.go @@ -31,6 +31,11 @@ func newSQLGetAsyncStatusFunc(t Transport) SQLGetAsyncStatus { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type SQLGetAsyncStatusRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SQLGetAsyncStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SQLGetAsyncStatusRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.get_async_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_sql") + 1 + len("async") + 1 + len("status") + 1 + len(r.DocumentID)) @@ -76,6 +92,9 @@ func (r SQLGetAsyncStatusRequest) Do(ctx context.Context, transport Transport) ( path.WriteString("status") path.WriteString("/") path.WriteString(r.DocumentID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.DocumentID) + } params = make(map[string]string) @@ -97,6 +116,9 @@ func (r SQLGetAsyncStatusRequest) Do(ctx context.Context, transport Transport) ( req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r SQLGetAsyncStatusRequest) Do(ctx context.Context, transport Transport) ( req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "sql.get_async_status") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.get_async_status") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.sql.query.go b/esapi/api.xpack.sql.query.go index c422681fcd..cb4c34e2f2 100644 --- a/esapi/api.xpack.sql.query.go +++ b/esapi/api.xpack.sql.query.go @@ -32,6 +32,11 @@ func newSQLQueryFunc(t Transport) SQLQuery { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type SQLQueryRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SQLQueryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SQLQueryRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_sql")) @@ -97,6 +113,9 @@ func (r SQLQueryRequest) Do(ctx context.Context, transport Transport) (*Response req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +147,20 @@ func (r SQLQueryRequest) Do(ctx context.Context, transport Transport) (*Response req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "sql.query") + if reader := instrument.RecordRequestBody(ctx, "sql.query", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.query") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.sql.translate.go b/esapi/api.xpack.sql.translate.go index dccb954252..290f9c8af7 100644 --- a/esapi/api.xpack.sql.translate.go +++ b/esapi/api.xpack.sql.translate.go @@ -32,6 +32,11 @@ func newSQLTranslateFunc(t Transport) SQLTranslate { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type SQLTranslateRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SQLTranslateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SQLTranslateRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.translate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_sql/translate")) @@ -91,6 +107,9 @@ func (r SQLTranslateRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r SQLTranslateRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "sql.translate") + if reader := instrument.RecordRequestBody(ctx, "sql.translate", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.translate") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.ssl.certificates.go b/esapi/api.xpack.ssl.certificates.go index 9bb318bf40..ccb543a3e5 100644 --- a/esapi/api.xpack.ssl.certificates.go +++ b/esapi/api.xpack.ssl.certificates.go @@ -31,6 +31,11 @@ func newSSLCertificatesFunc(t Transport) SSLCertificates { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type SSLCertificatesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r SSLCertificatesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r SSLCertificatesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ssl.certificates") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_ssl/certificates")) @@ -88,6 +104,9 @@ func (r SSLCertificatesRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r SSLCertificatesRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "ssl.certificates") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ssl.certificates") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.text_structure.find_structure.go b/esapi/api.xpack.text_structure.find_structure.go index f9b23dfd91..1b06f989c9 100644 --- a/esapi/api.xpack.text_structure.find_structure.go +++ b/esapi/api.xpack.text_structure.find_structure.go @@ -34,6 +34,11 @@ func newTextStructureFindStructureFunc(t Transport) TextStructureFindStructure { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -73,16 +78,27 @@ type TextStructureFindStructureRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TextStructureFindStructureRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TextStructureFindStructureRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "text_structure.find_structure") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_text_structure/find_structure")) @@ -169,6 +185,9 @@ func (r TextStructureFindStructureRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -200,8 +219,20 @@ func (r TextStructureFindStructureRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "text_structure.find_structure") + if reader := instrument.RecordRequestBody(ctx, "text_structure.find_structure", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "text_structure.find_structure") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.delete_transform.go b/esapi/api.xpack.transform.delete_transform.go index fde3dd7dae..91d73651e2 100644 --- a/esapi/api.xpack.transform.delete_transform.go +++ b/esapi/api.xpack.transform.delete_transform.go @@ -33,6 +33,11 @@ func newTransformDeleteTransformFunc(t Transport) TransformDeleteTransform { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type TransformDeleteTransformRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformDeleteTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformDeleteTransformRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.delete_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_transform") + 1 + len(r.TransformID)) @@ -78,6 +94,9 @@ func (r TransformDeleteTransformRequest) Do(ctx context.Context, transport Trans path.WriteString("_transform") path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } params = make(map[string]string) @@ -111,6 +130,9 @@ func (r TransformDeleteTransformRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +160,17 @@ func (r TransformDeleteTransformRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.delete_transform") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.delete_transform") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.get_transform.go b/esapi/api.xpack.transform.get_transform.go index 007ea75196..28f89d5b60 100644 --- a/esapi/api.xpack.transform.get_transform.go +++ b/esapi/api.xpack.transform.get_transform.go @@ -32,6 +32,11 @@ func newTransformGetTransformFunc(t Transport) TransformGetTransform { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type TransformGetTransformRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformGetTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformGetTransformRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.get_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_transform") + 1 + len(r.TransformID)) @@ -79,6 +95,9 @@ func (r TransformGetTransformRequest) Do(ctx context.Context, transport Transpor if r.TransformID != "" { path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } } params = make(map[string]string) @@ -117,6 +136,9 @@ func (r TransformGetTransformRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -144,8 +166,17 @@ func (r TransformGetTransformRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.get_transform") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.get_transform") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.get_transform_stats.go b/esapi/api.xpack.transform.get_transform_stats.go index 9f1c8ff1c2..1ba3a49688 100644 --- a/esapi/api.xpack.transform.get_transform_stats.go +++ b/esapi/api.xpack.transform.get_transform_stats.go @@ -33,6 +33,11 @@ func newTransformGetTransformStatsFunc(t Transport) TransformGetTransformStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -61,16 +66,27 @@ type TransformGetTransformStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformGetTransformStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformGetTransformStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.get_transform_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_stats")) @@ -79,6 +95,9 @@ func (r TransformGetTransformStatsRequest) Do(ctx context.Context, transport Tra path.WriteString("_transform") path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } path.WriteString("/") path.WriteString("_stats") @@ -118,6 +137,9 @@ func (r TransformGetTransformStatsRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -145,8 +167,17 @@ func (r TransformGetTransformStatsRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.get_transform_stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.get_transform_stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.preview_transform.go b/esapi/api.xpack.transform.preview_transform.go index b7361729f0..2a6a11cd87 100644 --- a/esapi/api.xpack.transform.preview_transform.go +++ b/esapi/api.xpack.transform.preview_transform.go @@ -33,6 +33,11 @@ func newTransformPreviewTransformFunc(t Transport) TransformPreviewTransform { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type TransformPreviewTransformRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformPreviewTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformPreviewTransformRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.preview_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_preview")) @@ -79,6 +95,9 @@ func (r TransformPreviewTransformRequest) Do(ctx context.Context, transport Tran if r.TransformID != "" { path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } } path.WriteString("/") path.WriteString("_preview") @@ -107,6 +126,9 @@ func (r TransformPreviewTransformRequest) Do(ctx context.Context, transport Tran req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -138,8 +160,20 @@ func (r TransformPreviewTransformRequest) Do(ctx context.Context, transport Tran req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.preview_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.preview_transform", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.preview_transform") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.put_transform.go b/esapi/api.xpack.transform.put_transform.go index 94d3f07a24..dd51b142ee 100644 --- a/esapi/api.xpack.transform.put_transform.go +++ b/esapi/api.xpack.transform.put_transform.go @@ -34,6 +34,11 @@ func newTransformPutTransformFunc(t Transport) TransformPutTransform { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type TransformPutTransformRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformPutTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformPutTransformRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.put_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_transform") + 1 + len(r.TransformID)) @@ -80,6 +96,9 @@ func (r TransformPutTransformRequest) Do(ctx context.Context, transport Transpor path.WriteString("_transform") path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } params = make(map[string]string) @@ -109,6 +128,9 @@ func (r TransformPutTransformRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +162,20 @@ func (r TransformPutTransformRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.put_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.put_transform", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.put_transform") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.reset_transform.go b/esapi/api.xpack.transform.reset_transform.go index 31cf1e8535..d97eb1ea3f 100644 --- a/esapi/api.xpack.transform.reset_transform.go +++ b/esapi/api.xpack.transform.reset_transform.go @@ -33,6 +33,11 @@ func newTransformResetTransformFunc(t Transport) TransformResetTransform { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -59,16 +64,27 @@ type TransformResetTransformRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformResetTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformResetTransformRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.reset_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_reset")) @@ -77,6 +93,9 @@ func (r TransformResetTransformRequest) Do(ctx context.Context, transport Transp path.WriteString("_transform") path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } path.WriteString("/") path.WriteString("_reset") @@ -108,6 +127,9 @@ func (r TransformResetTransformRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,17 @@ func (r TransformResetTransformRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.reset_transform") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.reset_transform") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.schedule_now_transform.go b/esapi/api.xpack.transform.schedule_now_transform.go index 7555d6eb71..3c3679edfc 100644 --- a/esapi/api.xpack.transform.schedule_now_transform.go +++ b/esapi/api.xpack.transform.schedule_now_transform.go @@ -32,6 +32,11 @@ func newTransformScheduleNowTransformFunc(t Transport) TransformScheduleNowTrans for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type TransformScheduleNowTransformRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformScheduleNowTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformScheduleNowTransformRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.schedule_now_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_schedule_now")) @@ -75,6 +91,9 @@ func (r TransformScheduleNowTransformRequest) Do(ctx context.Context, transport path.WriteString("_transform") path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } path.WriteString("/") path.WriteString("_schedule_now") @@ -102,6 +121,9 @@ func (r TransformScheduleNowTransformRequest) Do(ctx context.Context, transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +151,17 @@ func (r TransformScheduleNowTransformRequest) Do(ctx context.Context, transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.schedule_now_transform") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.schedule_now_transform") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.start_transform.go b/esapi/api.xpack.transform.start_transform.go index adce688281..68ce78a35a 100644 --- a/esapi/api.xpack.transform.start_transform.go +++ b/esapi/api.xpack.transform.start_transform.go @@ -32,6 +32,11 @@ func newTransformStartTransformFunc(t Transport) TransformStartTransform { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -58,16 +63,27 @@ type TransformStartTransformRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformStartTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformStartTransformRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.start_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_start")) @@ -76,6 +92,9 @@ func (r TransformStartTransformRequest) Do(ctx context.Context, transport Transp path.WriteString("_transform") path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } path.WriteString("/") path.WriteString("_start") @@ -107,6 +126,9 @@ func (r TransformStartTransformRequest) Do(ctx context.Context, transport Transp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -134,8 +156,17 @@ func (r TransformStartTransformRequest) Do(ctx context.Context, transport Transp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.start_transform") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.start_transform") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.stop_transform.go b/esapi/api.xpack.transform.stop_transform.go index 58791c1024..26a77ae771 100644 --- a/esapi/api.xpack.transform.stop_transform.go +++ b/esapi/api.xpack.transform.stop_transform.go @@ -33,6 +33,11 @@ func newTransformStopTransformFunc(t Transport) TransformStopTransform { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type TransformStopTransformRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformStopTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformStopTransformRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.stop_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_stop")) @@ -80,6 +96,9 @@ func (r TransformStopTransformRequest) Do(ctx context.Context, transport Transpo path.WriteString("_transform") path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } path.WriteString("/") path.WriteString("_stop") @@ -123,6 +142,9 @@ func (r TransformStopTransformRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -150,8 +172,17 @@ func (r TransformStopTransformRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.stop_transform") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.stop_transform") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.update_transform.go b/esapi/api.xpack.transform.update_transform.go index cacd490c05..c6a1a4c49e 100644 --- a/esapi/api.xpack.transform.update_transform.go +++ b/esapi/api.xpack.transform.update_transform.go @@ -34,6 +34,11 @@ func newTransformUpdateTransformFunc(t Transport) TransformUpdateTransform { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -62,16 +67,27 @@ type TransformUpdateTransformRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformUpdateTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformUpdateTransformRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.update_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + 1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_update")) @@ -80,6 +96,9 @@ func (r TransformUpdateTransformRequest) Do(ctx context.Context, transport Trans path.WriteString("_transform") path.WriteString("/") path.WriteString(r.TransformID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "transform_id", r.TransformID) + } path.WriteString("/") path.WriteString("_update") @@ -111,6 +130,9 @@ func (r TransformUpdateTransformRequest) Do(ctx context.Context, transport Trans req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -142,8 +164,20 @@ func (r TransformUpdateTransformRequest) Do(ctx context.Context, transport Trans req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.update_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.update_transform", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.update_transform") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.transform.upgrade_transforms.go b/esapi/api.xpack.transform.upgrade_transforms.go index 4d9d867954..7d10c0dbe4 100644 --- a/esapi/api.xpack.transform.upgrade_transforms.go +++ b/esapi/api.xpack.transform.upgrade_transforms.go @@ -33,6 +33,11 @@ func newTransformUpgradeTransformsFunc(t Transport) TransformUpgradeTransforms { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type TransformUpgradeTransformsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r TransformUpgradeTransformsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r TransformUpgradeTransformsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.upgrade_transforms") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_transform/_upgrade")) @@ -101,6 +117,9 @@ func (r TransformUpgradeTransformsRequest) Do(ctx context.Context, transport Tra req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -128,8 +147,17 @@ func (r TransformUpgradeTransformsRequest) Do(ctx context.Context, transport Tra req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "transform.upgrade_transforms") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.upgrade_transforms") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.ack_watch.go b/esapi/api.xpack.watcher.ack_watch.go index c0c8ff7f3a..7ba9d9d231 100644 --- a/esapi/api.xpack.watcher.ack_watch.go +++ b/esapi/api.xpack.watcher.ack_watch.go @@ -31,6 +31,11 @@ func newWatcherAckWatchFunc(t Transport) WatcherAckWatch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type WatcherAckWatchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherAckWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherAckWatchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.ack_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID) + 1 + len("_ack") + 1 + len(strings.Join(r.ActionID, ","))) @@ -75,11 +91,17 @@ func (r WatcherAckWatchRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("watch") path.WriteString("/") path.WriteString(r.WatchID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "watch_id", r.WatchID) + } path.WriteString("/") path.WriteString("_ack") if len(r.ActionID) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.ActionID, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "action_id", strings.Join(r.ActionID, ",")) + } } params = make(map[string]string) @@ -102,6 +124,9 @@ func (r WatcherAckWatchRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -129,8 +154,17 @@ func (r WatcherAckWatchRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.ack_watch") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.ack_watch") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.activate_watch.go b/esapi/api.xpack.watcher.activate_watch.go index f87ed60f87..668baa3894 100644 --- a/esapi/api.xpack.watcher.activate_watch.go +++ b/esapi/api.xpack.watcher.activate_watch.go @@ -31,6 +31,11 @@ func newWatcherActivateWatchFunc(t Transport) WatcherActivateWatch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type WatcherActivateWatchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherActivateWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherActivateWatchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.activate_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID) + 1 + len("_activate")) @@ -74,6 +90,9 @@ func (r WatcherActivateWatchRequest) Do(ctx context.Context, transport Transport path.WriteString("watch") path.WriteString("/") path.WriteString(r.WatchID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "watch_id", r.WatchID) + } path.WriteString("/") path.WriteString("_activate") @@ -97,6 +116,9 @@ func (r WatcherActivateWatchRequest) Do(ctx context.Context, transport Transport req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r WatcherActivateWatchRequest) Do(ctx context.Context, transport Transport req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.activate_watch") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.activate_watch") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.deactivate_watch.go b/esapi/api.xpack.watcher.deactivate_watch.go index 75dffbe257..1584ebdd55 100644 --- a/esapi/api.xpack.watcher.deactivate_watch.go +++ b/esapi/api.xpack.watcher.deactivate_watch.go @@ -31,6 +31,11 @@ func newWatcherDeactivateWatchFunc(t Transport) WatcherDeactivateWatch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type WatcherDeactivateWatchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherDeactivateWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherDeactivateWatchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.deactivate_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID) + 1 + len("_deactivate")) @@ -74,6 +90,9 @@ func (r WatcherDeactivateWatchRequest) Do(ctx context.Context, transport Transpo path.WriteString("watch") path.WriteString("/") path.WriteString(r.WatchID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "watch_id", r.WatchID) + } path.WriteString("/") path.WriteString("_deactivate") @@ -97,6 +116,9 @@ func (r WatcherDeactivateWatchRequest) Do(ctx context.Context, transport Transpo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -124,8 +146,17 @@ func (r WatcherDeactivateWatchRequest) Do(ctx context.Context, transport Transpo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.deactivate_watch") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.deactivate_watch") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.delete_watch.go b/esapi/api.xpack.watcher.delete_watch.go index 91ba62ad12..d60782cff2 100644 --- a/esapi/api.xpack.watcher.delete_watch.go +++ b/esapi/api.xpack.watcher.delete_watch.go @@ -31,6 +31,11 @@ func newWatcherDeleteWatchFunc(t Transport) WatcherDeleteWatch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type WatcherDeleteWatchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherDeleteWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherDeleteWatchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.delete_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "DELETE" path.Grow(7 + 1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID)) @@ -74,6 +90,9 @@ func (r WatcherDeleteWatchRequest) Do(ctx context.Context, transport Transport) path.WriteString("watch") path.WriteString("/") path.WriteString(r.WatchID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.WatchID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r WatcherDeleteWatchRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r WatcherDeleteWatchRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.delete_watch") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.delete_watch") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.execute_watch.go b/esapi/api.xpack.watcher.execute_watch.go index 051af9facd..7bf90ed55d 100644 --- a/esapi/api.xpack.watcher.execute_watch.go +++ b/esapi/api.xpack.watcher.execute_watch.go @@ -33,6 +33,11 @@ func newWatcherExecuteWatchFunc(t Transport) WatcherExecuteWatch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -60,16 +65,27 @@ type WatcherExecuteWatchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherExecuteWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherExecuteWatchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.execute_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID) + 1 + len("_execute")) @@ -81,6 +97,9 @@ func (r WatcherExecuteWatchRequest) Do(ctx context.Context, transport Transport) if r.WatchID != "" { path.WriteString("/") path.WriteString(r.WatchID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.WatchID) + } } path.WriteString("/") path.WriteString("_execute") @@ -109,6 +128,9 @@ func (r WatcherExecuteWatchRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -140,8 +162,20 @@ func (r WatcherExecuteWatchRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.execute_watch") + if reader := instrument.RecordRequestBody(ctx, "watcher.execute_watch", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.execute_watch") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.get_settings.go b/esapi/api.xpack.watcher.get_settings.go index 860aaee79a..1f98915210 100644 --- a/esapi/api.xpack.watcher.get_settings.go +++ b/esapi/api.xpack.watcher.get_settings.go @@ -31,6 +31,11 @@ func newWatcherGetSettingsFunc(t Transport) WatcherGetSettings { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type WatcherGetSettingsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherGetSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherGetSettingsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.get_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_watcher/settings")) @@ -88,6 +104,9 @@ func (r WatcherGetSettingsRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r WatcherGetSettingsRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.get_settings") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.get_settings") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.get_watch.go b/esapi/api.xpack.watcher.get_watch.go index e473187cb5..86d27a25b3 100644 --- a/esapi/api.xpack.watcher.get_watch.go +++ b/esapi/api.xpack.watcher.get_watch.go @@ -31,6 +31,11 @@ func newWatcherGetWatchFunc(t Transport) WatcherGetWatch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -54,16 +59,27 @@ type WatcherGetWatchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherGetWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherGetWatchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.get_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID)) @@ -74,6 +90,9 @@ func (r WatcherGetWatchRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("watch") path.WriteString("/") path.WriteString(r.WatchID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.WatchID) + } params = make(map[string]string) @@ -95,6 +114,9 @@ func (r WatcherGetWatchRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +144,17 @@ func (r WatcherGetWatchRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.get_watch") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.get_watch") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.put_watch.go b/esapi/api.xpack.watcher.put_watch.go index 8c970cde75..44200a7235 100644 --- a/esapi/api.xpack.watcher.put_watch.go +++ b/esapi/api.xpack.watcher.put_watch.go @@ -33,6 +33,11 @@ func newWatcherPutWatchFunc(t Transport) WatcherPutWatch { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -63,16 +68,27 @@ type WatcherPutWatchRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherPutWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherPutWatchRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.put_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + 1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID)) @@ -83,6 +99,9 @@ func (r WatcherPutWatchRequest) Do(ctx context.Context, transport Transport) (*R path.WriteString("watch") path.WriteString("/") path.WriteString(r.WatchID) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.WatchID) + } params = make(map[string]string) @@ -120,6 +139,9 @@ func (r WatcherPutWatchRequest) Do(ctx context.Context, transport Transport) (*R req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -151,8 +173,20 @@ func (r WatcherPutWatchRequest) Do(ctx context.Context, transport Transport) (*R req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.put_watch") + if reader := instrument.RecordRequestBody(ctx, "watcher.put_watch", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.put_watch") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.query_watches.go b/esapi/api.xpack.watcher.query_watches.go index 45bde494a1..32cd3e9546 100644 --- a/esapi/api.xpack.watcher.query_watches.go +++ b/esapi/api.xpack.watcher.query_watches.go @@ -32,6 +32,11 @@ func newWatcherQueryWatchesFunc(t Transport) WatcherQueryWatches { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type WatcherQueryWatchesRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherQueryWatchesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherQueryWatchesRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.query_watches") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_watcher/_query/watches")) @@ -91,6 +107,9 @@ func (r WatcherQueryWatchesRequest) Do(ctx context.Context, transport Transport) req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r WatcherQueryWatchesRequest) Do(ctx context.Context, transport Transport) req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.query_watches") + if reader := instrument.RecordRequestBody(ctx, "watcher.query_watches", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.query_watches") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.start.go b/esapi/api.xpack.watcher.start.go index 5940d59865..fc3becf593 100644 --- a/esapi/api.xpack.watcher.start.go +++ b/esapi/api.xpack.watcher.start.go @@ -31,6 +31,11 @@ func newWatcherStartFunc(t Transport) WatcherStart { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type WatcherStartRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherStartRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherStartRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.start") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_watcher/_start")) @@ -88,6 +104,9 @@ func (r WatcherStartRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r WatcherStartRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.start") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.start") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.stats.go b/esapi/api.xpack.watcher.stats.go index b28452e721..f17e4f77dd 100644 --- a/esapi/api.xpack.watcher.stats.go +++ b/esapi/api.xpack.watcher.stats.go @@ -32,6 +32,11 @@ func newWatcherStatsFunc(t Transport) WatcherStats { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -57,16 +62,27 @@ type WatcherStatsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherStatsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + 1 + len("_watcher") + 1 + len("stats") + 1 + len(strings.Join(r.Metric, ","))) @@ -78,6 +94,9 @@ func (r WatcherStatsRequest) Do(ctx context.Context, transport Transport) (*Resp if len(r.Metric) > 0 { path.WriteString("/") path.WriteString(strings.Join(r.Metric, ",")) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", strings.Join(r.Metric, ",")) + } } params = make(map[string]string) @@ -108,6 +127,9 @@ func (r WatcherStatsRequest) Do(ctx context.Context, transport Transport) (*Resp req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -135,8 +157,17 @@ func (r WatcherStatsRequest) Do(ctx context.Context, transport Transport) (*Resp req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.stats") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.stats") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.stop.go b/esapi/api.xpack.watcher.stop.go index 225aad0671..10c878e7c9 100644 --- a/esapi/api.xpack.watcher.stop.go +++ b/esapi/api.xpack.watcher.stop.go @@ -31,6 +31,11 @@ func newWatcherStopFunc(t Transport) WatcherStop { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -52,16 +57,27 @@ type WatcherStopRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherStopRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherStopRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.stop") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "POST" path.Grow(7 + len("/_watcher/_stop")) @@ -88,6 +104,9 @@ func (r WatcherStopRequest) Do(ctx context.Context, transport Transport) (*Respo req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -115,8 +134,17 @@ func (r WatcherStopRequest) Do(ctx context.Context, transport Transport) (*Respo req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.stop") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.stop") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.watcher.update_settings.go b/esapi/api.xpack.watcher.update_settings.go index c4e8d08898..ee48817ed2 100644 --- a/esapi/api.xpack.watcher.update_settings.go +++ b/esapi/api.xpack.watcher.update_settings.go @@ -32,6 +32,11 @@ func newWatcherUpdateSettingsFunc(t Transport) WatcherUpdateSettings { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type WatcherUpdateSettingsRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r WatcherUpdateSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r WatcherUpdateSettingsRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.update_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "PUT" path.Grow(7 + len("/_watcher/settings")) @@ -91,6 +107,9 @@ func (r WatcherUpdateSettingsRequest) Do(ctx context.Context, transport Transpor req, err := newRequest(method, path.String(), r.Body) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,20 @@ func (r WatcherUpdateSettingsRequest) Do(ctx context.Context, transport Transpor req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.update_settings") + if reader := instrument.RecordRequestBody(ctx, "watcher.update_settings", r.Body); reader != nil { + req.Body = reader + } + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.update_settings") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.xpack.info.go b/esapi/api.xpack.xpack.info.go index 51322b43bb..489bec4742 100644 --- a/esapi/api.xpack.xpack.info.go +++ b/esapi/api.xpack.xpack.info.go @@ -32,6 +32,11 @@ func newXPackInfoFunc(t Transport) XPackInfo { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -56,16 +61,27 @@ type XPackInfoRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r XPackInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r XPackInfoRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "xpack.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_xpack")) @@ -100,6 +116,9 @@ func (r XPackInfoRequest) Do(ctx context.Context, transport Transport) (*Respons req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -127,8 +146,17 @@ func (r XPackInfoRequest) Do(ctx context.Context, transport Transport) (*Respons req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "xpack.info") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "xpack.info") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/api.xpack.xpack.usage.go b/esapi/api.xpack.xpack.usage.go index 2991f71fec..da299c36a2 100644 --- a/esapi/api.xpack.xpack.usage.go +++ b/esapi/api.xpack.xpack.usage.go @@ -32,6 +32,11 @@ func newXPackUsageFunc(t Transport) XPackUsage { for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -55,16 +60,27 @@ type XPackUsageRequest struct { Header http.Header ctx context.Context + + instrument Instrumentation } // Do executes the request and returns response or error. -func (r XPackUsageRequest) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r XPackUsageRequest) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context ) + if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "xpack.usage") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + method = "GET" path.Grow(7 + len("/_xpack/usage")) @@ -95,6 +111,9 @@ func (r XPackUsageRequest) Do(ctx context.Context, transport Transport) (*Respon req, err := newRequest(method, path.String(), nil) if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -122,8 +141,17 @@ func (r XPackUsageRequest) Do(ctx context.Context, transport Transport) (*Respon req = req.WithContext(ctx) } + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "xpack.usage") + } res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "xpack.usage") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } diff --git a/esapi/esapi.go b/esapi/esapi.go index 0f33040add..12e39bb36b 100644 --- a/esapi/esapi.go +++ b/esapi/esapi.go @@ -22,25 +22,29 @@ import ( "strconv" "time" + "github.com/elastic/elastic-transport-go/v8/elastictransport" "github.com/elastic/go-elasticsearch/v8/internal/version" ) // Version returns the package version as a string. -// const Version = version.Client // Transport defines the interface for an API client. -// type Transport interface { Perform(*http.Request) (*http.Response, error) } +// Instrumented allows to retrieve the current transport Instrumentation +type Instrumented elastictransport.Instrumented + +// Instrumentation defines the interface for the instrumentation API. +type Instrumentation elastictransport.Instrumentation + // BoolPtr returns a pointer to v. // // It is used as a convenience function for converting a bool value // into a pointer when passing the value to a function or struct field // which expects a pointer. -// func BoolPtr(v bool) *bool { return &v } // IntPtr returns a pointer to v. @@ -48,12 +52,10 @@ func BoolPtr(v bool) *bool { return &v } // It is used as a convenience function for converting an int value // into a pointer when passing the value to a function or struct field // which expects a pointer. -// func IntPtr(v int) *int { return &v } // formatDuration converts duration to a string in the format // accepted by Elasticsearch. -// func formatDuration(d time.Duration) string { if d < time.Millisecond { return strconv.FormatInt(int64(d), 10) + "nanos" diff --git a/go.mod b/go.mod index 4f8ca3599d..54055623b1 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,15 @@ module github.com/elastic/go-elasticsearch/v8 -go 1.13 +go 1.20 -require github.com/elastic/elastic-transport-go/v8 v8.3.0 +require ( + github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b + go.opentelemetry.io/otel/trace v1.21.0 +) + +require ( + github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect +) diff --git a/go.sum b/go.sum index 1116adba6a..76f04f8878 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,20 @@ -github.com/elastic/elastic-transport-go/v8 v8.3.0 h1:DJGxovyQLXGr62e9nDMPSxRyWION0Bh6d9eCFBriiHo= -github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b h1:gukInwnC6WLBaoc4Knb2nG3lSxBuqaEEDYFBz4orRcw= +github.com/elastic/elastic-transport-go/v8 v8.3.1-0.20231219154625-903383caf56b/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/build/cmd/generate/commands/gensource/generator.go b/internal/build/cmd/generate/commands/gensource/generator.go index 8f74e60c3a..40e75077a2 100644 --- a/internal/build/cmd/generate/commands/gensource/generator.go +++ b/internal/build/cmd/generate/commands/gensource/generator.go @@ -135,6 +135,11 @@ func new` + g.Endpoint.MethodWithNamespace() + `Func(t Transport) ` + g.Endpoint g.w(` for _, f := range o { f(&r) } + + if transport, ok := t.(Instrumented); ok { + r.instrument = transport.InstrumentationEnabled() + } + return r.Do(r.ctx, t) } } @@ -281,7 +286,9 @@ type ` + g.Endpoint.MethodWithNamespace() + `Request struct {`) g.w("\n\n\tHeader\thttp.Header\n") - g.w("\n\tctx context.Context\n}\n") + g.w("\n\tctx context.Context\n") + g.w("\n\tinstrument Instrumentation\n") + g.w("}\n") } func (g *Generator) genWithOptions() { @@ -494,13 +501,22 @@ func (f ` + g.Endpoint.MethodWithNamespace() + `) WithOpaqueID(s string) func(*` func (g *Generator) genDoMethod() { g.w(`// Do executes the request and returns response or error. // -func (r ` + g.Endpoint.MethodWithNamespace() + `Request) Do(ctx context.Context, transport Transport) (*Response, error) { +func (r ` + g.Endpoint.MethodWithNamespace() + `Request) Do(providedCtx context.Context, transport Transport) (*Response, error) { var ( method string path strings.Builder params map[string]string + ctx context.Context )` + "\n\n") + g.w(`if instrument, ok := r.instrument.(Instrumentation); ok { + ctx = instrument.Start(providedCtx, "` + g.Endpoint.Name + `") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + }` + "\n\n") + switch g.Endpoint.Name { case "index": g.w("\t") @@ -630,17 +646,29 @@ func (r ` + g.Endpoint.MethodWithNamespace() + `Request) Do(ctx context.Context, requiredArgsValidation.WriteString(`if r.` + p + ` == nil { return nil, errors.New("` + a.Name + ` is required and cannot be nil") }` + "\n") pathGrow.WriteString(`len(strconv.Itoa(*r.` + p + `)) + `) pathContent.WriteString(` path.WriteString(strconv.Itoa(*r.` + p + `))` + "\n") + pathContent.WriteString(`if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "` + a.Name + `", strconv.Itoa(*r.` + p + `)) + }` + "\n") case "string": pathGrow.WriteString(`len(r.` + p + `) + `) pathContent.WriteString(` path.WriteString(r.` + p + `)` + "\n") + pathContent.WriteString(`if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "` + a.Name + `", r.` + p + `) + }` + "\n") case "list": requiredArgsValidation.WriteString(`if len(r.` + p + `) == 0 { return nil, errors.New("` + a.Name + ` is required and cannot be nil or empty") }` + "\n") pathGrow.WriteString(`len(strings.Join(r.` + p + `, ",")) + `) pathContent.WriteString(` path.WriteString(strings.Join(r.` + p + `, ","))` + "\n") + pathContent.WriteString(`if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "` + a.Name + `", strings.Join(r.` + p + `, ",")) + }` + "\n") case "long": requiredArgsValidation.WriteString(`if r.` + p + ` == nil { return nil, errors.New("` + a.Name + ` is required and cannot be nil") }` + "\n") pathGrow.WriteString(`len(strconv.Itoa(*r.` + p + `)) + `) pathContent.WriteString(` path.WriteString(strconv.Itoa(*r.` + p + `))` + "\n") + pathContent.WriteString(`if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "` + a.Name + `", strconv.Itoa(*r.` + p + `)) + }` + "\n") default: panic(fmt.Sprintf("FAIL: %q: unexpected type %q for URL part %q\n", g.Endpoint.Name, a.Type, a.Name)) } @@ -661,12 +689,18 @@ func (r ` + g.Endpoint.MethodWithNamespace() + `Request) Do(ctx context.Context, pathContent.WriteString(` if r.` + p + ` != "" {` + "\n") pathContent.WriteString(` path.WriteString("/")` + "\n") pathContent.WriteString(` path.WriteString(r.` + p + `)` + "\n") + pathContent.WriteString(`if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "` + a.Name + `", r.` + p + `) + }` + "\n") pathContent.WriteString(` }` + "\n") case "list": pathGrow.WriteString(`1 + len(strings.Join(r.` + p + `, ",")) + `) pathContent.WriteString(` if len(r.` + p + `) > 0 {` + "\n") pathContent.WriteString(` path.WriteString("/")` + "\n") pathContent.WriteString(` path.WriteString(strings.Join(r.` + p + `, ","))` + "\n") + pathContent.WriteString(`if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "` + a.Name + `", strings.Join(r.` + p + `, ",")) + }` + "\n") pathContent.WriteString(` }` + "\n") case "int", "long": pathContent.WriteString(` if r.` + p + ` != nil {` + "\n") @@ -674,6 +708,9 @@ func (r ` + g.Endpoint.MethodWithNamespace() + `Request) Do(ctx context.Context, pathContent.WriteString(` path.Grow(1 + len(value))` + "\n") pathContent.WriteString(` path.WriteString("/")` + "\n") pathContent.WriteString(` path.WriteString(value)` + "\n") + pathContent.WriteString(`if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordPathPart(ctx, "` + a.Name + `", value) + }` + "\n") pathContent.WriteString(` }` + "\n") default: panic(fmt.Sprintf("FAIL: %q: unexpected type %q for URL part %q\n", g.Endpoint.Name, a.Type, a.Name)) @@ -811,6 +848,9 @@ func (r ` + g.Endpoint.MethodWithNamespace() + `Request) Do(ctx context.Context, g.w(`req, err := newRequest(method, path.String(), ` + httpBody + `)` + "\n") g.w(`if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err }` + "\n\n") @@ -844,9 +884,26 @@ func (r ` + g.Endpoint.MethodWithNamespace() + `Request) Do(ctx context.Context, req = req.WithContext(ctx) }` + "\n\n") + g.w(` + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.BeforeRequest(req, "` + g.Endpoint.Name + `") + `) + if g.Endpoint.Body != nil { + g.w(`if reader := instrument.RecordRequestBody(ctx, "` + g.Endpoint.Name + `", r.Body); reader != nil { + req.Body = reader + }`) + } + + g.w(`}`) g.w(` res, err := transport.Perform(req) + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "` + g.Endpoint.Name + `") + } if err != nil { + if instrument, ok := r.instrument.(Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err }` + "\n\n") diff --git a/internal/build/go.mod b/internal/build/go.mod index 4a6d3aaf3b..9985a4c0d0 100644 --- a/internal/build/go.mod +++ b/internal/build/go.mod @@ -1,6 +1,6 @@ module github.com/elastic/go-elasticsearch/v8/internal/build -go 1.15 +go 1.20 replace github.com/elastic/go-elasticsearch/v8 => ../../ @@ -8,8 +8,17 @@ require ( github.com/alecthomas/chroma v0.8.2 github.com/elastic/go-elasticsearch/v8 v8.0.0-20210817150010-57d659deaca7 github.com/spf13/cobra v1.1.3 - github.com/stretchr/testify v1.4.0 // indirect golang.org/x/crypto v0.0.0-20220408190544-5352b0902921 golang.org/x/tools v0.7.0 gopkg.in/yaml.v2 v2.4.0 ) + +require ( + github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect + github.com/dlclark/regexp2 v1.2.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + golang.org/x/mod v0.9.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect +) diff --git a/internal/build/go.sum b/internal/build/go.sum index 7d285df13f..568ca41694 100644 --- a/internal/build/go.sum +++ b/internal/build/go.sum @@ -43,13 +43,11 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/elastic/elastic-transport-go/v8 v8.0.0-20230329154755-1a3c63de0db6/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -144,7 +142,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -182,12 +179,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -199,7 +193,6 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220408190544-5352b0902921 h1:iU7T1X1J6yxDr0rda54sWGkHgOp5XJrqm79gcNlC2VM= golang.org/x/crypto v0.0.0-20220408190544-5352b0902921/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -220,8 +213,6 @@ golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -238,11 +229,6 @@ golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -251,9 +237,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -271,26 +255,13 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -310,9 +281,6 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -346,7 +314,6 @@ gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/typedapi/api._.go b/typedapi/api._.go index f875a49369..0f630b5374 100644 --- a/typedapi/api._.go +++ b/typedapi/api._.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package typedapi @@ -141,10 +141,12 @@ import ( eql_get "github.com/elastic/go-elasticsearch/v8/typedapi/eql/get" eql_get_status "github.com/elastic/go-elasticsearch/v8/typedapi/eql/getstatus" eql_search "github.com/elastic/go-elasticsearch/v8/typedapi/eql/search" + esql_query "github.com/elastic/go-elasticsearch/v8/typedapi/esql/query" features_get_features "github.com/elastic/go-elasticsearch/v8/typedapi/features/getfeatures" features_reset_features "github.com/elastic/go-elasticsearch/v8/typedapi/features/resetfeatures" fleet_global_checkpoints "github.com/elastic/go-elasticsearch/v8/typedapi/fleet/globalcheckpoints" fleet_msearch "github.com/elastic/go-elasticsearch/v8/typedapi/fleet/msearch" + fleet_post_secret "github.com/elastic/go-elasticsearch/v8/typedapi/fleet/postsecret" fleet_search "github.com/elastic/go-elasticsearch/v8/typedapi/fleet/search" graph_explore "github.com/elastic/go-elasticsearch/v8/typedapi/graph/explore" ilm_delete_lifecycle "github.com/elastic/go-elasticsearch/v8/typedapi/ilm/deletelifecycle" @@ -216,6 +218,10 @@ import ( indices_unfreeze "github.com/elastic/go-elasticsearch/v8/typedapi/indices/unfreeze" indices_update_aliases "github.com/elastic/go-elasticsearch/v8/typedapi/indices/updatealiases" indices_validate_query "github.com/elastic/go-elasticsearch/v8/typedapi/indices/validatequery" + inference_delete_model "github.com/elastic/go-elasticsearch/v8/typedapi/inference/deletemodel" + inference_get_model "github.com/elastic/go-elasticsearch/v8/typedapi/inference/getmodel" + inference_inference "github.com/elastic/go-elasticsearch/v8/typedapi/inference/inference" + inference_put_model "github.com/elastic/go-elasticsearch/v8/typedapi/inference/putmodel" ingest_delete_pipeline "github.com/elastic/go-elasticsearch/v8/typedapi/ingest/deletepipeline" ingest_geo_ip_stats "github.com/elastic/go-elasticsearch/v8/typedapi/ingest/geoipstats" ingest_get_pipeline "github.com/elastic/go-elasticsearch/v8/typedapi/ingest/getpipeline" @@ -369,6 +375,7 @@ import ( security_get_role_mapping "github.com/elastic/go-elasticsearch/v8/typedapi/security/getrolemapping" security_get_service_accounts "github.com/elastic/go-elasticsearch/v8/typedapi/security/getserviceaccounts" security_get_service_credentials "github.com/elastic/go-elasticsearch/v8/typedapi/security/getservicecredentials" + security_get_settings "github.com/elastic/go-elasticsearch/v8/typedapi/security/getsettings" security_get_token "github.com/elastic/go-elasticsearch/v8/typedapi/security/gettoken" security_get_user "github.com/elastic/go-elasticsearch/v8/typedapi/security/getuser" security_get_user_privileges "github.com/elastic/go-elasticsearch/v8/typedapi/security/getuserprivileges" @@ -394,6 +401,7 @@ import ( security_saml_service_provider_metadata "github.com/elastic/go-elasticsearch/v8/typedapi/security/samlserviceprovidermetadata" security_suggest_user_profiles "github.com/elastic/go-elasticsearch/v8/typedapi/security/suggestuserprofiles" security_update_api_key "github.com/elastic/go-elasticsearch/v8/typedapi/security/updateapikey" + security_update_settings "github.com/elastic/go-elasticsearch/v8/typedapi/security/updatesettings" security_update_user_profile_data "github.com/elastic/go-elasticsearch/v8/typedapi/security/updateuserprofiledata" shutdown_delete_node "github.com/elastic/go-elasticsearch/v8/typedapi/shutdown/deletenode" shutdown_get_node "github.com/elastic/go-elasticsearch/v8/typedapi/shutdown/getnode" @@ -886,17 +894,23 @@ type Eql struct { Delete eql_delete.NewDelete // Returns async results from previously executed Event Query Language (EQL) // search - // https://www.elastic.co/guide/en/elasticsearch/reference/current/get-async-eql-search-api.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/get-async-eql-search-api.html Get eql_get.NewGet // Returns the status of a previously submitted async or stored Event Query // Language (EQL) search - // https://www.elastic.co/guide/en/elasticsearch/reference/current/get-async-eql-status-api.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/get-async-eql-status-api.html GetStatus eql_get_status.NewGetStatus // Returns results matching a query expressed in Event Query Language (EQL) // https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html Search eql_search.NewSearch } +type Esql struct { + // Executes an ESQL request + // https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-rest.html + Query esql_query.NewQuery +} + type Features struct { // Gets a list of features which can be included in snapshots using the // feature_states field when creating a snapshot @@ -917,6 +931,9 @@ type Fleet struct { // use by the fleet server project. // Msearch fleet_msearch.NewMsearch + // Creates a secret stored by Fleet. + // + PostSecret fleet_post_secret.NewPostSecret // Search API where the search will only be executed after specified checkpoints // are available due to a refresh. This API is designed for internal use by the // fleet server project. @@ -1011,10 +1028,10 @@ type Indices struct { // https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html DeleteDataStream indices_delete_data_stream.NewDeleteDataStream // Deletes an index template. - // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-template.html DeleteIndexTemplate indices_delete_index_template.NewDeleteIndexTemplate // Deletes an index template. - // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-template-v1.html DeleteTemplate indices_delete_template.NewDeleteTemplate // Analyzes the disk usage of each field of an index or data stream // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-disk-usage.html @@ -1029,10 +1046,10 @@ type Indices struct { // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html ExistsAlias indices_exists_alias.NewExistsAlias // Returns information about whether a particular index template exists. - // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html ExistsIndexTemplate indices_exists_index_template.NewExistsIndexTemplate // Returns information about whether a particular index template exists. - // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-template-exists-v1.html ExistsTemplate indices_exists_template.NewExistsTemplate // Retrieves information about the index's current data stream lifecycle, such // as any potential encountered error, time since creation etc. @@ -1063,7 +1080,7 @@ type Indices struct { // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html GetFieldMapping indices_get_field_mapping.NewGetFieldMapping // Returns an index template. - // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-template.html GetIndexTemplate indices_get_index_template.NewGetIndexTemplate // Returns mappings for one or more indices. // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html @@ -1072,7 +1089,7 @@ type Indices struct { // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html GetSettings indices_get_settings.NewGetSettings // Returns an index template. - // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-template-v1.html GetTemplate indices_get_template.NewGetTemplate // Migrates an alias to a data stream // https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html @@ -1094,7 +1111,7 @@ type Indices struct { // https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-put-lifecycle.html PutDataLifecycle indices_put_data_lifecycle.NewPutDataLifecycle // Creates or updates an index template. - // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-template.html PutIndexTemplate indices_put_index_template.NewPutIndexTemplate // Updates the index mappings. // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html @@ -1103,7 +1120,7 @@ type Indices struct { // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html PutSettings indices_put_settings.NewPutSettings // Creates or updates an index template. - // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html PutTemplate indices_put_template.NewPutTemplate // Returns information about ongoing index shard recoveries. // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-recovery.html @@ -1132,10 +1149,10 @@ type Indices struct { Shrink indices_shrink.NewShrink // Simulate matching the given index name against the index templates in the // system - // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-simulate-index.html SimulateIndexTemplate indices_simulate_index_template.NewSimulateIndexTemplate // Simulate resolving the given template name or body - // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-simulate-template.html SimulateTemplate indices_simulate_template.NewSimulateTemplate // Allows you to split an existing index into a new index with more primary // shards. @@ -1156,6 +1173,21 @@ type Indices struct { ValidateQuery indices_validate_query.NewValidateQuery } +type Inference struct { + // Delete model in the Inference API + // https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference-api.html + DeleteModel inference_delete_model.NewDeleteModel + // Get a model in the Inference API + // https://www.elastic.co/guide/en/elasticsearch/reference/current/get-inference-api.html + GetModel inference_get_model.NewGetModel + // Perform inference on a model + // https://www.elastic.co/guide/en/elasticsearch/reference/current/post-inference-api.html + Inference inference_inference.NewInference + // Configure a model for use in the Inference API + // https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference-api.html + PutModel inference_put_model.NewPutModel +} + type Ingest struct { // Deletes a pipeline. // https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-pipeline-api.html @@ -1530,7 +1562,7 @@ type Rollup struct { type SearchApplication struct { // Deletes a search application. - // https://www.elastic.co/guide/en/elasticsearch/reference/current/put-search-application.html + // https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-search-application.html Delete search_application_delete.NewDelete // Delete a behavioral analytics collection. // https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-analytics-collection.html @@ -1666,6 +1698,9 @@ type Security struct { // Retrieves information of all service credentials for a service account. // https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-service-credentials.html GetServiceCredentials security_get_service_credentials.NewGetServiceCredentials + // Retrieve settings for the security system indices + // https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-settings.html + GetSettings security_get_settings.NewGetSettings // Creates a bearer token for access without requiring basic authentication. // https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html GetToken security_get_token.NewGetToken @@ -1747,6 +1782,9 @@ type Security struct { // Updates attributes of an existing API key. // https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-api-key.html UpdateApiKey security_update_api_key.NewUpdateApiKey + // Update settings for the security system index + // https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-settings.html + UpdateSettings security_update_settings.NewUpdateSettings // Update application specific data for the user profile of the given unique ID. // https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-user-profile-data.html UpdateUserProfileData security_update_user_profile_data.NewUpdateUserProfileData @@ -2011,11 +2049,13 @@ type API struct { DanglingIndices DanglingIndices Enrich Enrich Eql Eql + Esql Esql Features Features Fleet Fleet Graph Graph Ilm Ilm Indices Indices + Inference Inference Ingest Ingest License License Logstash Logstash @@ -2350,6 +2390,11 @@ func New(tp elastictransport.Interface) *API { Search: eql_search.NewSearchFunc(tp), }, + // Esql + Esql: Esql{ + Query: esql_query.NewQueryFunc(tp), + }, + // Features Features: Features{ GetFeatures: features_get_features.NewGetFeaturesFunc(tp), @@ -2360,6 +2405,7 @@ func New(tp elastictransport.Interface) *API { Fleet: Fleet{ GlobalCheckpoints: fleet_global_checkpoints.NewGlobalCheckpointsFunc(tp), Msearch: fleet_msearch.NewMsearchFunc(tp), + PostSecret: fleet_post_secret.NewPostSecretFunc(tp), Search: fleet_search.NewSearchFunc(tp), }, @@ -2445,6 +2491,14 @@ func New(tp elastictransport.Interface) *API { ValidateQuery: indices_validate_query.NewValidateQueryFunc(tp), }, + // Inference + Inference: Inference{ + DeleteModel: inference_delete_model.NewDeleteModelFunc(tp), + GetModel: inference_get_model.NewGetModelFunc(tp), + Inference: inference_inference.NewInferenceFunc(tp), + PutModel: inference_put_model.NewPutModelFunc(tp), + }, + // Ingest Ingest: Ingest{ DeletePipeline: ingest_delete_pipeline.NewDeletePipelineFunc(tp), @@ -2644,6 +2698,7 @@ func New(tp elastictransport.Interface) *API { GetRoleMapping: security_get_role_mapping.NewGetRoleMappingFunc(tp), GetServiceAccounts: security_get_service_accounts.NewGetServiceAccountsFunc(tp), GetServiceCredentials: security_get_service_credentials.NewGetServiceCredentialsFunc(tp), + GetSettings: security_get_settings.NewGetSettingsFunc(tp), GetToken: security_get_token.NewGetTokenFunc(tp), GetUser: security_get_user.NewGetUserFunc(tp), GetUserPrivileges: security_get_user_privileges.NewGetUserPrivilegesFunc(tp), @@ -2669,6 +2724,7 @@ func New(tp elastictransport.Interface) *API { SamlServiceProviderMetadata: security_saml_service_provider_metadata.NewSamlServiceProviderMetadataFunc(tp), SuggestUserProfiles: security_suggest_user_profiles.NewSuggestUserProfilesFunc(tp), UpdateApiKey: security_update_api_key.NewUpdateApiKeyFunc(tp), + UpdateSettings: security_update_settings.NewUpdateSettingsFunc(tp), UpdateUserProfileData: security_update_user_profile_data.NewUpdateUserProfileDataFunc(tp), }, diff --git a/typedapi/asyncsearch/delete/delete.go b/typedapi/asyncsearch/delete/delete.go index e79d578df9..dd49d45b01 100644 --- a/typedapi/asyncsearch/delete/delete.go +++ b/typedapi/asyncsearch/delete/delete.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an async search by ID. If the search is still running, the search // request will be cancelled. Otherwise, the saved search results are deleted. package delete import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Delete struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDelete type alias for index. @@ -77,13 +80,18 @@ func NewDeleteFunc(tp elastictransport.Interface) NewDelete { // Deletes an async search by ID. If the search is still running, the search // request will be cancelled. Otherwise, the saved search results are deleted. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/async-search.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html func New(tp elastictransport.Interface) *Delete { r := &Delete{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_async_search") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Delete) Perform(ctx context.Context) (*http.Response, error) { +func (r Delete) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "async_search.delete") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "async_search.delete") + if reader := instrument.RecordRequestBody(ctx, "async_search.delete", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "async_search.delete") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Delete query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Delete query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a delete.Response -func (r Delete) Do(ctx context.Context) (*Response, error) { +func (r Delete) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Delete) IsSuccess(ctx context.Context) (bool, error) { +func (r Delete) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r Delete) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Delete query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/asyncsearch/delete/response.go b/typedapi/asyncsearch/delete/response.go index 27ea57fb81..951fdfd8b8 100644 --- a/typedapi/asyncsearch/delete/response.go +++ b/typedapi/asyncsearch/delete/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package delete // Response holds the response body struct for the package delete // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/async_search/delete/AsyncSearchDeleteResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/async_search/delete/AsyncSearchDeleteResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/asyncsearch/get/get.go b/typedapi/asyncsearch/get/get.go index 92a2c49e86..1e3a6653f8 100644 --- a/typedapi/asyncsearch/get/get.go +++ b/typedapi/asyncsearch/get/get.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves the results of a previously submitted async search request given // its ID. package get import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Get struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGet type alias for index. @@ -78,13 +81,18 @@ func NewGetFunc(tp elastictransport.Interface) NewGet { // Retrieves the results of a previously submitted async search request given // its ID. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/async-search.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html func New(tp elastictransport.Interface) *Get { r := &Get{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_async_search") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -120,9 +131,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,22 +150,58 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Get) Perform(ctx context.Context) (*http.Response, error) { +func (r Get) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "async_search.get") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "async_search.get") + if reader := instrument.RecordRequestBody(ctx, "async_search.get", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "async_search.get") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Get query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Get query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a get.Response -func (r Get) Do(ctx context.Context) (*Response, error) { +func (r Get) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() @@ -162,6 +209,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Get) IsSuccess(ctx context.Context) (bool, error) { +func (r Get) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r Get) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Get query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/asyncsearch/get/response.go b/typedapi/asyncsearch/get/response.go index 4afdf8740a..1ef0df4a62 100644 --- a/typedapi/asyncsearch/get/response.go +++ b/typedapi/asyncsearch/get/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package get @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package get // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/async_search/get/AsyncSearchGetResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/async_search/get/AsyncSearchGetResponse.ts#L22-L24 type Response struct { // CompletionTime Indicates when the async search completed. Only present diff --git a/typedapi/asyncsearch/status/response.go b/typedapi/asyncsearch/status/response.go index 4de9ccd14f..be5ffaa399 100644 --- a/typedapi/asyncsearch/status/response.go +++ b/typedapi/asyncsearch/status/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package status @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package status // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/async_search/status/AsyncSearchStatusResponse.ts#L39-L41 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/async_search/status/AsyncSearchStatusResponse.ts#L39-L41 type Response struct { // Clusters_ Metadata about clusters involved in the cross-cluster search. diff --git a/typedapi/asyncsearch/status/status.go b/typedapi/asyncsearch/status/status.go index 6a7cd1b63c..81c9d44faf 100644 --- a/typedapi/asyncsearch/status/status.go +++ b/typedapi/asyncsearch/status/status.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves the status of a previously submitted async search request given its // ID. package status import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Status struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStatus type alias for index. @@ -77,13 +80,18 @@ func NewStatusFunc(tp elastictransport.Interface) NewStatus { // Retrieves the status of a previously submitted async search request given its // ID. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/async-search.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html func New(tp elastictransport.Interface) *Status { r := &Status{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *Status) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("status") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -121,9 +132,9 @@ func (r *Status) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *Status) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Status) Perform(ctx context.Context) (*http.Response, error) { +func (r Status) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "async_search.status") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "async_search.status") + if reader := instrument.RecordRequestBody(ctx, "async_search.status", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "async_search.status") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Status query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Status query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a status.Response -func (r Status) Do(ctx context.Context) (*Response, error) { +func (r Status) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r Status) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r Status) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r Status) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Status) IsSuccess(ctx context.Context) (bool, error) { +func (r Status) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r Status) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Status query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/asyncsearch/submit/request.go b/typedapi/asyncsearch/submit/request.go index 01ce2f2471..f3fc99ee4d 100644 --- a/typedapi/asyncsearch/submit/request.go +++ b/typedapi/asyncsearch/submit/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package submit @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package submit // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/async_search/submit/AsyncSearchSubmitRequest.ts#L55-L286 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/async_search/submit/AsyncSearchSubmitRequest.ts#L55-L286 type Request struct { Aggregations map[string]types.Aggregations `json:"aggregations,omitempty"` Collapse *types.FieldCollapse `json:"collapse,omitempty"` diff --git a/typedapi/asyncsearch/submit/response.go b/typedapi/asyncsearch/submit/response.go index bdcbb863f9..e2ebed3ce6 100644 --- a/typedapi/asyncsearch/submit/response.go +++ b/typedapi/asyncsearch/submit/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package submit @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package submit // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/async_search/submit/AsyncSearchSubmitResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/async_search/submit/AsyncSearchSubmitResponse.ts#L22-L24 type Response struct { // CompletionTime Indicates when the async search completed. Only present diff --git a/typedapi/asyncsearch/submit/submit.go b/typedapi/asyncsearch/submit/submit.go index dc049a36f5..869e90ac4a 100644 --- a/typedapi/asyncsearch/submit/submit.go +++ b/typedapi/asyncsearch/submit/submit.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Executes a search request asynchronously. package submit @@ -55,15 +55,19 @@ type Submit struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSubmit type alias for index. @@ -81,17 +85,24 @@ func NewSubmitFunc(tp elastictransport.Interface) NewSubmit { // Executes a search request asynchronously. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/async-search.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html func New(tp elastictransport.Interface) *Submit { r := &Submit{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -128,9 +139,7 @@ func (r *Submit) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -142,6 +151,10 @@ func (r *Submit) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,6 +166,9 @@ func (r *Submit) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_async_search") @@ -168,15 +184,15 @@ func (r *Submit) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -193,22 +209,58 @@ func (r *Submit) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Submit) Perform(ctx context.Context) (*http.Response, error) { +func (r Submit) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "async_search.submit") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "async_search.submit") + if reader := instrument.RecordRequestBody(ctx, "async_search.submit", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "async_search.submit") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Submit query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Submit query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a submit.Response -func (r Submit) Do(ctx context.Context) (*Response, error) { +func (r Submit) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "async_search.submit") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() @@ -216,6 +268,9 @@ func (r Submit) Do(ctx context.Context) (*Response, error) { res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -223,6 +278,9 @@ func (r Submit) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +290,9 @@ func (r Submit) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -239,6 +300,9 @@ func (r Submit) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/autoscaling/deleteautoscalingpolicy/delete_autoscaling_policy.go b/typedapi/autoscaling/deleteautoscalingpolicy/delete_autoscaling_policy.go index b9e98df0d4..5025161f96 100644 --- a/typedapi/autoscaling/deleteautoscalingpolicy/delete_autoscaling_policy.go +++ b/typedapi/autoscaling/deleteautoscalingpolicy/delete_autoscaling_policy.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. // Direct use is not supported. package deleteautoscalingpolicy import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteAutoscalingPolicy struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteAutoscalingPolicy type alias for index. @@ -77,13 +80,18 @@ func NewDeleteAutoscalingPolicyFunc(tp elastictransport.Interface) NewDeleteAuto // Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. // Direct use is not supported. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/autoscaling-delete-autoscaling-policy.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-delete-autoscaling-policy.html func New(tp elastictransport.Interface) *DeleteAutoscalingPolicy { r := &DeleteAutoscalingPolicy{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *DeleteAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Reques path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -121,9 +132,9 @@ func (r *DeleteAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Reques } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *DeleteAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Reques } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteAutoscalingPolicy) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteAutoscalingPolicy) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "autoscaling.delete_autoscaling_policy") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "autoscaling.delete_autoscaling_policy") + if reader := instrument.RecordRequestBody(ctx, "autoscaling.delete_autoscaling_policy", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "autoscaling.delete_autoscaling_policy") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteAutoscalingPolicy query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteAutoscalingPolicy query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleteautoscalingpolicy.Response -func (r DeleteAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { +func (r DeleteAutoscalingPolicy) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.delete_autoscaling_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r DeleteAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r DeleteAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r DeleteAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteAutoscalingPolicy) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteAutoscalingPolicy) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.delete_autoscaling_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r DeleteAutoscalingPolicy) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteAutoscalingPolicy query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/autoscaling/deleteautoscalingpolicy/response.go b/typedapi/autoscaling/deleteautoscalingpolicy/response.go index ba4520fc81..b0eae41368 100644 --- a/typedapi/autoscaling/deleteautoscalingpolicy/response.go +++ b/typedapi/autoscaling/deleteautoscalingpolicy/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleteautoscalingpolicy // Response holds the response body struct for the package deleteautoscalingpolicy // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/delete_autoscaling_policy/DeleteAutoscalingPolicyResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/delete_autoscaling_policy/DeleteAutoscalingPolicyResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/autoscaling/getautoscalingcapacity/get_autoscaling_capacity.go b/typedapi/autoscaling/getautoscalingcapacity/get_autoscaling_capacity.go index 1be07d0905..c3de9a3290 100644 --- a/typedapi/autoscaling/getautoscalingcapacity/get_autoscaling_capacity.go +++ b/typedapi/autoscaling/getautoscalingcapacity/get_autoscaling_capacity.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets the current autoscaling capacity based on the configured autoscaling // policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not @@ -24,7 +24,6 @@ package getautoscalingcapacity import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -49,9 +48,13 @@ type GetAutoscalingCapacity struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetAutoscalingCapacity type alias for index. @@ -71,13 +74,18 @@ func NewGetAutoscalingCapacityFunc(tp elastictransport.Interface) NewGetAutoscal // policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not // supported. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/autoscaling-get-autoscaling-capacity.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html func New(tp elastictransport.Interface) *GetAutoscalingCapacity { r := &GetAutoscalingCapacity{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,9 +120,9 @@ func (r *GetAutoscalingCapacity) HttpRequest(ctx context.Context) (*http.Request } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -131,27 +139,66 @@ func (r *GetAutoscalingCapacity) HttpRequest(ctx context.Context) (*http.Request } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetAutoscalingCapacity) Perform(ctx context.Context) (*http.Response, error) { +func (r GetAutoscalingCapacity) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "autoscaling.get_autoscaling_capacity") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "autoscaling.get_autoscaling_capacity") + if reader := instrument.RecordRequestBody(ctx, "autoscaling.get_autoscaling_capacity", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "autoscaling.get_autoscaling_capacity") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetAutoscalingCapacity query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetAutoscalingCapacity query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getautoscalingcapacity.Response -func (r GetAutoscalingCapacity) Do(ctx context.Context) (*Response, error) { +func (r GetAutoscalingCapacity) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.get_autoscaling_capacity") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -159,6 +206,9 @@ func (r GetAutoscalingCapacity) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -168,6 +218,9 @@ func (r GetAutoscalingCapacity) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,12 +228,25 @@ func (r GetAutoscalingCapacity) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetAutoscalingCapacity) IsSuccess(ctx context.Context) (bool, error) { +func (r GetAutoscalingCapacity) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.get_autoscaling_capacity") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -196,6 +262,14 @@ func (r GetAutoscalingCapacity) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetAutoscalingCapacity query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/autoscaling/getautoscalingcapacity/response.go b/typedapi/autoscaling/getautoscalingcapacity/response.go index b20dc5d204..82f13615c2 100644 --- a/typedapi/autoscaling/getautoscalingcapacity/response.go +++ b/typedapi/autoscaling/getautoscalingcapacity/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getautoscalingcapacity @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getautoscalingcapacity // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L25-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L25-L29 type Response struct { Policies map[string]types.AutoscalingDeciders `json:"policies"` } diff --git a/typedapi/autoscaling/getautoscalingpolicy/get_autoscaling_policy.go b/typedapi/autoscaling/getautoscalingpolicy/get_autoscaling_policy.go index fac001a547..1153e6874c 100644 --- a/typedapi/autoscaling/getautoscalingpolicy/get_autoscaling_policy.go +++ b/typedapi/autoscaling/getautoscalingpolicy/get_autoscaling_policy.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and // ECK. Direct use is not supported. package getautoscalingpolicy import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetAutoscalingPolicy struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetAutoscalingPolicy type alias for index. @@ -77,13 +80,18 @@ func NewGetAutoscalingPolicyFunc(tp elastictransport.Interface) NewGetAutoscalin // Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and // ECK. Direct use is not supported. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/autoscaling-get-autoscaling-capacity.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html func New(tp elastictransport.Interface) *GetAutoscalingPolicy { r := &GetAutoscalingPolicy{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *GetAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -121,9 +132,9 @@ func (r *GetAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *GetAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetAutoscalingPolicy) Perform(ctx context.Context) (*http.Response, error) { +func (r GetAutoscalingPolicy) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "autoscaling.get_autoscaling_policy") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "autoscaling.get_autoscaling_policy") + if reader := instrument.RecordRequestBody(ctx, "autoscaling.get_autoscaling_policy", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "autoscaling.get_autoscaling_policy") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetAutoscalingPolicy query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetAutoscalingPolicy query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getautoscalingpolicy.Response -func (r GetAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { +func (r GetAutoscalingPolicy) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.get_autoscaling_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r GetAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r GetAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r GetAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetAutoscalingPolicy) IsSuccess(ctx context.Context) (bool, error) { +func (r GetAutoscalingPolicy) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.get_autoscaling_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r GetAutoscalingPolicy) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetAutoscalingPolicy query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/autoscaling/getautoscalingpolicy/response.go b/typedapi/autoscaling/getautoscalingpolicy/response.go index 00a1575adb..cfcd4336fa 100644 --- a/typedapi/autoscaling/getautoscalingpolicy/response.go +++ b/typedapi/autoscaling/getautoscalingpolicy/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getautoscalingpolicy @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getautoscalingpolicy // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/get_autoscaling_policy/GetAutoscalingPolicyResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/get_autoscaling_policy/GetAutoscalingPolicyResponse.ts#L22-L24 type Response struct { // Deciders Decider settings diff --git a/typedapi/autoscaling/putautoscalingpolicy/put_autoscaling_policy.go b/typedapi/autoscaling/putautoscalingpolicy/put_autoscaling_policy.go index 39f527c0e4..06af186b6a 100644 --- a/typedapi/autoscaling/putautoscalingpolicy/put_autoscaling_policy.go +++ b/typedapi/autoscaling/putautoscalingpolicy/put_autoscaling_policy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and // ECK. Direct use is not supported. @@ -51,15 +51,19 @@ type PutAutoscalingPolicy struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutAutoscalingPolicy type alias for index. @@ -80,13 +84,20 @@ func NewPutAutoscalingPolicyFunc(tp elastictransport.Interface) NewPutAutoscalin // Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and // ECK. Direct use is not supported. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/autoscaling-put-autoscaling-policy.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-put-autoscaling-policy.html func New(tp elastictransport.Interface) *PutAutoscalingPolicy { r := &PutAutoscalingPolicy{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -125,9 +136,7 @@ func (r *PutAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Request, } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Request, } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -162,15 +178,15 @@ func (r *PutAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *PutAutoscalingPolicy) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutAutoscalingPolicy) Perform(ctx context.Context) (*http.Response, error) { +func (r PutAutoscalingPolicy) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "autoscaling.put_autoscaling_policy") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "autoscaling.put_autoscaling_policy") + if reader := instrument.RecordRequestBody(ctx, "autoscaling.put_autoscaling_policy", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "autoscaling.put_autoscaling_policy") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutAutoscalingPolicy query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutAutoscalingPolicy query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putautoscalingpolicy.Response -func (r PutAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { +func (r PutAutoscalingPolicy) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "autoscaling.put_autoscaling_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r PutAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r PutAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r PutAutoscalingPolicy) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/autoscaling/putautoscalingpolicy/request.go b/typedapi/autoscaling/putautoscalingpolicy/request.go index 3bd1df3d8a..6100fe6f24 100644 --- a/typedapi/autoscaling/putautoscalingpolicy/request.go +++ b/typedapi/autoscaling/putautoscalingpolicy/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putautoscalingpolicy @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package putautoscalingpolicy // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/put_autoscaling_policy/PutAutoscalingPolicyRequest.ts#L24-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/put_autoscaling_policy/PutAutoscalingPolicyRequest.ts#L24-L35 type Request = types.AutoscalingPolicy diff --git a/typedapi/autoscaling/putautoscalingpolicy/response.go b/typedapi/autoscaling/putautoscalingpolicy/response.go index be061da17d..a4809905d6 100644 --- a/typedapi/autoscaling/putautoscalingpolicy/response.go +++ b/typedapi/autoscaling/putautoscalingpolicy/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putautoscalingpolicy // Response holds the response body struct for the package putautoscalingpolicy // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/put_autoscaling_policy/PutAutoscalingPolicyResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/put_autoscaling_policy/PutAutoscalingPolicyResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/cat/aliases/aliases.go b/typedapi/cat/aliases/aliases.go index 9b6363c65a..c3b91a73bf 100644 --- a/typedapi/cat/aliases/aliases.go +++ b/typedapi/cat/aliases/aliases.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Shows information about currently configured aliases to indices including // filter and routing infos. package aliases import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Aliases struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewAliases type alias for index. @@ -76,13 +79,18 @@ func NewAliasesFunc(tp elastictransport.Interface) NewAliases { // Shows information about currently configured aliases to indices including // filter and routing infos. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-alias.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-alias.html func New(tp elastictransport.Interface) *Aliases { r := &Aliases{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,6 +122,9 @@ func (r *Aliases) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("aliases") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -127,9 +138,9 @@ func (r *Aliases) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -146,27 +157,66 @@ func (r *Aliases) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Aliases) Perform(ctx context.Context) (*http.Response, error) { +func (r Aliases) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.aliases") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.aliases") + if reader := instrument.RecordRequestBody(ctx, "cat.aliases", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.aliases") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Aliases query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Aliases query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a aliases.Response -func (r Aliases) Do(ctx context.Context) (Response, error) { +func (r Aliases) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.aliases") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -174,6 +224,9 @@ func (r Aliases) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,6 +236,9 @@ func (r Aliases) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -190,12 +246,25 @@ func (r Aliases) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Aliases) IsSuccess(ctx context.Context) (bool, error) { +func (r Aliases) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.aliases") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -211,6 +280,14 @@ func (r Aliases) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Aliases query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/aliases/response.go b/typedapi/cat/aliases/response.go index dbbe6a6ef8..4e5cf3d9c2 100644 --- a/typedapi/cat/aliases/response.go +++ b/typedapi/cat/aliases/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package aliases @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package aliases // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/aliases/CatAliasesResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/aliases/CatAliasesResponse.ts#L22-L24 type Response []types.AliasesRecord diff --git a/typedapi/cat/allocation/allocation.go b/typedapi/cat/allocation/allocation.go index 51759ff497..2b58aa1a20 100644 --- a/typedapi/cat/allocation/allocation.go +++ b/typedapi/cat/allocation/allocation.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Provides a snapshot of how many shards are allocated to each data node and // how much disk space they are using. package allocation import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Allocation struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewAllocation type alias for index. @@ -76,13 +79,18 @@ func NewAllocationFunc(tp elastictransport.Interface) NewAllocation { // Provides a snapshot of how many shards are allocated to each data node and // how much disk space they are using. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-allocation.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-allocation.html func New(tp elastictransport.Interface) *Allocation { r := &Allocation{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,6 +122,9 @@ func (r *Allocation) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("allocation") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) method = http.MethodGet @@ -127,9 +138,9 @@ func (r *Allocation) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -146,27 +157,66 @@ func (r *Allocation) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Allocation) Perform(ctx context.Context) (*http.Response, error) { +func (r Allocation) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.allocation") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.allocation") + if reader := instrument.RecordRequestBody(ctx, "cat.allocation", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.allocation") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Allocation query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Allocation query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a allocation.Response -func (r Allocation) Do(ctx context.Context) (Response, error) { +func (r Allocation) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.allocation") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -174,6 +224,9 @@ func (r Allocation) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,6 +236,9 @@ func (r Allocation) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -190,12 +246,25 @@ func (r Allocation) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Allocation) IsSuccess(ctx context.Context) (bool, error) { +func (r Allocation) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.allocation") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -211,6 +280,14 @@ func (r Allocation) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Allocation query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/allocation/response.go b/typedapi/cat/allocation/response.go index be0daaf7b6..b4e09ce35f 100644 --- a/typedapi/cat/allocation/response.go +++ b/typedapi/cat/allocation/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package allocation @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package allocation // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/allocation/CatAllocationResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/allocation/CatAllocationResponse.ts#L22-L24 type Response []types.AllocationRecord diff --git a/typedapi/cat/componenttemplates/component_templates.go b/typedapi/cat/componenttemplates/component_templates.go index cf75a461c4..90264db00e 100644 --- a/typedapi/cat/componenttemplates/component_templates.go +++ b/typedapi/cat/componenttemplates/component_templates.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about existing component_templates templates. package componenttemplates import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type ComponentTemplates struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewComponentTemplates type alias for index. @@ -73,13 +76,18 @@ func NewComponentTemplatesFunc(tp elastictransport.Interface) NewComponentTempla // Returns information about existing component_templates templates. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-component-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-component-templates.html func New(tp elastictransport.Interface) *ComponentTemplates { r := &ComponentTemplates{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,6 +119,9 @@ func (r *ComponentTemplates) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("component_templates") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -124,9 +135,9 @@ func (r *ComponentTemplates) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -143,27 +154,66 @@ func (r *ComponentTemplates) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ComponentTemplates) Perform(ctx context.Context) (*http.Response, error) { +func (r ComponentTemplates) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.component_templates") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.component_templates") + if reader := instrument.RecordRequestBody(ctx, "cat.component_templates", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.component_templates") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ComponentTemplates query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ComponentTemplates query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a componenttemplates.Response -func (r ComponentTemplates) Do(ctx context.Context) (Response, error) { +func (r ComponentTemplates) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.component_templates") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -171,6 +221,9 @@ func (r ComponentTemplates) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,6 +233,9 @@ func (r ComponentTemplates) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,12 +243,25 @@ func (r ComponentTemplates) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ComponentTemplates) IsSuccess(ctx context.Context) (bool, error) { +func (r ComponentTemplates) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.component_templates") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -208,6 +277,14 @@ func (r ComponentTemplates) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ComponentTemplates query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/componenttemplates/response.go b/typedapi/cat/componenttemplates/response.go index 31adb48e8b..55fd3a79ea 100644 --- a/typedapi/cat/componenttemplates/response.go +++ b/typedapi/cat/componenttemplates/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package componenttemplates @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package componenttemplates // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/component_templates/CatComponentTemplatesResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/component_templates/CatComponentTemplatesResponse.ts#L22-L24 type Response []types.CatComponentTemplate diff --git a/typedapi/cat/count/count.go b/typedapi/cat/count/count.go index b9411a1807..dd59316154 100644 --- a/typedapi/cat/count/count.go +++ b/typedapi/cat/count/count.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Provides quick access to the document count of the entire cluster, or // individual indices. package count import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Count struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCount type alias for index. @@ -75,13 +78,18 @@ func NewCountFunc(tp elastictransport.Interface) NewCount { // Provides quick access to the document count of the entire cluster, or // individual indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-count.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-count.html func New(tp elastictransport.Interface) *Count { r := &Count{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -113,6 +121,9 @@ func (r *Count) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("count") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodGet @@ -126,9 +137,9 @@ func (r *Count) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -145,27 +156,66 @@ func (r *Count) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Count) Perform(ctx context.Context) (*http.Response, error) { +func (r Count) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.count") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.count") + if reader := instrument.RecordRequestBody(ctx, "cat.count", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.count") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Count query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Count query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a count.Response -func (r Count) Do(ctx context.Context) (Response, error) { +func (r Count) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.count") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -173,6 +223,9 @@ func (r Count) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,6 +235,9 @@ func (r Count) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,12 +245,25 @@ func (r Count) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Count) IsSuccess(ctx context.Context) (bool, error) { +func (r Count) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.count") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -210,6 +279,14 @@ func (r Count) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Count query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/count/response.go b/typedapi/cat/count/response.go index e32fd8b9da..3626061b4b 100644 --- a/typedapi/cat/count/response.go +++ b/typedapi/cat/count/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package count @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package count // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/count/CatCountResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/count/CatCountResponse.ts#L22-L24 type Response []types.CountRecord diff --git a/typedapi/cat/fielddata/fielddata.go b/typedapi/cat/fielddata/fielddata.go index 3db5dd12a1..150c647a6a 100644 --- a/typedapi/cat/fielddata/fielddata.go +++ b/typedapi/cat/fielddata/fielddata.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Shows how much heap memory is currently being used by fielddata on every data // node in the cluster. package fielddata import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Fielddata struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int fields string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewFielddata type alias for index. @@ -76,13 +79,18 @@ func NewFielddataFunc(tp elastictransport.Interface) NewFielddata { // Shows how much heap memory is currently being used by fielddata on every data // node in the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-fielddata.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-fielddata.html func New(tp elastictransport.Interface) *Fielddata { r := &Fielddata{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,6 +122,9 @@ func (r *Fielddata) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("fielddata") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "fields", r.fields) + } path.WriteString(r.fields) method = http.MethodGet @@ -127,9 +138,9 @@ func (r *Fielddata) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -146,27 +157,66 @@ func (r *Fielddata) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Fielddata) Perform(ctx context.Context) (*http.Response, error) { +func (r Fielddata) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.fielddata") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.fielddata") + if reader := instrument.RecordRequestBody(ctx, "cat.fielddata", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.fielddata") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Fielddata query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Fielddata query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a fielddata.Response -func (r Fielddata) Do(ctx context.Context) (Response, error) { +func (r Fielddata) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.fielddata") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -174,6 +224,9 @@ func (r Fielddata) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,6 +236,9 @@ func (r Fielddata) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -190,12 +246,25 @@ func (r Fielddata) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Fielddata) IsSuccess(ctx context.Context) (bool, error) { +func (r Fielddata) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.fielddata") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -211,6 +280,14 @@ func (r Fielddata) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Fielddata query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/fielddata/response.go b/typedapi/cat/fielddata/response.go index a6c22d36ce..24211492c6 100644 --- a/typedapi/cat/fielddata/response.go +++ b/typedapi/cat/fielddata/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package fielddata @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package fielddata // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/fielddata/CatFielddataResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/fielddata/CatFielddataResponse.ts#L22-L24 type Response []types.FielddataRecord diff --git a/typedapi/cat/health/health.go b/typedapi/cat/health/health.go index 32ec010fa8..81a5fa2e5a 100644 --- a/typedapi/cat/health/health.go +++ b/typedapi/cat/health/health.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns a concise representation of the cluster health. package health import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -49,9 +48,13 @@ type Health struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewHealth type alias for index. @@ -69,13 +72,18 @@ func NewHealthFunc(tp elastictransport.Interface) NewHealth { // Returns a concise representation of the cluster health. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-health.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-health.html func New(tp elastictransport.Interface) *Health { r := &Health{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *Health) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *Health) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Health) Perform(ctx context.Context) (*http.Response, error) { +func (r Health) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.health") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.health") + if reader := instrument.RecordRequestBody(ctx, "cat.health", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.health") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Health query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Health query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a health.Response -func (r Health) Do(ctx context.Context) (Response, error) { +func (r Health) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.health") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r Health) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r Health) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r Health) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Health) IsSuccess(ctx context.Context) (bool, error) { +func (r Health) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.health") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r Health) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Health query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/health/response.go b/typedapi/cat/health/response.go index 2168caeabb..86e4b73854 100644 --- a/typedapi/cat/health/response.go +++ b/typedapi/cat/health/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package health @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package health // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/health/CatHealthResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/health/CatHealthResponse.ts#L22-L24 type Response []types.HealthRecord diff --git a/typedapi/cat/help/help.go b/typedapi/cat/help/help.go index 236648f397..a5d2662cf8 100644 --- a/typedapi/cat/help/help.go +++ b/typedapi/cat/help/help.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns help for the Cat APIs. package help import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Help struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewHelp type alias for index. @@ -67,13 +70,18 @@ func NewHelpFunc(tp elastictransport.Interface) NewHelp { // Returns help for the Cat APIs. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html func New(tp elastictransport.Interface) *Help { r := &Help{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,9 +114,9 @@ func (r *Help) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -125,27 +133,66 @@ func (r *Help) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Help) Perform(ctx context.Context) (*http.Response, error) { +func (r Help) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.help") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.help") + if reader := instrument.RecordRequestBody(ctx, "cat.help", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.help") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Help query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Help query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a help.Response -func (r Help) Do(ctx context.Context) (Response, error) { +func (r Help) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.help") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -153,6 +200,9 @@ func (r Help) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -162,6 +212,9 @@ func (r Help) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -169,12 +222,25 @@ func (r Help) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Help) IsSuccess(ctx context.Context) (bool, error) { +func (r Help) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.help") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -190,6 +256,14 @@ func (r Help) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Help query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/help/response.go b/typedapi/cat/help/response.go index 7e5393f8d5..21b31eb945 100644 --- a/typedapi/cat/help/response.go +++ b/typedapi/cat/help/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package help @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package help // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/help/CatHelpResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/help/CatHelpResponse.ts#L22-L24 type Response []types.HelpRecord diff --git a/typedapi/cat/indices/indices.go b/typedapi/cat/indices/indices.go index 15f46a3650..96a326f4c5 100644 --- a/typedapi/cat/indices/indices.go +++ b/typedapi/cat/indices/indices.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about indices: number of primaries and replicas, document // counts, disk size, ... package indices import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -57,11 +56,15 @@ type Indices struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewIndices type alias for index. @@ -80,13 +83,18 @@ func NewIndicesFunc(tp elastictransport.Interface) NewIndices { // Returns information about indices: number of primaries and replicas, document // counts, disk size, ... // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-indices.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-indices.html func New(tp elastictransport.Interface) *Indices { r := &Indices{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -118,6 +126,9 @@ func (r *Indices) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("indices") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodGet @@ -131,9 +142,9 @@ func (r *Indices) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -150,27 +161,66 @@ func (r *Indices) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Indices) Perform(ctx context.Context) (*http.Response, error) { +func (r Indices) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.indices") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.indices") + if reader := instrument.RecordRequestBody(ctx, "cat.indices", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.indices") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Indices query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Indices query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a indices.Response -func (r Indices) Do(ctx context.Context) (Response, error) { +func (r Indices) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.indices") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -178,6 +228,9 @@ func (r Indices) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,6 +240,9 @@ func (r Indices) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -194,12 +250,25 @@ func (r Indices) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Indices) IsSuccess(ctx context.Context) (bool, error) { +func (r Indices) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.indices") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -215,6 +284,14 @@ func (r Indices) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Indices query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/indices/response.go b/typedapi/cat/indices/response.go index 14031427d0..a5eccdc4fb 100644 --- a/typedapi/cat/indices/response.go +++ b/typedapi/cat/indices/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package indices @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package indices // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/indices/CatIndicesResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/indices/CatIndicesResponse.ts#L22-L24 type Response []types.IndicesRecord diff --git a/typedapi/cat/master/master.go b/typedapi/cat/master/master.go index ce2840d9ed..9be6d558cf 100644 --- a/typedapi/cat/master/master.go +++ b/typedapi/cat/master/master.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about the master node. package master import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Master struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMaster type alias for index. @@ -67,13 +70,18 @@ func NewMasterFunc(tp elastictransport.Interface) NewMaster { // Returns information about the master node. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-master.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-master.html func New(tp elastictransport.Interface) *Master { r := &Master{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Master) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Master) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Master) Perform(ctx context.Context) (*http.Response, error) { +func (r Master) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.master") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.master") + if reader := instrument.RecordRequestBody(ctx, "cat.master", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.master") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Master query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Master query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a master.Response -func (r Master) Do(ctx context.Context) (Response, error) { +func (r Master) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.master") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Master) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Master) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Master) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Master) IsSuccess(ctx context.Context) (bool, error) { +func (r Master) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.master") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Master) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Master query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/master/response.go b/typedapi/cat/master/response.go index 4483bac89e..b0fa4409da 100644 --- a/typedapi/cat/master/response.go +++ b/typedapi/cat/master/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package master @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package master // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/master/CatMasterResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/master/CatMasterResponse.ts#L22-L24 type Response []types.MasterRecord diff --git a/typedapi/cat/mldatafeeds/ml_datafeeds.go b/typedapi/cat/mldatafeeds/ml_datafeeds.go index 405c755694..7d71dbf72a 100644 --- a/typedapi/cat/mldatafeeds/ml_datafeeds.go +++ b/typedapi/cat/mldatafeeds/ml_datafeeds.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets configuration and usage information about datafeeds. package mldatafeeds import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type MlDatafeeds struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int datafeedid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMlDatafeeds type alias for index. @@ -76,13 +79,18 @@ func NewMlDatafeedsFunc(tp elastictransport.Interface) NewMlDatafeeds { // Gets configuration and usage information about datafeeds. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-datafeeds.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-datafeeds.html func New(tp elastictransport.Interface) *MlDatafeeds { r := &MlDatafeeds{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -118,6 +126,9 @@ func (r *MlDatafeeds) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("datafeeds") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeedid", r.datafeedid) + } path.WriteString(r.datafeedid) method = http.MethodGet @@ -131,9 +142,9 @@ func (r *MlDatafeeds) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -150,27 +161,66 @@ func (r *MlDatafeeds) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r MlDatafeeds) Perform(ctx context.Context) (*http.Response, error) { +func (r MlDatafeeds) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.ml_datafeeds") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.ml_datafeeds") + if reader := instrument.RecordRequestBody(ctx, "cat.ml_datafeeds", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.ml_datafeeds") + } if err != nil { - return nil, fmt.Errorf("an error happened during the MlDatafeeds query execution: %w", err) + localErr := fmt.Errorf("an error happened during the MlDatafeeds query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a mldatafeeds.Response -func (r MlDatafeeds) Do(ctx context.Context) (Response, error) { +func (r MlDatafeeds) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_datafeeds") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -178,6 +228,9 @@ func (r MlDatafeeds) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,6 +240,9 @@ func (r MlDatafeeds) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -194,12 +250,25 @@ func (r MlDatafeeds) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r MlDatafeeds) IsSuccess(ctx context.Context) (bool, error) { +func (r MlDatafeeds) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_datafeeds") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -215,6 +284,14 @@ func (r MlDatafeeds) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the MlDatafeeds query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/mldatafeeds/response.go b/typedapi/cat/mldatafeeds/response.go index 7f30632437..eec4d71856 100644 --- a/typedapi/cat/mldatafeeds/response.go +++ b/typedapi/cat/mldatafeeds/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package mldatafeeds @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package mldatafeeds // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/ml_datafeeds/CatDatafeedsResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/ml_datafeeds/CatDatafeedsResponse.ts#L22-L24 type Response []types.DatafeedsRecord diff --git a/typedapi/cat/mldataframeanalytics/ml_data_frame_analytics.go b/typedapi/cat/mldataframeanalytics/ml_data_frame_analytics.go index 458601c8a4..db356805fb 100644 --- a/typedapi/cat/mldataframeanalytics/ml_data_frame_analytics.go +++ b/typedapi/cat/mldataframeanalytics/ml_data_frame_analytics.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets configuration and usage information about data frame analytics jobs. package mldataframeanalytics import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type MlDataFrameAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMlDataFrameAnalytics type alias for index. @@ -76,13 +79,18 @@ func NewMlDataFrameAnalyticsFunc(tp elastictransport.Interface) NewMlDataFrameAn // Gets configuration and usage information about data frame analytics jobs. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-dfanalytics.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-dfanalytics.html func New(tp elastictransport.Interface) *MlDataFrameAnalytics { r := &MlDataFrameAnalytics{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -122,6 +130,9 @@ func (r *MlDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -135,9 +146,9 @@ func (r *MlDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -154,27 +165,66 @@ func (r *MlDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r MlDataFrameAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r MlDataFrameAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.ml_data_frame_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.ml_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "cat.ml_data_frame_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.ml_data_frame_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the MlDataFrameAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the MlDataFrameAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a mldataframeanalytics.Response -func (r MlDataFrameAnalytics) Do(ctx context.Context) (Response, error) { +func (r MlDataFrameAnalytics) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -182,6 +232,9 @@ func (r MlDataFrameAnalytics) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -191,6 +244,9 @@ func (r MlDataFrameAnalytics) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -198,12 +254,25 @@ func (r MlDataFrameAnalytics) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r MlDataFrameAnalytics) IsSuccess(ctx context.Context) (bool, error) { +func (r MlDataFrameAnalytics) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -219,6 +288,14 @@ func (r MlDataFrameAnalytics) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the MlDataFrameAnalytics query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/mldataframeanalytics/response.go b/typedapi/cat/mldataframeanalytics/response.go index 6ead9302fb..e16da48358 100644 --- a/typedapi/cat/mldataframeanalytics/response.go +++ b/typedapi/cat/mldataframeanalytics/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package mldataframeanalytics @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package mldataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/ml_data_frame_analytics/CatDataFrameAnalyticsResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/ml_data_frame_analytics/CatDataFrameAnalyticsResponse.ts#L22-L24 type Response []types.DataFrameAnalyticsRecord diff --git a/typedapi/cat/mljobs/ml_jobs.go b/typedapi/cat/mljobs/ml_jobs.go index a8fdf2cd39..94a153c4fb 100644 --- a/typedapi/cat/mljobs/ml_jobs.go +++ b/typedapi/cat/mljobs/ml_jobs.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets configuration and usage information about anomaly detection jobs. package mljobs import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -55,11 +54,15 @@ type MlJobs struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMlJobs type alias for index. @@ -77,13 +80,18 @@ func NewMlJobsFunc(tp elastictransport.Interface) NewMlJobs { // Gets configuration and usage information about anomaly detection jobs. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-anomaly-detectors.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-anomaly-detectors.html func New(tp elastictransport.Interface) *MlJobs { r := &MlJobs{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -119,6 +127,9 @@ func (r *MlJobs) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) method = http.MethodGet @@ -132,9 +143,9 @@ func (r *MlJobs) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -151,27 +162,66 @@ func (r *MlJobs) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r MlJobs) Perform(ctx context.Context) (*http.Response, error) { +func (r MlJobs) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.ml_jobs") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.ml_jobs") + if reader := instrument.RecordRequestBody(ctx, "cat.ml_jobs", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.ml_jobs") + } if err != nil { - return nil, fmt.Errorf("an error happened during the MlJobs query execution: %w", err) + localErr := fmt.Errorf("an error happened during the MlJobs query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a mljobs.Response -func (r MlJobs) Do(ctx context.Context) (Response, error) { +func (r MlJobs) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_jobs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -179,6 +229,9 @@ func (r MlJobs) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,6 +241,9 @@ func (r MlJobs) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -195,12 +251,25 @@ func (r MlJobs) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r MlJobs) IsSuccess(ctx context.Context) (bool, error) { +func (r MlJobs) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_jobs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -216,6 +285,14 @@ func (r MlJobs) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the MlJobs query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/mljobs/response.go b/typedapi/cat/mljobs/response.go index c488b3c777..dc8351bff1 100644 --- a/typedapi/cat/mljobs/response.go +++ b/typedapi/cat/mljobs/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package mljobs @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package mljobs // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/ml_jobs/CatJobsResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/ml_jobs/CatJobsResponse.ts#L22-L24 type Response []types.JobsRecord diff --git a/typedapi/cat/mltrainedmodels/ml_trained_models.go b/typedapi/cat/mltrainedmodels/ml_trained_models.go index 587235fa53..828a1917b4 100644 --- a/typedapi/cat/mltrainedmodels/ml_trained_models.go +++ b/typedapi/cat/mltrainedmodels/ml_trained_models.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets configuration and usage information about inference trained models. package mltrainedmodels import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type MlTrainedModels struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMlTrainedModels type alias for index. @@ -76,13 +79,18 @@ func NewMlTrainedModelsFunc(tp elastictransport.Interface) NewMlTrainedModels { // Gets configuration and usage information about inference trained models. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-trained-model.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-trained-model.html func New(tp elastictransport.Interface) *MlTrainedModels { r := &MlTrainedModels{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -118,6 +126,9 @@ func (r *MlTrainedModels) HttpRequest(ctx context.Context) (*http.Request, error path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) method = http.MethodGet @@ -131,9 +142,9 @@ func (r *MlTrainedModels) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -150,27 +161,66 @@ func (r *MlTrainedModels) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r MlTrainedModels) Perform(ctx context.Context) (*http.Response, error) { +func (r MlTrainedModels) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.ml_trained_models") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.ml_trained_models") + if reader := instrument.RecordRequestBody(ctx, "cat.ml_trained_models", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.ml_trained_models") + } if err != nil { - return nil, fmt.Errorf("an error happened during the MlTrainedModels query execution: %w", err) + localErr := fmt.Errorf("an error happened during the MlTrainedModels query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a mltrainedmodels.Response -func (r MlTrainedModels) Do(ctx context.Context) (Response, error) { +func (r MlTrainedModels) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_trained_models") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -178,6 +228,9 @@ func (r MlTrainedModels) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,6 +240,9 @@ func (r MlTrainedModels) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -194,12 +250,25 @@ func (r MlTrainedModels) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r MlTrainedModels) IsSuccess(ctx context.Context) (bool, error) { +func (r MlTrainedModels) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.ml_trained_models") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -215,6 +284,14 @@ func (r MlTrainedModels) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the MlTrainedModels query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/mltrainedmodels/response.go b/typedapi/cat/mltrainedmodels/response.go index 41ed6b3dc3..dbac5ab797 100644 --- a/typedapi/cat/mltrainedmodels/response.go +++ b/typedapi/cat/mltrainedmodels/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package mltrainedmodels @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package mltrainedmodels // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/ml_trained_models/CatTrainedModelsResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/ml_trained_models/CatTrainedModelsResponse.ts#L22-L24 type Response []types.TrainedModelsRecord diff --git a/typedapi/cat/nodeattrs/nodeattrs.go b/typedapi/cat/nodeattrs/nodeattrs.go index e682814e04..c716bd3a18 100644 --- a/typedapi/cat/nodeattrs/nodeattrs.go +++ b/typedapi/cat/nodeattrs/nodeattrs.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about custom node attributes. package nodeattrs import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Nodeattrs struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewNodeattrs type alias for index. @@ -67,13 +70,18 @@ func NewNodeattrsFunc(tp elastictransport.Interface) NewNodeattrs { // Returns information about custom node attributes. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-nodeattrs.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodeattrs.html func New(tp elastictransport.Interface) *Nodeattrs { r := &Nodeattrs{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Nodeattrs) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Nodeattrs) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Nodeattrs) Perform(ctx context.Context) (*http.Response, error) { +func (r Nodeattrs) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.nodeattrs") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.nodeattrs") + if reader := instrument.RecordRequestBody(ctx, "cat.nodeattrs", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.nodeattrs") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Nodeattrs query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Nodeattrs query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a nodeattrs.Response -func (r Nodeattrs) Do(ctx context.Context) (Response, error) { +func (r Nodeattrs) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.nodeattrs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Nodeattrs) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Nodeattrs) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Nodeattrs) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Nodeattrs) IsSuccess(ctx context.Context) (bool, error) { +func (r Nodeattrs) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.nodeattrs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Nodeattrs) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Nodeattrs query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/nodeattrs/response.go b/typedapi/cat/nodeattrs/response.go index 5936b3c5f4..14cc666816 100644 --- a/typedapi/cat/nodeattrs/response.go +++ b/typedapi/cat/nodeattrs/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package nodeattrs @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package nodeattrs // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/nodeattrs/CatNodeAttributesResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/nodeattrs/CatNodeAttributesResponse.ts#L22-L24 type Response []types.NodeAttributesRecord diff --git a/typedapi/cat/nodes/nodes.go b/typedapi/cat/nodes/nodes.go index 4034c93817..f77afab117 100644 --- a/typedapi/cat/nodes/nodes.go +++ b/typedapi/cat/nodes/nodes.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns basic statistics about performance of cluster nodes. package nodes import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -49,9 +48,13 @@ type Nodes struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewNodes type alias for index. @@ -69,13 +72,18 @@ func NewNodesFunc(tp elastictransport.Interface) NewNodes { // Returns basic statistics about performance of cluster nodes. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-nodes.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html func New(tp elastictransport.Interface) *Nodes { r := &Nodes{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *Nodes) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *Nodes) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Nodes) Perform(ctx context.Context) (*http.Response, error) { +func (r Nodes) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.nodes") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.nodes") + if reader := instrument.RecordRequestBody(ctx, "cat.nodes", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.nodes") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Nodes query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Nodes query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a nodes.Response -func (r Nodes) Do(ctx context.Context) (Response, error) { +func (r Nodes) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.nodes") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r Nodes) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r Nodes) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r Nodes) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Nodes) IsSuccess(ctx context.Context) (bool, error) { +func (r Nodes) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.nodes") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r Nodes) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Nodes query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/nodes/response.go b/typedapi/cat/nodes/response.go index 70be2f335e..9405c56293 100644 --- a/typedapi/cat/nodes/response.go +++ b/typedapi/cat/nodes/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package nodes @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package nodes // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/nodes/CatNodesResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/nodes/CatNodesResponse.ts#L22-L24 type Response []types.NodesRecord diff --git a/typedapi/cat/pendingtasks/pending_tasks.go b/typedapi/cat/pendingtasks/pending_tasks.go index 251a2d00ba..ea2cda3a47 100644 --- a/typedapi/cat/pendingtasks/pending_tasks.go +++ b/typedapi/cat/pendingtasks/pending_tasks.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns a concise representation of the cluster pending tasks. package pendingtasks import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type PendingTasks struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPendingTasks type alias for index. @@ -67,13 +70,18 @@ func NewPendingTasksFunc(tp elastictransport.Interface) NewPendingTasks { // Returns a concise representation of the cluster pending tasks. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-pending-tasks.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-pending-tasks.html func New(tp elastictransport.Interface) *PendingTasks { r := &PendingTasks{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *PendingTasks) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *PendingTasks) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PendingTasks) Perform(ctx context.Context) (*http.Response, error) { +func (r PendingTasks) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.pending_tasks") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.pending_tasks") + if reader := instrument.RecordRequestBody(ctx, "cat.pending_tasks", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.pending_tasks") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PendingTasks query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PendingTasks query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a pendingtasks.Response -func (r PendingTasks) Do(ctx context.Context) (Response, error) { +func (r PendingTasks) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.pending_tasks") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r PendingTasks) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r PendingTasks) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r PendingTasks) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PendingTasks) IsSuccess(ctx context.Context) (bool, error) { +func (r PendingTasks) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.pending_tasks") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r PendingTasks) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PendingTasks query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/pendingtasks/response.go b/typedapi/cat/pendingtasks/response.go index 625ea393c1..e05b2467e8 100644 --- a/typedapi/cat/pendingtasks/response.go +++ b/typedapi/cat/pendingtasks/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package pendingtasks @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package pendingtasks // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/pending_tasks/CatPendingTasksResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/pending_tasks/CatPendingTasksResponse.ts#L22-L24 type Response []types.PendingTasksRecord diff --git a/typedapi/cat/plugins/plugins.go b/typedapi/cat/plugins/plugins.go index e4b339814d..e253a0fd53 100644 --- a/typedapi/cat/plugins/plugins.go +++ b/typedapi/cat/plugins/plugins.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about installed plugins across nodes node. package plugins import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Plugins struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPlugins type alias for index. @@ -67,13 +70,18 @@ func NewPluginsFunc(tp elastictransport.Interface) NewPlugins { // Returns information about installed plugins across nodes node. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-plugins.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-plugins.html func New(tp elastictransport.Interface) *Plugins { r := &Plugins{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Plugins) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Plugins) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Plugins) Perform(ctx context.Context) (*http.Response, error) { +func (r Plugins) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.plugins") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.plugins") + if reader := instrument.RecordRequestBody(ctx, "cat.plugins", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.plugins") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Plugins query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Plugins query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a plugins.Response -func (r Plugins) Do(ctx context.Context) (Response, error) { +func (r Plugins) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.plugins") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Plugins) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Plugins) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Plugins) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Plugins) IsSuccess(ctx context.Context) (bool, error) { +func (r Plugins) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.plugins") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Plugins) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Plugins query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/plugins/response.go b/typedapi/cat/plugins/response.go index b22f84d2ae..04638934a8 100644 --- a/typedapi/cat/plugins/response.go +++ b/typedapi/cat/plugins/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package plugins @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package plugins // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/plugins/CatPluginsResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/plugins/CatPluginsResponse.ts#L22-L24 type Response []types.PluginsRecord diff --git a/typedapi/cat/recovery/recovery.go b/typedapi/cat/recovery/recovery.go index 5c7e51e51c..5413f12cfb 100644 --- a/typedapi/cat/recovery/recovery.go +++ b/typedapi/cat/recovery/recovery.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about index shard recoveries, both on-going completed. package recovery import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Recovery struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRecovery type alias for index. @@ -75,13 +78,18 @@ func NewRecoveryFunc(tp elastictransport.Interface) NewRecovery { // Returns information about index shard recoveries, both on-going completed. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-recovery.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-recovery.html func New(tp elastictransport.Interface) *Recovery { r := &Recovery{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -113,6 +121,9 @@ func (r *Recovery) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("recovery") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodGet @@ -126,9 +137,9 @@ func (r *Recovery) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -145,27 +156,66 @@ func (r *Recovery) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Recovery) Perform(ctx context.Context) (*http.Response, error) { +func (r Recovery) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.recovery") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.recovery") + if reader := instrument.RecordRequestBody(ctx, "cat.recovery", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.recovery") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Recovery query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Recovery query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a recovery.Response -func (r Recovery) Do(ctx context.Context) (Response, error) { +func (r Recovery) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.recovery") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -173,6 +223,9 @@ func (r Recovery) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,6 +235,9 @@ func (r Recovery) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,12 +245,25 @@ func (r Recovery) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Recovery) IsSuccess(ctx context.Context) (bool, error) { +func (r Recovery) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.recovery") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -210,6 +279,14 @@ func (r Recovery) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Recovery query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/recovery/response.go b/typedapi/cat/recovery/response.go index 8c28bb228c..54f7a58a81 100644 --- a/typedapi/cat/recovery/response.go +++ b/typedapi/cat/recovery/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package recovery @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package recovery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/recovery/CatRecoveryResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/recovery/CatRecoveryResponse.ts#L22-L24 type Response []types.RecoveryRecord diff --git a/typedapi/cat/repositories/repositories.go b/typedapi/cat/repositories/repositories.go index a756641798..125840cc03 100644 --- a/typedapi/cat/repositories/repositories.go +++ b/typedapi/cat/repositories/repositories.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about snapshot repositories registered in the cluster. package repositories import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Repositories struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRepositories type alias for index. @@ -67,13 +70,18 @@ func NewRepositoriesFunc(tp elastictransport.Interface) NewRepositories { // Returns information about snapshot repositories registered in the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-repositories.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-repositories.html func New(tp elastictransport.Interface) *Repositories { r := &Repositories{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Repositories) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Repositories) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Repositories) Perform(ctx context.Context) (*http.Response, error) { +func (r Repositories) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.repositories") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.repositories") + if reader := instrument.RecordRequestBody(ctx, "cat.repositories", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.repositories") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Repositories query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Repositories query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a repositories.Response -func (r Repositories) Do(ctx context.Context) (Response, error) { +func (r Repositories) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.repositories") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Repositories) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Repositories) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Repositories) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Repositories) IsSuccess(ctx context.Context) (bool, error) { +func (r Repositories) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.repositories") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Repositories) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Repositories query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/repositories/response.go b/typedapi/cat/repositories/response.go index 69f9f819c1..013d9805cc 100644 --- a/typedapi/cat/repositories/response.go +++ b/typedapi/cat/repositories/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package repositories @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package repositories // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/repositories/CatRepositoriesResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/repositories/CatRepositoriesResponse.ts#L22-L24 type Response []types.RepositoriesRecord diff --git a/typedapi/cat/segments/response.go b/typedapi/cat/segments/response.go index b64890fa92..a604d7c41a 100644 --- a/typedapi/cat/segments/response.go +++ b/typedapi/cat/segments/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package segments @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package segments // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/segments/CatSegmentsResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/segments/CatSegmentsResponse.ts#L22-L24 type Response []types.SegmentsRecord diff --git a/typedapi/cat/segments/segments.go b/typedapi/cat/segments/segments.go index addaec6689..b61f96ca6e 100644 --- a/typedapi/cat/segments/segments.go +++ b/typedapi/cat/segments/segments.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Provides low-level information about the segments in the shards of an index. package segments import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Segments struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSegments type alias for index. @@ -74,13 +77,18 @@ func NewSegmentsFunc(tp elastictransport.Interface) NewSegments { // Provides low-level information about the segments in the shards of an index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-segments.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-segments.html func New(tp elastictransport.Interface) *Segments { r := &Segments{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,6 +120,9 @@ func (r *Segments) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("segments") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodGet @@ -125,9 +136,9 @@ func (r *Segments) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *Segments) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Segments) Perform(ctx context.Context) (*http.Response, error) { +func (r Segments) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.segments") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.segments") + if reader := instrument.RecordRequestBody(ctx, "cat.segments", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.segments") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Segments query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Segments query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a segments.Response -func (r Segments) Do(ctx context.Context) (Response, error) { +func (r Segments) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.segments") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r Segments) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r Segments) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r Segments) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Segments) IsSuccess(ctx context.Context) (bool, error) { +func (r Segments) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.segments") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r Segments) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Segments query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/shards/response.go b/typedapi/cat/shards/response.go index 3c4beba428..4375bed249 100644 --- a/typedapi/cat/shards/response.go +++ b/typedapi/cat/shards/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package shards @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package shards // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/shards/CatShardsResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/shards/CatShardsResponse.ts#L22-L24 type Response []types.ShardsRecord diff --git a/typedapi/cat/shards/shards.go b/typedapi/cat/shards/shards.go index b168155638..5e9050682c 100644 --- a/typedapi/cat/shards/shards.go +++ b/typedapi/cat/shards/shards.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Provides a detailed view of shard allocation on nodes. package shards import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Shards struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewShards type alias for index. @@ -74,13 +77,18 @@ func NewShardsFunc(tp elastictransport.Interface) NewShards { // Provides a detailed view of shard allocation on nodes. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-shards.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-shards.html func New(tp elastictransport.Interface) *Shards { r := &Shards{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,6 +120,9 @@ func (r *Shards) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("shards") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodGet @@ -125,9 +136,9 @@ func (r *Shards) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *Shards) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Shards) Perform(ctx context.Context) (*http.Response, error) { +func (r Shards) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.shards") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.shards") + if reader := instrument.RecordRequestBody(ctx, "cat.shards", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.shards") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Shards query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Shards query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a shards.Response -func (r Shards) Do(ctx context.Context) (Response, error) { +func (r Shards) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.shards") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r Shards) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r Shards) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r Shards) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Shards) IsSuccess(ctx context.Context) (bool, error) { +func (r Shards) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.shards") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r Shards) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Shards query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/snapshots/response.go b/typedapi/cat/snapshots/response.go index 703783de80..2c1f374009 100644 --- a/typedapi/cat/snapshots/response.go +++ b/typedapi/cat/snapshots/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package snapshots @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package snapshots // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/snapshots/CatSnapshotsResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/snapshots/CatSnapshotsResponse.ts#L22-L24 type Response []types.SnapshotsRecord diff --git a/typedapi/cat/snapshots/snapshots.go b/typedapi/cat/snapshots/snapshots.go index cf46f92c75..963a2a4e68 100644 --- a/typedapi/cat/snapshots/snapshots.go +++ b/typedapi/cat/snapshots/snapshots.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns all snapshots in a specific repository. package snapshots import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Snapshots struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int repository string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSnapshots type alias for index. @@ -74,13 +77,18 @@ func NewSnapshotsFunc(tp elastictransport.Interface) NewSnapshots { // Returns all snapshots in a specific repository. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-snapshots.html func New(tp elastictransport.Interface) *Snapshots { r := &Snapshots{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,6 +120,9 @@ func (r *Snapshots) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("snapshots") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) method = http.MethodGet @@ -125,9 +136,9 @@ func (r *Snapshots) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *Snapshots) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Snapshots) Perform(ctx context.Context) (*http.Response, error) { +func (r Snapshots) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.snapshots") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.snapshots") + if reader := instrument.RecordRequestBody(ctx, "cat.snapshots", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.snapshots") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Snapshots query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Snapshots query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a snapshots.Response -func (r Snapshots) Do(ctx context.Context) (Response, error) { +func (r Snapshots) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.snapshots") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r Snapshots) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r Snapshots) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r Snapshots) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Snapshots) IsSuccess(ctx context.Context) (bool, error) { +func (r Snapshots) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.snapshots") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r Snapshots) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Snapshots query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/tasks/response.go b/typedapi/cat/tasks/response.go index c00d604e83..6c8191312c 100644 --- a/typedapi/cat/tasks/response.go +++ b/typedapi/cat/tasks/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package tasks @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package tasks // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/tasks/CatTasksResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/tasks/CatTasksResponse.ts#L22-L24 type Response []types.TasksRecord diff --git a/typedapi/cat/tasks/tasks.go b/typedapi/cat/tasks/tasks.go index 65f6d103a6..19121b0258 100644 --- a/typedapi/cat/tasks/tasks.go +++ b/typedapi/cat/tasks/tasks.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about the tasks currently executing on one or more nodes // in the cluster. package tasks import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -49,9 +48,13 @@ type Tasks struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewTasks type alias for index. @@ -70,13 +73,18 @@ func NewTasksFunc(tp elastictransport.Interface) NewTasks { // Returns information about the tasks currently executing on one or more nodes // in the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/tasks.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html func New(tp elastictransport.Interface) *Tasks { r := &Tasks{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,9 +119,9 @@ func (r *Tasks) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -130,27 +138,66 @@ func (r *Tasks) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Tasks) Perform(ctx context.Context) (*http.Response, error) { +func (r Tasks) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.tasks") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.tasks") + if reader := instrument.RecordRequestBody(ctx, "cat.tasks", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.tasks") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Tasks query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Tasks query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a tasks.Response -func (r Tasks) Do(ctx context.Context) (Response, error) { +func (r Tasks) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.tasks") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -158,6 +205,9 @@ func (r Tasks) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -167,6 +217,9 @@ func (r Tasks) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -174,12 +227,25 @@ func (r Tasks) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Tasks) IsSuccess(ctx context.Context) (bool, error) { +func (r Tasks) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.tasks") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -195,6 +261,14 @@ func (r Tasks) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Tasks query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/templates/response.go b/typedapi/cat/templates/response.go index dfb8c6077f..76eb8a878d 100644 --- a/typedapi/cat/templates/response.go +++ b/typedapi/cat/templates/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package templates @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package templates // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/templates/CatTemplatesResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/templates/CatTemplatesResponse.ts#L22-L24 type Response []types.TemplatesRecord diff --git a/typedapi/cat/templates/templates.go b/typedapi/cat/templates/templates.go index fb6addeb15..3ef5b07421 100644 --- a/typedapi/cat/templates/templates.go +++ b/typedapi/cat/templates/templates.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about existing templates. package templates import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type Templates struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewTemplates type alias for index. @@ -73,13 +76,18 @@ func NewTemplatesFunc(tp elastictransport.Interface) NewTemplates { // Returns information about existing templates. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-templates.html func New(tp elastictransport.Interface) *Templates { r := &Templates{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,6 +119,9 @@ func (r *Templates) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("templates") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -124,9 +135,9 @@ func (r *Templates) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -143,27 +154,66 @@ func (r *Templates) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Templates) Perform(ctx context.Context) (*http.Response, error) { +func (r Templates) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.templates") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.templates") + if reader := instrument.RecordRequestBody(ctx, "cat.templates", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.templates") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Templates query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Templates query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a templates.Response -func (r Templates) Do(ctx context.Context) (Response, error) { +func (r Templates) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.templates") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -171,6 +221,9 @@ func (r Templates) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,6 +233,9 @@ func (r Templates) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,12 +243,25 @@ func (r Templates) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Templates) IsSuccess(ctx context.Context) (bool, error) { +func (r Templates) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.templates") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -208,6 +277,14 @@ func (r Templates) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Templates query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/threadpool/response.go b/typedapi/cat/threadpool/response.go index f63058e2cc..319b21ff24 100644 --- a/typedapi/cat/threadpool/response.go +++ b/typedapi/cat/threadpool/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package threadpool @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package threadpool // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/thread_pool/CatThreadPoolResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/thread_pool/CatThreadPoolResponse.ts#L22-L24 type Response []types.ThreadPoolRecord diff --git a/typedapi/cat/threadpool/thread_pool.go b/typedapi/cat/threadpool/thread_pool.go index 2beb10b232..d859cc826c 100644 --- a/typedapi/cat/threadpool/thread_pool.go +++ b/typedapi/cat/threadpool/thread_pool.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns cluster-wide thread pool statistics per node. // By default the active, queue and rejected statistics are returned for all @@ -24,7 +24,6 @@ package threadpool import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type ThreadPool struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int threadpoolpatterns string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewThreadPool type alias for index. @@ -78,13 +81,18 @@ func NewThreadPoolFunc(tp elastictransport.Interface) NewThreadPool { // By default the active, queue and rejected statistics are returned for all // thread pools. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-thread-pool.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-thread-pool.html func New(tp elastictransport.Interface) *ThreadPool { r := &ThreadPool{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -116,6 +124,9 @@ func (r *ThreadPool) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("thread_pool") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "threadpoolpatterns", r.threadpoolpatterns) + } path.WriteString(r.threadpoolpatterns) method = http.MethodGet @@ -129,9 +140,9 @@ func (r *ThreadPool) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +159,66 @@ func (r *ThreadPool) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ThreadPool) Perform(ctx context.Context) (*http.Response, error) { +func (r ThreadPool) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.thread_pool") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.thread_pool") + if reader := instrument.RecordRequestBody(ctx, "cat.thread_pool", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.thread_pool") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ThreadPool query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ThreadPool query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a threadpool.Response -func (r ThreadPool) Do(ctx context.Context) (Response, error) { +func (r ThreadPool) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.thread_pool") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +226,9 @@ func (r ThreadPool) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +238,9 @@ func (r ThreadPool) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +248,25 @@ func (r ThreadPool) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ThreadPool) IsSuccess(ctx context.Context) (bool, error) { +func (r ThreadPool) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.thread_pool") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +282,14 @@ func (r ThreadPool) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ThreadPool query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cat/transforms/response.go b/typedapi/cat/transforms/response.go index 92da1c33ce..d01808d882 100644 --- a/typedapi/cat/transforms/response.go +++ b/typedapi/cat/transforms/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package transforms @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package transforms // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/transforms/CatTransformsResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/transforms/CatTransformsResponse.ts#L22-L24 type Response []types.TransformsRecord diff --git a/typedapi/cat/transforms/transforms.go b/typedapi/cat/transforms/transforms.go index 8476ddda40..614502c595 100644 --- a/typedapi/cat/transforms/transforms.go +++ b/typedapi/cat/transforms/transforms.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets configuration and usage information about transforms. package transforms import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type Transforms struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewTransforms type alias for index. @@ -76,13 +79,18 @@ func NewTransformsFunc(tp elastictransport.Interface) NewTransforms { // Gets configuration and usage information about transforms. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cat-transforms.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transforms.html func New(tp elastictransport.Interface) *Transforms { r := &Transforms{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,6 +122,9 @@ func (r *Transforms) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("transforms") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) method = http.MethodGet @@ -127,9 +138,9 @@ func (r *Transforms) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -146,27 +157,66 @@ func (r *Transforms) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Transforms) Perform(ctx context.Context) (*http.Response, error) { +func (r Transforms) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cat.transforms") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cat.transforms") + if reader := instrument.RecordRequestBody(ctx, "cat.transforms", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cat.transforms") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Transforms query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Transforms query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a transforms.Response -func (r Transforms) Do(ctx context.Context) (Response, error) { +func (r Transforms) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.transforms") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -174,6 +224,9 @@ func (r Transforms) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,6 +236,9 @@ func (r Transforms) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -190,12 +246,25 @@ func (r Transforms) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Transforms) IsSuccess(ctx context.Context) (bool, error) { +func (r Transforms) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cat.transforms") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -211,6 +280,14 @@ func (r Transforms) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Transforms query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ccr/deleteautofollowpattern/delete_auto_follow_pattern.go b/typedapi/ccr/deleteautofollowpattern/delete_auto_follow_pattern.go index 0f899603b3..f7b91350ec 100644 --- a/typedapi/ccr/deleteautofollowpattern/delete_auto_follow_pattern.go +++ b/typedapi/ccr/deleteautofollowpattern/delete_auto_follow_pattern.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes auto-follow patterns. package deleteautofollowpattern import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteAutoFollowPattern struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteAutoFollowPattern type alias for index. @@ -75,13 +78,18 @@ func NewDeleteAutoFollowPatternFunc(tp elastictransport.Interface) NewDeleteAuto // Deletes auto-follow patterns. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-delete-auto-follow-pattern.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html func New(tp elastictransport.Interface) *DeleteAutoFollowPattern { r := &DeleteAutoFollowPattern{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeleteAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Reques path.WriteString("auto_follow") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *DeleteAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Reques } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *DeleteAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Reques } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteAutoFollowPattern) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteAutoFollowPattern) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.delete_auto_follow_pattern") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.delete_auto_follow_pattern") + if reader := instrument.RecordRequestBody(ctx, "ccr.delete_auto_follow_pattern", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.delete_auto_follow_pattern") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteAutoFollowPattern query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteAutoFollowPattern query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleteautofollowpattern.Response -func (r DeleteAutoFollowPattern) Do(ctx context.Context) (*Response, error) { +func (r DeleteAutoFollowPattern) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.delete_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r DeleteAutoFollowPattern) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r DeleteAutoFollowPattern) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r DeleteAutoFollowPattern) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteAutoFollowPattern) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteAutoFollowPattern) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.delete_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r DeleteAutoFollowPattern) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteAutoFollowPattern query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ccr/deleteautofollowpattern/response.go b/typedapi/ccr/deleteautofollowpattern/response.go index 58b947cef0..98e6f48c9d 100644 --- a/typedapi/ccr/deleteautofollowpattern/response.go +++ b/typedapi/ccr/deleteautofollowpattern/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleteautofollowpattern // Response holds the response body struct for the package deleteautofollowpattern // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/delete_auto_follow_pattern/DeleteAutoFollowPatternResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/delete_auto_follow_pattern/DeleteAutoFollowPatternResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ccr/follow/follow.go b/typedapi/ccr/follow/follow.go index e0a6ff348c..894a804988 100644 --- a/typedapi/ccr/follow/follow.go +++ b/typedapi/ccr/follow/follow.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a new follower index configured to follow the referenced leader // index. @@ -51,15 +51,19 @@ type Follow struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewFollow type alias for index. @@ -80,17 +84,24 @@ func NewFollowFunc(tp elastictransport.Interface) NewFollow { // Creates a new follower index configured to follow the referenced leader // index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-put-follow.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html func New(tp elastictransport.Interface) *Follow { r := &Follow{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *Follow) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,12 +150,19 @@ func (r *Follow) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_ccr") @@ -164,15 +180,15 @@ func (r *Follow) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *Follow) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Follow) Perform(ctx context.Context) (*http.Response, error) { +func (r Follow) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.follow") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.follow") + if reader := instrument.RecordRequestBody(ctx, "ccr.follow", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.follow") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Follow query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Follow query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a follow.Response -func (r Follow) Do(ctx context.Context) (*Response, error) { +func (r Follow) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.follow") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r Follow) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r Follow) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r Follow) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ccr/follow/request.go b/typedapi/ccr/follow/request.go index 13b0dcddf4..f57c5a4954 100644 --- a/typedapi/ccr/follow/request.go +++ b/typedapi/ccr/follow/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package follow @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package follow // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/follow/CreateFollowIndexRequest.ts#L25-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/follow/CreateFollowIndexRequest.ts#L25-L51 type Request struct { LeaderIndex *string `json:"leader_index,omitempty"` MaxOutstandingReadRequests *int64 `json:"max_outstanding_read_requests,omitempty"` diff --git a/typedapi/ccr/follow/response.go b/typedapi/ccr/follow/response.go index 13338696f8..4584cf52bf 100644 --- a/typedapi/ccr/follow/response.go +++ b/typedapi/ccr/follow/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package follow // Response holds the response body struct for the package follow // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/follow/CreateFollowIndexResponse.ts#L20-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/follow/CreateFollowIndexResponse.ts#L20-L26 type Response struct { FollowIndexCreated bool `json:"follow_index_created"` FollowIndexShardsAcked bool `json:"follow_index_shards_acked"` diff --git a/typedapi/ccr/followinfo/follow_info.go b/typedapi/ccr/followinfo/follow_info.go index d05658383c..c65135ff34 100644 --- a/typedapi/ccr/followinfo/follow_info.go +++ b/typedapi/ccr/followinfo/follow_info.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about all follower indices, including parameters and // status for each follower index package followinfo import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type FollowInfo struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewFollowInfo type alias for index. @@ -77,13 +80,18 @@ func NewFollowInfoFunc(tp elastictransport.Interface) NewFollowInfo { // Retrieves information about all follower indices, including parameters and // status for each follower index // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-get-follow-info.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html func New(tp elastictransport.Interface) *FollowInfo { r := &FollowInfo{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *FollowInfo) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_ccr") @@ -121,9 +132,9 @@ func (r *FollowInfo) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *FollowInfo) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r FollowInfo) Perform(ctx context.Context) (*http.Response, error) { +func (r FollowInfo) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.follow_info") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.follow_info") + if reader := instrument.RecordRequestBody(ctx, "ccr.follow_info", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.follow_info") + } if err != nil { - return nil, fmt.Errorf("an error happened during the FollowInfo query execution: %w", err) + localErr := fmt.Errorf("an error happened during the FollowInfo query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a followinfo.Response -func (r FollowInfo) Do(ctx context.Context) (*Response, error) { +func (r FollowInfo) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.follow_info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r FollowInfo) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r FollowInfo) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r FollowInfo) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r FollowInfo) IsSuccess(ctx context.Context) (bool, error) { +func (r FollowInfo) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.follow_info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r FollowInfo) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the FollowInfo query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ccr/followinfo/response.go b/typedapi/ccr/followinfo/response.go index d54b5496a2..602c4f231e 100644 --- a/typedapi/ccr/followinfo/response.go +++ b/typedapi/ccr/followinfo/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package followinfo @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package followinfo // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/follow_info/FollowInfoResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/follow_info/FollowInfoResponse.ts#L22-L24 type Response struct { FollowerIndices []types.FollowerIndex `json:"follower_indices"` } diff --git a/typedapi/ccr/followstats/follow_stats.go b/typedapi/ccr/followstats/follow_stats.go index 99cab64790..670a91b123 100644 --- a/typedapi/ccr/followstats/follow_stats.go +++ b/typedapi/ccr/followstats/follow_stats.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves follower stats. return shard-level stats about the following tasks // associated with each shard for the specified indices. package followstats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type FollowStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewFollowStats type alias for index. @@ -77,13 +80,18 @@ func NewFollowStatsFunc(tp elastictransport.Interface) NewFollowStats { // Retrieves follower stats. return shard-level stats about the following tasks // associated with each shard for the specified indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-get-follow-stats.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html func New(tp elastictransport.Interface) *FollowStats { r := &FollowStats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *FollowStats) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_ccr") @@ -121,9 +132,9 @@ func (r *FollowStats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *FollowStats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r FollowStats) Perform(ctx context.Context) (*http.Response, error) { +func (r FollowStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.follow_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.follow_stats") + if reader := instrument.RecordRequestBody(ctx, "ccr.follow_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.follow_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the FollowStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the FollowStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a followstats.Response -func (r FollowStats) Do(ctx context.Context) (*Response, error) { +func (r FollowStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.follow_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r FollowStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r FollowStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r FollowStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r FollowStats) IsSuccess(ctx context.Context) (bool, error) { +func (r FollowStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.follow_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r FollowStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the FollowStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ccr/followstats/response.go b/typedapi/ccr/followstats/response.go index b36e13188a..ea297f4241 100644 --- a/typedapi/ccr/followstats/response.go +++ b/typedapi/ccr/followstats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package followstats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package followstats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/follow_stats/FollowIndexStatsResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/follow_stats/FollowIndexStatsResponse.ts#L22-L24 type Response struct { Indices []types.FollowIndexStats `json:"indices"` } diff --git a/typedapi/ccr/forgetfollower/forget_follower.go b/typedapi/ccr/forgetfollower/forget_follower.go index 7d77f23f58..183e2ab60c 100644 --- a/typedapi/ccr/forgetfollower/forget_follower.go +++ b/typedapi/ccr/forgetfollower/forget_follower.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Removes the follower retention leases from the leader. package forgetfollower @@ -50,15 +50,19 @@ type ForgetFollower struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewForgetFollower type alias for index. @@ -78,17 +82,24 @@ func NewForgetFollowerFunc(tp elastictransport.Interface) NewForgetFollower { // Removes the follower retention leases from the leader. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-post-forget-follower.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-forget-follower.html func New(tp elastictransport.Interface) *ForgetFollower { r := &ForgetFollower{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *ForgetFollower) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,12 +148,19 @@ func (r *ForgetFollower) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_ccr") @@ -162,15 +178,15 @@ func (r *ForgetFollower) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *ForgetFollower) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ForgetFollower) Perform(ctx context.Context) (*http.Response, error) { +func (r ForgetFollower) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.forget_follower") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.forget_follower") + if reader := instrument.RecordRequestBody(ctx, "ccr.forget_follower", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.forget_follower") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ForgetFollower query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ForgetFollower query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a forgetfollower.Response -func (r ForgetFollower) Do(ctx context.Context) (*Response, error) { +func (r ForgetFollower) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.forget_follower") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r ForgetFollower) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r ForgetFollower) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r ForgetFollower) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ccr/forgetfollower/request.go b/typedapi/ccr/forgetfollower/request.go index 32801f562a..e5fa8b9b0f 100644 --- a/typedapi/ccr/forgetfollower/request.go +++ b/typedapi/ccr/forgetfollower/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package forgetfollower @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package forgetfollower // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/forget_follower/ForgetFollowerIndexRequest.ts#L23-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/forget_follower/ForgetFollowerIndexRequest.ts#L23-L38 type Request struct { FollowerCluster *string `json:"follower_cluster,omitempty"` FollowerIndex *string `json:"follower_index,omitempty"` diff --git a/typedapi/ccr/forgetfollower/response.go b/typedapi/ccr/forgetfollower/response.go index 469fe0567a..c681f2d45b 100644 --- a/typedapi/ccr/forgetfollower/response.go +++ b/typedapi/ccr/forgetfollower/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package forgetfollower @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package forgetfollower // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/forget_follower/ForgetFollowerIndexResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/forget_follower/ForgetFollowerIndexResponse.ts#L22-L24 type Response struct { Shards_ types.ShardStatistics `json:"_shards"` } diff --git a/typedapi/ccr/getautofollowpattern/get_auto_follow_pattern.go b/typedapi/ccr/getautofollowpattern/get_auto_follow_pattern.go index 8ac88b2183..2a1767c92d 100644 --- a/typedapi/ccr/getautofollowpattern/get_auto_follow_pattern.go +++ b/typedapi/ccr/getautofollowpattern/get_auto_follow_pattern.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets configured auto-follow patterns. Returns the specified auto-follow // pattern collection. package getautofollowpattern import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetAutoFollowPattern struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetAutoFollowPattern type alias for index. @@ -75,13 +78,18 @@ func NewGetAutoFollowPatternFunc(tp elastictransport.Interface) NewGetAutoFollow // Gets configured auto-follow patterns. Returns the specified auto-follow // pattern collection. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-get-auto-follow-pattern.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html func New(tp elastictransport.Interface) *GetAutoFollowPattern { r := &GetAutoFollowPattern{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -113,6 +121,9 @@ func (r *GetAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("auto_follow") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -126,9 +137,9 @@ func (r *GetAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -145,27 +156,66 @@ func (r *GetAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetAutoFollowPattern) Perform(ctx context.Context) (*http.Response, error) { +func (r GetAutoFollowPattern) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.get_auto_follow_pattern") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.get_auto_follow_pattern") + if reader := instrument.RecordRequestBody(ctx, "ccr.get_auto_follow_pattern", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.get_auto_follow_pattern") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetAutoFollowPattern query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetAutoFollowPattern query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getautofollowpattern.Response -func (r GetAutoFollowPattern) Do(ctx context.Context) (*Response, error) { +func (r GetAutoFollowPattern) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.get_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -173,6 +223,9 @@ func (r GetAutoFollowPattern) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,6 +235,9 @@ func (r GetAutoFollowPattern) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,12 +245,25 @@ func (r GetAutoFollowPattern) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetAutoFollowPattern) IsSuccess(ctx context.Context) (bool, error) { +func (r GetAutoFollowPattern) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.get_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -210,6 +279,14 @@ func (r GetAutoFollowPattern) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetAutoFollowPattern query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ccr/getautofollowpattern/response.go b/typedapi/ccr/getautofollowpattern/response.go index 6a2bbd3977..2c95936c41 100644 --- a/typedapi/ccr/getautofollowpattern/response.go +++ b/typedapi/ccr/getautofollowpattern/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getautofollowpattern @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getautofollowpattern // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/get_auto_follow_pattern/GetAutoFollowPatternResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/get_auto_follow_pattern/GetAutoFollowPatternResponse.ts#L22-L24 type Response struct { Patterns []types.AutoFollowPattern `json:"patterns"` } diff --git a/typedapi/ccr/pauseautofollowpattern/pause_auto_follow_pattern.go b/typedapi/ccr/pauseautofollowpattern/pause_auto_follow_pattern.go index ad39d82533..028f66001a 100644 --- a/typedapi/ccr/pauseautofollowpattern/pause_auto_follow_pattern.go +++ b/typedapi/ccr/pauseautofollowpattern/pause_auto_follow_pattern.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Pauses an auto-follow pattern package pauseautofollowpattern import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type PauseAutoFollowPattern struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPauseAutoFollowPattern type alias for index. @@ -75,13 +78,18 @@ func NewPauseAutoFollowPatternFunc(tp elastictransport.Interface) NewPauseAutoFo // Pauses an auto-follow pattern // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-pause-auto-follow-pattern.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-pause-auto-follow-pattern.html func New(tp elastictransport.Interface) *PauseAutoFollowPattern { r := &PauseAutoFollowPattern{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *PauseAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request path.WriteString("auto_follow") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) path.WriteString("/") path.WriteString("pause") @@ -121,9 +132,9 @@ func (r *PauseAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *PauseAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PauseAutoFollowPattern) Perform(ctx context.Context) (*http.Response, error) { +func (r PauseAutoFollowPattern) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.pause_auto_follow_pattern") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.pause_auto_follow_pattern") + if reader := instrument.RecordRequestBody(ctx, "ccr.pause_auto_follow_pattern", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.pause_auto_follow_pattern") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PauseAutoFollowPattern query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PauseAutoFollowPattern query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a pauseautofollowpattern.Response -func (r PauseAutoFollowPattern) Do(ctx context.Context) (*Response, error) { +func (r PauseAutoFollowPattern) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.pause_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r PauseAutoFollowPattern) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r PauseAutoFollowPattern) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r PauseAutoFollowPattern) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PauseAutoFollowPattern) IsSuccess(ctx context.Context) (bool, error) { +func (r PauseAutoFollowPattern) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.pause_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r PauseAutoFollowPattern) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PauseAutoFollowPattern query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ccr/pauseautofollowpattern/response.go b/typedapi/ccr/pauseautofollowpattern/response.go index 8d946cfe42..0033d311ed 100644 --- a/typedapi/ccr/pauseautofollowpattern/response.go +++ b/typedapi/ccr/pauseautofollowpattern/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package pauseautofollowpattern // Response holds the response body struct for the package pauseautofollowpattern // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/pause_auto_follow_pattern/PauseAutoFollowPatternResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/pause_auto_follow_pattern/PauseAutoFollowPatternResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ccr/pausefollow/pause_follow.go b/typedapi/ccr/pausefollow/pause_follow.go index 3e682b2605..416ac3f3db 100644 --- a/typedapi/ccr/pausefollow/pause_follow.go +++ b/typedapi/ccr/pausefollow/pause_follow.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Pauses a follower index. The follower index will not fetch any additional // operations from the leader index. package pausefollow import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type PauseFollow struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPauseFollow type alias for index. @@ -77,13 +80,18 @@ func NewPauseFollowFunc(tp elastictransport.Interface) NewPauseFollow { // Pauses a follower index. The follower index will not fetch any additional // operations from the leader index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-post-pause-follow.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html func New(tp elastictransport.Interface) *PauseFollow { r := &PauseFollow{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *PauseFollow) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_ccr") @@ -121,9 +132,9 @@ func (r *PauseFollow) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *PauseFollow) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PauseFollow) Perform(ctx context.Context) (*http.Response, error) { +func (r PauseFollow) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.pause_follow") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.pause_follow") + if reader := instrument.RecordRequestBody(ctx, "ccr.pause_follow", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.pause_follow") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PauseFollow query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PauseFollow query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a pausefollow.Response -func (r PauseFollow) Do(ctx context.Context) (*Response, error) { +func (r PauseFollow) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.pause_follow") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r PauseFollow) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r PauseFollow) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r PauseFollow) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PauseFollow) IsSuccess(ctx context.Context) (bool, error) { +func (r PauseFollow) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.pause_follow") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r PauseFollow) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PauseFollow query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ccr/pausefollow/response.go b/typedapi/ccr/pausefollow/response.go index 766fdea55d..67f9515e4e 100644 --- a/typedapi/ccr/pausefollow/response.go +++ b/typedapi/ccr/pausefollow/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package pausefollow // Response holds the response body struct for the package pausefollow // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/pause_follow/PauseFollowIndexResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/pause_follow/PauseFollowIndexResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ccr/putautofollowpattern/put_auto_follow_pattern.go b/typedapi/ccr/putautofollowpattern/put_auto_follow_pattern.go index 017ee8cd40..5f3b3d0fc5 100644 --- a/typedapi/ccr/putautofollowpattern/put_auto_follow_pattern.go +++ b/typedapi/ccr/putautofollowpattern/put_auto_follow_pattern.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a new named collection of auto-follow patterns against a specified // remote cluster. Newly created indices on the remote cluster matching any of @@ -52,15 +52,19 @@ type PutAutoFollowPattern struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutAutoFollowPattern type alias for index. @@ -82,17 +86,24 @@ func NewPutAutoFollowPatternFunc(tp elastictransport.Interface) NewPutAutoFollow // remote cluster. Newly created indices on the remote cluster matching any of // the specified patterns will be automatically configured as follower indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-put-auto-follow-pattern.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html func New(tp elastictransport.Interface) *PutAutoFollowPattern { r := &PutAutoFollowPattern{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -129,9 +140,7 @@ func (r *PutAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request, } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -143,6 +152,10 @@ func (r *PutAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request, } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,6 +166,9 @@ func (r *PutAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("auto_follow") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -166,15 +182,15 @@ func (r *PutAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -191,27 +207,66 @@ func (r *PutAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutAutoFollowPattern) Perform(ctx context.Context) (*http.Response, error) { +func (r PutAutoFollowPattern) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.put_auto_follow_pattern") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.put_auto_follow_pattern") + if reader := instrument.RecordRequestBody(ctx, "ccr.put_auto_follow_pattern", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.put_auto_follow_pattern") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutAutoFollowPattern query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutAutoFollowPattern query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putautofollowpattern.Response -func (r PutAutoFollowPattern) Do(ctx context.Context) (*Response, error) { +func (r PutAutoFollowPattern) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.put_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -219,6 +274,9 @@ func (r PutAutoFollowPattern) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -228,6 +286,9 @@ func (r PutAutoFollowPattern) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +296,9 @@ func (r PutAutoFollowPattern) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ccr/putautofollowpattern/request.go b/typedapi/ccr/putautofollowpattern/request.go index be4f93830a..2e918008d4 100644 --- a/typedapi/ccr/putautofollowpattern/request.go +++ b/typedapi/ccr/putautofollowpattern/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putautofollowpattern @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putautofollowpattern // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/put_auto_follow_pattern/PutAutoFollowPatternRequest.ts#L27-L112 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/put_auto_follow_pattern/PutAutoFollowPatternRequest.ts#L27-L112 type Request struct { // FollowIndexPattern The name of follower index. The template {{leader_index}} can be used to diff --git a/typedapi/ccr/putautofollowpattern/response.go b/typedapi/ccr/putautofollowpattern/response.go index e9599db178..a8e33408cd 100644 --- a/typedapi/ccr/putautofollowpattern/response.go +++ b/typedapi/ccr/putautofollowpattern/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putautofollowpattern // Response holds the response body struct for the package putautofollowpattern // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/put_auto_follow_pattern/PutAutoFollowPatternResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/put_auto_follow_pattern/PutAutoFollowPatternResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ccr/resumeautofollowpattern/response.go b/typedapi/ccr/resumeautofollowpattern/response.go index 4f92a51d08..dea101ea42 100644 --- a/typedapi/ccr/resumeautofollowpattern/response.go +++ b/typedapi/ccr/resumeautofollowpattern/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package resumeautofollowpattern // Response holds the response body struct for the package resumeautofollowpattern // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/resume_auto_follow_pattern/ResumeAutoFollowPatternResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/resume_auto_follow_pattern/ResumeAutoFollowPatternResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ccr/resumeautofollowpattern/resume_auto_follow_pattern.go b/typedapi/ccr/resumeautofollowpattern/resume_auto_follow_pattern.go index af9a8e9942..a4b28060eb 100644 --- a/typedapi/ccr/resumeautofollowpattern/resume_auto_follow_pattern.go +++ b/typedapi/ccr/resumeautofollowpattern/resume_auto_follow_pattern.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Resumes an auto-follow pattern that has been paused package resumeautofollowpattern import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type ResumeAutoFollowPattern struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewResumeAutoFollowPattern type alias for index. @@ -75,13 +78,18 @@ func NewResumeAutoFollowPatternFunc(tp elastictransport.Interface) NewResumeAuto // Resumes an auto-follow pattern that has been paused // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-resume-auto-follow-pattern.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-resume-auto-follow-pattern.html func New(tp elastictransport.Interface) *ResumeAutoFollowPattern { r := &ResumeAutoFollowPattern{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *ResumeAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Reques path.WriteString("auto_follow") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) path.WriteString("/") path.WriteString("resume") @@ -121,9 +132,9 @@ func (r *ResumeAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Reques } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *ResumeAutoFollowPattern) HttpRequest(ctx context.Context) (*http.Reques } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ResumeAutoFollowPattern) Perform(ctx context.Context) (*http.Response, error) { +func (r ResumeAutoFollowPattern) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.resume_auto_follow_pattern") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.resume_auto_follow_pattern") + if reader := instrument.RecordRequestBody(ctx, "ccr.resume_auto_follow_pattern", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.resume_auto_follow_pattern") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ResumeAutoFollowPattern query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ResumeAutoFollowPattern query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a resumeautofollowpattern.Response -func (r ResumeAutoFollowPattern) Do(ctx context.Context) (*Response, error) { +func (r ResumeAutoFollowPattern) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.resume_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r ResumeAutoFollowPattern) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r ResumeAutoFollowPattern) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r ResumeAutoFollowPattern) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ResumeAutoFollowPattern) IsSuccess(ctx context.Context) (bool, error) { +func (r ResumeAutoFollowPattern) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.resume_auto_follow_pattern") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r ResumeAutoFollowPattern) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ResumeAutoFollowPattern query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ccr/resumefollow/request.go b/typedapi/ccr/resumefollow/request.go index 774bd4fc31..9d9aa8c989 100644 --- a/typedapi/ccr/resumefollow/request.go +++ b/typedapi/ccr/resumefollow/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package resumefollow @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package resumefollow // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/resume_follow/ResumeFollowIndexRequest.ts#L25-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/resume_follow/ResumeFollowIndexRequest.ts#L25-L46 type Request struct { MaxOutstandingReadRequests *int64 `json:"max_outstanding_read_requests,omitempty"` MaxOutstandingWriteRequests *int64 `json:"max_outstanding_write_requests,omitempty"` diff --git a/typedapi/ccr/resumefollow/response.go b/typedapi/ccr/resumefollow/response.go index 3f23f62483..99800efbd4 100644 --- a/typedapi/ccr/resumefollow/response.go +++ b/typedapi/ccr/resumefollow/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package resumefollow // Response holds the response body struct for the package resumefollow // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/resume_follow/ResumeFollowIndexResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/resume_follow/ResumeFollowIndexResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ccr/resumefollow/resume_follow.go b/typedapi/ccr/resumefollow/resume_follow.go index 9cca3b3f48..6e18b0e049 100644 --- a/typedapi/ccr/resumefollow/resume_follow.go +++ b/typedapi/ccr/resumefollow/resume_follow.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Resumes a follower index that has been paused package resumefollow @@ -50,15 +50,19 @@ type ResumeFollow struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewResumeFollow type alias for index. @@ -78,17 +82,24 @@ func NewResumeFollowFunc(tp elastictransport.Interface) NewResumeFollow { // Resumes a follower index that has been paused // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-post-resume-follow.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html func New(tp elastictransport.Interface) *ResumeFollow { r := &ResumeFollow{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *ResumeFollow) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,12 +148,19 @@ func (r *ResumeFollow) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_ccr") @@ -162,15 +178,15 @@ func (r *ResumeFollow) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *ResumeFollow) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ResumeFollow) Perform(ctx context.Context) (*http.Response, error) { +func (r ResumeFollow) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.resume_follow") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.resume_follow") + if reader := instrument.RecordRequestBody(ctx, "ccr.resume_follow", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.resume_follow") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ResumeFollow query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ResumeFollow query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a resumefollow.Response -func (r ResumeFollow) Do(ctx context.Context) (*Response, error) { +func (r ResumeFollow) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.resume_follow") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r ResumeFollow) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r ResumeFollow) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r ResumeFollow) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ccr/stats/response.go b/typedapi/ccr/stats/response.go index 4b0834ab47..39b92409a9 100644 --- a/typedapi/ccr/stats/response.go +++ b/typedapi/ccr/stats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package stats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/stats/CcrStatsResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/stats/CcrStatsResponse.ts#L22-L27 type Response struct { AutoFollowStats types.AutoFollowStats `json:"auto_follow_stats"` FollowStats types.FollowStats `json:"follow_stats"` diff --git a/typedapi/ccr/stats/stats.go b/typedapi/ccr/stats/stats.go index 4f8fd6c185..3954c8d31e 100644 --- a/typedapi/ccr/stats/stats.go +++ b/typedapi/ccr/stats/stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets all stats related to cross-cluster replication. package stats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Stats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStats type alias for index. @@ -67,13 +70,18 @@ func NewStatsFunc(tp elastictransport.Interface) NewStats { // Gets all stats related to cross-cluster replication. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-get-stats.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html func New(tp elastictransport.Interface) *Stats { r := &Stats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Stats) Perform(ctx context.Context) (*http.Response, error) { +func (r Stats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.stats") + if reader := instrument.RecordRequestBody(ctx, "ccr.stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Stats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Stats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stats.Response -func (r Stats) Do(ctx context.Context) (*Response, error) { +func (r Stats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Stats) IsSuccess(ctx context.Context) (bool, error) { +func (r Stats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Stats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Stats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ccr/unfollow/response.go b/typedapi/ccr/unfollow/response.go index 6259b731f6..df0d1140a3 100644 --- a/typedapi/ccr/unfollow/response.go +++ b/typedapi/ccr/unfollow/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package unfollow // Response holds the response body struct for the package unfollow // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/unfollow/UnfollowIndexResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/unfollow/UnfollowIndexResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ccr/unfollow/unfollow.go b/typedapi/ccr/unfollow/unfollow.go index 3043fa7b2f..dd0ba9890e 100644 --- a/typedapi/ccr/unfollow/unfollow.go +++ b/typedapi/ccr/unfollow/unfollow.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Stops the following task associated with a follower index and removes index // metadata and settings associated with cross-cluster replication. package unfollow import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Unfollow struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUnfollow type alias for index. @@ -77,13 +80,18 @@ func NewUnfollowFunc(tp elastictransport.Interface) NewUnfollow { // Stops the following task associated with a follower index and removes index // metadata and settings associated with cross-cluster replication. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-post-unfollow.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-unfollow.html func New(tp elastictransport.Interface) *Unfollow { r := &Unfollow{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *Unfollow) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_ccr") @@ -121,9 +132,9 @@ func (r *Unfollow) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *Unfollow) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Unfollow) Perform(ctx context.Context) (*http.Response, error) { +func (r Unfollow) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ccr.unfollow") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ccr.unfollow") + if reader := instrument.RecordRequestBody(ctx, "ccr.unfollow", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ccr.unfollow") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Unfollow query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Unfollow query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a unfollow.Response -func (r Unfollow) Do(ctx context.Context) (*Response, error) { +func (r Unfollow) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.unfollow") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r Unfollow) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r Unfollow) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r Unfollow) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Unfollow) IsSuccess(ctx context.Context) (bool, error) { +func (r Unfollow) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ccr.unfollow") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r Unfollow) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Unfollow query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/allocationexplain/allocation_explain.go b/typedapi/cluster/allocationexplain/allocation_explain.go index b324a8bd86..6b1cf71949 100644 --- a/typedapi/cluster/allocationexplain/allocation_explain.go +++ b/typedapi/cluster/allocationexplain/allocation_explain.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Provides explanations for shard allocations in the cluster. package allocationexplain @@ -47,13 +47,17 @@ type AllocationExplain struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewAllocationExplain type alias for index. @@ -71,17 +75,24 @@ func NewAllocationExplainFunc(tp elastictransport.Interface) NewAllocationExplai // Provides explanations for shard allocations in the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-allocation-explain.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-allocation-explain.html func New(tp elastictransport.Interface) *AllocationExplain { r := &AllocationExplain{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -118,9 +129,7 @@ func (r *AllocationExplain) HttpRequest(ctx context.Context) (*http.Request, err } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -132,6 +141,10 @@ func (r *AllocationExplain) HttpRequest(ctx context.Context) (*http.Request, err } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,15 +167,15 @@ func (r *AllocationExplain) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -179,27 +192,66 @@ func (r *AllocationExplain) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r AllocationExplain) Perform(ctx context.Context) (*http.Response, error) { +func (r AllocationExplain) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.allocation_explain") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.allocation_explain") + if reader := instrument.RecordRequestBody(ctx, "cluster.allocation_explain", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.allocation_explain") + } if err != nil { - return nil, fmt.Errorf("an error happened during the AllocationExplain query execution: %w", err) + localErr := fmt.Errorf("an error happened during the AllocationExplain query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a allocationexplain.Response -func (r AllocationExplain) Do(ctx context.Context) (*Response, error) { +func (r AllocationExplain) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.allocation_explain") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -207,6 +259,9 @@ func (r AllocationExplain) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -216,6 +271,9 @@ func (r AllocationExplain) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r AllocationExplain) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/cluster/allocationexplain/request.go b/typedapi/cluster/allocationexplain/request.go index e8305e3067..15cfd7dfad 100644 --- a/typedapi/cluster/allocationexplain/request.go +++ b/typedapi/cluster/allocationexplain/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package allocationexplain @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package allocationexplain // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/ClusterAllocationExplainRequest.ts#L24-L61 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/ClusterAllocationExplainRequest.ts#L24-L61 type Request struct { // CurrentNode Specifies the node ID or the name of the node to only explain a shard that is diff --git a/typedapi/cluster/allocationexplain/response.go b/typedapi/cluster/allocationexplain/response.go index 98953c4fb7..ebb4cb0812 100644 --- a/typedapi/cluster/allocationexplain/response.go +++ b/typedapi/cluster/allocationexplain/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package allocationexplain @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package allocationexplain // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/ClusterAllocationExplainResponse.ts#L32-L64 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/ClusterAllocationExplainResponse.ts#L32-L64 type Response struct { AllocateExplanation *string `json:"allocate_explanation,omitempty"` AllocationDelay types.Duration `json:"allocation_delay,omitempty"` diff --git a/typedapi/cluster/deletecomponenttemplate/delete_component_template.go b/typedapi/cluster/deletecomponenttemplate/delete_component_template.go index 90f823cba8..0813de6e13 100644 --- a/typedapi/cluster/deletecomponenttemplate/delete_component_template.go +++ b/typedapi/cluster/deletecomponenttemplate/delete_component_template.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a component template package deletecomponenttemplate import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteComponentTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteComponentTemplate type alias for index. @@ -75,13 +78,18 @@ func NewDeleteComponentTemplateFunc(tp elastictransport.Interface) NewDeleteComp // Deletes a component template // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-component-template.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-component-template.html func New(tp elastictransport.Interface) *DeleteComponentTemplate { r := &DeleteComponentTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *DeleteComponentTemplate) HttpRequest(ctx context.Context) (*http.Reques path.WriteString("_component_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -117,9 +128,9 @@ func (r *DeleteComponentTemplate) HttpRequest(ctx context.Context) (*http.Reques } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *DeleteComponentTemplate) HttpRequest(ctx context.Context) (*http.Reques } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteComponentTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteComponentTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.delete_component_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.delete_component_template") + if reader := instrument.RecordRequestBody(ctx, "cluster.delete_component_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.delete_component_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteComponentTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteComponentTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletecomponenttemplate.Response -func (r DeleteComponentTemplate) Do(ctx context.Context) (*Response, error) { +func (r DeleteComponentTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.delete_component_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r DeleteComponentTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r DeleteComponentTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r DeleteComponentTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteComponentTemplate) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteComponentTemplate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.delete_component_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r DeleteComponentTemplate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteComponentTemplate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/deletecomponenttemplate/response.go b/typedapi/cluster/deletecomponenttemplate/response.go index 7ef4ee6806..42838e38d3 100644 --- a/typedapi/cluster/deletecomponenttemplate/response.go +++ b/typedapi/cluster/deletecomponenttemplate/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletecomponenttemplate // Response holds the response body struct for the package deletecomponenttemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/delete_component_template/ClusterDeleteComponentTemplateResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/delete_component_template/ClusterDeleteComponentTemplateResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/cluster/deletevotingconfigexclusions/delete_voting_config_exclusions.go b/typedapi/cluster/deletevotingconfigexclusions/delete_voting_config_exclusions.go index ddd16b7e9c..be9c9529d9 100644 --- a/typedapi/cluster/deletevotingconfigexclusions/delete_voting_config_exclusions.go +++ b/typedapi/cluster/deletevotingconfigexclusions/delete_voting_config_exclusions.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Clears cluster voting config exclusions. package deletevotingconfigexclusions import ( - gobytes "bytes" "context" "errors" "fmt" @@ -46,9 +45,13 @@ type DeleteVotingConfigExclusions struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteVotingConfigExclusions type alias for index. @@ -66,13 +69,18 @@ func NewDeleteVotingConfigExclusionsFunc(tp elastictransport.Interface) NewDelet // Clears cluster voting config exclusions. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/voting-config-exclusions.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/voting-config-exclusions.html func New(tp elastictransport.Interface) *DeleteVotingConfigExclusions { r := &DeleteVotingConfigExclusions{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,9 +115,9 @@ func (r *DeleteVotingConfigExclusions) HttpRequest(ctx context.Context) (*http.R } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -126,15 +134,42 @@ func (r *DeleteVotingConfigExclusions) HttpRequest(ctx context.Context) (*http.R } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteVotingConfigExclusions) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteVotingConfigExclusions) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.delete_voting_config_exclusions") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.delete_voting_config_exclusions") + if reader := instrument.RecordRequestBody(ctx, "cluster.delete_voting_config_exclusions", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.delete_voting_config_exclusions") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteVotingConfigExclusions query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteVotingConfigExclusions query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -147,7 +182,17 @@ func (r DeleteVotingConfigExclusions) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteVotingConfigExclusions) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteVotingConfigExclusions) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.delete_voting_config_exclusions") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -163,6 +208,14 @@ func (r DeleteVotingConfigExclusions) IsSuccess(ctx context.Context) (bool, erro return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteVotingConfigExclusions query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/existscomponenttemplate/exists_component_template.go b/typedapi/cluster/existscomponenttemplate/exists_component_template.go index 1370117de3..828617225a 100644 --- a/typedapi/cluster/existscomponenttemplate/exists_component_template.go +++ b/typedapi/cluster/existscomponenttemplate/exists_component_template.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about whether a particular component template exist package existscomponenttemplate import ( - gobytes "bytes" "context" "errors" "fmt" @@ -50,11 +49,15 @@ type ExistsComponentTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExistsComponentTemplate type alias for index. @@ -74,13 +77,18 @@ func NewExistsComponentTemplateFunc(tp elastictransport.Interface) NewExistsComp // Returns information about whether a particular component template exist // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-component-template.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-component-template.html func New(tp elastictransport.Interface) *ExistsComponentTemplate { r := &ExistsComponentTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -103,6 +111,9 @@ func (r *ExistsComponentTemplate) HttpRequest(ctx context.Context) (*http.Reques path.WriteString("_component_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodHead @@ -116,9 +127,9 @@ func (r *ExistsComponentTemplate) HttpRequest(ctx context.Context) (*http.Reques } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -135,15 +146,42 @@ func (r *ExistsComponentTemplate) HttpRequest(ctx context.Context) (*http.Reques } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExistsComponentTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r ExistsComponentTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.exists_component_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.exists_component_template") + if reader := instrument.RecordRequestBody(ctx, "cluster.exists_component_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.exists_component_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExistsComponentTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExistsComponentTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -156,7 +194,17 @@ func (r ExistsComponentTemplate) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ExistsComponentTemplate) IsSuccess(ctx context.Context) (bool, error) { +func (r ExistsComponentTemplate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.exists_component_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -172,6 +220,14 @@ func (r ExistsComponentTemplate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ExistsComponentTemplate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/getcomponenttemplate/get_component_template.go b/typedapi/cluster/getcomponenttemplate/get_component_template.go index 7bee901633..f60ad0b366 100644 --- a/typedapi/cluster/getcomponenttemplate/get_component_template.go +++ b/typedapi/cluster/getcomponenttemplate/get_component_template.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns one or more component templates package getcomponenttemplate import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetComponentTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetComponentTemplate type alias for index. @@ -74,13 +77,18 @@ func NewGetComponentTemplateFunc(tp elastictransport.Interface) NewGetComponentT // Returns one or more component templates // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-component-template.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-component-template.html func New(tp elastictransport.Interface) *GetComponentTemplate { r := &GetComponentTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *GetComponentTemplate) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("_component_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -121,9 +132,9 @@ func (r *GetComponentTemplate) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *GetComponentTemplate) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetComponentTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r GetComponentTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.get_component_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.get_component_template") + if reader := instrument.RecordRequestBody(ctx, "cluster.get_component_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.get_component_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetComponentTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetComponentTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getcomponenttemplate.Response -func (r GetComponentTemplate) Do(ctx context.Context) (*Response, error) { +func (r GetComponentTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.get_component_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r GetComponentTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r GetComponentTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r GetComponentTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetComponentTemplate) IsSuccess(ctx context.Context) (bool, error) { +func (r GetComponentTemplate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.get_component_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r GetComponentTemplate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetComponentTemplate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/getcomponenttemplate/response.go b/typedapi/cluster/getcomponenttemplate/response.go index 1021e074cd..c349c2db8b 100644 --- a/typedapi/cluster/getcomponenttemplate/response.go +++ b/typedapi/cluster/getcomponenttemplate/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getcomponenttemplate @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getcomponenttemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/get_component_template/ClusterGetComponentTemplateResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/get_component_template/ClusterGetComponentTemplateResponse.ts#L22-L24 type Response struct { ComponentTemplates []types.ClusterComponentTemplate `json:"component_templates"` } diff --git a/typedapi/cluster/getsettings/get_settings.go b/typedapi/cluster/getsettings/get_settings.go index 5d9b0c21f5..9b2c3b3031 100644 --- a/typedapi/cluster/getsettings/get_settings.go +++ b/typedapi/cluster/getsettings/get_settings.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns cluster settings. package getsettings import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type GetSettings struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetSettings type alias for index. @@ -68,13 +71,18 @@ func NewGetSettingsFunc(tp elastictransport.Interface) NewGetSettings { // Returns cluster settings. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-get-settings.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-get-settings.html func New(tp elastictransport.Interface) *GetSettings { r := &GetSettings{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,9 +117,9 @@ func (r *GetSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -128,27 +136,66 @@ func (r *GetSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetSettings) Perform(ctx context.Context) (*http.Response, error) { +func (r GetSettings) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.get_settings") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.get_settings") + if reader := instrument.RecordRequestBody(ctx, "cluster.get_settings", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.get_settings") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetSettings query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetSettings query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getsettings.Response -func (r GetSettings) Do(ctx context.Context) (*Response, error) { +func (r GetSettings) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.get_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -156,6 +203,9 @@ func (r GetSettings) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -165,6 +215,9 @@ func (r GetSettings) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -172,12 +225,25 @@ func (r GetSettings) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetSettings) IsSuccess(ctx context.Context) (bool, error) { +func (r GetSettings) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.get_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -193,6 +259,14 @@ func (r GetSettings) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetSettings query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/getsettings/response.go b/typedapi/cluster/getsettings/response.go index 765828dd45..555bd007b8 100644 --- a/typedapi/cluster/getsettings/response.go +++ b/typedapi/cluster/getsettings/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getsettings @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getsettings // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/get_settings/ClusterGetSettingsResponse.ts#L23-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/get_settings/ClusterGetSettingsResponse.ts#L23-L29 type Response struct { Defaults map[string]json.RawMessage `json:"defaults,omitempty"` Persistent map[string]json.RawMessage `json:"persistent"` diff --git a/typedapi/cluster/health/health.go b/typedapi/cluster/health/health.go index 674db997c7..b9d0153a82 100644 --- a/typedapi/cluster/health/health.go +++ b/typedapi/cluster/health/health.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns basic information about the health of the cluster. package health @@ -56,11 +56,15 @@ type Health struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewHealth type alias for index. @@ -78,13 +82,18 @@ func NewHealthFunc(tp elastictransport.Interface) NewHealth { // Returns basic information about the health of the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-health.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html func New(tp elastictransport.Interface) *Health { r := &Health{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -116,6 +125,9 @@ func (r *Health) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("health") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodGet @@ -129,9 +141,9 @@ func (r *Health) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +160,66 @@ func (r *Health) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Health) Perform(ctx context.Context) (*http.Response, error) { +func (r Health) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.health") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.health") + if reader := instrument.RecordRequestBody(ctx, "cluster.health", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.health") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Health query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Health query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a health.Response -func (r Health) Do(ctx context.Context) (*Response, error) { +func (r Health) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.health") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +227,9 @@ func (r Health) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,30 +239,45 @@ func (r Health) Do(ctx context.Context) (*Response, error) { if res.StatusCode == 408 { data, err := ioutil.ReadAll(res.Body) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(gobytes.NewReader(data)).Decode(&errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } if errorResponse.Status == 0 { err = json.NewDecoder(gobytes.NewReader(data)).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } return response, nil } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -216,12 +285,25 @@ func (r Health) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Health) IsSuccess(ctx context.Context) (bool, error) { +func (r Health) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.health") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -237,6 +319,14 @@ func (r Health) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Health query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/health/response.go b/typedapi/cluster/health/response.go index da808a5e9f..8bbb4cd05a 100644 --- a/typedapi/cluster/health/response.go +++ b/typedapi/cluster/health/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package health @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package health // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/health/ClusterHealthResponse.ts#L26-L37 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/health/ClusterHealthResponse.ts#L26-L37 type Response struct { // ActivePrimaryShards The number of active primary shards. diff --git a/typedapi/cluster/info/info.go b/typedapi/cluster/info/info.go index 4d59356afc..96ba3c68fa 100644 --- a/typedapi/cluster/info/info.go +++ b/typedapi/cluster/info/info.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns different information about the cluster. package info import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type Info struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int target string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewInfo type alias for index. @@ -75,13 +78,18 @@ func NewInfoFunc(tp elastictransport.Interface) NewInfo { // Returns different information about the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-info.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-info.html func New(tp elastictransport.Interface) *Info { r := &Info{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_info") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "target", r.target) + } path.WriteString(r.target) method = http.MethodGet @@ -117,9 +128,9 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Info) Perform(ctx context.Context) (*http.Response, error) { +func (r Info) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.info") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.info") + if reader := instrument.RecordRequestBody(ctx, "cluster.info", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.info") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Info query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Info query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a info.Response -func (r Info) Do(ctx context.Context) (*Response, error) { +func (r Info) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r Info) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r Info) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r Info) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Info) IsSuccess(ctx context.Context) (bool, error) { +func (r Info) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r Info) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Info query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/info/response.go b/typedapi/cluster/info/response.go index ee6dc7595c..b077455fa5 100644 --- a/typedapi/cluster/info/response.go +++ b/typedapi/cluster/info/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package info @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package info // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/info/ClusterInfoResponse.ts#L26-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/info/ClusterInfoResponse.ts#L26-L34 type Response struct { ClusterName string `json:"cluster_name"` Http *types.Http `json:"http,omitempty"` diff --git a/typedapi/cluster/pendingtasks/pending_tasks.go b/typedapi/cluster/pendingtasks/pending_tasks.go index b2c183a82a..e9694d0e1a 100644 --- a/typedapi/cluster/pendingtasks/pending_tasks.go +++ b/typedapi/cluster/pendingtasks/pending_tasks.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns a list of any cluster-level changes (e.g. create index, update // mapping, @@ -24,7 +24,6 @@ package pendingtasks import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -50,9 +49,13 @@ type PendingTasks struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPendingTasks type alias for index. @@ -72,13 +75,18 @@ func NewPendingTasksFunc(tp elastictransport.Interface) NewPendingTasks { // mapping, // allocate or fail shard) which have not yet been executed. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-pending.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-pending.html func New(tp elastictransport.Interface) *PendingTasks { r := &PendingTasks{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -113,9 +121,9 @@ func (r *PendingTasks) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -132,27 +140,66 @@ func (r *PendingTasks) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PendingTasks) Perform(ctx context.Context) (*http.Response, error) { +func (r PendingTasks) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.pending_tasks") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.pending_tasks") + if reader := instrument.RecordRequestBody(ctx, "cluster.pending_tasks", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.pending_tasks") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PendingTasks query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PendingTasks query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a pendingtasks.Response -func (r PendingTasks) Do(ctx context.Context) (*Response, error) { +func (r PendingTasks) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.pending_tasks") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -160,6 +207,9 @@ func (r PendingTasks) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -169,6 +219,9 @@ func (r PendingTasks) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,12 +229,25 @@ func (r PendingTasks) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PendingTasks) IsSuccess(ctx context.Context) (bool, error) { +func (r PendingTasks) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.pending_tasks") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -197,6 +263,14 @@ func (r PendingTasks) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PendingTasks query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/pendingtasks/response.go b/typedapi/cluster/pendingtasks/response.go index ed2d12e387..d1f3a51d76 100644 --- a/typedapi/cluster/pendingtasks/response.go +++ b/typedapi/cluster/pendingtasks/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package pendingtasks @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package pendingtasks // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/pending_tasks/ClusterPendingTasksResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/pending_tasks/ClusterPendingTasksResponse.ts#L22-L24 type Response struct { Tasks []types.PendingTask `json:"tasks"` } diff --git a/typedapi/cluster/postvotingconfigexclusions/post_voting_config_exclusions.go b/typedapi/cluster/postvotingconfigexclusions/post_voting_config_exclusions.go index 5ad2f2e0ec..a43e109504 100644 --- a/typedapi/cluster/postvotingconfigexclusions/post_voting_config_exclusions.go +++ b/typedapi/cluster/postvotingconfigexclusions/post_voting_config_exclusions.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates the cluster voting config exclusions by node ids or node names. package postvotingconfigexclusions import ( - gobytes "bytes" "context" "errors" "fmt" @@ -45,9 +44,13 @@ type PostVotingConfigExclusions struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPostVotingConfigExclusions type alias for index. @@ -65,13 +68,18 @@ func NewPostVotingConfigExclusionsFunc(tp elastictransport.Interface) NewPostVot // Updates the cluster voting config exclusions by node ids or node names. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/voting-config-exclusions.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/voting-config-exclusions.html func New(tp elastictransport.Interface) *PostVotingConfigExclusions { r := &PostVotingConfigExclusions{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,9 +114,9 @@ func (r *PostVotingConfigExclusions) HttpRequest(ctx context.Context) (*http.Req } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -125,15 +133,42 @@ func (r *PostVotingConfigExclusions) HttpRequest(ctx context.Context) (*http.Req } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PostVotingConfigExclusions) Perform(ctx context.Context) (*http.Response, error) { +func (r PostVotingConfigExclusions) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.post_voting_config_exclusions") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.post_voting_config_exclusions") + if reader := instrument.RecordRequestBody(ctx, "cluster.post_voting_config_exclusions", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.post_voting_config_exclusions") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PostVotingConfigExclusions query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PostVotingConfigExclusions query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -146,7 +181,17 @@ func (r PostVotingConfigExclusions) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PostVotingConfigExclusions) IsSuccess(ctx context.Context) (bool, error) { +func (r PostVotingConfigExclusions) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.post_voting_config_exclusions") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -162,6 +207,14 @@ func (r PostVotingConfigExclusions) IsSuccess(ctx context.Context) (bool, error) return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PostVotingConfigExclusions query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/putcomponenttemplate/put_component_template.go b/typedapi/cluster/putcomponenttemplate/put_component_template.go index 18f550cd19..5ab8ddcb16 100644 --- a/typedapi/cluster/putcomponenttemplate/put_component_template.go +++ b/typedapi/cluster/putcomponenttemplate/put_component_template.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates a component template package putcomponenttemplate @@ -51,15 +51,19 @@ type PutComponentTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutComponentTemplate type alias for index. @@ -79,17 +83,24 @@ func NewPutComponentTemplateFunc(tp elastictransport.Interface) NewPutComponentT // Creates or updates a component template // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-component-template.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-component-template.html func New(tp elastictransport.Interface) *PutComponentTemplate { r := &PutComponentTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *PutComponentTemplate) HttpRequest(ctx context.Context) (*http.Request, } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *PutComponentTemplate) HttpRequest(ctx context.Context) (*http.Request, } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -148,6 +161,9 @@ func (r *PutComponentTemplate) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("_component_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -161,15 +177,15 @@ func (r *PutComponentTemplate) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -186,27 +202,66 @@ func (r *PutComponentTemplate) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutComponentTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r PutComponentTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.put_component_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.put_component_template") + if reader := instrument.RecordRequestBody(ctx, "cluster.put_component_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.put_component_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutComponentTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutComponentTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putcomponenttemplate.Response -func (r PutComponentTemplate) Do(ctx context.Context) (*Response, error) { +func (r PutComponentTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.put_component_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -214,6 +269,9 @@ func (r PutComponentTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r PutComponentTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +291,9 @@ func (r PutComponentTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/cluster/putcomponenttemplate/request.go b/typedapi/cluster/putcomponenttemplate/request.go index 7554ad3c7a..71c2334ae5 100644 --- a/typedapi/cluster/putcomponenttemplate/request.go +++ b/typedapi/cluster/putcomponenttemplate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putcomponenttemplate @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putcomponenttemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/put_component_template/ClusterPutComponentTemplateRequest.ts#L29-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/put_component_template/ClusterPutComponentTemplateRequest.ts#L29-L99 type Request struct { // AllowAutoCreate This setting overrides the value of the `action.auto_create_index` cluster diff --git a/typedapi/cluster/putcomponenttemplate/response.go b/typedapi/cluster/putcomponenttemplate/response.go index 41297e6d61..8baaae4a91 100644 --- a/typedapi/cluster/putcomponenttemplate/response.go +++ b/typedapi/cluster/putcomponenttemplate/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putcomponenttemplate // Response holds the response body struct for the package putcomponenttemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/put_component_template/ClusterPutComponentTemplateResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/put_component_template/ClusterPutComponentTemplateResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/cluster/putsettings/put_settings.go b/typedapi/cluster/putsettings/put_settings.go index b12ccadaae..10689bcf8a 100644 --- a/typedapi/cluster/putsettings/put_settings.go +++ b/typedapi/cluster/putsettings/put_settings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates the cluster settings. package putsettings @@ -47,13 +47,17 @@ type PutSettings struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutSettings type alias for index. @@ -71,17 +75,24 @@ func NewPutSettingsFunc(tp elastictransport.Interface) NewPutSettings { // Updates the cluster settings. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-update-settings.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html func New(tp elastictransport.Interface) *PutSettings { r := &PutSettings{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -118,9 +129,7 @@ func (r *PutSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -132,6 +141,10 @@ func (r *PutSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -152,15 +165,15 @@ func (r *PutSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -177,27 +190,66 @@ func (r *PutSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutSettings) Perform(ctx context.Context) (*http.Response, error) { +func (r PutSettings) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.put_settings") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.put_settings") + if reader := instrument.RecordRequestBody(ctx, "cluster.put_settings", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.put_settings") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutSettings query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutSettings query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putsettings.Response -func (r PutSettings) Do(ctx context.Context) (*Response, error) { +func (r PutSettings) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.put_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -205,6 +257,9 @@ func (r PutSettings) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -214,6 +269,9 @@ func (r PutSettings) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -221,6 +279,9 @@ func (r PutSettings) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/cluster/putsettings/request.go b/typedapi/cluster/putsettings/request.go index 4e5246f94d..d5979773bc 100644 --- a/typedapi/cluster/putsettings/request.go +++ b/typedapi/cluster/putsettings/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putsettings @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package putsettings // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/put_settings/ClusterPutSettingsRequest.ts#L25-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/put_settings/ClusterPutSettingsRequest.ts#L25-L43 type Request struct { Persistent map[string]json.RawMessage `json:"persistent,omitempty"` Transient map[string]json.RawMessage `json:"transient,omitempty"` diff --git a/typedapi/cluster/putsettings/response.go b/typedapi/cluster/putsettings/response.go index ca6c23e554..f5c67343ca 100644 --- a/typedapi/cluster/putsettings/response.go +++ b/typedapi/cluster/putsettings/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putsettings @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package putsettings // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/put_settings/ClusterPutSettingsResponse.ts#L23-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/put_settings/ClusterPutSettingsResponse.ts#L23-L29 type Response struct { Acknowledged bool `json:"acknowledged"` Persistent map[string]json.RawMessage `json:"persistent"` diff --git a/typedapi/cluster/remoteinfo/remote_info.go b/typedapi/cluster/remoteinfo/remote_info.go index 811e3650c2..23e3b93574 100644 --- a/typedapi/cluster/remoteinfo/remote_info.go +++ b/typedapi/cluster/remoteinfo/remote_info.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the information about configured remote clusters. package remoteinfo import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type RemoteInfo struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRemoteInfo type alias for index. @@ -67,13 +70,18 @@ func NewRemoteInfoFunc(tp elastictransport.Interface) NewRemoteInfo { // Returns the information about configured remote clusters. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-remote-info.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-remote-info.html func New(tp elastictransport.Interface) *RemoteInfo { r := &RemoteInfo{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *RemoteInfo) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *RemoteInfo) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r RemoteInfo) Perform(ctx context.Context) (*http.Response, error) { +func (r RemoteInfo) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.remote_info") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.remote_info") + if reader := instrument.RecordRequestBody(ctx, "cluster.remote_info", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.remote_info") + } if err != nil { - return nil, fmt.Errorf("an error happened during the RemoteInfo query execution: %w", err) + localErr := fmt.Errorf("an error happened during the RemoteInfo query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a remoteinfo.Response -func (r RemoteInfo) Do(ctx context.Context) (Response, error) { +func (r RemoteInfo) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.remote_info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r RemoteInfo) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r RemoteInfo) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r RemoteInfo) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r RemoteInfo) IsSuccess(ctx context.Context) (bool, error) { +func (r RemoteInfo) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.remote_info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r RemoteInfo) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the RemoteInfo query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/remoteinfo/response.go b/typedapi/cluster/remoteinfo/response.go index ffa3c84920..4b0f9f9f40 100644 --- a/typedapi/cluster/remoteinfo/response.go +++ b/typedapi/cluster/remoteinfo/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package remoteinfo @@ -32,7 +32,7 @@ import ( // Response holds the response body struct for the package remoteinfo // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/remote_info/ClusterRemoteInfoResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/remote_info/ClusterRemoteInfoResponse.ts#L24-L26 type Response map[string]types.ClusterRemoteInfo diff --git a/typedapi/cluster/reroute/request.go b/typedapi/cluster/reroute/request.go index a35bdfe257..c12fe9deb4 100644 --- a/typedapi/cluster/reroute/request.go +++ b/typedapi/cluster/reroute/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package reroute @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package reroute // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/reroute/ClusterRerouteRequest.ts#L25-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/reroute/ClusterRerouteRequest.ts#L25-L70 type Request struct { // Commands Defines the commands to perform. diff --git a/typedapi/cluster/reroute/reroute.go b/typedapi/cluster/reroute/reroute.go index 320df66473..dd62508f19 100644 --- a/typedapi/cluster/reroute/reroute.go +++ b/typedapi/cluster/reroute/reroute.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to manually change the allocation of individual shards in the cluster. package reroute @@ -47,13 +47,17 @@ type Reroute struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewReroute type alias for index. @@ -71,17 +75,24 @@ func NewRerouteFunc(tp elastictransport.Interface) NewReroute { // Allows to manually change the allocation of individual shards in the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-reroute.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-reroute.html func New(tp elastictransport.Interface) *Reroute { r := &Reroute{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -118,9 +129,7 @@ func (r *Reroute) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -132,6 +141,10 @@ func (r *Reroute) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -152,15 +165,15 @@ func (r *Reroute) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -177,27 +190,66 @@ func (r *Reroute) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Reroute) Perform(ctx context.Context) (*http.Response, error) { +func (r Reroute) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.reroute") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.reroute") + if reader := instrument.RecordRequestBody(ctx, "cluster.reroute", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.reroute") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Reroute query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Reroute query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a reroute.Response -func (r Reroute) Do(ctx context.Context) (*Response, error) { +func (r Reroute) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.reroute") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -205,6 +257,9 @@ func (r Reroute) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -214,6 +269,9 @@ func (r Reroute) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -221,6 +279,9 @@ func (r Reroute) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/cluster/reroute/response.go b/typedapi/cluster/reroute/response.go index 11f890e678..fce1623532 100644 --- a/typedapi/cluster/reroute/response.go +++ b/typedapi/cluster/reroute/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package reroute @@ -28,8 +28,7 @@ import ( // Response holds the response body struct for the package reroute // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/reroute/ClusterRerouteResponse.ts#L23-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/reroute/ClusterRerouteResponse.ts#L23-L34 type Response struct { Acknowledged bool `json:"acknowledged"` Explanations []types.RerouteExplanation `json:"explanations,omitempty"` diff --git a/typedapi/cluster/state/response.go b/typedapi/cluster/state/response.go index 7d25aa121a..4fec876a03 100644 --- a/typedapi/cluster/state/response.go +++ b/typedapi/cluster/state/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package state @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package state // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/state/ClusterStateResponse.ts#L22-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/state/ClusterStateResponse.ts#L22-L29 type Response = json.RawMessage diff --git a/typedapi/cluster/state/state.go b/typedapi/cluster/state/state.go index cc06827fc4..adf9cc89c7 100644 --- a/typedapi/cluster/state/state.go +++ b/typedapi/cluster/state/state.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns a comprehensive information about the state of the cluster. package state import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -55,12 +54,16 @@ type State struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int metric string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewState type alias for index. @@ -78,13 +81,18 @@ func NewStateFunc(tp elastictransport.Interface) NewState { // Returns a comprehensive information about the state of the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-state.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html func New(tp elastictransport.Interface) *State { r := &State{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -116,6 +124,9 @@ func (r *State) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("state") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) method = http.MethodGet @@ -126,9 +137,15 @@ func (r *State) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("state") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodGet @@ -142,9 +159,9 @@ func (r *State) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -161,27 +178,66 @@ func (r *State) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r State) Perform(ctx context.Context) (*http.Response, error) { +func (r State) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.state") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.state") + if reader := instrument.RecordRequestBody(ctx, "cluster.state", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.state") + } if err != nil { - return nil, fmt.Errorf("an error happened during the State query execution: %w", err) + localErr := fmt.Errorf("an error happened during the State query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a state.Response -func (r State) Do(ctx context.Context) (Response, error) { +func (r State) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.state") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := new(Response) res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -189,6 +245,9 @@ func (r State) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -198,6 +257,9 @@ func (r State) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -205,12 +267,25 @@ func (r State) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r State) IsSuccess(ctx context.Context) (bool, error) { +func (r State) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.state") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -226,6 +301,14 @@ func (r State) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the State query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/cluster/stats/response.go b/typedapi/cluster/stats/response.go index 18e3437cb2..7265999a32 100644 --- a/typedapi/cluster/stats/response.go +++ b/typedapi/cluster/stats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stats @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package stats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/ClusterStatsResponse.ts#L53-L55 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/ClusterStatsResponse.ts#L53-L55 type Response struct { // ClusterName Name of the cluster, based on the cluster name setting. diff --git a/typedapi/cluster/stats/stats.go b/typedapi/cluster/stats/stats.go index f583bbd831..74cfbcc066 100644 --- a/typedapi/cluster/stats/stats.go +++ b/typedapi/cluster/stats/stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns high-level overview of cluster statistics. package stats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Stats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStats type alias for index. @@ -74,13 +77,18 @@ func NewStatsFunc(tp elastictransport.Interface) NewStats { // Returns high-level overview of cluster statistics. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-stats.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-stats.html func New(tp elastictransport.Interface) *Stats { r := &Stats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,6 +122,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) method = http.MethodGet @@ -127,9 +138,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -146,27 +157,66 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Stats) Perform(ctx context.Context) (*http.Response, error) { +func (r Stats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "cluster.stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "cluster.stats") + if reader := instrument.RecordRequestBody(ctx, "cluster.stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "cluster.stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Stats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Stats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stats.Response -func (r Stats) Do(ctx context.Context) (*Response, error) { +func (r Stats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -174,6 +224,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,6 +236,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -190,12 +246,25 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Stats) IsSuccess(ctx context.Context) (bool, error) { +func (r Stats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "cluster.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -211,6 +280,14 @@ func (r Stats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Stats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/bulk/bulk.go b/typedapi/core/bulk/bulk.go index 7c32e5a2b7..152cbd870d 100644 --- a/typedapi/core/bulk/bulk.go +++ b/typedapi/core/bulk/bulk.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to perform multiple index/update/delete operations in a single // request. @@ -53,15 +53,19 @@ type Bulk struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewBulk type alias for index. @@ -80,13 +84,20 @@ func NewBulkFunc(tp elastictransport.Interface) NewBulk { // Allows to perform multiple index/update/delete operations in a single // request. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/docs-bulk.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html func New(tp elastictransport.Interface) *Bulk { r := &Bulk{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -125,9 +136,7 @@ func (r *Bulk) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { for _, elem := range *r.req { data, err := json.Marshal(elem) @@ -144,6 +153,10 @@ func (r *Bulk) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -155,6 +168,9 @@ func (r *Bulk) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_bulk") @@ -170,15 +186,15 @@ func (r *Bulk) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+x-ndjson;compatible-with=8") } } @@ -195,27 +211,66 @@ func (r *Bulk) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Bulk) Perform(ctx context.Context) (*http.Response, error) { +func (r Bulk) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "bulk") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "bulk") + if reader := instrument.RecordRequestBody(ctx, "bulk", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "bulk") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Bulk query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Bulk query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a bulk.Response -func (r Bulk) Do(ctx context.Context) (*Response, error) { +func (r Bulk) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "bulk") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -223,6 +278,9 @@ func (r Bulk) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +290,9 @@ func (r Bulk) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -239,6 +300,9 @@ func (r Bulk) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/bulk/request.go b/typedapi/core/bulk/request.go index 79cb87b2ea..6db5a4be63 100644 --- a/typedapi/core/bulk/request.go +++ b/typedapi/core/bulk/request.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package bulk // Request holds the request body struct for the package bulk // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/BulkRequest.ts#L32-L103 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/BulkRequest.ts#L32-L103 type Request = []interface{} diff --git a/typedapi/core/bulk/response.go b/typedapi/core/bulk/response.go index ce20293272..d8bc21ee14 100644 --- a/typedapi/core/bulk/response.go +++ b/typedapi/core/bulk/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package bulk @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package bulk // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/BulkResponse.ts#L24-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/BulkResponse.ts#L24-L31 type Response struct { Errors bool `json:"errors"` IngestTook *int64 `json:"ingest_took,omitempty"` diff --git a/typedapi/core/clearscroll/clear_scroll.go b/typedapi/core/clearscroll/clear_scroll.go index c8ed7c2afc..e0335df554 100644 --- a/typedapi/core/clearscroll/clear_scroll.go +++ b/typedapi/core/clearscroll/clear_scroll.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Explicitly clears the search context for a scroll. package clearscroll @@ -51,15 +51,19 @@ type ClearScroll struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int scrollid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearScroll type alias for index. @@ -77,17 +81,24 @@ func NewClearScrollFunc(tp elastictransport.Interface) NewClearScroll { // Explicitly clears the search context for a scroll. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/clear-scroll-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-scroll-api.html func New(tp elastictransport.Interface) *ClearScroll { r := &ClearScroll{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -124,9 +135,7 @@ func (r *ClearScroll) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -138,6 +147,10 @@ func (r *ClearScroll) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -155,6 +168,9 @@ func (r *ClearScroll) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("scroll") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "scrollid", r.scrollid) + } path.WriteString(r.scrollid) method = http.MethodDelete @@ -168,15 +184,15 @@ func (r *ClearScroll) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -193,27 +209,66 @@ func (r *ClearScroll) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearScroll) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearScroll) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "clear_scroll") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "clear_scroll") + if reader := instrument.RecordRequestBody(ctx, "clear_scroll", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "clear_scroll") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearScroll query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearScroll query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clearscroll.Response -func (r ClearScroll) Do(ctx context.Context) (*Response, error) { +func (r ClearScroll) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "clear_scroll") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -221,6 +276,9 @@ func (r ClearScroll) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,30 +288,45 @@ func (r ClearScroll) Do(ctx context.Context) (*Response, error) { if res.StatusCode == 404 { data, err := ioutil.ReadAll(res.Body) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(gobytes.NewReader(data)).Decode(&errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } if errorResponse.Status == 0 { err = json.NewDecoder(gobytes.NewReader(data)).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } return response, nil } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -261,6 +334,9 @@ func (r ClearScroll) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/clearscroll/request.go b/typedapi/core/clearscroll/request.go index 580114d242..c5d712b35e 100644 --- a/typedapi/core/clearscroll/request.go +++ b/typedapi/core/clearscroll/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearscroll @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package clearscroll // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/clear_scroll/ClearScrollRequest.ts#L23-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/clear_scroll/ClearScrollRequest.ts#L23-L45 type Request struct { // ScrollId Scroll IDs to clear. diff --git a/typedapi/core/clearscroll/response.go b/typedapi/core/clearscroll/response.go index 2dcfe966e6..df2aebcbc1 100644 --- a/typedapi/core/clearscroll/response.go +++ b/typedapi/core/clearscroll/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearscroll // Response holds the response body struct for the package clearscroll // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/clear_scroll/ClearScrollResponse.ts#L22-L36 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/clear_scroll/ClearScrollResponse.ts#L22-L36 type Response struct { NumFreed int `json:"num_freed"` Succeeded bool `json:"succeeded"` diff --git a/typedapi/core/closepointintime/close_point_in_time.go b/typedapi/core/closepointintime/close_point_in_time.go index 6b8bf36ee2..5bc9154fdb 100644 --- a/typedapi/core/closepointintime/close_point_in_time.go +++ b/typedapi/core/closepointintime/close_point_in_time.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Close a point in time package closepointintime @@ -47,13 +47,17 @@ type ClosePointInTime struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClosePointInTime type alias for index. @@ -71,17 +75,24 @@ func NewClosePointInTimeFunc(tp elastictransport.Interface) NewClosePointInTime // Close a point in time // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/point-in-time-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/point-in-time-api.html func New(tp elastictransport.Interface) *ClosePointInTime { r := &ClosePointInTime{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -118,9 +129,7 @@ func (r *ClosePointInTime) HttpRequest(ctx context.Context) (*http.Request, erro } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -132,6 +141,10 @@ func (r *ClosePointInTime) HttpRequest(ctx context.Context) (*http.Request, erro } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,15 +163,15 @@ func (r *ClosePointInTime) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -175,27 +188,66 @@ func (r *ClosePointInTime) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClosePointInTime) Perform(ctx context.Context) (*http.Response, error) { +func (r ClosePointInTime) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "close_point_in_time") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "close_point_in_time") + if reader := instrument.RecordRequestBody(ctx, "close_point_in_time", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "close_point_in_time") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClosePointInTime query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClosePointInTime query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a closepointintime.Response -func (r ClosePointInTime) Do(ctx context.Context) (*Response, error) { +func (r ClosePointInTime) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "close_point_in_time") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -203,6 +255,9 @@ func (r ClosePointInTime) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -212,30 +267,45 @@ func (r ClosePointInTime) Do(ctx context.Context) (*Response, error) { if res.StatusCode == 404 { data, err := ioutil.ReadAll(res.Body) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(gobytes.NewReader(data)).Decode(&errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } if errorResponse.Status == 0 { err = json.NewDecoder(gobytes.NewReader(data)).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } return response, nil } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -243,6 +313,9 @@ func (r ClosePointInTime) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/closepointintime/request.go b/typedapi/core/closepointintime/request.go index c569806c5e..b109e669f9 100644 --- a/typedapi/core/closepointintime/request.go +++ b/typedapi/core/closepointintime/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package closepointintime @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package closepointintime // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/close_point_in_time/ClosePointInTimeRequest.ts#L23-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/close_point_in_time/ClosePointInTimeRequest.ts#L23-L37 type Request struct { // Id The ID of the point-in-time. diff --git a/typedapi/core/closepointintime/response.go b/typedapi/core/closepointintime/response.go index def20fa92c..9df9574e79 100644 --- a/typedapi/core/closepointintime/response.go +++ b/typedapi/core/closepointintime/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package closepointintime // Response holds the response body struct for the package closepointintime // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/close_point_in_time/ClosePointInTimeResponse.ts#L22-L36 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/close_point_in_time/ClosePointInTimeResponse.ts#L22-L36 type Response struct { NumFreed int `json:"num_freed"` Succeeded bool `json:"succeeded"` diff --git a/typedapi/core/count/count.go b/typedapi/core/count/count.go index d2ecdaf436..aa5a5933a7 100644 --- a/typedapi/core/count/count.go +++ b/typedapi/core/count/count.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns number of documents matching a query. package count @@ -53,15 +53,19 @@ type Count struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCount type alias for index. @@ -79,17 +83,24 @@ func NewCountFunc(tp elastictransport.Interface) NewCount { // Returns number of documents matching a query. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html func New(tp elastictransport.Interface) *Count { r := &Count{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *Count) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *Count) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *Count) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_count") @@ -166,15 +182,15 @@ func (r *Count) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -191,27 +207,66 @@ func (r *Count) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Count) Perform(ctx context.Context) (*http.Response, error) { +func (r Count) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "count") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "count") + if reader := instrument.RecordRequestBody(ctx, "count", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "count") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Count query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Count query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a count.Response -func (r Count) Do(ctx context.Context) (*Response, error) { +func (r Count) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "count") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -219,6 +274,9 @@ func (r Count) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -228,6 +286,9 @@ func (r Count) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +296,9 @@ func (r Count) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/count/request.go b/typedapi/core/count/request.go index 804864736a..7f37986067 100644 --- a/typedapi/core/count/request.go +++ b/typedapi/core/count/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package count @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package count // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/count/CountRequest.ts#L26-L120 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/count/CountRequest.ts#L26-L120 type Request struct { // Query Defines the search definition using the Query DSL. diff --git a/typedapi/core/count/response.go b/typedapi/core/count/response.go index cecdef8316..e943453942 100644 --- a/typedapi/core/count/response.go +++ b/typedapi/core/count/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package count @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package count // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/count/CountResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/count/CountResponse.ts#L23-L25 type Response struct { Count int64 `json:"count"` Shards_ types.ShardStatistics `json:"_shards"` diff --git a/typedapi/core/create/create.go b/typedapi/core/create/create.go index 47ecfa9df9..fe9bcbeafe 100644 --- a/typedapi/core/create/create.go +++ b/typedapi/core/create/create.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a new document in the index. // @@ -57,16 +57,20 @@ type Create struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req interface{} deferred []func(request interface{}) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCreate type alias for index. @@ -91,13 +95,20 @@ func NewCreateFunc(tp elastictransport.Interface) NewCreate { // Returns a 409 response when a document with a same ID already exists in the // index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html func New(tp elastictransport.Interface) *Create { r := &Create{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -143,9 +154,7 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -157,17 +166,27 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|idMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_create") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPut @@ -181,15 +200,15 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -206,27 +225,66 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Create) Perform(ctx context.Context) (*http.Response, error) { +func (r Create) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "create") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "create") + if reader := instrument.RecordRequestBody(ctx, "create", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "create") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Create query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Create query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a create.Response -func (r Create) Do(ctx context.Context) (*Response, error) { +func (r Create) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "create") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -234,6 +292,9 @@ func (r Create) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -243,6 +304,9 @@ func (r Create) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -250,6 +314,9 @@ func (r Create) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/create/request.go b/typedapi/core/create/request.go index 381af65727..64c0cfc90b 100644 --- a/typedapi/core/create/request.go +++ b/typedapi/core/create/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package create @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package create // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/create/CreateRequest.ts#L32-L95 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/create/CreateRequest.ts#L32-L95 type Request = json.RawMessage diff --git a/typedapi/core/create/response.go b/typedapi/core/create/response.go index fa360888e5..c3e427c460 100644 --- a/typedapi/core/create/response.go +++ b/typedapi/core/create/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package create @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package create // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/create/CreateResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/create/CreateResponse.ts#L22-L24 type Response struct { ForcedRefresh *bool `json:"forced_refresh,omitempty"` Id_ string `json:"_id"` diff --git a/typedapi/core/delete/delete.go b/typedapi/core/delete/delete.go index 4a6a1596e1..5d9a6c6a6f 100644 --- a/typedapi/core/delete/delete.go +++ b/typedapi/core/delete/delete.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Removes a document from the index. package delete @@ -55,12 +55,16 @@ type Delete struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDelete type alias for index. @@ -82,13 +86,18 @@ func NewDeleteFunc(tp elastictransport.Interface) NewDelete { // Removes a document from the index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html func New(tp elastictransport.Interface) *Delete { r := &Delete{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,11 +118,17 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask|idMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_doc") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -127,9 +142,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -146,27 +161,66 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Delete) Perform(ctx context.Context) (*http.Response, error) { +func (r Delete) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "delete") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "delete") + if reader := instrument.RecordRequestBody(ctx, "delete", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "delete") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Delete query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Delete query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a delete.Response -func (r Delete) Do(ctx context.Context) (*Response, error) { +func (r Delete) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -174,6 +228,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,30 +240,45 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { if res.StatusCode == 404 { data, err := ioutil.ReadAll(res.Body) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(gobytes.NewReader(data)).Decode(&errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } if errorResponse.Status == 0 { err = json.NewDecoder(gobytes.NewReader(data)).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } return response, nil } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -214,12 +286,25 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Delete) IsSuccess(ctx context.Context) (bool, error) { +func (r Delete) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -235,6 +320,14 @@ func (r Delete) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Delete query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/delete/response.go b/typedapi/core/delete/response.go index 0f72dc7fe1..d74bc4a185 100644 --- a/typedapi/core/delete/response.go +++ b/typedapi/core/delete/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package delete @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package delete // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/delete/DeleteResponse.ts#L22-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/delete/DeleteResponse.ts#L22-L34 type Response struct { ForcedRefresh *bool `json:"forced_refresh,omitempty"` Id_ string `json:"_id"` diff --git a/typedapi/core/deletebyquery/delete_by_query.go b/typedapi/core/deletebyquery/delete_by_query.go index ea7647bf37..bdecd7bd9b 100644 --- a/typedapi/core/deletebyquery/delete_by_query.go +++ b/typedapi/core/deletebyquery/delete_by_query.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes documents matching the provided query. package deletebyquery @@ -55,15 +55,19 @@ type DeleteByQuery struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteByQuery type alias for index. @@ -83,17 +87,24 @@ func NewDeleteByQueryFunc(tp elastictransport.Interface) NewDeleteByQuery { // Deletes documents matching the provided query. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html func New(tp elastictransport.Interface) *DeleteByQuery { r := &DeleteByQuery{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -130,9 +141,7 @@ func (r *DeleteByQuery) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -144,12 +153,19 @@ func (r *DeleteByQuery) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_delete_by_query") @@ -165,15 +181,15 @@ func (r *DeleteByQuery) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -190,27 +206,66 @@ func (r *DeleteByQuery) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteByQuery) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteByQuery) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "delete_by_query") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "delete_by_query") + if reader := instrument.RecordRequestBody(ctx, "delete_by_query", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "delete_by_query") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteByQuery query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteByQuery query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletebyquery.Response -func (r DeleteByQuery) Do(ctx context.Context) (*Response, error) { +func (r DeleteByQuery) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete_by_query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -218,6 +273,9 @@ func (r DeleteByQuery) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -227,6 +285,9 @@ func (r DeleteByQuery) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +295,9 @@ func (r DeleteByQuery) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/deletebyquery/request.go b/typedapi/core/deletebyquery/request.go index ca7137ac7b..0f9dd2f896 100644 --- a/typedapi/core/deletebyquery/request.go +++ b/typedapi/core/deletebyquery/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletebyquery @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package deletebyquery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/delete_by_query/DeleteByQueryRequest.ts#L36-L209 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/delete_by_query/DeleteByQueryRequest.ts#L36-L209 type Request struct { // MaxDocs The maximum number of documents to delete. diff --git a/typedapi/core/deletebyquery/response.go b/typedapi/core/deletebyquery/response.go index c1ef7b0332..2d7a02e9c3 100644 --- a/typedapi/core/deletebyquery/response.go +++ b/typedapi/core/deletebyquery/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletebyquery @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package deletebyquery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/delete_by_query/DeleteByQueryResponse.ts#L26-L45 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/delete_by_query/DeleteByQueryResponse.ts#L26-L45 type Response struct { Batches *int64 `json:"batches,omitempty"` Deleted *int64 `json:"deleted,omitempty"` diff --git a/typedapi/core/deletebyqueryrethrottle/delete_by_query_rethrottle.go b/typedapi/core/deletebyqueryrethrottle/delete_by_query_rethrottle.go index 14a31b40bf..059e265684 100644 --- a/typedapi/core/deletebyqueryrethrottle/delete_by_query_rethrottle.go +++ b/typedapi/core/deletebyqueryrethrottle/delete_by_query_rethrottle.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Changes the number of requests per second for a particular Delete By Query // operation. package deletebyqueryrethrottle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteByQueryRethrottle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int taskid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteByQueryRethrottle type alias for index. @@ -83,7 +86,12 @@ func New(tp elastictransport.Interface) *DeleteByQueryRethrottle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeleteByQueryRethrottle) HttpRequest(ctx context.Context) (*http.Reques path.WriteString("_delete_by_query") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "taskid", r.taskid) + } path.WriteString(r.taskid) path.WriteString("/") path.WriteString("_rethrottle") @@ -121,9 +132,9 @@ func (r *DeleteByQueryRethrottle) HttpRequest(ctx context.Context) (*http.Reques } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *DeleteByQueryRethrottle) HttpRequest(ctx context.Context) (*http.Reques } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteByQueryRethrottle) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteByQueryRethrottle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "delete_by_query_rethrottle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "delete_by_query_rethrottle") + if reader := instrument.RecordRequestBody(ctx, "delete_by_query_rethrottle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "delete_by_query_rethrottle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteByQueryRethrottle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteByQueryRethrottle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletebyqueryrethrottle.Response -func (r DeleteByQueryRethrottle) Do(ctx context.Context) (*Response, error) { +func (r DeleteByQueryRethrottle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete_by_query_rethrottle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r DeleteByQueryRethrottle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r DeleteByQueryRethrottle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r DeleteByQueryRethrottle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteByQueryRethrottle) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteByQueryRethrottle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete_by_query_rethrottle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r DeleteByQueryRethrottle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteByQueryRethrottle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/deletebyqueryrethrottle/response.go b/typedapi/core/deletebyqueryrethrottle/response.go index d4fe462861..45e0cd82d5 100644 --- a/typedapi/core/deletebyqueryrethrottle/response.go +++ b/typedapi/core/deletebyqueryrethrottle/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletebyqueryrethrottle @@ -31,8 +31,7 @@ import ( // Response holds the response body struct for the package deletebyqueryrethrottle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/delete_by_query_rethrottle/DeleteByQueryRethrottleResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/delete_by_query_rethrottle/DeleteByQueryRethrottleResponse.ts#L22-L24 type Response struct { NodeFailures []types.ErrorCause `json:"node_failures,omitempty"` // Nodes Task information grouped by node, if `group_by` was set to `node` (the diff --git a/typedapi/core/deletescript/delete_script.go b/typedapi/core/deletescript/delete_script.go index 45b1063d6b..f19db60a2c 100644 --- a/typedapi/core/deletescript/delete_script.go +++ b/typedapi/core/deletescript/delete_script.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a script. package deletescript import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteScript struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteScript type alias for index. @@ -75,13 +78,18 @@ func NewDeleteScriptFunc(tp elastictransport.Interface) NewDeleteScript { // Deletes a script. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html func New(tp elastictransport.Interface) *DeleteScript { r := &DeleteScript{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *DeleteScript) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_scripts") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -117,9 +128,9 @@ func (r *DeleteScript) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *DeleteScript) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteScript) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteScript) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "delete_script") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "delete_script") + if reader := instrument.RecordRequestBody(ctx, "delete_script", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "delete_script") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteScript query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteScript query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletescript.Response -func (r DeleteScript) Do(ctx context.Context) (*Response, error) { +func (r DeleteScript) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete_script") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r DeleteScript) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r DeleteScript) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r DeleteScript) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteScript) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteScript) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "delete_script") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r DeleteScript) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteScript query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/deletescript/response.go b/typedapi/core/deletescript/response.go index 2c7bffc73d..714e92c7bd 100644 --- a/typedapi/core/deletescript/response.go +++ b/typedapi/core/deletescript/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletescript // Response holds the response body struct for the package deletescript // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/delete_script/DeleteScriptResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/delete_script/DeleteScriptResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/core/exists/exists.go b/typedapi/core/exists/exists.go index 0d4189321b..91971d85f9 100644 --- a/typedapi/core/exists/exists.go +++ b/typedapi/core/exists/exists.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about whether a document exists in an index. package exists import ( - gobytes "bytes" "context" "errors" "fmt" @@ -53,12 +52,16 @@ type Exists struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExists type alias for index. @@ -80,13 +83,18 @@ func NewExistsFunc(tp elastictransport.Interface) NewExists { // Returns information about whether a document exists in an index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html func New(tp elastictransport.Interface) *Exists { r := &Exists{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,11 +115,17 @@ func (r *Exists) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask|idMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_doc") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodHead @@ -125,9 +139,9 @@ func (r *Exists) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,15 +158,42 @@ func (r *Exists) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Exists) Perform(ctx context.Context) (*http.Response, error) { +func (r Exists) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "exists") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "exists") + if reader := instrument.RecordRequestBody(ctx, "exists", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "exists") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Exists query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Exists query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -165,7 +206,17 @@ func (r Exists) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Exists) IsSuccess(ctx context.Context) (bool, error) { +func (r Exists) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "exists") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -181,6 +232,14 @@ func (r Exists) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Exists query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/existssource/exists_source.go b/typedapi/core/existssource/exists_source.go index 71888c5d67..e562917de5 100644 --- a/typedapi/core/existssource/exists_source.go +++ b/typedapi/core/existssource/exists_source.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about whether a document source exists in an index. package existssource import ( - gobytes "bytes" "context" "errors" "fmt" @@ -53,12 +52,16 @@ type ExistsSource struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExistsSource type alias for index. @@ -80,13 +83,18 @@ func NewExistsSourceFunc(tp elastictransport.Interface) NewExistsSource { // Returns information about whether a document source exists in an index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html func New(tp elastictransport.Interface) *ExistsSource { r := &ExistsSource{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,11 +115,17 @@ func (r *ExistsSource) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask|idMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_source") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodHead @@ -125,9 +139,9 @@ func (r *ExistsSource) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,15 +158,42 @@ func (r *ExistsSource) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExistsSource) Perform(ctx context.Context) (*http.Response, error) { +func (r ExistsSource) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "exists_source") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "exists_source") + if reader := instrument.RecordRequestBody(ctx, "exists_source", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "exists_source") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExistsSource query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExistsSource query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -165,7 +206,17 @@ func (r ExistsSource) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ExistsSource) IsSuccess(ctx context.Context) (bool, error) { +func (r ExistsSource) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "exists_source") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -181,6 +232,14 @@ func (r ExistsSource) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ExistsSource query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/explain/explain.go b/typedapi/core/explain/explain.go index da4803104f..6745acf509 100644 --- a/typedapi/core/explain/explain.go +++ b/typedapi/core/explain/explain.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about why a specific matches (or doesn't match) a query. package explain @@ -54,16 +54,20 @@ type Explain struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExplain type alias for index. @@ -85,17 +89,24 @@ func NewExplainFunc(tp elastictransport.Interface) NewExplain { // Returns information about why a specific matches (or doesn't match) a query. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html func New(tp elastictransport.Interface) *Explain { r := &Explain{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -132,9 +143,7 @@ func (r *Explain) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -146,17 +155,27 @@ func (r *Explain) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|idMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_explain") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPost @@ -170,15 +189,15 @@ func (r *Explain) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -195,27 +214,66 @@ func (r *Explain) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Explain) Perform(ctx context.Context) (*http.Response, error) { +func (r Explain) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "explain") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "explain") + if reader := instrument.RecordRequestBody(ctx, "explain", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "explain") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Explain query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Explain query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a explain.Response -func (r Explain) Do(ctx context.Context) (*Response, error) { +func (r Explain) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "explain") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -223,6 +281,9 @@ func (r Explain) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +293,9 @@ func (r Explain) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -239,6 +303,9 @@ func (r Explain) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/explain/request.go b/typedapi/core/explain/request.go index a391e41c32..194271bd79 100644 --- a/typedapi/core/explain/request.go +++ b/typedapi/core/explain/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package explain @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package explain // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/explain/ExplainRequest.ts#L26-L105 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/explain/ExplainRequest.ts#L26-L105 type Request struct { // Query Defines the search definition using the Query DSL. diff --git a/typedapi/core/explain/response.go b/typedapi/core/explain/response.go index ce4675479e..64ca5ba0cb 100644 --- a/typedapi/core/explain/response.go +++ b/typedapi/core/explain/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package explain @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package explain // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/explain/ExplainResponse.ts#L23-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/explain/ExplainResponse.ts#L23-L31 type Response struct { Explanation *types.ExplanationDetail `json:"explanation,omitempty"` Get *types.InlineGet `json:"get,omitempty"` diff --git a/typedapi/core/fieldcaps/field_caps.go b/typedapi/core/fieldcaps/field_caps.go index 44e339d053..8f0ef8efd6 100644 --- a/typedapi/core/fieldcaps/field_caps.go +++ b/typedapi/core/fieldcaps/field_caps.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the information about the capabilities of fields among multiple // indices. @@ -53,15 +53,19 @@ type FieldCaps struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewFieldCaps type alias for index. @@ -80,17 +84,24 @@ func NewFieldCapsFunc(tp elastictransport.Interface) NewFieldCaps { // Returns the information about the capabilities of fields among multiple // indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html func New(tp elastictransport.Interface) *FieldCaps { r := &FieldCaps{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *FieldCaps) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,6 +150,10 @@ func (r *FieldCaps) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -152,6 +165,9 @@ func (r *FieldCaps) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_field_caps") @@ -167,15 +183,15 @@ func (r *FieldCaps) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -192,27 +208,66 @@ func (r *FieldCaps) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r FieldCaps) Perform(ctx context.Context) (*http.Response, error) { +func (r FieldCaps) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "field_caps") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "field_caps") + if reader := instrument.RecordRequestBody(ctx, "field_caps", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "field_caps") + } if err != nil { - return nil, fmt.Errorf("an error happened during the FieldCaps query execution: %w", err) + localErr := fmt.Errorf("an error happened during the FieldCaps query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a fieldcaps.Response -func (r FieldCaps) Do(ctx context.Context) (*Response, error) { +func (r FieldCaps) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "field_caps") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -220,6 +275,9 @@ func (r FieldCaps) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +287,9 @@ func (r FieldCaps) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +297,9 @@ func (r FieldCaps) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/fieldcaps/request.go b/typedapi/core/fieldcaps/request.go index 9f75d6ab47..6c8baf6329 100644 --- a/typedapi/core/fieldcaps/request.go +++ b/typedapi/core/fieldcaps/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package fieldcaps @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package fieldcaps // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/field_caps/FieldCapabilitiesRequest.ts#L25-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/field_caps/FieldCapabilitiesRequest.ts#L25-L99 type Request struct { // Fields List of fields to retrieve capabilities for. Wildcard (`*`) expressions are diff --git a/typedapi/core/fieldcaps/response.go b/typedapi/core/fieldcaps/response.go index e0a444a74f..9d092e5894 100644 --- a/typedapi/core/fieldcaps/response.go +++ b/typedapi/core/fieldcaps/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package fieldcaps @@ -31,8 +31,7 @@ import ( // Response holds the response body struct for the package fieldcaps // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/field_caps/FieldCapabilitiesResponse.ts#L24-L35 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/field_caps/FieldCapabilitiesResponse.ts#L24-L35 type Response struct { Fields map[string]map[string]types.FieldCapability `json:"fields"` Indices []string `json:"indices"` diff --git a/typedapi/core/get/get.go b/typedapi/core/get/get.go index a6c964f02d..b8fd62398e 100644 --- a/typedapi/core/get/get.go +++ b/typedapi/core/get/get.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns a document. package get @@ -55,12 +55,16 @@ type Get struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGet type alias for index. @@ -82,13 +86,18 @@ func NewGetFunc(tp elastictransport.Interface) NewGet { // Returns a document. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html func New(tp elastictransport.Interface) *Get { r := &Get{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,11 +118,17 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask|idMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_doc") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -127,9 +142,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -146,27 +161,66 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Get) Perform(ctx context.Context) (*http.Response, error) { +func (r Get) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "get") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "get") + if reader := instrument.RecordRequestBody(ctx, "get", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "get") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Get query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Get query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a get.Response -func (r Get) Do(ctx context.Context) (*Response, error) { +func (r Get) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -174,6 +228,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,30 +240,45 @@ func (r Get) Do(ctx context.Context) (*Response, error) { if res.StatusCode == 404 { data, err := ioutil.ReadAll(res.Body) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(gobytes.NewReader(data)).Decode(&errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } if errorResponse.Status == 0 { err = json.NewDecoder(gobytes.NewReader(data)).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } return response, nil } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -214,12 +286,25 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Get) IsSuccess(ctx context.Context) (bool, error) { +func (r Get) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -235,6 +320,14 @@ func (r Get) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Get query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/get/response.go b/typedapi/core/get/response.go index 198076a4e1..ccb7682a95 100644 --- a/typedapi/core/get/response.go +++ b/typedapi/core/get/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package get @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package get // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/get/GetResponse.ts#L23-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/get/GetResponse.ts#L23-L34 type Response struct { Fields map[string]json.RawMessage `json:"fields,omitempty"` Found bool `json:"found"` diff --git a/typedapi/core/getscript/get_script.go b/typedapi/core/getscript/get_script.go index 3d3d55ffc3..d937c8a223 100644 --- a/typedapi/core/getscript/get_script.go +++ b/typedapi/core/getscript/get_script.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns a script. package getscript import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type GetScript struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetScript type alias for index. @@ -75,13 +78,18 @@ func NewGetScriptFunc(tp elastictransport.Interface) NewGetScript { // Returns a script. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html func New(tp elastictransport.Interface) *GetScript { r := &GetScript{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *GetScript) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_scripts") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -117,9 +128,9 @@ func (r *GetScript) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *GetScript) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetScript) Perform(ctx context.Context) (*http.Response, error) { +func (r GetScript) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "get_script") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "get_script") + if reader := instrument.RecordRequestBody(ctx, "get_script", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "get_script") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetScript query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetScript query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getscript.Response -func (r GetScript) Do(ctx context.Context) (*Response, error) { +func (r GetScript) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_script") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r GetScript) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r GetScript) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r GetScript) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetScript) IsSuccess(ctx context.Context) (bool, error) { +func (r GetScript) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_script") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r GetScript) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetScript query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/getscript/response.go b/typedapi/core/getscript/response.go index 2831393ab0..123b36477d 100644 --- a/typedapi/core/getscript/response.go +++ b/typedapi/core/getscript/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getscript @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getscript // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/get_script/GetScriptResponse.ts#L23-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/get_script/GetScriptResponse.ts#L23-L29 type Response struct { Found bool `json:"found"` Id_ string `json:"_id"` diff --git a/typedapi/core/getscriptcontext/get_script_context.go b/typedapi/core/getscriptcontext/get_script_context.go index 816cd83591..5bf49463e4 100644 --- a/typedapi/core/getscriptcontext/get_script_context.go +++ b/typedapi/core/getscriptcontext/get_script_context.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns all script contexts. package getscriptcontext import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type GetScriptContext struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetScriptContext type alias for index. @@ -67,13 +70,18 @@ func NewGetScriptContextFunc(tp elastictransport.Interface) NewGetScriptContext // Returns all script contexts. // -// https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-contexts.html +// https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-contexts.html func New(tp elastictransport.Interface) *GetScriptContext { r := &GetScriptContext{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,9 +114,9 @@ func (r *GetScriptContext) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -125,27 +133,66 @@ func (r *GetScriptContext) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetScriptContext) Perform(ctx context.Context) (*http.Response, error) { +func (r GetScriptContext) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "get_script_context") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "get_script_context") + if reader := instrument.RecordRequestBody(ctx, "get_script_context", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "get_script_context") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetScriptContext query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetScriptContext query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getscriptcontext.Response -func (r GetScriptContext) Do(ctx context.Context) (*Response, error) { +func (r GetScriptContext) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_script_context") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -153,6 +200,9 @@ func (r GetScriptContext) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -162,6 +212,9 @@ func (r GetScriptContext) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -169,12 +222,25 @@ func (r GetScriptContext) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetScriptContext) IsSuccess(ctx context.Context) (bool, error) { +func (r GetScriptContext) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_script_context") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -190,6 +256,14 @@ func (r GetScriptContext) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetScriptContext query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/getscriptcontext/response.go b/typedapi/core/getscriptcontext/response.go index 8340bd67f6..9523c6d7c6 100644 --- a/typedapi/core/getscriptcontext/response.go +++ b/typedapi/core/getscriptcontext/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getscriptcontext @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getscriptcontext // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/get_script_context/GetScriptContextResponse.ts#L22-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/get_script_context/GetScriptContextResponse.ts#L22-L26 type Response struct { Contexts []types.GetScriptContext `json:"contexts"` } diff --git a/typedapi/core/getscriptlanguages/get_script_languages.go b/typedapi/core/getscriptlanguages/get_script_languages.go index c367e11876..8c756cf1b5 100644 --- a/typedapi/core/getscriptlanguages/get_script_languages.go +++ b/typedapi/core/getscriptlanguages/get_script_languages.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns available script types, languages and contexts package getscriptlanguages import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type GetScriptLanguages struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetScriptLanguages type alias for index. @@ -67,13 +70,18 @@ func NewGetScriptLanguagesFunc(tp elastictransport.Interface) NewGetScriptLangua // Returns available script types, languages and contexts // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html func New(tp elastictransport.Interface) *GetScriptLanguages { r := &GetScriptLanguages{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,9 +114,9 @@ func (r *GetScriptLanguages) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -125,27 +133,66 @@ func (r *GetScriptLanguages) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetScriptLanguages) Perform(ctx context.Context) (*http.Response, error) { +func (r GetScriptLanguages) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "get_script_languages") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "get_script_languages") + if reader := instrument.RecordRequestBody(ctx, "get_script_languages", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "get_script_languages") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetScriptLanguages query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetScriptLanguages query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getscriptlanguages.Response -func (r GetScriptLanguages) Do(ctx context.Context) (*Response, error) { +func (r GetScriptLanguages) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_script_languages") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -153,6 +200,9 @@ func (r GetScriptLanguages) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -162,6 +212,9 @@ func (r GetScriptLanguages) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -169,12 +222,25 @@ func (r GetScriptLanguages) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetScriptLanguages) IsSuccess(ctx context.Context) (bool, error) { +func (r GetScriptLanguages) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_script_languages") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -190,6 +256,14 @@ func (r GetScriptLanguages) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetScriptLanguages query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/getscriptlanguages/response.go b/typedapi/core/getscriptlanguages/response.go index 6e2234ff38..202150fd4d 100644 --- a/typedapi/core/getscriptlanguages/response.go +++ b/typedapi/core/getscriptlanguages/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getscriptlanguages @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getscriptlanguages // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/get_script_languages/GetScriptLanguagesResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/get_script_languages/GetScriptLanguagesResponse.ts#L22-L27 type Response struct { LanguageContexts []types.LanguageContext `json:"language_contexts"` TypesAllowed []string `json:"types_allowed"` diff --git a/typedapi/core/getsource/get_source.go b/typedapi/core/getsource/get_source.go index 745a1e2a28..66cc5dd2e2 100644 --- a/typedapi/core/getsource/get_source.go +++ b/typedapi/core/getsource/get_source.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the source of a document. package getsource import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -55,12 +54,16 @@ type GetSource struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetSource type alias for index. @@ -82,13 +85,18 @@ func NewGetSourceFunc(tp elastictransport.Interface) NewGetSource { // Returns the source of a document. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html func New(tp elastictransport.Interface) *GetSource { r := &GetSource{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,11 +117,17 @@ func (r *GetSource) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask|idMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_source") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -127,9 +141,9 @@ func (r *GetSource) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -146,27 +160,66 @@ func (r *GetSource) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetSource) Perform(ctx context.Context) (*http.Response, error) { +func (r GetSource) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "get_source") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "get_source") + if reader := instrument.RecordRequestBody(ctx, "get_source", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "get_source") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetSource query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetSource query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getsource.Response -func (r GetSource) Do(ctx context.Context) (Response, error) { +func (r GetSource) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_source") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := new(Response) res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -174,6 +227,9 @@ func (r GetSource) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,6 +239,9 @@ func (r GetSource) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -190,12 +249,25 @@ func (r GetSource) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetSource) IsSuccess(ctx context.Context) (bool, error) { +func (r GetSource) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "get_source") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -211,6 +283,14 @@ func (r GetSource) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetSource query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/getsource/response.go b/typedapi/core/getsource/response.go index 9769128cc8..94c7d37ce9 100644 --- a/typedapi/core/getsource/response.go +++ b/typedapi/core/getsource/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getsource @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getsource // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/get_source/SourceResponse.ts#L20-L22 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/get_source/SourceResponse.ts#L20-L22 type Response = json.RawMessage diff --git a/typedapi/core/healthreport/health_report.go b/typedapi/core/healthreport/health_report.go index ff82b59fab..64ef302dc2 100644 --- a/typedapi/core/healthreport/health_report.go +++ b/typedapi/core/healthreport/health_report.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the health of the cluster. package healthreport import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type HealthReport struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int feature string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewHealthReport type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *HealthReport { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *HealthReport) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_health_report") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "feature", r.feature) + } path.WriteString(r.feature) method = http.MethodGet @@ -121,9 +132,9 @@ func (r *HealthReport) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *HealthReport) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r HealthReport) Perform(ctx context.Context) (*http.Response, error) { +func (r HealthReport) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "health_report") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "health_report") + if reader := instrument.RecordRequestBody(ctx, "health_report", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "health_report") + } if err != nil { - return nil, fmt.Errorf("an error happened during the HealthReport query execution: %w", err) + localErr := fmt.Errorf("an error happened during the HealthReport query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a healthreport.Response -func (r HealthReport) Do(ctx context.Context) (*Response, error) { +func (r HealthReport) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "health_report") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r HealthReport) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r HealthReport) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r HealthReport) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r HealthReport) IsSuccess(ctx context.Context) (bool, error) { +func (r HealthReport) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "health_report") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r HealthReport) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the HealthReport query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/healthreport/response.go b/typedapi/core/healthreport/response.go index 17b30787d9..b1af710ebd 100644 --- a/typedapi/core/healthreport/response.go +++ b/typedapi/core/healthreport/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package healthreport @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package healthreport // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/Response.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/Response.ts#L22-L28 type Response struct { ClusterName string `json:"cluster_name"` Indicators types.Indicators `json:"indicators"` diff --git a/typedapi/core/index/index.go b/typedapi/core/index/index.go index f0141c0f2d..40e56445bd 100644 --- a/typedapi/core/index/index.go +++ b/typedapi/core/index/index.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates a document in an index. package index @@ -56,16 +56,20 @@ type Index struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req interface{} deferred []func(request interface{}) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewIndex type alias for index. @@ -85,13 +89,20 @@ func NewIndexFunc(tp elastictransport.Interface) NewIndex { // Creates or updates a document in an index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html func New(tp elastictransport.Interface) *Index { r := &Index{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -137,9 +148,7 @@ func (r *Index) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -151,23 +160,36 @@ func (r *Index) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|idMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_doc") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPut case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_doc") @@ -183,15 +205,15 @@ func (r *Index) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -208,27 +230,66 @@ func (r *Index) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Index) Perform(ctx context.Context) (*http.Response, error) { +func (r Index) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "index") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "index") + if reader := instrument.RecordRequestBody(ctx, "index", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "index") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Index query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Index query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a index.Response -func (r Index) Do(ctx context.Context) (*Response, error) { +func (r Index) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -236,6 +297,9 @@ func (r Index) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -245,6 +309,9 @@ func (r Index) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -252,6 +319,9 @@ func (r Index) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/index/request.go b/typedapi/core/index/request.go index 7d0c22c25f..64ad0c8b4a 100644 --- a/typedapi/core/index/request.go +++ b/typedapi/core/index/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package index @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package index // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/index/IndexRequest.ts#L35-L117 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/index/IndexRequest.ts#L35-L117 type Request = json.RawMessage diff --git a/typedapi/core/index/response.go b/typedapi/core/index/response.go index b0b6f43f82..fba1ab8150 100644 --- a/typedapi/core/index/response.go +++ b/typedapi/core/index/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package index @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package index // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/index/IndexResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/index/IndexResponse.ts#L22-L24 type Response struct { ForcedRefresh *bool `json:"forced_refresh,omitempty"` Id_ string `json:"_id"` diff --git a/typedapi/core/info/info.go b/typedapi/core/info/info.go index 1958af8953..905f9e77ee 100644 --- a/typedapi/core/info/info.go +++ b/typedapi/core/info/info.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns basic information about the cluster. package info import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Info struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewInfo type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *Info { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,9 +112,9 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -123,27 +131,66 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Info) Perform(ctx context.Context) (*http.Response, error) { +func (r Info) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "info") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "info") + if reader := instrument.RecordRequestBody(ctx, "info", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "info") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Info query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Info query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a info.Response -func (r Info) Do(ctx context.Context) (*Response, error) { +func (r Info) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -151,6 +198,9 @@ func (r Info) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -160,6 +210,9 @@ func (r Info) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -167,12 +220,25 @@ func (r Info) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Info) IsSuccess(ctx context.Context) (bool, error) { +func (r Info) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -188,6 +254,14 @@ func (r Info) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Info query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/info/response.go b/typedapi/core/info/response.go index ad76a9ac67..83c24a15a4 100644 --- a/typedapi/core/info/response.go +++ b/typedapi/core/info/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package info @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package info // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/info/RootNodeInfoResponse.ts#L23-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/info/RootNodeInfoResponse.ts#L23-L31 type Response struct { ClusterName string `json:"cluster_name"` ClusterUuid string `json:"cluster_uuid"` diff --git a/typedapi/core/knnsearch/knn_search.go b/typedapi/core/knnsearch/knn_search.go index b96f2217b8..6fd4ddc590 100644 --- a/typedapi/core/knnsearch/knn_search.go +++ b/typedapi/core/knnsearch/knn_search.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Performs a kNN search. package knnsearch @@ -50,15 +50,19 @@ type KnnSearch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewKnnSearch type alias for index. @@ -78,17 +82,24 @@ func NewKnnSearchFunc(tp elastictransport.Interface) NewKnnSearch { // Performs a kNN search. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html func New(tp elastictransport.Interface) *KnnSearch { r := &KnnSearch{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *KnnSearch) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,12 +148,19 @@ func (r *KnnSearch) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_knn_search") @@ -160,15 +176,15 @@ func (r *KnnSearch) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -185,27 +201,66 @@ func (r *KnnSearch) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r KnnSearch) Perform(ctx context.Context) (*http.Response, error) { +func (r KnnSearch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "knn_search") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "knn_search") + if reader := instrument.RecordRequestBody(ctx, "knn_search", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "knn_search") + } if err != nil { - return nil, fmt.Errorf("an error happened during the KnnSearch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the KnnSearch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a knnsearch.Response -func (r KnnSearch) Do(ctx context.Context) (*Response, error) { +func (r KnnSearch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "knn_search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -213,6 +268,9 @@ func (r KnnSearch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r KnnSearch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +290,9 @@ func (r KnnSearch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/knnsearch/request.go b/typedapi/core/knnsearch/request.go index 107486f34e..f6e1328bc9 100644 --- a/typedapi/core/knnsearch/request.go +++ b/typedapi/core/knnsearch/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package knnsearch @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package knnsearch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/knn_search/KnnSearchRequest.ts#L27-L80 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/knn_search/KnnSearchRequest.ts#L27-L80 type Request struct { // DocvalueFields The request returns doc values for field names matching these patterns diff --git a/typedapi/core/knnsearch/response.go b/typedapi/core/knnsearch/response.go index 2be4b88317..48b936016d 100644 --- a/typedapi/core/knnsearch/response.go +++ b/typedapi/core/knnsearch/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package knnsearch @@ -28,8 +28,7 @@ import ( // Response holds the response body struct for the package knnsearch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/knn_search/KnnSearchResponse.ts#L26-L54 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/knn_search/KnnSearchResponse.ts#L26-L54 type Response struct { // Fields Contains field values for the documents. These fields diff --git a/typedapi/core/mget/mget.go b/typedapi/core/mget/mget.go index 2b87aba838..83085f8a60 100644 --- a/typedapi/core/mget/mget.go +++ b/typedapi/core/mget/mget.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to get multiple documents in one request. package mget @@ -51,15 +51,19 @@ type Mget struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMget type alias for index. @@ -77,17 +81,24 @@ func NewMgetFunc(tp elastictransport.Interface) NewMget { // Allows to get multiple documents in one request. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html func New(tp elastictransport.Interface) *Mget { r := &Mget{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -124,9 +135,7 @@ func (r *Mget) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -138,6 +147,10 @@ func (r *Mget) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *Mget) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_mget") @@ -164,15 +180,15 @@ func (r *Mget) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *Mget) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Mget) Perform(ctx context.Context) (*http.Response, error) { +func (r Mget) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "mget") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "mget") + if reader := instrument.RecordRequestBody(ctx, "mget", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "mget") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Mget query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Mget query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a mget.Response -func (r Mget) Do(ctx context.Context) (*Response, error) { +func (r Mget) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "mget") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r Mget) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r Mget) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r Mget) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/mget/request.go b/typedapi/core/mget/request.go index 3939c017d6..fd52b8afce 100644 --- a/typedapi/core/mget/request.go +++ b/typedapi/core/mget/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package mget @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package mget // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/mget/MultiGetRequest.ts#L25-L91 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/mget/MultiGetRequest.ts#L25-L91 type Request struct { // Docs The documents you want to retrieve. Required if no index is specified in the diff --git a/typedapi/core/mget/response.go b/typedapi/core/mget/response.go index d539302ff9..a79e35a55b 100644 --- a/typedapi/core/mget/response.go +++ b/typedapi/core/mget/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package mget @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package mget // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/mget/MultiGetResponse.ts#L22-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/mget/MultiGetResponse.ts#L22-L26 type Response struct { Docs []types.MgetResponseItem `json:"docs"` } diff --git a/typedapi/core/msearch/msearch.go b/typedapi/core/msearch/msearch.go index 0531ecf88c..b896fd90fc 100644 --- a/typedapi/core/msearch/msearch.go +++ b/typedapi/core/msearch/msearch.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to execute several search operations in one request. package msearch @@ -53,15 +53,19 @@ type Msearch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMsearch type alias for index. @@ -79,13 +83,20 @@ func NewMsearchFunc(tp elastictransport.Interface) NewMsearch { // Allows to execute several search operations in one request. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html func New(tp elastictransport.Interface) *Msearch { r := &Msearch{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -124,9 +135,7 @@ func (r *Msearch) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { for _, elem := range *r.req { data, err := json.Marshal(elem) @@ -143,6 +152,10 @@ func (r *Msearch) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,6 +167,9 @@ func (r *Msearch) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_msearch") @@ -169,15 +185,15 @@ func (r *Msearch) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+x-ndjson;compatible-with=8") } } @@ -194,22 +210,58 @@ func (r *Msearch) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Msearch) Perform(ctx context.Context) (*http.Response, error) { +func (r Msearch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "msearch") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "msearch") + if reader := instrument.RecordRequestBody(ctx, "msearch", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "msearch") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Msearch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Msearch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a msearch.Response -func (r Msearch) Do(ctx context.Context) (*Response, error) { +func (r Msearch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "msearch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() @@ -217,6 +269,9 @@ func (r Msearch) Do(ctx context.Context) (*Response, error) { res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -224,6 +279,9 @@ func (r Msearch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +291,9 @@ func (r Msearch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -240,6 +301,9 @@ func (r Msearch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/msearch/request.go b/typedapi/core/msearch/request.go index fea58633ef..b937dad8d0 100644 --- a/typedapi/core/msearch/request.go +++ b/typedapi/core/msearch/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package msearch @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package msearch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch/MultiSearchRequest.ts#L25-L96 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch/MultiSearchRequest.ts#L25-L96 type Request = []types.MsearchRequestItem diff --git a/typedapi/core/msearch/response.go b/typedapi/core/msearch/response.go index 8ebce37711..0e1c78f2fa 100644 --- a/typedapi/core/msearch/response.go +++ b/typedapi/core/msearch/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package msearch @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package msearch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch/MultiSearchResponse.ts#L25-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch/MultiSearchResponse.ts#L25-L27 type Response struct { Responses []types.MsearchResponseItem `json:"responses"` Took int64 `json:"took"` diff --git a/typedapi/core/msearchtemplate/msearch_template.go b/typedapi/core/msearchtemplate/msearch_template.go index a05ccb87dc..e28b41c597 100644 --- a/typedapi/core/msearchtemplate/msearch_template.go +++ b/typedapi/core/msearchtemplate/msearch_template.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to execute several search template operations in one request. package msearchtemplate @@ -52,15 +52,19 @@ type MsearchTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMsearchTemplate type alias for index. @@ -84,7 +88,14 @@ func New(tp elastictransport.Interface) *MsearchTemplate { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -123,9 +134,7 @@ func (r *MsearchTemplate) HttpRequest(ctx context.Context) (*http.Request, error } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { for _, elem := range *r.req { data, err := json.Marshal(elem) @@ -142,6 +151,10 @@ func (r *MsearchTemplate) HttpRequest(ctx context.Context) (*http.Request, error } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -155,6 +168,9 @@ func (r *MsearchTemplate) HttpRequest(ctx context.Context) (*http.Request, error case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_msearch") @@ -172,15 +188,15 @@ func (r *MsearchTemplate) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+x-ndjson;compatible-with=8") } } @@ -197,22 +213,58 @@ func (r *MsearchTemplate) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r MsearchTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r MsearchTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "msearch_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "msearch_template") + if reader := instrument.RecordRequestBody(ctx, "msearch_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "msearch_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the MsearchTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the MsearchTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a msearchtemplate.Response -func (r MsearchTemplate) Do(ctx context.Context) (*Response, error) { +func (r MsearchTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "msearch_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() @@ -220,6 +272,9 @@ func (r MsearchTemplate) Do(ctx context.Context) (*Response, error) { res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -227,6 +282,9 @@ func (r MsearchTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +294,9 @@ func (r MsearchTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -243,6 +304,9 @@ func (r MsearchTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/msearchtemplate/request.go b/typedapi/core/msearchtemplate/request.go index e3b73a2e54..b7b6ed0fd0 100644 --- a/typedapi/core/msearchtemplate/request.go +++ b/typedapi/core/msearchtemplate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package msearchtemplate @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package msearchtemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch_template/MultiSearchTemplateRequest.ts#L25-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch_template/MultiSearchTemplateRequest.ts#L25-L70 type Request = []types.RequestItem diff --git a/typedapi/core/msearchtemplate/response.go b/typedapi/core/msearchtemplate/response.go index fc5dd3935b..886715401c 100644 --- a/typedapi/core/msearchtemplate/response.go +++ b/typedapi/core/msearchtemplate/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package msearchtemplate @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package msearchtemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch_template/MultiSearchTemplateResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch_template/MultiSearchTemplateResponse.ts#L22-L24 type Response struct { Responses []types.MsearchResponseItem `json:"responses"` Took int64 `json:"took"` diff --git a/typedapi/core/mtermvectors/mtermvectors.go b/typedapi/core/mtermvectors/mtermvectors.go index 74dd63d3c4..e120e87a0a 100644 --- a/typedapi/core/mtermvectors/mtermvectors.go +++ b/typedapi/core/mtermvectors/mtermvectors.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns multiple termvectors in one request. package mtermvectors @@ -52,15 +52,19 @@ type Mtermvectors struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMtermvectors type alias for index. @@ -78,17 +82,24 @@ func NewMtermvectorsFunc(tp elastictransport.Interface) NewMtermvectors { // Returns multiple termvectors in one request. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html func New(tp elastictransport.Interface) *Mtermvectors { r := &Mtermvectors{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *Mtermvectors) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *Mtermvectors) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,6 +163,9 @@ func (r *Mtermvectors) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_mtermvectors") @@ -165,15 +181,15 @@ func (r *Mtermvectors) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -190,27 +206,66 @@ func (r *Mtermvectors) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Mtermvectors) Perform(ctx context.Context) (*http.Response, error) { +func (r Mtermvectors) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "mtermvectors") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "mtermvectors") + if reader := instrument.RecordRequestBody(ctx, "mtermvectors", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "mtermvectors") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Mtermvectors query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Mtermvectors query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a mtermvectors.Response -func (r Mtermvectors) Do(ctx context.Context) (*Response, error) { +func (r Mtermvectors) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "mtermvectors") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -218,6 +273,9 @@ func (r Mtermvectors) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -227,6 +285,9 @@ func (r Mtermvectors) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +295,9 @@ func (r Mtermvectors) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/mtermvectors/request.go b/typedapi/core/mtermvectors/request.go index d993118e74..745c62caf3 100644 --- a/typedapi/core/mtermvectors/request.go +++ b/typedapi/core/mtermvectors/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package mtermvectors @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package mtermvectors // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/mtermvectors/MultiTermVectorsRequest.ts#L31-L109 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/mtermvectors/MultiTermVectorsRequest.ts#L31-L109 type Request struct { // Docs Array of existing or artificial documents. diff --git a/typedapi/core/mtermvectors/response.go b/typedapi/core/mtermvectors/response.go index d00e2552e9..17eebf432e 100644 --- a/typedapi/core/mtermvectors/response.go +++ b/typedapi/core/mtermvectors/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package mtermvectors @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package mtermvectors // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/mtermvectors/MultiTermVectorsResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/mtermvectors/MultiTermVectorsResponse.ts#L22-L24 type Response struct { Docs []types.TermVectorsResult `json:"docs"` } diff --git a/typedapi/core/openpointintime/open_point_in_time.go b/typedapi/core/openpointintime/open_point_in_time.go index 476f1b85ff..369360e250 100644 --- a/typedapi/core/openpointintime/open_point_in_time.go +++ b/typedapi/core/openpointintime/open_point_in_time.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Open a point in time that can be used in subsequent searches package openpointintime import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type OpenPointInTime struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewOpenPointInTime type alias for index. @@ -77,13 +80,18 @@ func NewOpenPointInTimeFunc(tp elastictransport.Interface) NewOpenPointInTime { // Open a point in time that can be used in subsequent searches // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/point-in-time-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/point-in-time-api.html func New(tp elastictransport.Interface) *OpenPointInTime { r := &OpenPointInTime{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *OpenPointInTime) HttpRequest(ctx context.Context) (*http.Request, error case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_pit") @@ -119,9 +130,9 @@ func (r *OpenPointInTime) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *OpenPointInTime) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r OpenPointInTime) Perform(ctx context.Context) (*http.Response, error) { +func (r OpenPointInTime) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "open_point_in_time") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "open_point_in_time") + if reader := instrument.RecordRequestBody(ctx, "open_point_in_time", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "open_point_in_time") + } if err != nil { - return nil, fmt.Errorf("an error happened during the OpenPointInTime query execution: %w", err) + localErr := fmt.Errorf("an error happened during the OpenPointInTime query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a openpointintime.Response -func (r OpenPointInTime) Do(ctx context.Context) (*Response, error) { +func (r OpenPointInTime) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "open_point_in_time") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r OpenPointInTime) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r OpenPointInTime) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r OpenPointInTime) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r OpenPointInTime) IsSuccess(ctx context.Context) (bool, error) { +func (r OpenPointInTime) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "open_point_in_time") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r OpenPointInTime) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the OpenPointInTime query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/openpointintime/response.go b/typedapi/core/openpointintime/response.go index 809bf5138b..0789ec721a 100644 --- a/typedapi/core/openpointintime/response.go +++ b/typedapi/core/openpointintime/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package openpointintime // Response holds the response body struct for the package openpointintime // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/open_point_in_time/OpenPointInTimeResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/open_point_in_time/OpenPointInTimeResponse.ts#L22-L24 type Response struct { Id string `json:"id"` } diff --git a/typedapi/core/ping/ping.go b/typedapi/core/ping/ping.go index c8173a2056..e75bfa714f 100644 --- a/typedapi/core/ping/ping.go +++ b/typedapi/core/ping/ping.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns whether the cluster is running. package ping import ( - gobytes "bytes" "context" "errors" "fmt" @@ -45,9 +44,13 @@ type Ping struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPing type alias for index. @@ -71,7 +74,12 @@ func New(tp elastictransport.Interface) *Ping { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -102,9 +110,9 @@ func (r *Ping) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -121,15 +129,42 @@ func (r *Ping) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Ping) Perform(ctx context.Context) (*http.Response, error) { +func (r Ping) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ping") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ping") + if reader := instrument.RecordRequestBody(ctx, "ping", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ping") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Ping query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Ping query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -142,7 +177,17 @@ func (r Ping) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Ping) IsSuccess(ctx context.Context) (bool, error) { +func (r Ping) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -158,6 +203,14 @@ func (r Ping) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Ping query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/putscript/put_script.go b/typedapi/core/putscript/put_script.go index 432c63cf5b..9e219627ca 100644 --- a/typedapi/core/putscript/put_script.go +++ b/typedapi/core/putscript/put_script.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates a script. package putscript @@ -52,16 +52,20 @@ type PutScript struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string context string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutScript type alias for index. @@ -81,17 +85,24 @@ func NewPutScriptFunc(tp elastictransport.Interface) NewPutScript { // Creates or updates a script. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html func New(tp elastictransport.Interface) *PutScript { r := &PutScript{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -128,9 +139,7 @@ func (r *PutScript) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -142,6 +151,10 @@ func (r *PutScript) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,6 +163,9 @@ func (r *PutScript) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_scripts") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPut @@ -158,9 +174,15 @@ func (r *PutScript) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_scripts") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "context", r.context) + } path.WriteString(r.context) method = http.MethodPut @@ -174,15 +196,15 @@ func (r *PutScript) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -199,27 +221,66 @@ func (r *PutScript) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutScript) Perform(ctx context.Context) (*http.Response, error) { +func (r PutScript) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "put_script") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "put_script") + if reader := instrument.RecordRequestBody(ctx, "put_script", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "put_script") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutScript query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutScript query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putscript.Response -func (r PutScript) Do(ctx context.Context) (*Response, error) { +func (r PutScript) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "put_script") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -227,6 +288,9 @@ func (r PutScript) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +300,9 @@ func (r PutScript) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -243,6 +310,9 @@ func (r PutScript) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/putscript/request.go b/typedapi/core/putscript/request.go index 79498bc876..578338fdf7 100644 --- a/typedapi/core/putscript/request.go +++ b/typedapi/core/putscript/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putscript @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putscript // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/put_script/PutScriptRequest.ts#L25-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/put_script/PutScriptRequest.ts#L25-L64 type Request struct { // Script Contains the script or search template, its parameters, and its language. diff --git a/typedapi/core/putscript/response.go b/typedapi/core/putscript/response.go index a5aefd4829..48e4e9560b 100644 --- a/typedapi/core/putscript/response.go +++ b/typedapi/core/putscript/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putscript // Response holds the response body struct for the package putscript // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/put_script/PutScriptResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/put_script/PutScriptResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/core/rankeval/rank_eval.go b/typedapi/core/rankeval/rank_eval.go index dd07fba97a..0ead69266c 100644 --- a/typedapi/core/rankeval/rank_eval.go +++ b/typedapi/core/rankeval/rank_eval.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to evaluate the quality of ranked search results over a set of typical // search queries @@ -53,15 +53,19 @@ type RankEval struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRankEval type alias for index. @@ -80,17 +84,24 @@ func NewRankEvalFunc(tp elastictransport.Interface) NewRankEval { // Allows to evaluate the quality of ranked search results over a set of typical // search queries // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-rank-eval.html func New(tp elastictransport.Interface) *RankEval { r := &RankEval{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *RankEval) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,6 +150,10 @@ func (r *RankEval) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -152,6 +165,9 @@ func (r *RankEval) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_rank_eval") @@ -167,15 +183,15 @@ func (r *RankEval) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -192,27 +208,66 @@ func (r *RankEval) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r RankEval) Perform(ctx context.Context) (*http.Response, error) { +func (r RankEval) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "rank_eval") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "rank_eval") + if reader := instrument.RecordRequestBody(ctx, "rank_eval", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rank_eval") + } if err != nil { - return nil, fmt.Errorf("an error happened during the RankEval query execution: %w", err) + localErr := fmt.Errorf("an error happened during the RankEval query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a rankeval.Response -func (r RankEval) Do(ctx context.Context) (*Response, error) { +func (r RankEval) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rank_eval") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -220,6 +275,9 @@ func (r RankEval) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +287,9 @@ func (r RankEval) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +297,9 @@ func (r RankEval) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/rankeval/request.go b/typedapi/core/rankeval/request.go index 44f0955cdc..a263ddc8e1 100644 --- a/typedapi/core/rankeval/request.go +++ b/typedapi/core/rankeval/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package rankeval @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package rankeval // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/RankEvalRequest.ts#L24-L61 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/RankEvalRequest.ts#L24-L61 type Request struct { // Metric Definition of the evaluation metric to calculate. diff --git a/typedapi/core/rankeval/response.go b/typedapi/core/rankeval/response.go index 2fc1068c86..bf27c9945a 100644 --- a/typedapi/core/rankeval/response.go +++ b/typedapi/core/rankeval/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package rankeval @@ -28,8 +28,7 @@ import ( // Response holds the response body struct for the package rankeval // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/RankEvalResponse.ts#L26-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/RankEvalResponse.ts#L26-L34 type Response struct { // Details The details section contains one entry for every query in the original diff --git a/typedapi/core/reindex/reindex.go b/typedapi/core/reindex/reindex.go index 65b649be93..bf50c5f85c 100644 --- a/typedapi/core/reindex/reindex.go +++ b/typedapi/core/reindex/reindex.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to copy documents from one index to another, optionally filtering the // source @@ -52,13 +52,17 @@ type Reindex struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewReindex type alias for index. @@ -80,17 +84,24 @@ func NewReindexFunc(tp elastictransport.Interface) NewReindex { // the // documents from a remote cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html func New(tp elastictransport.Interface) *Reindex { r := &Reindex{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *Reindex) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,6 +150,10 @@ func (r *Reindex) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -159,15 +172,15 @@ func (r *Reindex) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -184,27 +197,66 @@ func (r *Reindex) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Reindex) Perform(ctx context.Context) (*http.Response, error) { +func (r Reindex) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "reindex") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "reindex") + if reader := instrument.RecordRequestBody(ctx, "reindex", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "reindex") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Reindex query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Reindex query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a reindex.Response -func (r Reindex) Do(ctx context.Context) (*Response, error) { +func (r Reindex) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "reindex") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -212,6 +264,9 @@ func (r Reindex) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -221,6 +276,9 @@ func (r Reindex) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -228,6 +286,9 @@ func (r Reindex) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/reindex/request.go b/typedapi/core/reindex/request.go index e08cf41744..71b32682bb 100644 --- a/typedapi/core/reindex/request.go +++ b/typedapi/core/reindex/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package reindex @@ -30,7 +30,7 @@ import ( // Request holds the request body struct for the package reindex // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/reindex/ReindexRequest.ts#L27-L101 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/reindex/ReindexRequest.ts#L27-L101 type Request struct { // Conflicts Set to proceed to continue reindexing even if there are conflicts. diff --git a/typedapi/core/reindex/response.go b/typedapi/core/reindex/response.go index 76b2c721ba..fc051c8f0d 100644 --- a/typedapi/core/reindex/response.go +++ b/typedapi/core/reindex/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package reindex @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package reindex // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/reindex/ReindexResponse.ts#L26-L45 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/reindex/ReindexResponse.ts#L26-L45 type Response struct { Batches *int64 `json:"batches,omitempty"` Created *int64 `json:"created,omitempty"` diff --git a/typedapi/core/reindexrethrottle/reindex_rethrottle.go b/typedapi/core/reindexrethrottle/reindex_rethrottle.go index bd230e2ed2..a9fe11fbba 100644 --- a/typedapi/core/reindexrethrottle/reindex_rethrottle.go +++ b/typedapi/core/reindexrethrottle/reindex_rethrottle.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Changes the number of requests per second for a particular Reindex operation. package reindexrethrottle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type ReindexRethrottle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int taskid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewReindexRethrottle type alias for index. @@ -75,13 +78,18 @@ func NewReindexRethrottleFunc(tp elastictransport.Interface) NewReindexRethrottl // Changes the number of requests per second for a particular Reindex operation. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html func New(tp elastictransport.Interface) *ReindexRethrottle { r := &ReindexRethrottle{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *ReindexRethrottle) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("_reindex") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "taskid", r.taskid) + } path.WriteString(r.taskid) path.WriteString("/") path.WriteString("_rethrottle") @@ -119,9 +130,9 @@ func (r *ReindexRethrottle) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *ReindexRethrottle) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ReindexRethrottle) Perform(ctx context.Context) (*http.Response, error) { +func (r ReindexRethrottle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "reindex_rethrottle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "reindex_rethrottle") + if reader := instrument.RecordRequestBody(ctx, "reindex_rethrottle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "reindex_rethrottle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ReindexRethrottle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ReindexRethrottle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a reindexrethrottle.Response -func (r ReindexRethrottle) Do(ctx context.Context) (*Response, error) { +func (r ReindexRethrottle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "reindex_rethrottle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r ReindexRethrottle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r ReindexRethrottle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r ReindexRethrottle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ReindexRethrottle) IsSuccess(ctx context.Context) (bool, error) { +func (r ReindexRethrottle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "reindex_rethrottle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r ReindexRethrottle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ReindexRethrottle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/reindexrethrottle/response.go b/typedapi/core/reindexrethrottle/response.go index d550d4ba2a..1bc16a5277 100644 --- a/typedapi/core/reindexrethrottle/response.go +++ b/typedapi/core/reindexrethrottle/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package reindexrethrottle @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package reindexrethrottle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/reindex_rethrottle/ReindexRethrottleResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/reindex_rethrottle/ReindexRethrottleResponse.ts#L23-L25 type Response struct { Nodes map[string]types.ReindexNode `json:"nodes"` } diff --git a/typedapi/core/rendersearchtemplate/render_search_template.go b/typedapi/core/rendersearchtemplate/render_search_template.go index 6f7f5400b1..ee1e0eb1ba 100644 --- a/typedapi/core/rendersearchtemplate/render_search_template.go +++ b/typedapi/core/rendersearchtemplate/render_search_template.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to use the Mustache language to pre-render a search definition. package rendersearchtemplate @@ -50,15 +50,19 @@ type RenderSearchTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRenderSearchTemplate type alias for index. @@ -82,11 +86,18 @@ func New(tp elastictransport.Interface) *RenderSearchTemplate { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -123,9 +134,7 @@ func (r *RenderSearchTemplate) HttpRequest(ctx context.Context) (*http.Request, } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -137,6 +146,10 @@ func (r *RenderSearchTemplate) HttpRequest(ctx context.Context) (*http.Request, } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,6 +167,9 @@ func (r *RenderSearchTemplate) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPost @@ -167,15 +183,15 @@ func (r *RenderSearchTemplate) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -192,27 +208,66 @@ func (r *RenderSearchTemplate) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r RenderSearchTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r RenderSearchTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "render_search_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "render_search_template") + if reader := instrument.RecordRequestBody(ctx, "render_search_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "render_search_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the RenderSearchTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the RenderSearchTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a rendersearchtemplate.Response -func (r RenderSearchTemplate) Do(ctx context.Context) (*Response, error) { +func (r RenderSearchTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "render_search_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -220,6 +275,9 @@ func (r RenderSearchTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +287,9 @@ func (r RenderSearchTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +297,9 @@ func (r RenderSearchTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/rendersearchtemplate/request.go b/typedapi/core/rendersearchtemplate/request.go index 6b9d035e04..e1e63580e9 100644 --- a/typedapi/core/rendersearchtemplate/request.go +++ b/typedapi/core/rendersearchtemplate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package rendersearchtemplate @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package rendersearchtemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/render_search_template/RenderSearchTemplateRequest.ts#L25-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/render_search_template/RenderSearchTemplateRequest.ts#L25-L55 type Request struct { File *string `json:"file,omitempty"` // Params Key-value pairs used to replace Mustache variables in the template. diff --git a/typedapi/core/rendersearchtemplate/response.go b/typedapi/core/rendersearchtemplate/response.go index 665e64a80f..c6e86aaa4e 100644 --- a/typedapi/core/rendersearchtemplate/response.go +++ b/typedapi/core/rendersearchtemplate/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package rendersearchtemplate @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package rendersearchtemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/render_search_template/RenderSearchTemplateResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/render_search_template/RenderSearchTemplateResponse.ts#L23-L25 type Response struct { TemplateOutput map[string]json.RawMessage `json:"template_output"` } diff --git a/typedapi/core/scriptspainlessexecute/request.go b/typedapi/core/scriptspainlessexecute/request.go index 35a97cccf9..ff67915d7b 100644 --- a/typedapi/core/scriptspainlessexecute/request.go +++ b/typedapi/core/scriptspainlessexecute/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package scriptspainlessexecute @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package scriptspainlessexecute // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/scripts_painless_execute/ExecutePainlessScriptRequest.ts#L24-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/scripts_painless_execute/ExecutePainlessScriptRequest.ts#L24-L46 type Request struct { // Context The context that the script should run in. diff --git a/typedapi/core/scriptspainlessexecute/response.go b/typedapi/core/scriptspainlessexecute/response.go index 9e618a766c..38082517cf 100644 --- a/typedapi/core/scriptspainlessexecute/response.go +++ b/typedapi/core/scriptspainlessexecute/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package scriptspainlessexecute @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package scriptspainlessexecute // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/scripts_painless_execute/ExecutePainlessScriptResponse.ts#L20-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/scripts_painless_execute/ExecutePainlessScriptResponse.ts#L20-L24 type Response struct { Result json.RawMessage `json:"result,omitempty"` } diff --git a/typedapi/core/scriptspainlessexecute/scripts_painless_execute.go b/typedapi/core/scriptspainlessexecute/scripts_painless_execute.go index 601511b07c..25b3cb22df 100644 --- a/typedapi/core/scriptspainlessexecute/scripts_painless_execute.go +++ b/typedapi/core/scriptspainlessexecute/scripts_painless_execute.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows an arbitrary script to be executed and a result to be returned package scriptspainlessexecute @@ -46,13 +46,17 @@ type ScriptsPainlessExecute struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewScriptsPainlessExecute type alias for index. @@ -70,17 +74,24 @@ func NewScriptsPainlessExecuteFunc(tp elastictransport.Interface) NewScriptsPain // Allows an arbitrary script to be executed and a result to be returned // -// https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html +// https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-execute-api.html func New(tp elastictransport.Interface) *ScriptsPainlessExecute { r := &ScriptsPainlessExecute{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *ScriptsPainlessExecute) HttpRequest(ctx context.Context) (*http.Request } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *ScriptsPainlessExecute) HttpRequest(ctx context.Context) (*http.Request } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,15 +166,15 @@ func (r *ScriptsPainlessExecute) HttpRequest(ctx context.Context) (*http.Request } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -178,27 +191,66 @@ func (r *ScriptsPainlessExecute) HttpRequest(ctx context.Context) (*http.Request } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ScriptsPainlessExecute) Perform(ctx context.Context) (*http.Response, error) { +func (r ScriptsPainlessExecute) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "scripts_painless_execute") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "scripts_painless_execute") + if reader := instrument.RecordRequestBody(ctx, "scripts_painless_execute", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "scripts_painless_execute") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ScriptsPainlessExecute query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ScriptsPainlessExecute query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a scriptspainlessexecute.Response -func (r ScriptsPainlessExecute) Do(ctx context.Context) (*Response, error) { +func (r ScriptsPainlessExecute) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "scripts_painless_execute") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -206,6 +258,9 @@ func (r ScriptsPainlessExecute) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -215,6 +270,9 @@ func (r ScriptsPainlessExecute) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r ScriptsPainlessExecute) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/scroll/request.go b/typedapi/core/scroll/request.go index 02bc76807b..efb479d311 100644 --- a/typedapi/core/scroll/request.go +++ b/typedapi/core/scroll/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package scroll @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package scroll // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/scroll/ScrollRequest.ts#L24-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/scroll/ScrollRequest.ts#L24-L59 type Request struct { // Scroll Period to retain the search context for scrolling. diff --git a/typedapi/core/scroll/response.go b/typedapi/core/scroll/response.go index 7de3a2f186..83a18d5629 100644 --- a/typedapi/core/scroll/response.go +++ b/typedapi/core/scroll/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package scroll @@ -33,8 +33,7 @@ import ( // Response holds the response body struct for the package scroll // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/scroll/ScrollResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/scroll/ScrollResponse.ts#L22-L24 type Response struct { Aggregations map[string]types.Aggregate `json:"aggregations,omitempty"` Clusters_ *types.ClusterStatistics `json:"_clusters,omitempty"` diff --git a/typedapi/core/scroll/scroll.go b/typedapi/core/scroll/scroll.go index 4eaa452ee2..afaaffa9d6 100644 --- a/typedapi/core/scroll/scroll.go +++ b/typedapi/core/scroll/scroll.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to retrieve a large numbers of results from a single search request. package scroll @@ -51,15 +51,19 @@ type Scroll struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int scrollid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewScroll type alias for index. @@ -77,17 +81,24 @@ func NewScrollFunc(tp elastictransport.Interface) NewScroll { // Allows to retrieve a large numbers of results from a single search request. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-scroll func New(tp elastictransport.Interface) *Scroll { r := &Scroll{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -124,9 +135,7 @@ func (r *Scroll) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -138,6 +147,10 @@ func (r *Scroll) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -155,6 +168,9 @@ func (r *Scroll) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("scroll") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "scrollid", r.scrollid) + } path.WriteString(r.scrollid) method = http.MethodPost @@ -168,15 +184,15 @@ func (r *Scroll) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -193,27 +209,66 @@ func (r *Scroll) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Scroll) Perform(ctx context.Context) (*http.Response, error) { +func (r Scroll) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "scroll") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "scroll") + if reader := instrument.RecordRequestBody(ctx, "scroll", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "scroll") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Scroll query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Scroll query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a scroll.Response -func (r Scroll) Do(ctx context.Context) (*Response, error) { +func (r Scroll) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "scroll") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -221,6 +276,9 @@ func (r Scroll) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +288,9 @@ func (r Scroll) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -237,6 +298,9 @@ func (r Scroll) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/search/request.go b/typedapi/core/search/request.go index bc5a1c3b03..cb1dd089b5 100644 --- a/typedapi/core/search/request.go +++ b/typedapi/core/search/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package search @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package search // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/SearchRequest.ts#L53-L506 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/SearchRequest.ts#L53-L506 type Request struct { // Aggregations Defines the aggregations that are run as part of the search request. diff --git a/typedapi/core/search/response.go b/typedapi/core/search/response.go index 9a7350788b..82668b7979 100644 --- a/typedapi/core/search/response.go +++ b/typedapi/core/search/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package search @@ -33,8 +33,7 @@ import ( // Response holds the response body struct for the package search // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/SearchResponse.ts#L34-L36 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/SearchResponse.ts#L34-L36 type Response struct { Aggregations map[string]types.Aggregate `json:"aggregations,omitempty"` Clusters_ *types.ClusterStatistics `json:"_clusters,omitempty"` diff --git a/typedapi/core/search/search.go b/typedapi/core/search/search.go index 7dcc6498dc..21fa70ce2f 100644 --- a/typedapi/core/search/search.go +++ b/typedapi/core/search/search.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns results matching a query. package search @@ -55,15 +55,19 @@ type Search struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSearch type alias for index. @@ -81,17 +85,24 @@ func NewSearchFunc(tp elastictransport.Interface) NewSearch { // Returns results matching a query. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html func New(tp elastictransport.Interface) *Search { r := &Search{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -128,9 +139,7 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -142,6 +151,10 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,6 +166,9 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_search") @@ -168,15 +184,15 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -193,22 +209,58 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Search) Perform(ctx context.Context) (*http.Response, error) { +func (r Search) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search") + if reader := instrument.RecordRequestBody(ctx, "search", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Search query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Search query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a search.Response -func (r Search) Do(ctx context.Context) (*Response, error) { +func (r Search) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() @@ -216,6 +268,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -223,6 +278,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +290,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -239,6 +300,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/searchmvt/request.go b/typedapi/core/searchmvt/request.go index f58e8ffa77..43fb106ae5 100644 --- a/typedapi/core/searchmvt/request.go +++ b/typedapi/core/searchmvt/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package searchmvt @@ -31,7 +31,7 @@ import ( // Request holds the request body struct for the package searchmvt // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search_mvt/SearchMvtRequest.ts#L33-L188 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search_mvt/SearchMvtRequest.ts#L33-L188 type Request struct { // Aggs Sub-aggregations for the geotile_grid. diff --git a/typedapi/core/searchmvt/response.go b/typedapi/core/searchmvt/response.go index 871a990602..e8438b663c 100644 --- a/typedapi/core/searchmvt/response.go +++ b/typedapi/core/searchmvt/response.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package searchmvt // Response holds the response body struct for the package searchmvt // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search_mvt/SearchMvtResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search_mvt/SearchMvtResponse.ts#L22-L24 type Response = []byte diff --git a/typedapi/core/searchmvt/search_mvt.go b/typedapi/core/searchmvt/search_mvt.go index 2721435c33..3b5bd65c0b 100644 --- a/typedapi/core/searchmvt/search_mvt.go +++ b/typedapi/core/searchmvt/search_mvt.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Searches a vector tile for geospatial values. Returns results as a binary // Mapbox vector tile. @@ -61,11 +61,11 @@ type SearchMvt struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int @@ -74,6 +74,10 @@ type SearchMvt struct { zoom string x string y string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSearchMvt type alias for index. @@ -102,17 +106,24 @@ func NewSearchMvtFunc(tp elastictransport.Interface) NewSearchMvt { // Searches a vector tile for geospatial values. Returns results as a binary // Mapbox vector tile. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-vector-tile-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-vector-tile-api.html func New(tp elastictransport.Interface) *SearchMvt { r := &SearchMvt{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -149,9 +160,7 @@ func (r *SearchMvt) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -163,26 +172,45 @@ func (r *SearchMvt) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|fieldMask|zoomMask|xMask|yMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_mvt") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "field", r.field) + } path.WriteString(r.field) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "zoom", r.zoom) + } path.WriteString(r.zoom) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "x", r.x) + } path.WriteString(r.x) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "y", r.y) + } path.WriteString(r.y) method = http.MethodPost @@ -196,15 +224,15 @@ func (r *SearchMvt) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/json") } } @@ -221,27 +249,66 @@ func (r *SearchMvt) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SearchMvt) Perform(ctx context.Context) (*http.Response, error) { +func (r SearchMvt) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_mvt") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_mvt") + if reader := instrument.RecordRequestBody(ctx, "search_mvt", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_mvt") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SearchMvt query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SearchMvt query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a searchmvt.Response -func (r SearchMvt) Do(ctx context.Context) (Response, error) { +func (r SearchMvt) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_mvt") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -249,6 +316,9 @@ func (r SearchMvt) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -258,6 +328,9 @@ func (r SearchMvt) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -265,6 +338,9 @@ func (r SearchMvt) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/searchshards/response.go b/typedapi/core/searchshards/response.go index 0cc6a2307a..f2226af746 100644 --- a/typedapi/core/searchshards/response.go +++ b/typedapi/core/searchshards/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package searchshards @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package searchshards // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search_shards/SearchShardsResponse.ts#L25-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search_shards/SearchShardsResponse.ts#L25-L31 type Response struct { Indices map[string]types.ShardStoreIndex `json:"indices"` Nodes map[string]types.NodeAttributes `json:"nodes"` diff --git a/typedapi/core/searchshards/search_shards.go b/typedapi/core/searchshards/search_shards.go index 8561bed6c8..4d6889f4b8 100644 --- a/typedapi/core/searchshards/search_shards.go +++ b/typedapi/core/searchshards/search_shards.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about the indices and shards that a search request would // be executed against. package searchshards import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type SearchShards struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSearchShards type alias for index. @@ -77,13 +80,18 @@ func NewSearchShardsFunc(tp elastictransport.Interface) NewSearchShards { // Returns information about the indices and shards that a search request would // be executed against. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html func New(tp elastictransport.Interface) *SearchShards { r := &SearchShards{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,6 +117,9 @@ func (r *SearchShards) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_search_shards") @@ -124,9 +135,9 @@ func (r *SearchShards) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -143,27 +154,66 @@ func (r *SearchShards) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SearchShards) Perform(ctx context.Context) (*http.Response, error) { +func (r SearchShards) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_shards") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_shards") + if reader := instrument.RecordRequestBody(ctx, "search_shards", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_shards") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SearchShards query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SearchShards query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a searchshards.Response -func (r SearchShards) Do(ctx context.Context) (*Response, error) { +func (r SearchShards) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_shards") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -171,6 +221,9 @@ func (r SearchShards) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,6 +233,9 @@ func (r SearchShards) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,12 +243,25 @@ func (r SearchShards) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r SearchShards) IsSuccess(ctx context.Context) (bool, error) { +func (r SearchShards) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_shards") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -208,6 +277,14 @@ func (r SearchShards) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the SearchShards query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/core/searchtemplate/request.go b/typedapi/core/searchtemplate/request.go index ecf8472a46..e0f0d32287 100644 --- a/typedapi/core/searchtemplate/request.go +++ b/typedapi/core/searchtemplate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package searchtemplate @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package searchtemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search_template/SearchTemplateRequest.ts#L32-L134 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search_template/SearchTemplateRequest.ts#L32-L134 type Request struct { // Explain If `true`, returns detailed information about score calculation as part of diff --git a/typedapi/core/searchtemplate/response.go b/typedapi/core/searchtemplate/response.go index 8ad3f43fd9..04c2d8c6a5 100644 --- a/typedapi/core/searchtemplate/response.go +++ b/typedapi/core/searchtemplate/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package searchtemplate @@ -33,8 +33,7 @@ import ( // Response holds the response body struct for the package searchtemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search_template/SearchTemplateResponse.ts#L30-L48 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search_template/SearchTemplateResponse.ts#L30-L48 type Response struct { Aggregations map[string]types.Aggregate `json:"aggregations,omitempty"` Clusters_ *types.ClusterStatistics `json:"_clusters,omitempty"` diff --git a/typedapi/core/searchtemplate/search_template.go b/typedapi/core/searchtemplate/search_template.go index 7e8be7d949..bf0232e47e 100644 --- a/typedapi/core/searchtemplate/search_template.go +++ b/typedapi/core/searchtemplate/search_template.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to use the Mustache language to pre-render a search definition. package searchtemplate @@ -53,15 +53,19 @@ type SearchTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSearchTemplate type alias for index. @@ -85,11 +89,18 @@ func New(tp elastictransport.Interface) *SearchTemplate { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *SearchTemplate) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *SearchTemplate) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,6 +166,9 @@ func (r *SearchTemplate) HttpRequest(ctx context.Context) (*http.Request, error) case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_search") @@ -170,15 +186,15 @@ func (r *SearchTemplate) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -195,22 +211,58 @@ func (r *SearchTemplate) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SearchTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r SearchTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_template") + if reader := instrument.RecordRequestBody(ctx, "search_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SearchTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SearchTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a searchtemplate.Response -func (r SearchTemplate) Do(ctx context.Context) (*Response, error) { +func (r SearchTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() @@ -218,6 +270,9 @@ func (r SearchTemplate) Do(ctx context.Context) (*Response, error) { res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -225,6 +280,9 @@ func (r SearchTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +292,9 @@ func (r SearchTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -241,6 +302,9 @@ func (r SearchTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/termsenum/request.go b/typedapi/core/termsenum/request.go index c48300ce1b..e67e159f9a 100644 --- a/typedapi/core/termsenum/request.go +++ b/typedapi/core/termsenum/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package termsenum @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package termsenum // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/terms_enum/TermsEnumRequest.ts#L26-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/terms_enum/TermsEnumRequest.ts#L26-L65 type Request struct { // CaseInsensitive When true the provided search string is matched against index terms without diff --git a/typedapi/core/termsenum/response.go b/typedapi/core/termsenum/response.go index aab66c1d95..227b29dab6 100644 --- a/typedapi/core/termsenum/response.go +++ b/typedapi/core/termsenum/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package termsenum @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package termsenum // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/terms_enum/TermsEnumResponse.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/terms_enum/TermsEnumResponse.ts#L22-L28 type Response struct { Complete bool `json:"complete"` Shards_ types.ShardStatistics `json:"_shards"` diff --git a/typedapi/core/termsenum/terms_enum.go b/typedapi/core/termsenum/terms_enum.go index e9dc41ef66..12a0ef0b74 100644 --- a/typedapi/core/termsenum/terms_enum.go +++ b/typedapi/core/termsenum/terms_enum.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // The terms enum API can be used to discover terms in the index that begin // with the provided string. It is designed for low-latency look-ups used in @@ -52,15 +52,19 @@ type TermsEnum struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewTermsEnum type alias for index. @@ -88,11 +92,18 @@ func New(tp elastictransport.Interface) *TermsEnum { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -129,9 +140,7 @@ func (r *TermsEnum) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -143,12 +152,19 @@ func (r *TermsEnum) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_terms_enum") @@ -164,15 +180,15 @@ func (r *TermsEnum) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *TermsEnum) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r TermsEnum) Perform(ctx context.Context) (*http.Response, error) { +func (r TermsEnum) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "terms_enum") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "terms_enum") + if reader := instrument.RecordRequestBody(ctx, "terms_enum", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "terms_enum") + } if err != nil { - return nil, fmt.Errorf("an error happened during the TermsEnum query execution: %w", err) + localErr := fmt.Errorf("an error happened during the TermsEnum query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a termsenum.Response -func (r TermsEnum) Do(ctx context.Context) (*Response, error) { +func (r TermsEnum) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "terms_enum") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r TermsEnum) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r TermsEnum) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r TermsEnum) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/termvectors/request.go b/typedapi/core/termvectors/request.go index 3113752825..3abe289800 100644 --- a/typedapi/core/termvectors/request.go +++ b/typedapi/core/termvectors/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package termvectors @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package termvectors // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/termvectors/TermVectorsRequest.ts#L33-L118 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/termvectors/TermVectorsRequest.ts#L33-L118 type Request struct { // Doc An artificial document (a document not present in the index) for which you diff --git a/typedapi/core/termvectors/response.go b/typedapi/core/termvectors/response.go index b7cba1ad9d..620b9525c5 100644 --- a/typedapi/core/termvectors/response.go +++ b/typedapi/core/termvectors/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package termvectors @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package termvectors // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/termvectors/TermVectorsResponse.ts#L25-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/termvectors/TermVectorsResponse.ts#L25-L34 type Response struct { Found bool `json:"found"` Id_ string `json:"_id"` diff --git a/typedapi/core/termvectors/termvectors.go b/typedapi/core/termvectors/termvectors.go index 1d952ede19..ade9f60c9c 100644 --- a/typedapi/core/termvectors/termvectors.go +++ b/typedapi/core/termvectors/termvectors.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information and statistics about terms in the fields of a particular // document. @@ -55,16 +55,20 @@ type Termvectors struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewTermvectors type alias for index. @@ -85,17 +89,24 @@ func NewTermvectorsFunc(tp elastictransport.Interface) NewTermvectors { // Returns information and statistics about terms in the fields of a particular // document. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html func New(tp elastictransport.Interface) *Termvectors { r := &Termvectors{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -132,9 +143,7 @@ func (r *Termvectors) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -146,23 +155,36 @@ func (r *Termvectors) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|idMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_termvectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPost case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_termvectors") @@ -178,15 +200,15 @@ func (r *Termvectors) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -203,27 +225,66 @@ func (r *Termvectors) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Termvectors) Perform(ctx context.Context) (*http.Response, error) { +func (r Termvectors) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "termvectors") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "termvectors") + if reader := instrument.RecordRequestBody(ctx, "termvectors", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "termvectors") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Termvectors query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Termvectors query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a termvectors.Response -func (r Termvectors) Do(ctx context.Context) (*Response, error) { +func (r Termvectors) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "termvectors") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -231,6 +292,9 @@ func (r Termvectors) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -240,6 +304,9 @@ func (r Termvectors) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -247,6 +314,9 @@ func (r Termvectors) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/update/request.go b/typedapi/core/update/request.go index ae962e03ef..23de1113a2 100644 --- a/typedapi/core/update/request.go +++ b/typedapi/core/update/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package update @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package update // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/update/UpdateRequest.ts#L38-L151 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/update/UpdateRequest.ts#L38-L151 type Request struct { // DetectNoop Set to false to disable setting 'result' in the response diff --git a/typedapi/core/update/response.go b/typedapi/core/update/response.go index e575cbce7d..e02a8163bc 100644 --- a/typedapi/core/update/response.go +++ b/typedapi/core/update/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package update @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package update // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/update/UpdateResponse.ts#L27-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/update/UpdateResponse.ts#L27-L29 type Response struct { ForcedRefresh *bool `json:"forced_refresh,omitempty"` Get *types.InlineGet `json:"get,omitempty"` diff --git a/typedapi/core/update/update.go b/typedapi/core/update/update.go index 85cf460b6a..fbc0abb073 100644 --- a/typedapi/core/update/update.go +++ b/typedapi/core/update/update.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates a document with a script or partial document. package update @@ -54,16 +54,20 @@ type Update struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdate type alias for index. @@ -85,17 +89,24 @@ func NewUpdateFunc(tp elastictransport.Interface) NewUpdate { // Updates a document with a script or partial document. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html func New(tp elastictransport.Interface) *Update { r := &Update{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -132,9 +143,7 @@ func (r *Update) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -146,17 +155,27 @@ func (r *Update) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|idMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_update") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPost @@ -170,15 +189,15 @@ func (r *Update) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -195,27 +214,66 @@ func (r *Update) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Update) Perform(ctx context.Context) (*http.Response, error) { +func (r Update) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "update") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "update") + if reader := instrument.RecordRequestBody(ctx, "update", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "update") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Update query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Update query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a update.Response -func (r Update) Do(ctx context.Context) (*Response, error) { +func (r Update) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "update") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -223,6 +281,9 @@ func (r Update) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +293,9 @@ func (r Update) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -239,6 +303,9 @@ func (r Update) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/updatebyquery/request.go b/typedapi/core/updatebyquery/request.go index 0d279df2ff..f2212ccb1a 100644 --- a/typedapi/core/updatebyquery/request.go +++ b/typedapi/core/updatebyquery/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatebyquery @@ -30,7 +30,7 @@ import ( // Request holds the request body struct for the package updatebyquery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/update_by_query/UpdateByQueryRequest.ts#L37-L221 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/update_by_query/UpdateByQueryRequest.ts#L37-L221 type Request struct { // Conflicts What to do if update by query hits version conflicts: `abort` or `proceed`. diff --git a/typedapi/core/updatebyquery/response.go b/typedapi/core/updatebyquery/response.go index b967f12d31..7bc0d65975 100644 --- a/typedapi/core/updatebyquery/response.go +++ b/typedapi/core/updatebyquery/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatebyquery @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package updatebyquery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/update_by_query/UpdateByQueryResponse.ts#L26-L45 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/update_by_query/UpdateByQueryResponse.ts#L26-L45 type Response struct { Batches *int64 `json:"batches,omitempty"` Deleted *int64 `json:"deleted,omitempty"` diff --git a/typedapi/core/updatebyquery/update_by_query.go b/typedapi/core/updatebyquery/update_by_query.go index cf3ca26045..3af697bfb4 100644 --- a/typedapi/core/updatebyquery/update_by_query.go +++ b/typedapi/core/updatebyquery/update_by_query.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Performs an update on every document in the index without changing the // source, @@ -57,15 +57,19 @@ type UpdateByQuery struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateByQuery type alias for index. @@ -87,17 +91,24 @@ func NewUpdateByQueryFunc(tp elastictransport.Interface) NewUpdateByQuery { // source, // for example to pick up a mapping change. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html func New(tp elastictransport.Interface) *UpdateByQuery { r := &UpdateByQuery{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -134,9 +145,7 @@ func (r *UpdateByQuery) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -148,12 +157,19 @@ func (r *UpdateByQuery) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_update_by_query") @@ -169,15 +185,15 @@ func (r *UpdateByQuery) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -194,27 +210,66 @@ func (r *UpdateByQuery) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateByQuery) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateByQuery) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "update_by_query") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "update_by_query") + if reader := instrument.RecordRequestBody(ctx, "update_by_query", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "update_by_query") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateByQuery query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateByQuery query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updatebyquery.Response -func (r UpdateByQuery) Do(ctx context.Context) (*Response, error) { +func (r UpdateByQuery) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "update_by_query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -222,6 +277,9 @@ func (r UpdateByQuery) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +289,9 @@ func (r UpdateByQuery) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -238,6 +299,9 @@ func (r UpdateByQuery) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/core/updatebyqueryrethrottle/response.go b/typedapi/core/updatebyqueryrethrottle/response.go index 79345fb698..bbe39bdacc 100644 --- a/typedapi/core/updatebyqueryrethrottle/response.go +++ b/typedapi/core/updatebyqueryrethrottle/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatebyqueryrethrottle @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package updatebyqueryrethrottle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/update_by_query_rethrottle/UpdateByQueryRethrottleResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/update_by_query_rethrottle/UpdateByQueryRethrottleResponse.ts#L23-L25 type Response struct { Nodes map[string]types.UpdateByQueryRethrottleNode `json:"nodes"` } diff --git a/typedapi/core/updatebyqueryrethrottle/update_by_query_rethrottle.go b/typedapi/core/updatebyqueryrethrottle/update_by_query_rethrottle.go index 4f088f3cf1..12d7979621 100644 --- a/typedapi/core/updatebyqueryrethrottle/update_by_query_rethrottle.go +++ b/typedapi/core/updatebyqueryrethrottle/update_by_query_rethrottle.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Changes the number of requests per second for a particular Update By Query // operation. package updatebyqueryrethrottle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type UpdateByQueryRethrottle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int taskid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateByQueryRethrottle type alias for index. @@ -83,7 +86,12 @@ func New(tp elastictransport.Interface) *UpdateByQueryRethrottle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *UpdateByQueryRethrottle) HttpRequest(ctx context.Context) (*http.Reques path.WriteString("_update_by_query") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "taskid", r.taskid) + } path.WriteString(r.taskid) path.WriteString("/") path.WriteString("_rethrottle") @@ -121,9 +132,9 @@ func (r *UpdateByQueryRethrottle) HttpRequest(ctx context.Context) (*http.Reques } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *UpdateByQueryRethrottle) HttpRequest(ctx context.Context) (*http.Reques } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateByQueryRethrottle) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateByQueryRethrottle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "update_by_query_rethrottle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "update_by_query_rethrottle") + if reader := instrument.RecordRequestBody(ctx, "update_by_query_rethrottle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "update_by_query_rethrottle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateByQueryRethrottle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateByQueryRethrottle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updatebyqueryrethrottle.Response -func (r UpdateByQueryRethrottle) Do(ctx context.Context) (*Response, error) { +func (r UpdateByQueryRethrottle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "update_by_query_rethrottle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r UpdateByQueryRethrottle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r UpdateByQueryRethrottle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r UpdateByQueryRethrottle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r UpdateByQueryRethrottle) IsSuccess(ctx context.Context) (bool, error) { +func (r UpdateByQueryRethrottle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "update_by_query_rethrottle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r UpdateByQueryRethrottle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the UpdateByQueryRethrottle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/danglingindices/deletedanglingindex/delete_dangling_index.go b/typedapi/danglingindices/deletedanglingindex/delete_dangling_index.go index 319f01010f..d55dc24018 100644 --- a/typedapi/danglingindices/deletedanglingindex/delete_dangling_index.go +++ b/typedapi/danglingindices/deletedanglingindex/delete_dangling_index.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes the specified dangling index package deletedanglingindex import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteDanglingIndex struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int indexuuid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteDanglingIndex type alias for index. @@ -76,13 +79,18 @@ func NewDeleteDanglingIndexFunc(tp elastictransport.Interface) NewDeleteDangling // Deletes the specified dangling index // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway-dangling-indices.html func New(tp elastictransport.Interface) *DeleteDanglingIndex { r := &DeleteDanglingIndex{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *DeleteDanglingIndex) HttpRequest(ctx context.Context) (*http.Request, e path.WriteString("_dangling") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "indexuuid", r.indexuuid) + } path.WriteString(r.indexuuid) method = http.MethodDelete @@ -118,9 +129,9 @@ func (r *DeleteDanglingIndex) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -137,27 +148,66 @@ func (r *DeleteDanglingIndex) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteDanglingIndex) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteDanglingIndex) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "dangling_indices.delete_dangling_index") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "dangling_indices.delete_dangling_index") + if reader := instrument.RecordRequestBody(ctx, "dangling_indices.delete_dangling_index", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "dangling_indices.delete_dangling_index") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteDanglingIndex query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteDanglingIndex query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletedanglingindex.Response -func (r DeleteDanglingIndex) Do(ctx context.Context) (*Response, error) { +func (r DeleteDanglingIndex) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "dangling_indices.delete_dangling_index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -165,6 +215,9 @@ func (r DeleteDanglingIndex) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -174,6 +227,9 @@ func (r DeleteDanglingIndex) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,12 +237,25 @@ func (r DeleteDanglingIndex) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteDanglingIndex) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteDanglingIndex) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "dangling_indices.delete_dangling_index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -202,6 +271,14 @@ func (r DeleteDanglingIndex) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteDanglingIndex query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/danglingindices/deletedanglingindex/response.go b/typedapi/danglingindices/deletedanglingindex/response.go index 7acb76f5c2..b4b6d7f569 100644 --- a/typedapi/danglingindices/deletedanglingindex/response.go +++ b/typedapi/danglingindices/deletedanglingindex/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletedanglingindex // Response holds the response body struct for the package deletedanglingindex // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/dangling_indices/delete_dangling_index/DeleteDanglingIndexResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/dangling_indices/delete_dangling_index/DeleteDanglingIndexResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/danglingindices/importdanglingindex/import_dangling_index.go b/typedapi/danglingindices/importdanglingindex/import_dangling_index.go index c3c3d60270..30e7aedaf2 100644 --- a/typedapi/danglingindices/importdanglingindex/import_dangling_index.go +++ b/typedapi/danglingindices/importdanglingindex/import_dangling_index.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Imports the specified dangling index package importdanglingindex import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type ImportDanglingIndex struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int indexuuid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewImportDanglingIndex type alias for index. @@ -76,13 +79,18 @@ func NewImportDanglingIndexFunc(tp elastictransport.Interface) NewImportDangling // Imports the specified dangling index // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway-dangling-indices.html func New(tp elastictransport.Interface) *ImportDanglingIndex { r := &ImportDanglingIndex{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *ImportDanglingIndex) HttpRequest(ctx context.Context) (*http.Request, e path.WriteString("_dangling") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "indexuuid", r.indexuuid) + } path.WriteString(r.indexuuid) method = http.MethodPost @@ -118,9 +129,9 @@ func (r *ImportDanglingIndex) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -137,27 +148,66 @@ func (r *ImportDanglingIndex) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ImportDanglingIndex) Perform(ctx context.Context) (*http.Response, error) { +func (r ImportDanglingIndex) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "dangling_indices.import_dangling_index") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "dangling_indices.import_dangling_index") + if reader := instrument.RecordRequestBody(ctx, "dangling_indices.import_dangling_index", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "dangling_indices.import_dangling_index") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ImportDanglingIndex query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ImportDanglingIndex query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a importdanglingindex.Response -func (r ImportDanglingIndex) Do(ctx context.Context) (*Response, error) { +func (r ImportDanglingIndex) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "dangling_indices.import_dangling_index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -165,6 +215,9 @@ func (r ImportDanglingIndex) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -174,6 +227,9 @@ func (r ImportDanglingIndex) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,12 +237,25 @@ func (r ImportDanglingIndex) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ImportDanglingIndex) IsSuccess(ctx context.Context) (bool, error) { +func (r ImportDanglingIndex) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "dangling_indices.import_dangling_index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -202,6 +271,14 @@ func (r ImportDanglingIndex) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ImportDanglingIndex query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/danglingindices/importdanglingindex/response.go b/typedapi/danglingindices/importdanglingindex/response.go index 7ffd3ab392..4377f8a65b 100644 --- a/typedapi/danglingindices/importdanglingindex/response.go +++ b/typedapi/danglingindices/importdanglingindex/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package importdanglingindex // Response holds the response body struct for the package importdanglingindex // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/dangling_indices/import_dangling_index/ImportDanglingIndexResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/dangling_indices/import_dangling_index/ImportDanglingIndexResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/danglingindices/listdanglingindices/list_dangling_indices.go b/typedapi/danglingindices/listdanglingindices/list_dangling_indices.go index 430b197994..b24283cf98 100644 --- a/typedapi/danglingindices/listdanglingindices/list_dangling_indices.go +++ b/typedapi/danglingindices/listdanglingindices/list_dangling_indices.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns all dangling indices. package listdanglingindices import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type ListDanglingIndices struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewListDanglingIndices type alias for index. @@ -67,13 +70,18 @@ func NewListDanglingIndicesFunc(tp elastictransport.Interface) NewListDanglingIn // Returns all dangling indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway-dangling-indices.html func New(tp elastictransport.Interface) *ListDanglingIndices { r := &ListDanglingIndices{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,9 +114,9 @@ func (r *ListDanglingIndices) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -125,27 +133,66 @@ func (r *ListDanglingIndices) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ListDanglingIndices) Perform(ctx context.Context) (*http.Response, error) { +func (r ListDanglingIndices) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "dangling_indices.list_dangling_indices") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "dangling_indices.list_dangling_indices") + if reader := instrument.RecordRequestBody(ctx, "dangling_indices.list_dangling_indices", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "dangling_indices.list_dangling_indices") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ListDanglingIndices query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ListDanglingIndices query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a listdanglingindices.Response -func (r ListDanglingIndices) Do(ctx context.Context) (*Response, error) { +func (r ListDanglingIndices) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "dangling_indices.list_dangling_indices") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -153,6 +200,9 @@ func (r ListDanglingIndices) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -162,6 +212,9 @@ func (r ListDanglingIndices) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -169,12 +222,25 @@ func (r ListDanglingIndices) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ListDanglingIndices) IsSuccess(ctx context.Context) (bool, error) { +func (r ListDanglingIndices) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "dangling_indices.list_dangling_indices") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -190,6 +256,14 @@ func (r ListDanglingIndices) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ListDanglingIndices query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/danglingindices/listdanglingindices/response.go b/typedapi/danglingindices/listdanglingindices/response.go index 7ec6dd3da2..9df3fecf08 100644 --- a/typedapi/danglingindices/listdanglingindices/response.go +++ b/typedapi/danglingindices/listdanglingindices/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package listdanglingindices @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package listdanglingindices // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/dangling_indices/list_dangling_indices/ListDanglingIndicesResponse.ts#L23-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/dangling_indices/list_dangling_indices/ListDanglingIndicesResponse.ts#L23-L27 type Response struct { DanglingIndices []types.DanglingIndex `json:"dangling_indices"` } diff --git a/typedapi/enrich/deletepolicy/delete_policy.go b/typedapi/enrich/deletepolicy/delete_policy.go index f1f94d39ee..efb5b5013b 100644 --- a/typedapi/enrich/deletepolicy/delete_policy.go +++ b/typedapi/enrich/deletepolicy/delete_policy.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an existing enrich policy and its enrich index. package deletepolicy import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeletePolicy struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeletePolicy type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *DeletePolicy { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeletePolicy) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *DeletePolicy) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *DeletePolicy) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeletePolicy) Perform(ctx context.Context) (*http.Response, error) { +func (r DeletePolicy) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "enrich.delete_policy") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "enrich.delete_policy") + if reader := instrument.RecordRequestBody(ctx, "enrich.delete_policy", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "enrich.delete_policy") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeletePolicy query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeletePolicy query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletepolicy.Response -func (r DeletePolicy) Do(ctx context.Context) (*Response, error) { +func (r DeletePolicy) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.delete_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r DeletePolicy) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r DeletePolicy) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r DeletePolicy) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeletePolicy) IsSuccess(ctx context.Context) (bool, error) { +func (r DeletePolicy) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.delete_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r DeletePolicy) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeletePolicy query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/enrich/deletepolicy/response.go b/typedapi/enrich/deletepolicy/response.go index e723605407..ed4b0f96fb 100644 --- a/typedapi/enrich/deletepolicy/response.go +++ b/typedapi/enrich/deletepolicy/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletepolicy // Response holds the response body struct for the package deletepolicy // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/delete_policy/DeleteEnrichPolicyResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/delete_policy/DeleteEnrichPolicyResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/enrich/executepolicy/execute_policy.go b/typedapi/enrich/executepolicy/execute_policy.go index 1f33b84612..62b2ff2590 100644 --- a/typedapi/enrich/executepolicy/execute_policy.go +++ b/typedapi/enrich/executepolicy/execute_policy.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates the enrich index for an existing enrich policy. package executepolicy import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type ExecutePolicy struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExecutePolicy type alias for index. @@ -76,13 +79,18 @@ func NewExecutePolicyFunc(tp elastictransport.Interface) NewExecutePolicy { // Creates the enrich index for an existing enrich policy. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/execute-enrich-policy-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/execute-enrich-policy-api.html func New(tp elastictransport.Interface) *ExecutePolicy { r := &ExecutePolicy{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *ExecutePolicy) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) path.WriteString("/") path.WriteString("_execute") @@ -122,9 +133,9 @@ func (r *ExecutePolicy) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *ExecutePolicy) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExecutePolicy) Perform(ctx context.Context) (*http.Response, error) { +func (r ExecutePolicy) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "enrich.execute_policy") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "enrich.execute_policy") + if reader := instrument.RecordRequestBody(ctx, "enrich.execute_policy", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "enrich.execute_policy") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExecutePolicy query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExecutePolicy query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a executepolicy.Response -func (r ExecutePolicy) Do(ctx context.Context) (*Response, error) { +func (r ExecutePolicy) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.execute_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r ExecutePolicy) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r ExecutePolicy) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r ExecutePolicy) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ExecutePolicy) IsSuccess(ctx context.Context) (bool, error) { +func (r ExecutePolicy) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.execute_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r ExecutePolicy) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ExecutePolicy query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/enrich/executepolicy/response.go b/typedapi/enrich/executepolicy/response.go index a002e825cb..2a7f7fcd5b 100644 --- a/typedapi/enrich/executepolicy/response.go +++ b/typedapi/enrich/executepolicy/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package executepolicy @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package executepolicy // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/execute_policy/ExecuteEnrichPolicyResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/execute_policy/ExecuteEnrichPolicyResponse.ts#L23-L28 type Response struct { Status types.ExecuteEnrichPolicyStatus `json:"status"` TaskId types.TaskId `json:"task_id,omitempty"` diff --git a/typedapi/enrich/getpolicy/get_policy.go b/typedapi/enrich/getpolicy/get_policy.go index b950c0cf34..4bec6b5c35 100644 --- a/typedapi/enrich/getpolicy/get_policy.go +++ b/typedapi/enrich/getpolicy/get_policy.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets information about an enrich policy. package getpolicy import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type GetPolicy struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetPolicy type alias for index. @@ -79,7 +82,12 @@ func New(tp elastictransport.Interface) *GetPolicy { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *GetPolicy) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -124,9 +135,9 @@ func (r *GetPolicy) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -143,27 +154,66 @@ func (r *GetPolicy) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetPolicy) Perform(ctx context.Context) (*http.Response, error) { +func (r GetPolicy) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "enrich.get_policy") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "enrich.get_policy") + if reader := instrument.RecordRequestBody(ctx, "enrich.get_policy", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "enrich.get_policy") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetPolicy query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetPolicy query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getpolicy.Response -func (r GetPolicy) Do(ctx context.Context) (*Response, error) { +func (r GetPolicy) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.get_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -171,6 +221,9 @@ func (r GetPolicy) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,6 +233,9 @@ func (r GetPolicy) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,12 +243,25 @@ func (r GetPolicy) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetPolicy) IsSuccess(ctx context.Context) (bool, error) { +func (r GetPolicy) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.get_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -208,6 +277,14 @@ func (r GetPolicy) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetPolicy query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/enrich/getpolicy/response.go b/typedapi/enrich/getpolicy/response.go index 783591de8e..63835a6e35 100644 --- a/typedapi/enrich/getpolicy/response.go +++ b/typedapi/enrich/getpolicy/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getpolicy @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getpolicy // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/get_policy/GetEnrichPolicyResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/get_policy/GetEnrichPolicyResponse.ts#L22-L24 type Response struct { Policies []types.Summary `json:"policies"` } diff --git a/typedapi/enrich/putpolicy/put_policy.go b/typedapi/enrich/putpolicy/put_policy.go index 5a29bbfdb1..8e13379e01 100644 --- a/typedapi/enrich/putpolicy/put_policy.go +++ b/typedapi/enrich/putpolicy/put_policy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a new enrich policy. package putpolicy @@ -50,15 +50,19 @@ type PutPolicy struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutPolicy type alias for index. @@ -78,17 +82,24 @@ func NewPutPolicyFunc(tp elastictransport.Interface) NewPutPolicy { // Creates a new enrich policy. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/put-enrich-policy-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/put-enrich-policy-api.html func New(tp elastictransport.Interface) *PutPolicy { r := &PutPolicy{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutPolicy) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutPolicy) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutPolicy) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -162,15 +178,15 @@ func (r *PutPolicy) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *PutPolicy) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutPolicy) Perform(ctx context.Context) (*http.Response, error) { +func (r PutPolicy) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "enrich.put_policy") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "enrich.put_policy") + if reader := instrument.RecordRequestBody(ctx, "enrich.put_policy", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "enrich.put_policy") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutPolicy query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutPolicy query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putpolicy.Response -func (r PutPolicy) Do(ctx context.Context) (*Response, error) { +func (r PutPolicy) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.put_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r PutPolicy) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r PutPolicy) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r PutPolicy) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/enrich/putpolicy/request.go b/typedapi/enrich/putpolicy/request.go index 402b1b6216..7239f045b6 100644 --- a/typedapi/enrich/putpolicy/request.go +++ b/typedapi/enrich/putpolicy/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putpolicy @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putpolicy // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/put_policy/PutEnrichPolicyRequest.ts#L24-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/put_policy/PutEnrichPolicyRequest.ts#L24-L52 type Request struct { // GeoMatch Matches enrich data to incoming documents based on a `geo_shape` query. diff --git a/typedapi/enrich/putpolicy/response.go b/typedapi/enrich/putpolicy/response.go index 3fcd2b3f96..9480513fb0 100644 --- a/typedapi/enrich/putpolicy/response.go +++ b/typedapi/enrich/putpolicy/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putpolicy // Response holds the response body struct for the package putpolicy // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/put_policy/PutEnrichPolicyResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/put_policy/PutEnrichPolicyResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/enrich/stats/response.go b/typedapi/enrich/stats/response.go index a189d8fbcc..40b59468d0 100644 --- a/typedapi/enrich/stats/response.go +++ b/typedapi/enrich/stats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package stats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/stats/EnrichStatsResponse.ts#L22-L39 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/stats/EnrichStatsResponse.ts#L22-L39 type Response struct { // CacheStats Objects containing information about the enrich cache stats on each ingest diff --git a/typedapi/enrich/stats/stats.go b/typedapi/enrich/stats/stats.go index 2d6900c195..9dfc25fb04 100644 --- a/typedapi/enrich/stats/stats.go +++ b/typedapi/enrich/stats/stats.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets enrich coordinator statistics and information about enrich policies that // are currently executing. package stats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type Stats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStats type alias for index. @@ -75,7 +78,12 @@ func New(tp elastictransport.Interface) *Stats { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Stats) Perform(ctx context.Context) (*http.Response, error) { +func (r Stats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "enrich.stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "enrich.stats") + if reader := instrument.RecordRequestBody(ctx, "enrich.stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "enrich.stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Stats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Stats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stats.Response -func (r Stats) Do(ctx context.Context) (*Response, error) { +func (r Stats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Stats) IsSuccess(ctx context.Context) (bool, error) { +func (r Stats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "enrich.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r Stats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Stats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/eql/delete/delete.go b/typedapi/eql/delete/delete.go index 03cabc7942..90f9886cf6 100644 --- a/typedapi/eql/delete/delete.go +++ b/typedapi/eql/delete/delete.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an async EQL search by ID. If the search is still running, the search // request will be cancelled. Otherwise, the saved search results are deleted. package delete import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Delete struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDelete type alias for index. @@ -83,7 +86,12 @@ func New(tp elastictransport.Interface) *Delete { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("search") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -121,9 +132,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Delete) Perform(ctx context.Context) (*http.Response, error) { +func (r Delete) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "eql.delete") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "eql.delete") + if reader := instrument.RecordRequestBody(ctx, "eql.delete", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "eql.delete") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Delete query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Delete query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a delete.Response -func (r Delete) Do(ctx context.Context) (*Response, error) { +func (r Delete) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Delete) IsSuccess(ctx context.Context) (bool, error) { +func (r Delete) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r Delete) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Delete query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/eql/delete/response.go b/typedapi/eql/delete/response.go index dd9b926933..9d984e55f3 100644 --- a/typedapi/eql/delete/response.go +++ b/typedapi/eql/delete/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package delete // Response holds the response body struct for the package delete // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/eql/delete/EqlDeleteResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/eql/delete/EqlDeleteResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/eql/get/get.go b/typedapi/eql/get/get.go index 14122208fe..8449b8a108 100644 --- a/typedapi/eql/get/get.go +++ b/typedapi/eql/get/get.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns async results from previously executed Event Query Language (EQL) // search package get import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Get struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGet type alias for index. @@ -77,13 +80,18 @@ func NewGetFunc(tp elastictransport.Interface) NewGet { // Returns async results from previously executed Event Query Language (EQL) // search // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-async-eql-search-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-async-eql-search-api.html func New(tp elastictransport.Interface) *Get { r := &Get{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("search") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -121,9 +132,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Get) Perform(ctx context.Context) (*http.Response, error) { +func (r Get) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "eql.get") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "eql.get") + if reader := instrument.RecordRequestBody(ctx, "eql.get", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "eql.get") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Get query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Get query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a get.Response -func (r Get) Do(ctx context.Context) (*Response, error) { +func (r Get) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Get) IsSuccess(ctx context.Context) (bool, error) { +func (r Get) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r Get) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Get query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/eql/get/response.go b/typedapi/eql/get/response.go index 408581c348..e762b478e7 100644 --- a/typedapi/eql/get/response.go +++ b/typedapi/eql/get/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package get @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package get // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/eql/get/EqlGetResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/eql/get/EqlGetResponse.ts#L22-L24 type Response struct { // Hits Contains matching events and sequences. Also contains related metadata. diff --git a/typedapi/eql/getstatus/get_status.go b/typedapi/eql/getstatus/get_status.go index 2bd03c44e6..d4fc9d1786 100644 --- a/typedapi/eql/getstatus/get_status.go +++ b/typedapi/eql/getstatus/get_status.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the status of a previously submitted async or stored Event Query // Language (EQL) search package getstatus import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetStatus struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetStatus type alias for index. @@ -77,13 +80,18 @@ func NewGetStatusFunc(tp elastictransport.Interface) NewGetStatus { // Returns the status of a previously submitted async or stored Event Query // Language (EQL) search // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-async-eql-status-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-async-eql-status-api.html func New(tp elastictransport.Interface) *GetStatus { r := &GetStatus{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,6 +118,9 @@ func (r *GetStatus) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("status") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -123,9 +134,9 @@ func (r *GetStatus) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -142,27 +153,66 @@ func (r *GetStatus) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetStatus) Perform(ctx context.Context) (*http.Response, error) { +func (r GetStatus) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "eql.get_status") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "eql.get_status") + if reader := instrument.RecordRequestBody(ctx, "eql.get_status", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "eql.get_status") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetStatus query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetStatus query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getstatus.Response -func (r GetStatus) Do(ctx context.Context) (*Response, error) { +func (r GetStatus) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.get_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -170,6 +220,9 @@ func (r GetStatus) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -179,6 +232,9 @@ func (r GetStatus) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -186,12 +242,25 @@ func (r GetStatus) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetStatus) IsSuccess(ctx context.Context) (bool, error) { +func (r GetStatus) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.get_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -207,6 +276,14 @@ func (r GetStatus) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetStatus query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/eql/getstatus/response.go b/typedapi/eql/getstatus/response.go index c6e75cd54e..eace03dbbe 100644 --- a/typedapi/eql/getstatus/response.go +++ b/typedapi/eql/getstatus/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getstatus // Response holds the response body struct for the package getstatus // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/eql/get_status/EqlGetStatusResponse.ts#L24-L51 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/eql/get_status/EqlGetStatusResponse.ts#L24-L51 type Response struct { // CompletionStatus For a completed search shows the http status code of the completed search. diff --git a/typedapi/eql/search/request.go b/typedapi/eql/search/request.go index adf084ecc4..8cac01de5d 100644 --- a/typedapi/eql/search/request.go +++ b/typedapi/eql/search/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package search @@ -30,7 +30,7 @@ import ( // Request holds the request body struct for the package search // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/eql/search/EqlSearchRequest.ts#L28-L118 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/eql/search/EqlSearchRequest.ts#L28-L118 type Request struct { CaseSensitive *bool `json:"case_sensitive,omitempty"` // EventCategoryField Field containing the event classification, such as process, file, or network. diff --git a/typedapi/eql/search/response.go b/typedapi/eql/search/response.go index 83393062d1..76a5facdca 100644 --- a/typedapi/eql/search/response.go +++ b/typedapi/eql/search/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package search @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package search // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/eql/search/EqlSearchResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/eql/search/EqlSearchResponse.ts#L22-L24 type Response struct { // Hits Contains matching events and sequences. Also contains related metadata. diff --git a/typedapi/eql/search/search.go b/typedapi/eql/search/search.go index 9d6190cec3..df1d75bb52 100644 --- a/typedapi/eql/search/search.go +++ b/typedapi/eql/search/search.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns results matching a query expressed in Event Query Language (EQL) package search @@ -53,15 +53,19 @@ type Search struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSearch type alias for index. @@ -87,11 +91,18 @@ func New(tp elastictransport.Interface) *Search { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -128,9 +139,7 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -142,12 +151,19 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_eql") @@ -165,15 +181,15 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -190,27 +206,66 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Search) Perform(ctx context.Context) (*http.Response, error) { +func (r Search) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "eql.search") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "eql.search") + if reader := instrument.RecordRequestBody(ctx, "eql.search", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "eql.search") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Search query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Search query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a search.Response -func (r Search) Do(ctx context.Context) (*Response, error) { +func (r Search) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "eql.search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -218,6 +273,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -227,6 +285,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +295,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/esql/query/query.go b/typedapi/esql/query/query.go new file mode 100644 index 0000000000..d3f85acb55 --- /dev/null +++ b/typedapi/esql/query/query.go @@ -0,0 +1,356 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +// Executes an ESQL request +package query + +import ( + gobytes "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/elastic/elastic-transport-go/v8/elastictransport" + "github.com/elastic/go-elasticsearch/v8/typedapi/types" +) + +// ErrBuildPath is returned in case of missing parameters within the build of the request. +var ErrBuildPath = errors.New("cannot build path, check for missing path parameters") + +type Query struct { + transport elastictransport.Interface + + headers http.Header + values url.Values + path url.URL + + raw io.Reader + + req *Request + deferred []func(request *Request) error + buf *gobytes.Buffer + + paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation +} + +// NewQuery type alias for index. +type NewQuery func() *Query + +// NewQueryFunc returns a new instance of Query with the provided transport. +// Used in the index of the library this allows to retrieve every apis in once place. +func NewQueryFunc(tp elastictransport.Interface) NewQuery { + return func() *Query { + n := New(tp) + + return n + } +} + +// Executes an ESQL request +// +// https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-rest.html +func New(tp elastictransport.Interface) *Query { + r := &Query{ + transport: tp, + values: make(url.Values), + headers: make(http.Header), + + buf: gobytes.NewBuffer(nil), + + req: NewRequest(), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + + return r +} + +// Raw takes a json payload as input which is then passed to the http.Request +// If specified Raw takes precedence on Request method. +func (r *Query) Raw(raw io.Reader) *Query { + r.raw = raw + + return r +} + +// Request allows to set the request property with the appropriate payload. +func (r *Query) Request(req *Request) *Query { + r.req = req + + return r +} + +// HttpRequest returns the http.Request object built from the +// given parameters. +func (r *Query) HttpRequest(ctx context.Context) (*http.Request, error) { + var path strings.Builder + var method string + var req *http.Request + + var err error + + if len(r.deferred) > 0 { + for _, f := range r.deferred { + deferredErr := f(r.req) + if deferredErr != nil { + return nil, deferredErr + } + } + } + + if r.raw == nil && r.req != nil { + + data, err := json.Marshal(r.req) + + if err != nil { + return nil, fmt.Errorf("could not serialise request for Query: %w", err) + } + + r.buf.Write(data) + + } + + if r.buf.Len() > 0 { + r.raw = r.buf + } + + r.path.Scheme = "http" + + switch { + case r.paramSet == 0: + path.WriteString("/") + path.WriteString("_query") + + method = http.MethodPost + } + + r.path.Path = path.String() + r.path.RawQuery = r.values.Encode() + + if r.path.Path == "" { + return nil, ErrBuildPath + } + + if ctx != nil { + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) + } else { + req, err = http.NewRequest(method, r.path.String(), r.raw) + } + + req.Header = r.headers.Clone() + + if req.Header.Get("Content-Type") == "" { + if r.raw != nil { + req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") + } + } + + if req.Header.Get("Accept") == "" { + req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=8") + } + + if err != nil { + return req, fmt.Errorf("could not build http.Request: %w", err) + } + + return req, nil +} + +// Perform runs the http.Request through the provided transport and returns an http.Response. +func (r Query) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "esql.query") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + + req, err := r.HttpRequest(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "esql.query") + if reader := instrument.RecordRequestBody(ctx, "esql.query", r.raw); reader != nil { + req.Body = reader + } + } + res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "esql.query") + } + if err != nil { + localErr := fmt.Errorf("an error happened during the Query query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr + } + + return res, nil +} + +// Do runs the request through the transport, handle the response and returns a query.Response +func (r Query) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "esql.query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + response := NewResponse() + + res, err := r.Perform(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + defer res.Body.Close() + + if res.StatusCode < 299 { + err = json.NewDecoder(res.Body).Decode(&response) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + return response, nil + } + + errorResponse := types.NewElasticsearchError() + err = json.NewDecoder(res.Body).Decode(errorResponse) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if errorResponse.Status == 0 { + errorResponse.Status = res.StatusCode + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } + return nil, errorResponse +} + +// Header set a key, value pair in the Query headers map. +func (r *Query) Header(key, value string) *Query { + r.headers.Set(key, value) + + return r +} + +// Format A short version of the Accept header, e.g. json, yaml. +// API name: format +func (r *Query) Format(format string) *Query { + r.values.Set("format", format) + + return r +} + +// Delimiter The character to use between values within a CSV row. Only valid for the CSV +// format. +// API name: delimiter +func (r *Query) Delimiter(delimiter string) *Query { + r.values.Set("delimiter", delimiter) + + return r +} + +// Columnar By default, ES|QL returns results as rows. For example, FROM returns each +// individual document as one row. For the JSON, YAML, CBOR and smile formats, +// ES|QL can return the results in a columnar fashion where one row represents +// all the values of a certain column in the results. +// API name: columnar +func (r *Query) Columnar(columnar bool) *Query { + r.req.Columnar = &columnar + + return r +} + +// Filter Specify a Query DSL query in the filter parameter to filter the set of +// documents that an ES|QL query runs on. +// API name: filter +func (r *Query) Filter(filter *types.Query) *Query { + + r.req.Filter = filter + + return r +} + +// API name: locale +func (r *Query) Locale(locale string) *Query { + + r.req.Locale = &locale + + return r +} + +// Params To avoid any attempts of hacking or code injection, extract the values in a +// separate list of parameters. Use question mark placeholders (?) in the query +// string for each of the parameters. +// API name: params +func (r *Query) Params(params ...types.ScalarValue) *Query { + r.req.Params = params + + return r +} + +// Query The ES|QL query API accepts an ES|QL query string in the query parameter, +// runs it, and returns the results. +// API name: query +func (r *Query) Query(query string) *Query { + + r.req.Query = query + + return r +} diff --git a/typedapi/esql/query/request.go b/typedapi/esql/query/request.go new file mode 100644 index 0000000000..15ab2e6da0 --- /dev/null +++ b/typedapi/esql/query/request.go @@ -0,0 +1,69 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package query + +import ( + "encoding/json" + "fmt" + + "github.com/elastic/go-elasticsearch/v8/typedapi/types" +) + +// Request holds the request body struct for the package query +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/esql/query/QueryRequest.ts#L24-L64 +type Request struct { + + // Columnar By default, ES|QL returns results as rows. For example, FROM returns each + // individual document as one row. For the JSON, YAML, CBOR and smile formats, + // ES|QL can return the results in a columnar fashion where one row represents + // all the values of a certain column in the results. + Columnar *bool `json:"columnar,omitempty"` + // Filter Specify a Query DSL query in the filter parameter to filter the set of + // documents that an ES|QL query runs on. + Filter *types.Query `json:"filter,omitempty"` + Locale *string `json:"locale,omitempty"` + // Params To avoid any attempts of hacking or code injection, extract the values in a + // separate list of parameters. Use question mark placeholders (?) in the query + // string for each of the parameters. + Params []types.ScalarValue `json:"params,omitempty"` + // Query The ES|QL query API accepts an ES|QL query string in the query parameter, + // runs it, and returns the results. + Query string `json:"query"` +} + +// NewRequest returns a Request +func NewRequest() *Request { + r := &Request{} + return r +} + +// FromJSON allows to load an arbitrary json into the request structure +func (r *Request) FromJSON(data string) (*Request, error) { + var req Request + err := json.Unmarshal([]byte(data), &req) + + if err != nil { + return nil, fmt.Errorf("could not deserialise json into Query request: %w", err) + } + + return &req, nil +} diff --git a/typedapi/esql/query/response.go b/typedapi/esql/query/response.go new file mode 100644 index 0000000000..5c8192bc7b --- /dev/null +++ b/typedapi/esql/query/response.go @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package query + +// Response holds the response body struct for the package query +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/esql/query/QueryResponse.ts#L22-L24 + +type Response = []byte + +// NewResponse returns a Response +func NewResponse() Response { + r := Response{} + return r +} diff --git a/typedapi/features/getfeatures/get_features.go b/typedapi/features/getfeatures/get_features.go index 66c8a2b296..a9f7b3f3bb 100644 --- a/typedapi/features/getfeatures/get_features.go +++ b/typedapi/features/getfeatures/get_features.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets a list of features which can be included in snapshots using the // feature_states field when creating a snapshot package getfeatures import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type GetFeatures struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetFeatures type alias for index. @@ -69,13 +72,18 @@ func NewGetFeaturesFunc(tp elastictransport.Interface) NewGetFeatures { // Gets a list of features which can be included in snapshots using the // feature_states field when creating a snapshot // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-features-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-features-api.html func New(tp elastictransport.Interface) *GetFeatures { r := &GetFeatures{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *GetFeatures) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *GetFeatures) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetFeatures) Perform(ctx context.Context) (*http.Response, error) { +func (r GetFeatures) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "features.get_features") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "features.get_features") + if reader := instrument.RecordRequestBody(ctx, "features.get_features", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "features.get_features") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetFeatures query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetFeatures query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getfeatures.Response -func (r GetFeatures) Do(ctx context.Context) (*Response, error) { +func (r GetFeatures) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "features.get_features") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r GetFeatures) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r GetFeatures) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r GetFeatures) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetFeatures) IsSuccess(ctx context.Context) (bool, error) { +func (r GetFeatures) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "features.get_features") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r GetFeatures) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetFeatures query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/features/getfeatures/response.go b/typedapi/features/getfeatures/response.go index 498d801ccb..4fcb4ee121 100644 --- a/typedapi/features/getfeatures/response.go +++ b/typedapi/features/getfeatures/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getfeatures @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getfeatures // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/features/get_features/GetFeaturesResponse.ts#L22-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/features/get_features/GetFeaturesResponse.ts#L22-L26 type Response struct { Features []types.Feature `json:"features"` } diff --git a/typedapi/features/resetfeatures/reset_features.go b/typedapi/features/resetfeatures/reset_features.go index 468b9c8570..453c8d15f6 100644 --- a/typedapi/features/resetfeatures/reset_features.go +++ b/typedapi/features/resetfeatures/reset_features.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Resets the internal state of features, usually by deleting system indices package resetfeatures import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type ResetFeatures struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewResetFeatures type alias for index. @@ -67,13 +70,18 @@ func NewResetFeaturesFunc(tp elastictransport.Interface) NewResetFeatures { // Resets the internal state of features, usually by deleting system indices // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *ResetFeatures { r := &ResetFeatures{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *ResetFeatures) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *ResetFeatures) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ResetFeatures) Perform(ctx context.Context) (*http.Response, error) { +func (r ResetFeatures) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "features.reset_features") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "features.reset_features") + if reader := instrument.RecordRequestBody(ctx, "features.reset_features", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "features.reset_features") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ResetFeatures query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ResetFeatures query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a resetfeatures.Response -func (r ResetFeatures) Do(ctx context.Context) (*Response, error) { +func (r ResetFeatures) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "features.reset_features") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r ResetFeatures) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r ResetFeatures) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r ResetFeatures) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ResetFeatures) IsSuccess(ctx context.Context) (bool, error) { +func (r ResetFeatures) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "features.reset_features") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r ResetFeatures) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ResetFeatures query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/features/resetfeatures/response.go b/typedapi/features/resetfeatures/response.go index eae85299c2..ebc9c717db 100644 --- a/typedapi/features/resetfeatures/response.go +++ b/typedapi/features/resetfeatures/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package resetfeatures @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package resetfeatures // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/features/reset_features/ResetFeaturesResponse.ts#L22-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/features/reset_features/ResetFeaturesResponse.ts#L22-L26 type Response struct { Features []types.Feature `json:"features"` } diff --git a/typedapi/fleet/globalcheckpoints/global_checkpoints.go b/typedapi/fleet/globalcheckpoints/global_checkpoints.go index c048bc7841..3e2c699697 100644 --- a/typedapi/fleet/globalcheckpoints/global_checkpoints.go +++ b/typedapi/fleet/globalcheckpoints/global_checkpoints.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the current global checkpoints for an index. This API is design for // internal use by the fleet server project. package globalcheckpoints import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type GlobalCheckpoints struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGlobalCheckpoints type alias for index. @@ -84,7 +87,12 @@ func New(tp elastictransport.Interface) *GlobalCheckpoints { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *GlobalCheckpoints) HttpRequest(ctx context.Context) (*http.Request, err case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_fleet") @@ -122,15 +133,15 @@ func (r *GlobalCheckpoints) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -147,27 +158,66 @@ func (r *GlobalCheckpoints) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GlobalCheckpoints) Perform(ctx context.Context) (*http.Response, error) { +func (r GlobalCheckpoints) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "fleet.global_checkpoints") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "fleet.global_checkpoints") + if reader := instrument.RecordRequestBody(ctx, "fleet.global_checkpoints", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "fleet.global_checkpoints") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GlobalCheckpoints query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GlobalCheckpoints query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a globalcheckpoints.Response -func (r GlobalCheckpoints) Do(ctx context.Context) (*Response, error) { +func (r GlobalCheckpoints) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.global_checkpoints") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -175,6 +225,9 @@ func (r GlobalCheckpoints) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,6 +237,9 @@ func (r GlobalCheckpoints) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -191,12 +247,25 @@ func (r GlobalCheckpoints) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GlobalCheckpoints) IsSuccess(ctx context.Context) (bool, error) { +func (r GlobalCheckpoints) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.global_checkpoints") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -212,6 +281,14 @@ func (r GlobalCheckpoints) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GlobalCheckpoints query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/fleet/globalcheckpoints/response.go b/typedapi/fleet/globalcheckpoints/response.go index 6cd2a3715e..9ead90ea6f 100644 --- a/typedapi/fleet/globalcheckpoints/response.go +++ b/typedapi/fleet/globalcheckpoints/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package globalcheckpoints // Response holds the response body struct for the package globalcheckpoints // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/fleet/global_checkpoints/GlobalCheckpointsResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/fleet/global_checkpoints/GlobalCheckpointsResponse.ts#L22-L27 type Response struct { GlobalCheckpoints []int64 `json:"global_checkpoints"` TimedOut bool `json:"timed_out"` diff --git a/typedapi/fleet/msearch/msearch.go b/typedapi/fleet/msearch/msearch.go index 831f947eae..da940378d7 100644 --- a/typedapi/fleet/msearch/msearch.go +++ b/typedapi/fleet/msearch/msearch.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Multi Search API where the search will only be executed after specified // checkpoints are available due to a refresh. This API is designed for internal @@ -55,15 +55,19 @@ type Msearch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMsearch type alias for index. @@ -89,7 +93,14 @@ func New(tp elastictransport.Interface) *Msearch { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -128,9 +139,7 @@ func (r *Msearch) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { for _, elem := range *r.req { data, err := json.Marshal(elem) @@ -147,6 +156,10 @@ func (r *Msearch) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -160,6 +173,9 @@ func (r *Msearch) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_fleet") @@ -177,15 +193,15 @@ func (r *Msearch) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+x-ndjson;compatible-with=8") } } @@ -202,22 +218,58 @@ func (r *Msearch) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Msearch) Perform(ctx context.Context) (*http.Response, error) { +func (r Msearch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "fleet.msearch") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "fleet.msearch") + if reader := instrument.RecordRequestBody(ctx, "fleet.msearch", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "fleet.msearch") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Msearch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Msearch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a msearch.Response -func (r Msearch) Do(ctx context.Context) (*Response, error) { +func (r Msearch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.msearch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() @@ -225,6 +277,9 @@ func (r Msearch) Do(ctx context.Context) (*Response, error) { res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -232,6 +287,9 @@ func (r Msearch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -241,6 +299,9 @@ func (r Msearch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -248,6 +309,9 @@ func (r Msearch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/fleet/msearch/request.go b/typedapi/fleet/msearch/request.go index 429d93c807..b47aa9b72e 100644 --- a/typedapi/fleet/msearch/request.go +++ b/typedapi/fleet/msearch/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package msearch @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package msearch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/fleet/msearch/MultiSearchRequest.ts#L32-L115 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/fleet/msearch/MultiSearchRequest.ts#L32-L115 type Request = []types.MsearchRequestItem diff --git a/typedapi/fleet/msearch/response.go b/typedapi/fleet/msearch/response.go index 3ed2c8f550..7105d2d17b 100644 --- a/typedapi/fleet/msearch/response.go +++ b/typedapi/fleet/msearch/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package msearch @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package msearch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/fleet/msearch/MultiSearchResponse.ts#L25-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/fleet/msearch/MultiSearchResponse.ts#L25-L29 type Response struct { Docs []types.MsearchResponseItem `json:"docs"` } diff --git a/typedapi/fleet/postsecret/post_secret.go b/typedapi/fleet/postsecret/post_secret.go new file mode 100644 index 0000000000..c18251c09e --- /dev/null +++ b/typedapi/fleet/postsecret/post_secret.go @@ -0,0 +1,226 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +// Creates a secret stored by Fleet. +package postsecret + +import ( + "context" + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/elastic/elastic-transport-go/v8/elastictransport" +) + +// ErrBuildPath is returned in case of missing parameters within the build of the request. +var ErrBuildPath = errors.New("cannot build path, check for missing path parameters") + +type PostSecret struct { + transport elastictransport.Interface + + headers http.Header + values url.Values + path url.URL + + raw io.Reader + + paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation +} + +// NewPostSecret type alias for index. +type NewPostSecret func() *PostSecret + +// NewPostSecretFunc returns a new instance of PostSecret with the provided transport. +// Used in the index of the library this allows to retrieve every apis in once place. +func NewPostSecretFunc(tp elastictransport.Interface) NewPostSecret { + return func() *PostSecret { + n := New(tp) + + return n + } +} + +// Creates a secret stored by Fleet. +// +// +func New(tp elastictransport.Interface) *PostSecret { + r := &PostSecret{ + transport: tp, + values: make(url.Values), + headers: make(http.Header), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + + return r +} + +// HttpRequest returns the http.Request object built from the +// given parameters. +func (r *PostSecret) HttpRequest(ctx context.Context) (*http.Request, error) { + var path strings.Builder + var method string + var req *http.Request + + var err error + + r.path.Scheme = "http" + + switch { + case r.paramSet == 0: + path.WriteString("/") + path.WriteString("_fleet") + path.WriteString("/") + path.WriteString("secret") + + method = http.MethodPost + } + + r.path.Path = path.String() + r.path.RawQuery = r.values.Encode() + + if r.path.Path == "" { + return nil, ErrBuildPath + } + + if ctx != nil { + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) + } else { + req, err = http.NewRequest(method, r.path.String(), r.raw) + } + + req.Header = r.headers.Clone() + + if req.Header.Get("Accept") == "" { + req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=8") + } + + if err != nil { + return req, fmt.Errorf("could not build http.Request: %w", err) + } + + return req, nil +} + +// Perform runs the http.Request through the provided transport and returns an http.Response. +func (r PostSecret) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "fleet.post_secret") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + + req, err := r.HttpRequest(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "fleet.post_secret") + if reader := instrument.RecordRequestBody(ctx, "fleet.post_secret", r.raw); reader != nil { + req.Body = reader + } + } + res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "fleet.post_secret") + } + if err != nil { + localErr := fmt.Errorf("an error happened during the PostSecret query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr + } + + return res, nil +} + +// Do runs the request through the transport, handle the response and returns a postsecret.Response +func (r PostSecret) Do(ctx context.Context) (bool, error) { + return r.IsSuccess(ctx) +} + +// IsSuccess allows to run a query with a context and retrieve the result as a boolean. +// This only exists for endpoints without a request payload and allows for quick control flow. +func (r PostSecret) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.post_secret") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + res, err := r.Perform(ctx) + + if err != nil { + return false, err + } + io.Copy(ioutil.Discard, res.Body) + err = res.Body.Close() + if err != nil { + return false, err + } + + if res.StatusCode >= 200 && res.StatusCode < 300 { + return true, nil + } + + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PostSecret query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + + return false, nil +} + +// Header set a key, value pair in the PostSecret headers map. +func (r *PostSecret) Header(key, value string) *PostSecret { + r.headers.Set(key, value) + + return r +} diff --git a/typedapi/fleet/search/request.go b/typedapi/fleet/search/request.go index 1145545dd7..df7e7fb5ab 100644 --- a/typedapi/fleet/search/request.go +++ b/typedapi/fleet/search/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package search @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package search // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/fleet/search/SearchRequest.ts#L55-L260 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/fleet/search/SearchRequest.ts#L55-L260 type Request struct { Aggregations map[string]types.Aggregations `json:"aggregations,omitempty"` Collapse *types.FieldCollapse `json:"collapse,omitempty"` diff --git a/typedapi/fleet/search/response.go b/typedapi/fleet/search/response.go index b01a3a3560..053fc138ae 100644 --- a/typedapi/fleet/search/response.go +++ b/typedapi/fleet/search/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package search @@ -33,8 +33,7 @@ import ( // Response holds the response body struct for the package search // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/fleet/search/SearchResponse.ts#L33-L50 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/fleet/search/SearchResponse.ts#L33-L50 type Response struct { Aggregations map[string]types.Aggregate `json:"aggregations,omitempty"` Clusters_ *types.ClusterStatistics `json:"_clusters,omitempty"` diff --git a/typedapi/fleet/search/search.go b/typedapi/fleet/search/search.go index c05868a65a..e56dd03396 100644 --- a/typedapi/fleet/search/search.go +++ b/typedapi/fleet/search/search.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Search API where the search will only be executed after specified checkpoints // are available due to a refresh. This API is designed for internal use by the @@ -57,15 +57,19 @@ type Search struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSearch type alias for index. @@ -93,11 +97,18 @@ func New(tp elastictransport.Interface) *Search { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -134,9 +145,7 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -148,12 +157,19 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_fleet") @@ -171,15 +187,15 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -196,22 +212,58 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Search) Perform(ctx context.Context) (*http.Response, error) { +func (r Search) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "fleet.search") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "fleet.search") + if reader := instrument.RecordRequestBody(ctx, "fleet.search", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "fleet.search") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Search query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Search query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a search.Response -func (r Search) Do(ctx context.Context) (*Response, error) { +func (r Search) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "fleet.search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() @@ -219,6 +271,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -226,6 +281,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +293,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -242,6 +303,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/graph/explore/explore.go b/typedapi/graph/explore/explore.go index b0873f01a4..c33f54e258 100644 --- a/typedapi/graph/explore/explore.go +++ b/typedapi/graph/explore/explore.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Explore extracted and summarized information about the documents and terms in // an index. @@ -51,15 +51,19 @@ type Explore struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExplore type alias for index. @@ -80,17 +84,24 @@ func NewExploreFunc(tp elastictransport.Interface) NewExplore { // Explore extracted and summarized information about the documents and terms in // an index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/graph-explore-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html func New(tp elastictransport.Interface) *Explore { r := &Explore{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *Explore) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,12 +150,19 @@ func (r *Explore) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_graph") @@ -164,15 +180,15 @@ func (r *Explore) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *Explore) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Explore) Perform(ctx context.Context) (*http.Response, error) { +func (r Explore) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "graph.explore") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "graph.explore") + if reader := instrument.RecordRequestBody(ctx, "graph.explore", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "graph.explore") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Explore query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Explore query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a explore.Response -func (r Explore) Do(ctx context.Context) (*Response, error) { +func (r Explore) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "graph.explore") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r Explore) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r Explore) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r Explore) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/graph/explore/request.go b/typedapi/graph/explore/request.go index 02e031f3fd..af873b4a2b 100644 --- a/typedapi/graph/explore/request.go +++ b/typedapi/graph/explore/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package explore @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package explore // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/graph/explore/GraphExploreRequest.ts#L28-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/graph/explore/GraphExploreRequest.ts#L28-L72 type Request struct { // Connections Specifies or more fields from which you want to extract terms that are diff --git a/typedapi/graph/explore/response.go b/typedapi/graph/explore/response.go index 8eec4550da..feccff6f4c 100644 --- a/typedapi/graph/explore/response.go +++ b/typedapi/graph/explore/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package explore @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package explore // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/graph/explore/GraphExploreResponse.ts#L25-L33 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/graph/explore/GraphExploreResponse.ts#L25-L33 type Response struct { Connections []types.Connection `json:"connections"` Failures []types.ShardFailure `json:"failures"` diff --git a/typedapi/ilm/deletelifecycle/delete_lifecycle.go b/typedapi/ilm/deletelifecycle/delete_lifecycle.go index e90d9d3a96..8e94d13f6c 100644 --- a/typedapi/ilm/deletelifecycle/delete_lifecycle.go +++ b/typedapi/ilm/deletelifecycle/delete_lifecycle.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes the specified lifecycle policy definition. A currently used policy // cannot be deleted. package deletelifecycle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int policy string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteLifecycle type alias for index. @@ -83,7 +86,12 @@ func New(tp elastictransport.Interface) *DeleteLifecycle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *DeleteLifecycle) HttpRequest(ctx context.Context) (*http.Request, error path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "policy", r.policy) + } path.WriteString(r.policy) method = http.MethodDelete @@ -121,9 +132,9 @@ func (r *DeleteLifecycle) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *DeleteLifecycle) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.delete_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.delete_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "ilm.delete_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.delete_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletelifecycle.Response -func (r DeleteLifecycle) Do(ctx context.Context) (*Response, error) { +func (r DeleteLifecycle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.delete_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r DeleteLifecycle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r DeleteLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r DeleteLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteLifecycle) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteLifecycle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.delete_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r DeleteLifecycle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteLifecycle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ilm/deletelifecycle/response.go b/typedapi/ilm/deletelifecycle/response.go index ee374bdfdf..60dd128a03 100644 --- a/typedapi/ilm/deletelifecycle/response.go +++ b/typedapi/ilm/deletelifecycle/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletelifecycle // Response holds the response body struct for the package deletelifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/delete_lifecycle/DeleteLifecycleResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/delete_lifecycle/DeleteLifecycleResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ilm/explainlifecycle/explain_lifecycle.go b/typedapi/ilm/explainlifecycle/explain_lifecycle.go index bdd93b93c6..fc9acef4c3 100644 --- a/typedapi/ilm/explainlifecycle/explain_lifecycle.go +++ b/typedapi/ilm/explainlifecycle/explain_lifecycle.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about the index's current lifecycle state, such as the // currently executing phase, action, and step. package explainlifecycle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type ExplainLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExplainLifecycle type alias for index. @@ -84,7 +87,12 @@ func New(tp elastictransport.Interface) *ExplainLifecycle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *ExplainLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_ilm") @@ -122,9 +133,9 @@ func (r *ExplainLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *ExplainLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExplainLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r ExplainLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.explain_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.explain_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "ilm.explain_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.explain_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExplainLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExplainLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a explainlifecycle.Response -func (r ExplainLifecycle) Do(ctx context.Context) (*Response, error) { +func (r ExplainLifecycle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.explain_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r ExplainLifecycle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r ExplainLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r ExplainLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ExplainLifecycle) IsSuccess(ctx context.Context) (bool, error) { +func (r ExplainLifecycle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.explain_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r ExplainLifecycle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ExplainLifecycle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ilm/explainlifecycle/response.go b/typedapi/ilm/explainlifecycle/response.go index 8ae788d614..e7e022ad22 100644 --- a/typedapi/ilm/explainlifecycle/response.go +++ b/typedapi/ilm/explainlifecycle/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package explainlifecycle @@ -31,8 +31,7 @@ import ( // Response holds the response body struct for the package explainlifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/explain_lifecycle/ExplainLifecycleResponse.ts#L24-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/explain_lifecycle/ExplainLifecycleResponse.ts#L24-L28 type Response struct { Indices map[string]types.LifecycleExplain `json:"indices"` } diff --git a/typedapi/ilm/getlifecycle/get_lifecycle.go b/typedapi/ilm/getlifecycle/get_lifecycle.go index 22098e08da..471bfb7a0e 100644 --- a/typedapi/ilm/getlifecycle/get_lifecycle.go +++ b/typedapi/ilm/getlifecycle/get_lifecycle.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the specified policy definition. Includes the policy version and last // modified date. package getlifecycle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int policy string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetLifecycle type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *GetLifecycle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *GetLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "policy", r.policy) + } path.WriteString(r.policy) method = http.MethodGet @@ -126,9 +137,9 @@ func (r *GetLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -145,27 +156,66 @@ func (r *GetLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r GetLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.get_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.get_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "ilm.get_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.get_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getlifecycle.Response -func (r GetLifecycle) Do(ctx context.Context) (Response, error) { +func (r GetLifecycle) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.get_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -173,6 +223,9 @@ func (r GetLifecycle) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,6 +235,9 @@ func (r GetLifecycle) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,12 +245,25 @@ func (r GetLifecycle) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetLifecycle) IsSuccess(ctx context.Context) (bool, error) { +func (r GetLifecycle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.get_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -210,6 +279,14 @@ func (r GetLifecycle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetLifecycle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ilm/getlifecycle/response.go b/typedapi/ilm/getlifecycle/response.go index 388c987ad9..e6331a7dfc 100644 --- a/typedapi/ilm/getlifecycle/response.go +++ b/typedapi/ilm/getlifecycle/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getlifecycle @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getlifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/get_lifecycle/GetLifecycleResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/get_lifecycle/GetLifecycleResponse.ts#L23-L25 type Response map[string]types.Lifecycle diff --git a/typedapi/ilm/getstatus/get_status.go b/typedapi/ilm/getstatus/get_status.go index 22c3f04df8..56db0818a2 100644 --- a/typedapi/ilm/getstatus/get_status.go +++ b/typedapi/ilm/getstatus/get_status.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves the current index lifecycle management (ILM) status. package getstatus import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type GetStatus struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetStatus type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *GetStatus { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *GetStatus) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *GetStatus) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetStatus) Perform(ctx context.Context) (*http.Response, error) { +func (r GetStatus) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.get_status") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.get_status") + if reader := instrument.RecordRequestBody(ctx, "ilm.get_status", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.get_status") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetStatus query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetStatus query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getstatus.Response -func (r GetStatus) Do(ctx context.Context) (*Response, error) { +func (r GetStatus) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.get_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r GetStatus) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r GetStatus) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r GetStatus) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetStatus) IsSuccess(ctx context.Context) (bool, error) { +func (r GetStatus) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.get_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r GetStatus) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetStatus query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ilm/getstatus/response.go b/typedapi/ilm/getstatus/response.go index 8887e8f755..3cdb94c1b5 100644 --- a/typedapi/ilm/getstatus/response.go +++ b/typedapi/ilm/getstatus/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getstatus @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getstatus // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/get_status/GetIlmStatusResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/get_status/GetIlmStatusResponse.ts#L22-L24 type Response struct { OperationMode lifecycleoperationmode.LifecycleOperationMode `json:"operation_mode"` } diff --git a/typedapi/ilm/migratetodatatiers/migrate_to_data_tiers.go b/typedapi/ilm/migratetodatatiers/migrate_to_data_tiers.go index ee74930939..6ab1a6f018 100644 --- a/typedapi/ilm/migratetodatatiers/migrate_to_data_tiers.go +++ b/typedapi/ilm/migratetodatatiers/migrate_to_data_tiers.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Migrates the indices and ILM policies away from custom node attribute // allocation routing to data tiers routing @@ -48,13 +48,17 @@ type MigrateToDataTiers struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMigrateToDataTiers type alias for index. @@ -79,11 +83,18 @@ func New(tp elastictransport.Interface) *MigrateToDataTiers { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -120,9 +131,7 @@ func (r *MigrateToDataTiers) HttpRequest(ctx context.Context) (*http.Request, er } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -134,6 +143,10 @@ func (r *MigrateToDataTiers) HttpRequest(ctx context.Context) (*http.Request, er } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,15 +167,15 @@ func (r *MigrateToDataTiers) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -179,27 +192,66 @@ func (r *MigrateToDataTiers) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r MigrateToDataTiers) Perform(ctx context.Context) (*http.Response, error) { +func (r MigrateToDataTiers) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.migrate_to_data_tiers") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.migrate_to_data_tiers") + if reader := instrument.RecordRequestBody(ctx, "ilm.migrate_to_data_tiers", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.migrate_to_data_tiers") + } if err != nil { - return nil, fmt.Errorf("an error happened during the MigrateToDataTiers query execution: %w", err) + localErr := fmt.Errorf("an error happened during the MigrateToDataTiers query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a migratetodatatiers.Response -func (r MigrateToDataTiers) Do(ctx context.Context) (*Response, error) { +func (r MigrateToDataTiers) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.migrate_to_data_tiers") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -207,6 +259,9 @@ func (r MigrateToDataTiers) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -216,6 +271,9 @@ func (r MigrateToDataTiers) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r MigrateToDataTiers) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ilm/migratetodatatiers/request.go b/typedapi/ilm/migratetodatatiers/request.go index 30ef3ad8c8..3cadee1010 100644 --- a/typedapi/ilm/migratetodatatiers/request.go +++ b/typedapi/ilm/migratetodatatiers/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package migratetodatatiers @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package migratetodatatiers // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/migrate_to_data_tiers/Request.ts#L22-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/migrate_to_data_tiers/Request.ts#L22-L43 type Request struct { LegacyTemplateToDelete *string `json:"legacy_template_to_delete,omitempty"` NodeAttribute *string `json:"node_attribute,omitempty"` diff --git a/typedapi/ilm/migratetodatatiers/response.go b/typedapi/ilm/migratetodatatiers/response.go index df06aceef4..2c5d900d60 100644 --- a/typedapi/ilm/migratetodatatiers/response.go +++ b/typedapi/ilm/migratetodatatiers/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package migratetodatatiers @@ -30,8 +30,7 @@ import ( // Response holds the response body struct for the package migratetodatatiers // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/migrate_to_data_tiers/Response.ts#L22-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/migrate_to_data_tiers/Response.ts#L22-L32 type Response struct { DryRun bool `json:"dry_run"` MigratedComponentTemplates []string `json:"migrated_component_templates"` diff --git a/typedapi/ilm/movetostep/move_to_step.go b/typedapi/ilm/movetostep/move_to_step.go index 48cac3216f..938c0bd42b 100644 --- a/typedapi/ilm/movetostep/move_to_step.go +++ b/typedapi/ilm/movetostep/move_to_step.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Manually moves an index into the specified step and executes that step. package movetostep @@ -50,15 +50,19 @@ type MoveToStep struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMoveToStep type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *MoveToStep { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *MoveToStep) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *MoveToStep) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *MoveToStep) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("move") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodPost @@ -162,15 +178,15 @@ func (r *MoveToStep) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *MoveToStep) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r MoveToStep) Perform(ctx context.Context) (*http.Response, error) { +func (r MoveToStep) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.move_to_step") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.move_to_step") + if reader := instrument.RecordRequestBody(ctx, "ilm.move_to_step", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.move_to_step") + } if err != nil { - return nil, fmt.Errorf("an error happened during the MoveToStep query execution: %w", err) + localErr := fmt.Errorf("an error happened during the MoveToStep query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a movetostep.Response -func (r MoveToStep) Do(ctx context.Context) (*Response, error) { +func (r MoveToStep) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.move_to_step") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r MoveToStep) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r MoveToStep) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r MoveToStep) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ilm/movetostep/request.go b/typedapi/ilm/movetostep/request.go index 9b49b29f30..b89e67a63d 100644 --- a/typedapi/ilm/movetostep/request.go +++ b/typedapi/ilm/movetostep/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package movetostep @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package movetostep // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/move_to_step/MoveToStepRequest.ts#L24-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/move_to_step/MoveToStepRequest.ts#L24-L36 type Request struct { CurrentStep *types.StepKey `json:"current_step,omitempty"` NextStep *types.StepKey `json:"next_step,omitempty"` diff --git a/typedapi/ilm/movetostep/response.go b/typedapi/ilm/movetostep/response.go index 6c27a68db5..f22a7f1fa7 100644 --- a/typedapi/ilm/movetostep/response.go +++ b/typedapi/ilm/movetostep/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package movetostep // Response holds the response body struct for the package movetostep // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/move_to_step/MoveToStepResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/move_to_step/MoveToStepResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ilm/putlifecycle/put_lifecycle.go b/typedapi/ilm/putlifecycle/put_lifecycle.go index 119d606ffd..64fa60350a 100644 --- a/typedapi/ilm/putlifecycle/put_lifecycle.go +++ b/typedapi/ilm/putlifecycle/put_lifecycle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a lifecycle policy package putlifecycle @@ -50,15 +50,19 @@ type PutLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int policy string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutLifecycle type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *PutLifecycle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "policy", r.policy) + } path.WriteString(r.policy) method = http.MethodPut @@ -162,15 +178,15 @@ func (r *PutLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *PutLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r PutLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.put_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.put_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "ilm.put_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.put_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putlifecycle.Response -func (r PutLifecycle) Do(ctx context.Context) (*Response, error) { +func (r PutLifecycle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.put_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r PutLifecycle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r PutLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r PutLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ilm/putlifecycle/request.go b/typedapi/ilm/putlifecycle/request.go index 92d2942c9c..2956198f8d 100644 --- a/typedapi/ilm/putlifecycle/request.go +++ b/typedapi/ilm/putlifecycle/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putlifecycle @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putlifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/put_lifecycle/PutLifecycleRequest.ts#L25-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/put_lifecycle/PutLifecycleRequest.ts#L25-L55 type Request struct { Policy *types.IlmPolicy `json:"policy,omitempty"` } diff --git a/typedapi/ilm/putlifecycle/response.go b/typedapi/ilm/putlifecycle/response.go index faf0aced99..d2389b5238 100644 --- a/typedapi/ilm/putlifecycle/response.go +++ b/typedapi/ilm/putlifecycle/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putlifecycle // Response holds the response body struct for the package putlifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/put_lifecycle/PutLifecycleResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/put_lifecycle/PutLifecycleResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ilm/removepolicy/remove_policy.go b/typedapi/ilm/removepolicy/remove_policy.go index dfa8f569fc..a2dd6fc6cf 100644 --- a/typedapi/ilm/removepolicy/remove_policy.go +++ b/typedapi/ilm/removepolicy/remove_policy.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Removes the assigned lifecycle policy and stops managing the specified index package removepolicy import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type RemovePolicy struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRemovePolicy type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *RemovePolicy { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -102,6 +110,9 @@ func (r *RemovePolicy) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_ilm") @@ -119,9 +130,9 @@ func (r *RemovePolicy) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *RemovePolicy) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r RemovePolicy) Perform(ctx context.Context) (*http.Response, error) { +func (r RemovePolicy) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.remove_policy") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.remove_policy") + if reader := instrument.RecordRequestBody(ctx, "ilm.remove_policy", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.remove_policy") + } if err != nil { - return nil, fmt.Errorf("an error happened during the RemovePolicy query execution: %w", err) + localErr := fmt.Errorf("an error happened during the RemovePolicy query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a removepolicy.Response -func (r RemovePolicy) Do(ctx context.Context) (*Response, error) { +func (r RemovePolicy) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.remove_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r RemovePolicy) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r RemovePolicy) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r RemovePolicy) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r RemovePolicy) IsSuccess(ctx context.Context) (bool, error) { +func (r RemovePolicy) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.remove_policy") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r RemovePolicy) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the RemovePolicy query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ilm/removepolicy/response.go b/typedapi/ilm/removepolicy/response.go index 65e41dad75..6f3dee6aa4 100644 --- a/typedapi/ilm/removepolicy/response.go +++ b/typedapi/ilm/removepolicy/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package removepolicy // Response holds the response body struct for the package removepolicy // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/remove_policy/RemovePolicyResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/remove_policy/RemovePolicyResponse.ts#L22-L27 type Response struct { FailedIndexes []string `json:"failed_indexes"` HasFailures bool `json:"has_failures"` diff --git a/typedapi/ilm/retry/response.go b/typedapi/ilm/retry/response.go index 9ebafc36e4..0861d3faf2 100644 --- a/typedapi/ilm/retry/response.go +++ b/typedapi/ilm/retry/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package retry // Response holds the response body struct for the package retry // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/retry/RetryIlmResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/retry/RetryIlmResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ilm/retry/retry.go b/typedapi/ilm/retry/retry.go index 78c0c56a52..b97ee69b09 100644 --- a/typedapi/ilm/retry/retry.go +++ b/typedapi/ilm/retry/retry.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retries executing the policy for an index that is in the ERROR step. package retry import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type Retry struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRetry type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *Retry { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -102,6 +110,9 @@ func (r *Retry) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_ilm") @@ -119,9 +130,9 @@ func (r *Retry) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *Retry) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Retry) Perform(ctx context.Context) (*http.Response, error) { +func (r Retry) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.retry") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.retry") + if reader := instrument.RecordRequestBody(ctx, "ilm.retry", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.retry") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Retry query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Retry query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a retry.Response -func (r Retry) Do(ctx context.Context) (*Response, error) { +func (r Retry) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.retry") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r Retry) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r Retry) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r Retry) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Retry) IsSuccess(ctx context.Context) (bool, error) { +func (r Retry) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.retry") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r Retry) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Retry query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ilm/start/response.go b/typedapi/ilm/start/response.go index 1de335feec..a84d5eeea3 100644 --- a/typedapi/ilm/start/response.go +++ b/typedapi/ilm/start/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package start // Response holds the response body struct for the package start // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/start/StartIlmResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/start/StartIlmResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ilm/start/start.go b/typedapi/ilm/start/start.go index 21859162b6..1109ebcd0d 100644 --- a/typedapi/ilm/start/start.go +++ b/typedapi/ilm/start/start.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Start the index lifecycle management (ILM) plugin. package start import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Start struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStart type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *Start { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Start) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Start) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Start) Perform(ctx context.Context) (*http.Response, error) { +func (r Start) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.start") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.start") + if reader := instrument.RecordRequestBody(ctx, "ilm.start", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.start") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Start query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Start query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a start.Response -func (r Start) Do(ctx context.Context) (*Response, error) { +func (r Start) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.start") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Start) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Start) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Start) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Start) IsSuccess(ctx context.Context) (bool, error) { +func (r Start) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.start") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Start) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Start query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ilm/stop/response.go b/typedapi/ilm/stop/response.go index 3d9757f803..c97c4472bd 100644 --- a/typedapi/ilm/stop/response.go +++ b/typedapi/ilm/stop/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stop // Response holds the response body struct for the package stop // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/stop/StopIlmResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/stop/StopIlmResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ilm/stop/stop.go b/typedapi/ilm/stop/stop.go index 1690092d0e..067fa20c70 100644 --- a/typedapi/ilm/stop/stop.go +++ b/typedapi/ilm/stop/stop.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Halts all lifecycle management operations and stops the index lifecycle // management (ILM) plugin package stop import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type Stop struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStop type alias for index. @@ -75,7 +78,12 @@ func New(tp elastictransport.Interface) *Stop { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *Stop) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *Stop) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Stop) Perform(ctx context.Context) (*http.Response, error) { +func (r Stop) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ilm.stop") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ilm.stop") + if reader := instrument.RecordRequestBody(ctx, "ilm.stop", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ilm.stop") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Stop query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Stop query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stop.Response -func (r Stop) Do(ctx context.Context) (*Response, error) { +func (r Stop) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.stop") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r Stop) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r Stop) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r Stop) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Stop) IsSuccess(ctx context.Context) (bool, error) { +func (r Stop) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ilm.stop") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r Stop) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Stop query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/addblock/add_block.go b/typedapi/indices/addblock/add_block.go index c5cf3ca29d..90ef724447 100644 --- a/typedapi/indices/addblock/add_block.go +++ b/typedapi/indices/addblock/add_block.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Adds a block to an index. package addblock import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -55,12 +54,16 @@ type AddBlock struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string block string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewAddBlock type alias for index. @@ -82,13 +85,18 @@ func NewAddBlockFunc(tp elastictransport.Interface) NewAddBlock { // Adds a block to an index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-blocks.html func New(tp elastictransport.Interface) *AddBlock { r := &AddBlock{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,11 +117,17 @@ func (r *AddBlock) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask|blockMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_block") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "block", r.block) + } path.WriteString(r.block) method = http.MethodPut @@ -127,9 +141,9 @@ func (r *AddBlock) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -146,27 +160,66 @@ func (r *AddBlock) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r AddBlock) Perform(ctx context.Context) (*http.Response, error) { +func (r AddBlock) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.add_block") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.add_block") + if reader := instrument.RecordRequestBody(ctx, "indices.add_block", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.add_block") + } if err != nil { - return nil, fmt.Errorf("an error happened during the AddBlock query execution: %w", err) + localErr := fmt.Errorf("an error happened during the AddBlock query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a addblock.Response -func (r AddBlock) Do(ctx context.Context) (*Response, error) { +func (r AddBlock) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.add_block") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -174,6 +227,9 @@ func (r AddBlock) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,6 +239,9 @@ func (r AddBlock) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -190,12 +249,25 @@ func (r AddBlock) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r AddBlock) IsSuccess(ctx context.Context) (bool, error) { +func (r AddBlock) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.add_block") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -211,6 +283,14 @@ func (r AddBlock) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the AddBlock query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/addblock/response.go b/typedapi/indices/addblock/response.go index 91c0ca3e41..61b5af362f 100644 --- a/typedapi/indices/addblock/response.go +++ b/typedapi/indices/addblock/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package addblock @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package addblock // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/add_block/IndicesAddBlockResponse.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/add_block/IndicesAddBlockResponse.ts#L22-L28 type Response struct { Acknowledged bool `json:"acknowledged"` Indices []types.IndicesBlockStatus `json:"indices"` diff --git a/typedapi/indices/analyze/analyze.go b/typedapi/indices/analyze/analyze.go index 6b7000b527..d6d5fab548 100644 --- a/typedapi/indices/analyze/analyze.go +++ b/typedapi/indices/analyze/analyze.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Performs the analysis process on a text and return the tokens breakdown of // the text. @@ -51,15 +51,19 @@ type Analyze struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewAnalyze type alias for index. @@ -78,17 +82,24 @@ func NewAnalyzeFunc(tp elastictransport.Interface) NewAnalyze { // Performs the analysis process on a text and return the tokens breakdown of // the text. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-analyze.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html func New(tp elastictransport.Interface) *Analyze { r := &Analyze{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *Analyze) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *Analyze) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,6 +163,9 @@ func (r *Analyze) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_analyze") @@ -165,15 +181,15 @@ func (r *Analyze) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -190,27 +206,66 @@ func (r *Analyze) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Analyze) Perform(ctx context.Context) (*http.Response, error) { +func (r Analyze) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.analyze") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.analyze") + if reader := instrument.RecordRequestBody(ctx, "indices.analyze", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.analyze") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Analyze query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Analyze query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a analyze.Response -func (r Analyze) Do(ctx context.Context) (*Response, error) { +func (r Analyze) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.analyze") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -218,6 +273,9 @@ func (r Analyze) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -227,6 +285,9 @@ func (r Analyze) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +295,9 @@ func (r Analyze) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/analyze/request.go b/typedapi/indices/analyze/request.go index 4dd44480f4..7c29d52c9e 100644 --- a/typedapi/indices/analyze/request.go +++ b/typedapi/indices/analyze/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package analyze @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package analyze // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/analyze/IndicesAnalyzeRequest.ts#L27-L92 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/analyze/IndicesAnalyzeRequest.ts#L27-L92 type Request struct { // Analyzer The name of the analyzer that should be applied to the provided `text`. diff --git a/typedapi/indices/analyze/response.go b/typedapi/indices/analyze/response.go index 800a6b97d7..a39ae0d05d 100644 --- a/typedapi/indices/analyze/response.go +++ b/typedapi/indices/analyze/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package analyze @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package analyze // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/analyze/IndicesAnalyzeResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/analyze/IndicesAnalyzeResponse.ts#L22-L27 type Response struct { Detail *types.AnalyzeDetail `json:"detail,omitempty"` Tokens []types.AnalyzeToken `json:"tokens,omitempty"` diff --git a/typedapi/indices/clearcache/clear_cache.go b/typedapi/indices/clearcache/clear_cache.go index ff438440a0..5ec9f68d82 100644 --- a/typedapi/indices/clearcache/clear_cache.go +++ b/typedapi/indices/clearcache/clear_cache.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Clears all or specific caches for one or more indices. package clearcache import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type ClearCache struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearCache type alias for index. @@ -75,13 +78,18 @@ func NewClearCacheFunc(tp elastictransport.Interface) NewClearCache { // Clears all or specific caches for one or more indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html func New(tp elastictransport.Interface) *ClearCache { r := &ClearCache{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,6 +117,9 @@ func (r *ClearCache) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_cache") @@ -126,9 +137,9 @@ func (r *ClearCache) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -145,27 +156,66 @@ func (r *ClearCache) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearCache) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearCache) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.clear_cache") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.clear_cache") + if reader := instrument.RecordRequestBody(ctx, "indices.clear_cache", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.clear_cache") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearCache query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearCache query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clearcache.Response -func (r ClearCache) Do(ctx context.Context) (*Response, error) { +func (r ClearCache) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.clear_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -173,6 +223,9 @@ func (r ClearCache) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,6 +235,9 @@ func (r ClearCache) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,12 +245,25 @@ func (r ClearCache) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ClearCache) IsSuccess(ctx context.Context) (bool, error) { +func (r ClearCache) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.clear_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -210,6 +279,14 @@ func (r ClearCache) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ClearCache query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/clearcache/response.go b/typedapi/indices/clearcache/response.go index 1fce547556..3eaace9ab4 100644 --- a/typedapi/indices/clearcache/response.go +++ b/typedapi/indices/clearcache/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearcache @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package clearcache // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/clear_cache/IndicesClearCacheResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/clear_cache/IndicesClearCacheResponse.ts#L22-L24 type Response struct { Shards_ types.ShardStatistics `json:"_shards"` } diff --git a/typedapi/indices/clone/clone.go b/typedapi/indices/clone/clone.go index d1adf79961..7774b92ac7 100644 --- a/typedapi/indices/clone/clone.go +++ b/typedapi/indices/clone/clone.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Clones an index package clone @@ -52,16 +52,20 @@ type Clone struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string target string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClone type alias for index. @@ -83,17 +87,24 @@ func NewCloneFunc(tp elastictransport.Interface) NewClone { // Clones an index // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clone-index.html func New(tp elastictransport.Interface) *Clone { r := &Clone{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -130,9 +141,7 @@ func (r *Clone) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -144,17 +153,27 @@ func (r *Clone) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|targetMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_clone") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "target", r.target) + } path.WriteString(r.target) method = http.MethodPut @@ -168,15 +187,15 @@ func (r *Clone) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -193,27 +212,66 @@ func (r *Clone) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Clone) Perform(ctx context.Context) (*http.Response, error) { +func (r Clone) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.clone") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.clone") + if reader := instrument.RecordRequestBody(ctx, "indices.clone", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.clone") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Clone query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Clone query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clone.Response -func (r Clone) Do(ctx context.Context) (*Response, error) { +func (r Clone) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.clone") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -221,6 +279,9 @@ func (r Clone) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +291,9 @@ func (r Clone) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -237,6 +301,9 @@ func (r Clone) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/clone/request.go b/typedapi/indices/clone/request.go index 1719d62ecd..3e8c6dd5d8 100644 --- a/typedapi/indices/clone/request.go +++ b/typedapi/indices/clone/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clone @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package clone // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/clone/IndicesCloneRequest.ts#L27-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/clone/IndicesCloneRequest.ts#L27-L75 type Request struct { // Aliases Aliases for the resulting index. diff --git a/typedapi/indices/clone/response.go b/typedapi/indices/clone/response.go index 797afee834..fa4ae0f70c 100644 --- a/typedapi/indices/clone/response.go +++ b/typedapi/indices/clone/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clone // Response holds the response body struct for the package clone // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/clone/IndicesCloneResponse.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/clone/IndicesCloneResponse.ts#L22-L28 type Response struct { Acknowledged bool `json:"acknowledged"` Index string `json:"index"` diff --git a/typedapi/indices/close/close.go b/typedapi/indices/close/close.go index 0c1037bc0c..dccc2b2369 100644 --- a/typedapi/indices/close/close.go +++ b/typedapi/indices/close/close.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Closes an index. package close import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Close struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClose type alias for index. @@ -77,13 +80,18 @@ func NewCloseFunc(tp elastictransport.Interface) NewClose { // Closes an index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-close.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-close.html func New(tp elastictransport.Interface) *Close { r := &Close{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *Close) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_close") @@ -119,9 +130,9 @@ func (r *Close) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *Close) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Close) Perform(ctx context.Context) (*http.Response, error) { +func (r Close) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.close") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.close") + if reader := instrument.RecordRequestBody(ctx, "indices.close", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.close") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Close query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Close query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a close.Response -func (r Close) Do(ctx context.Context) (*Response, error) { +func (r Close) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.close") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r Close) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r Close) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r Close) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Close) IsSuccess(ctx context.Context) (bool, error) { +func (r Close) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.close") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r Close) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Close query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/close/response.go b/typedapi/indices/close/response.go index 98d34dccc5..0d826bca68 100644 --- a/typedapi/indices/close/response.go +++ b/typedapi/indices/close/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package close @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package close // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/close/CloseIndexResponse.ts#L24-L30 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/close/CloseIndexResponse.ts#L24-L30 type Response struct { Acknowledged bool `json:"acknowledged"` Indices map[string]types.CloseIndexResult `json:"indices"` diff --git a/typedapi/indices/create/create.go b/typedapi/indices/create/create.go index 7158d3ee68..82b1170fdc 100644 --- a/typedapi/indices/create/create.go +++ b/typedapi/indices/create/create.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates an index with optional settings and mappings. package create @@ -50,15 +50,19 @@ type Create struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCreate type alias for index. @@ -78,17 +82,24 @@ func NewCreateFunc(tp elastictransport.Interface) NewCreate { // Creates an index with optional settings and mappings. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-create-index.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html func New(tp elastictransport.Interface) *Create { r := &Create{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,12 +148,19 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodPut @@ -158,15 +174,15 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -183,27 +199,66 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Create) Perform(ctx context.Context) (*http.Response, error) { +func (r Create) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.create") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.create") + if reader := instrument.RecordRequestBody(ctx, "indices.create", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.create") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Create query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Create query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a create.Response -func (r Create) Do(ctx context.Context) (*Response, error) { +func (r Create) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.create") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -211,6 +266,9 @@ func (r Create) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -220,6 +278,9 @@ func (r Create) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -227,6 +288,9 @@ func (r Create) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/create/request.go b/typedapi/indices/create/request.go index e1279da16b..7fa39ed6fc 100644 --- a/typedapi/indices/create/request.go +++ b/typedapi/indices/create/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package create @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package create // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/create/IndicesCreateRequest.ts#L28-L81 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/create/IndicesCreateRequest.ts#L28-L81 type Request struct { // Aliases Aliases for the index. diff --git a/typedapi/indices/create/response.go b/typedapi/indices/create/response.go index fe36a72a70..5a98385ddb 100644 --- a/typedapi/indices/create/response.go +++ b/typedapi/indices/create/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package create // Response holds the response body struct for the package create // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/create/IndicesCreateResponse.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/create/IndicesCreateResponse.ts#L22-L28 type Response struct { Acknowledged bool `json:"acknowledged"` Index string `json:"index"` diff --git a/typedapi/indices/createdatastream/create_data_stream.go b/typedapi/indices/createdatastream/create_data_stream.go index bc62ed21cb..221ee2f71d 100644 --- a/typedapi/indices/createdatastream/create_data_stream.go +++ b/typedapi/indices/createdatastream/create_data_stream.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a data stream package createdatastream import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type CreateDataStream struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCreateDataStream type alias for index. @@ -75,13 +78,18 @@ func NewCreateDataStreamFunc(tp elastictransport.Interface) NewCreateDataStream // Creates a data stream // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html func New(tp elastictransport.Interface) *CreateDataStream { r := &CreateDataStream{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *CreateDataStream) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_data_stream") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -117,9 +128,9 @@ func (r *CreateDataStream) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *CreateDataStream) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r CreateDataStream) Perform(ctx context.Context) (*http.Response, error) { +func (r CreateDataStream) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.create_data_stream") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.create_data_stream") + if reader := instrument.RecordRequestBody(ctx, "indices.create_data_stream", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.create_data_stream") + } if err != nil { - return nil, fmt.Errorf("an error happened during the CreateDataStream query execution: %w", err) + localErr := fmt.Errorf("an error happened during the CreateDataStream query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a createdatastream.Response -func (r CreateDataStream) Do(ctx context.Context) (*Response, error) { +func (r CreateDataStream) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.create_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r CreateDataStream) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r CreateDataStream) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r CreateDataStream) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r CreateDataStream) IsSuccess(ctx context.Context) (bool, error) { +func (r CreateDataStream) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.create_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r CreateDataStream) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the CreateDataStream query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/createdatastream/response.go b/typedapi/indices/createdatastream/response.go index 29f3cf8cf3..e0d3d0ec20 100644 --- a/typedapi/indices/createdatastream/response.go +++ b/typedapi/indices/createdatastream/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package createdatastream // Response holds the response body struct for the package createdatastream // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/create_data_stream/IndicesCreateDataStreamResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/create_data_stream/IndicesCreateDataStreamResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/datastreamsstats/data_streams_stats.go b/typedapi/indices/datastreamsstats/data_streams_stats.go index eea261e7b6..0435a4a102 100644 --- a/typedapi/indices/datastreamsstats/data_streams_stats.go +++ b/typedapi/indices/datastreamsstats/data_streams_stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Provides statistics on operations happening in a data stream. package datastreamsstats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DataStreamsStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDataStreamsStats type alias for index. @@ -74,13 +77,18 @@ func NewDataStreamsStatsFunc(tp elastictransport.Interface) NewDataStreamsStats // Provides statistics on operations happening in a data stream. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html func New(tp elastictransport.Interface) *DataStreamsStats { r := &DataStreamsStats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,6 +118,9 @@ func (r *DataStreamsStats) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_data_stream") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) path.WriteString("/") path.WriteString("_stats") @@ -125,9 +136,9 @@ func (r *DataStreamsStats) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *DataStreamsStats) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DataStreamsStats) Perform(ctx context.Context) (*http.Response, error) { +func (r DataStreamsStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.data_streams_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.data_streams_stats") + if reader := instrument.RecordRequestBody(ctx, "indices.data_streams_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.data_streams_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DataStreamsStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DataStreamsStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a datastreamsstats.Response -func (r DataStreamsStats) Do(ctx context.Context) (*Response, error) { +func (r DataStreamsStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.data_streams_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r DataStreamsStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r DataStreamsStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r DataStreamsStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DataStreamsStats) IsSuccess(ctx context.Context) (bool, error) { +func (r DataStreamsStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.data_streams_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r DataStreamsStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DataStreamsStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/datastreamsstats/response.go b/typedapi/indices/datastreamsstats/response.go index 351b907a0f..8ef403f83c 100644 --- a/typedapi/indices/datastreamsstats/response.go +++ b/typedapi/indices/datastreamsstats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package datastreamsstats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package datastreamsstats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/data_streams_stats/IndicesDataStreamsStatsResponse.ts#L25-L43 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/data_streams_stats/IndicesDataStreamsStatsResponse.ts#L25-L43 type Response struct { // BackingIndices Total number of backing indices for the selected data streams. diff --git a/typedapi/indices/delete/delete.go b/typedapi/indices/delete/delete.go index 43d83fa5ee..78788cd0a9 100644 --- a/typedapi/indices/delete/delete.go +++ b/typedapi/indices/delete/delete.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an index. package delete import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Delete struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDelete type alias for index. @@ -77,13 +80,18 @@ func NewDeleteFunc(tp elastictransport.Interface) NewDelete { // Deletes an index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html func New(tp elastictransport.Interface) *Delete { r := &Delete{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodDelete @@ -117,9 +128,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Delete) Perform(ctx context.Context) (*http.Response, error) { +func (r Delete) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.delete") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete") + if reader := instrument.RecordRequestBody(ctx, "indices.delete", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Delete query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Delete query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a delete.Response -func (r Delete) Do(ctx context.Context) (*Response, error) { +func (r Delete) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Delete) IsSuccess(ctx context.Context) (bool, error) { +func (r Delete) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r Delete) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Delete query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/delete/response.go b/typedapi/indices/delete/response.go index ff97dd4fc7..2709f5f764 100644 --- a/typedapi/indices/delete/response.go +++ b/typedapi/indices/delete/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package delete @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package delete // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/delete/IndicesDeleteResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/delete/IndicesDeleteResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/deletealias/delete_alias.go b/typedapi/indices/deletealias/delete_alias.go index 18268a18a8..206f3b9cb7 100644 --- a/typedapi/indices/deletealias/delete_alias.go +++ b/typedapi/indices/deletealias/delete_alias.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an alias. package deletealias import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type DeleteAlias struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteAlias type alias for index. @@ -80,13 +83,18 @@ func NewDeleteAliasFunc(tp elastictransport.Interface) NewDeleteAlias { // Deletes an alias. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html func New(tp elastictransport.Interface) *DeleteAlias { r := &DeleteAlias{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,22 +115,34 @@ func (r *DeleteAlias) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask|nameMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_alias") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete case r.paramSet == indexMask|nameMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_aliases") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -136,9 +156,9 @@ func (r *DeleteAlias) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -155,27 +175,66 @@ func (r *DeleteAlias) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteAlias) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteAlias) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.delete_alias") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete_alias") + if reader := instrument.RecordRequestBody(ctx, "indices.delete_alias", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete_alias") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteAlias query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteAlias query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletealias.Response -func (r DeleteAlias) Do(ctx context.Context) (*Response, error) { +func (r DeleteAlias) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -183,6 +242,9 @@ func (r DeleteAlias) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,6 +254,9 @@ func (r DeleteAlias) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -199,12 +264,25 @@ func (r DeleteAlias) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteAlias) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteAlias) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -220,6 +298,14 @@ func (r DeleteAlias) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteAlias query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/deletealias/response.go b/typedapi/indices/deletealias/response.go index c38356c3e6..02866b9463 100644 --- a/typedapi/indices/deletealias/response.go +++ b/typedapi/indices/deletealias/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletealias // Response holds the response body struct for the package deletealias // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/delete_alias/IndicesDeleteAliasResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/delete_alias/IndicesDeleteAliasResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/deletedatalifecycle/delete_data_lifecycle.go b/typedapi/indices/deletedatalifecycle/delete_data_lifecycle.go index 2aba909f3a..3da9b83da1 100644 --- a/typedapi/indices/deletedatalifecycle/delete_data_lifecycle.go +++ b/typedapi/indices/deletedatalifecycle/delete_data_lifecycle.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes the data stream lifecycle of the selected data streams. package deletedatalifecycle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteDataLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteDataLifecycle type alias for index. @@ -76,13 +79,18 @@ func NewDeleteDataLifecycleFunc(tp elastictransport.Interface) NewDeleteDataLife // Deletes the data stream lifecycle of the selected data streams. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-delete-lifecycle.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-delete-lifecycle.html func New(tp elastictransport.Interface) *DeleteDataLifecycle { r := &DeleteDataLifecycle{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *DeleteDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, e path.WriteString("_data_stream") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) path.WriteString("/") path.WriteString("_lifecycle") @@ -120,9 +131,9 @@ func (r *DeleteDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,27 +150,66 @@ func (r *DeleteDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteDataLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteDataLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.delete_data_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete_data_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "indices.delete_data_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete_data_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteDataLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteDataLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletedatalifecycle.Response -func (r DeleteDataLifecycle) Do(ctx context.Context) (*Response, error) { +func (r DeleteDataLifecycle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -167,6 +217,9 @@ func (r DeleteDataLifecycle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,6 +229,9 @@ func (r DeleteDataLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,12 +239,25 @@ func (r DeleteDataLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteDataLifecycle) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteDataLifecycle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -204,6 +273,14 @@ func (r DeleteDataLifecycle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteDataLifecycle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/deletedatalifecycle/response.go b/typedapi/indices/deletedatalifecycle/response.go index 894e268936..a2411cab4d 100644 --- a/typedapi/indices/deletedatalifecycle/response.go +++ b/typedapi/indices/deletedatalifecycle/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletedatalifecycle // Response holds the response body struct for the package deletedatalifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/delete_data_lifecycle/IndicesDeleteDataLifecycleResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/delete_data_lifecycle/IndicesDeleteDataLifecycleResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/deletedatastream/delete_data_stream.go b/typedapi/indices/deletedatastream/delete_data_stream.go index 6b546df00c..3b4ca858e9 100644 --- a/typedapi/indices/deletedatastream/delete_data_stream.go +++ b/typedapi/indices/deletedatastream/delete_data_stream.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a data stream. package deletedatastream import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteDataStream struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteDataStream type alias for index. @@ -76,13 +79,18 @@ func NewDeleteDataStreamFunc(tp elastictransport.Interface) NewDeleteDataStream // Deletes a data stream. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html func New(tp elastictransport.Interface) *DeleteDataStream { r := &DeleteDataStream{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *DeleteDataStream) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_data_stream") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -118,9 +129,9 @@ func (r *DeleteDataStream) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -137,27 +148,66 @@ func (r *DeleteDataStream) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteDataStream) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteDataStream) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.delete_data_stream") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete_data_stream") + if reader := instrument.RecordRequestBody(ctx, "indices.delete_data_stream", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete_data_stream") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteDataStream query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteDataStream query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletedatastream.Response -func (r DeleteDataStream) Do(ctx context.Context) (*Response, error) { +func (r DeleteDataStream) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -165,6 +215,9 @@ func (r DeleteDataStream) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -174,6 +227,9 @@ func (r DeleteDataStream) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,12 +237,25 @@ func (r DeleteDataStream) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteDataStream) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteDataStream) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -202,6 +271,14 @@ func (r DeleteDataStream) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteDataStream query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/deletedatastream/response.go b/typedapi/indices/deletedatastream/response.go index 1e3d8ef501..8aad340929 100644 --- a/typedapi/indices/deletedatastream/response.go +++ b/typedapi/indices/deletedatastream/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletedatastream // Response holds the response body struct for the package deletedatastream // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/delete_data_stream/IndicesDeleteDataStreamResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/delete_data_stream/IndicesDeleteDataStreamResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/deleteindextemplate/delete_index_template.go b/typedapi/indices/deleteindextemplate/delete_index_template.go index f2a2cf9ff4..e930690cbb 100644 --- a/typedapi/indices/deleteindextemplate/delete_index_template.go +++ b/typedapi/indices/deleteindextemplate/delete_index_template.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an index template. package deleteindextemplate import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteIndexTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteIndexTemplate type alias for index. @@ -75,13 +78,18 @@ func NewDeleteIndexTemplateFunc(tp elastictransport.Interface) NewDeleteIndexTem // Deletes an index template. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-template.html func New(tp elastictransport.Interface) *DeleteIndexTemplate { r := &DeleteIndexTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *DeleteIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, e path.WriteString("_index_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -117,9 +128,9 @@ func (r *DeleteIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *DeleteIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteIndexTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteIndexTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.delete_index_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete_index_template") + if reader := instrument.RecordRequestBody(ctx, "indices.delete_index_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete_index_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteIndexTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteIndexTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleteindextemplate.Response -func (r DeleteIndexTemplate) Do(ctx context.Context) (*Response, error) { +func (r DeleteIndexTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r DeleteIndexTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r DeleteIndexTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r DeleteIndexTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteIndexTemplate) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteIndexTemplate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r DeleteIndexTemplate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteIndexTemplate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/deleteindextemplate/response.go b/typedapi/indices/deleteindextemplate/response.go index 017ff37317..5e61229860 100644 --- a/typedapi/indices/deleteindextemplate/response.go +++ b/typedapi/indices/deleteindextemplate/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleteindextemplate // Response holds the response body struct for the package deleteindextemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/delete_index_template/IndicesDeleteIndexTemplateResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/delete_index_template/IndicesDeleteIndexTemplateResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/deletetemplate/delete_template.go b/typedapi/indices/deletetemplate/delete_template.go index 723b36adb2..6f6ccc371a 100644 --- a/typedapi/indices/deletetemplate/delete_template.go +++ b/typedapi/indices/deletetemplate/delete_template.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an index template. package deletetemplate import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteTemplate type alias for index. @@ -75,13 +78,18 @@ func NewDeleteTemplateFunc(tp elastictransport.Interface) NewDeleteTemplate { // Deletes an index template. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-template-v1.html func New(tp elastictransport.Interface) *DeleteTemplate { r := &DeleteTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *DeleteTemplate) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -117,9 +128,9 @@ func (r *DeleteTemplate) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *DeleteTemplate) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.delete_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.delete_template") + if reader := instrument.RecordRequestBody(ctx, "indices.delete_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.delete_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletetemplate.Response -func (r DeleteTemplate) Do(ctx context.Context) (*Response, error) { +func (r DeleteTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r DeleteTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r DeleteTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r DeleteTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteTemplate) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteTemplate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.delete_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r DeleteTemplate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteTemplate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/deletetemplate/response.go b/typedapi/indices/deletetemplate/response.go index 8f2bd03ed9..2308e6c14a 100644 --- a/typedapi/indices/deletetemplate/response.go +++ b/typedapi/indices/deletetemplate/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletetemplate // Response holds the response body struct for the package deletetemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/delete_template/IndicesDeleteTemplateResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/delete_template/IndicesDeleteTemplateResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/diskusage/disk_usage.go b/typedapi/indices/diskusage/disk_usage.go index a54675eeb0..b4d3d48581 100644 --- a/typedapi/indices/diskusage/disk_usage.go +++ b/typedapi/indices/diskusage/disk_usage.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Analyzes the disk usage of each field of an index or data stream package diskusage import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type DiskUsage struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDiskUsage type alias for index. @@ -77,13 +80,18 @@ func NewDiskUsageFunc(tp elastictransport.Interface) NewDiskUsage { // Analyzes the disk usage of each field of an index or data stream // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-disk-usage.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-disk-usage.html func New(tp elastictransport.Interface) *DiskUsage { r := &DiskUsage{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *DiskUsage) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_disk_usage") @@ -119,9 +130,9 @@ func (r *DiskUsage) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *DiskUsage) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DiskUsage) Perform(ctx context.Context) (*http.Response, error) { +func (r DiskUsage) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.disk_usage") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.disk_usage") + if reader := instrument.RecordRequestBody(ctx, "indices.disk_usage", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.disk_usage") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DiskUsage query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DiskUsage query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a diskusage.Response -func (r DiskUsage) Do(ctx context.Context) (Response, error) { +func (r DiskUsage) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.disk_usage") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := new(Response) res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r DiskUsage) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r DiskUsage) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r DiskUsage) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DiskUsage) IsSuccess(ctx context.Context) (bool, error) { +func (r DiskUsage) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.disk_usage") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r DiskUsage) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DiskUsage query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/diskusage/response.go b/typedapi/indices/diskusage/response.go index 1f59c5231d..698389b2df 100644 --- a/typedapi/indices/diskusage/response.go +++ b/typedapi/indices/diskusage/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package diskusage @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package diskusage // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/disk_usage/IndicesDiskUsageResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/disk_usage/IndicesDiskUsageResponse.ts#L22-L24 type Response = json.RawMessage diff --git a/typedapi/indices/downsample/downsample.go b/typedapi/indices/downsample/downsample.go index 3c6a9c8682..17149927bd 100644 --- a/typedapi/indices/downsample/downsample.go +++ b/typedapi/indices/downsample/downsample.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Downsample an index package downsample @@ -52,16 +52,20 @@ type Downsample struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string targetindex string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDownsample type alias for index. @@ -83,13 +87,20 @@ func NewDownsampleFunc(tp elastictransport.Interface) NewDownsample { // Downsample an index // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-downsample-data-stream.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-downsample-data-stream.html func New(tp elastictransport.Interface) *Downsample { r := &Downsample{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -128,9 +139,7 @@ func (r *Downsample) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -142,17 +151,27 @@ func (r *Downsample) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|targetindexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_downsample") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "targetindex", r.targetindex) + } path.WriteString(r.targetindex) method = http.MethodPost @@ -166,15 +185,15 @@ func (r *Downsample) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -191,27 +210,66 @@ func (r *Downsample) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Downsample) Perform(ctx context.Context) (*http.Response, error) { +func (r Downsample) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.downsample") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.downsample") + if reader := instrument.RecordRequestBody(ctx, "indices.downsample", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.downsample") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Downsample query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Downsample query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a downsample.Response -func (r Downsample) Do(ctx context.Context) (Response, error) { +func (r Downsample) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.downsample") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := new(Response) res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -219,6 +277,9 @@ func (r Downsample) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -228,6 +289,9 @@ func (r Downsample) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +299,9 @@ func (r Downsample) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/downsample/request.go b/typedapi/indices/downsample/request.go index ca5ae22d00..dc91502e0f 100644 --- a/typedapi/indices/downsample/request.go +++ b/typedapi/indices/downsample/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package downsample @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package downsample // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/downsample/Request.ts#L24-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/downsample/Request.ts#L24-L44 type Request = types.DownsampleConfig diff --git a/typedapi/indices/downsample/response.go b/typedapi/indices/downsample/response.go index c635a3feff..5fefa33116 100644 --- a/typedapi/indices/downsample/response.go +++ b/typedapi/indices/downsample/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package downsample @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package downsample // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/downsample/Response.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/downsample/Response.ts#L22-L24 type Response = json.RawMessage diff --git a/typedapi/indices/exists/exists.go b/typedapi/indices/exists/exists.go index a5a663b6bd..783870ba50 100644 --- a/typedapi/indices/exists/exists.go +++ b/typedapi/indices/exists/exists.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about whether a particular index exists. package exists import ( - gobytes "bytes" "context" "errors" "fmt" @@ -51,11 +50,15 @@ type Exists struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExists type alias for index. @@ -75,13 +78,18 @@ func NewExistsFunc(tp elastictransport.Interface) NewExists { // Returns information about whether a particular index exists. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html func New(tp elastictransport.Interface) *Exists { r := &Exists{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -102,6 +110,9 @@ func (r *Exists) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodHead @@ -115,9 +126,9 @@ func (r *Exists) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -134,15 +145,42 @@ func (r *Exists) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Exists) Perform(ctx context.Context) (*http.Response, error) { +func (r Exists) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.exists") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.exists") + if reader := instrument.RecordRequestBody(ctx, "indices.exists", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.exists") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Exists query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Exists query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -155,7 +193,17 @@ func (r Exists) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Exists) IsSuccess(ctx context.Context) (bool, error) { +func (r Exists) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.exists") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -171,6 +219,14 @@ func (r Exists) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Exists query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/existsalias/exists_alias.go b/typedapi/indices/existsalias/exists_alias.go index 7b17d6a7cf..2bb283890c 100644 --- a/typedapi/indices/existsalias/exists_alias.go +++ b/typedapi/indices/existsalias/exists_alias.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about whether a particular alias exists. package existsalias import ( - gobytes "bytes" "context" "errors" "fmt" @@ -53,12 +52,16 @@ type ExistsAlias struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExistsAlias type alias for index. @@ -78,13 +81,18 @@ func NewExistsAliasFunc(tp elastictransport.Interface) NewExistsAlias { // Returns information about whether a particular alias exists. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html func New(tp elastictransport.Interface) *ExistsAlias { r := &ExistsAlias{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,17 +115,26 @@ func (r *ExistsAlias) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_alias") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodHead case r.paramSet == indexMask|nameMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_alias") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodHead @@ -131,9 +148,9 @@ func (r *ExistsAlias) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -150,15 +167,42 @@ func (r *ExistsAlias) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExistsAlias) Perform(ctx context.Context) (*http.Response, error) { +func (r ExistsAlias) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.exists_alias") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.exists_alias") + if reader := instrument.RecordRequestBody(ctx, "indices.exists_alias", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.exists_alias") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExistsAlias query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExistsAlias query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -171,7 +215,17 @@ func (r ExistsAlias) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ExistsAlias) IsSuccess(ctx context.Context) (bool, error) { +func (r ExistsAlias) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.exists_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -187,6 +241,14 @@ func (r ExistsAlias) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ExistsAlias query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/existsindextemplate/exists_index_template.go b/typedapi/indices/existsindextemplate/exists_index_template.go index 15fbb77d6a..9efb94929f 100644 --- a/typedapi/indices/existsindextemplate/exists_index_template.go +++ b/typedapi/indices/existsindextemplate/exists_index_template.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about whether a particular index template exists. package existsindextemplate import ( - gobytes "bytes" "context" "errors" "fmt" @@ -49,11 +48,15 @@ type ExistsIndexTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExistsIndexTemplate type alias for index. @@ -73,13 +76,18 @@ func NewExistsIndexTemplateFunc(tp elastictransport.Interface) NewExistsIndexTem // Returns information about whether a particular index template exists. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html func New(tp elastictransport.Interface) *ExistsIndexTemplate { r := &ExistsIndexTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -102,6 +110,9 @@ func (r *ExistsIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, e path.WriteString("_index_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodHead @@ -115,9 +126,9 @@ func (r *ExistsIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -134,15 +145,42 @@ func (r *ExistsIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExistsIndexTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r ExistsIndexTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.exists_index_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.exists_index_template") + if reader := instrument.RecordRequestBody(ctx, "indices.exists_index_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.exists_index_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExistsIndexTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExistsIndexTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -155,7 +193,17 @@ func (r ExistsIndexTemplate) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ExistsIndexTemplate) IsSuccess(ctx context.Context) (bool, error) { +func (r ExistsIndexTemplate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.exists_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -171,6 +219,14 @@ func (r ExistsIndexTemplate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ExistsIndexTemplate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/existstemplate/exists_template.go b/typedapi/indices/existstemplate/exists_template.go index 141e2be7e1..b8ef821874 100644 --- a/typedapi/indices/existstemplate/exists_template.go +++ b/typedapi/indices/existstemplate/exists_template.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about whether a particular index template exists. package existstemplate import ( - gobytes "bytes" "context" "errors" "fmt" @@ -50,11 +49,15 @@ type ExistsTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExistsTemplate type alias for index. @@ -74,13 +77,18 @@ func NewExistsTemplateFunc(tp elastictransport.Interface) NewExistsTemplate { // Returns information about whether a particular index template exists. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-template-exists-v1.html func New(tp elastictransport.Interface) *ExistsTemplate { r := &ExistsTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -103,6 +111,9 @@ func (r *ExistsTemplate) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodHead @@ -116,9 +127,9 @@ func (r *ExistsTemplate) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -135,15 +146,42 @@ func (r *ExistsTemplate) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExistsTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r ExistsTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.exists_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.exists_template") + if reader := instrument.RecordRequestBody(ctx, "indices.exists_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.exists_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExistsTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExistsTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -156,7 +194,17 @@ func (r ExistsTemplate) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ExistsTemplate) IsSuccess(ctx context.Context) (bool, error) { +func (r ExistsTemplate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.exists_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -172,6 +220,14 @@ func (r ExistsTemplate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ExistsTemplate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/explaindatalifecycle/explain_data_lifecycle.go b/typedapi/indices/explaindatalifecycle/explain_data_lifecycle.go index f8d4fb133d..b39cd46694 100644 --- a/typedapi/indices/explaindatalifecycle/explain_data_lifecycle.go +++ b/typedapi/indices/explaindatalifecycle/explain_data_lifecycle.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about the index's current data stream lifecycle, such // as any potential encountered error, time since creation etc. package explaindatalifecycle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type ExplainDataLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExplainDataLifecycle type alias for index. @@ -84,7 +87,12 @@ func New(tp elastictransport.Interface) *ExplainDataLifecycle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *ExplainDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_lifecycle") @@ -122,9 +133,9 @@ func (r *ExplainDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *ExplainDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExplainDataLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r ExplainDataLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.explain_data_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.explain_data_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "indices.explain_data_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.explain_data_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExplainDataLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExplainDataLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a explaindatalifecycle.Response -func (r ExplainDataLifecycle) Do(ctx context.Context) (*Response, error) { +func (r ExplainDataLifecycle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.explain_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r ExplainDataLifecycle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r ExplainDataLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r ExplainDataLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ExplainDataLifecycle) IsSuccess(ctx context.Context) (bool, error) { +func (r ExplainDataLifecycle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.explain_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r ExplainDataLifecycle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ExplainDataLifecycle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/explaindatalifecycle/response.go b/typedapi/indices/explaindatalifecycle/response.go index 0149ab80c7..9570176018 100644 --- a/typedapi/indices/explaindatalifecycle/response.go +++ b/typedapi/indices/explaindatalifecycle/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package explaindatalifecycle @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package explaindatalifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/explain_data_lifecycle/IndicesExplainDataLifecycleResponse.ts#L25-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/explain_data_lifecycle/IndicesExplainDataLifecycleResponse.ts#L25-L29 type Response struct { Indices map[string]types.DataStreamLifecycleExplain `json:"indices"` } diff --git a/typedapi/indices/fieldusagestats/field_usage_stats.go b/typedapi/indices/fieldusagestats/field_usage_stats.go index 1b5de88e8a..8be2e290d2 100644 --- a/typedapi/indices/fieldusagestats/field_usage_stats.go +++ b/typedapi/indices/fieldusagestats/field_usage_stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the field usage stats for each field of an index package fieldusagestats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type FieldUsageStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewFieldUsageStats type alias for index. @@ -77,13 +80,18 @@ func NewFieldUsageStatsFunc(tp elastictransport.Interface) NewFieldUsageStats { // Returns the field usage stats for each field of an index // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/field-usage-stats.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/field-usage-stats.html func New(tp elastictransport.Interface) *FieldUsageStats { r := &FieldUsageStats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *FieldUsageStats) HttpRequest(ctx context.Context) (*http.Request, error case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_field_usage_stats") @@ -119,9 +130,9 @@ func (r *FieldUsageStats) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *FieldUsageStats) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r FieldUsageStats) Perform(ctx context.Context) (*http.Response, error) { +func (r FieldUsageStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.field_usage_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.field_usage_stats") + if reader := instrument.RecordRequestBody(ctx, "indices.field_usage_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.field_usage_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the FieldUsageStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the FieldUsageStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a fieldusagestats.Response -func (r FieldUsageStats) Do(ctx context.Context) (*Response, error) { +func (r FieldUsageStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.field_usage_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r FieldUsageStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r FieldUsageStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r FieldUsageStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r FieldUsageStats) IsSuccess(ctx context.Context) (bool, error) { +func (r FieldUsageStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.field_usage_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r FieldUsageStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the FieldUsageStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/fieldusagestats/response.go b/typedapi/indices/fieldusagestats/response.go index 7ef623c4d1..22249cefa1 100644 --- a/typedapi/indices/fieldusagestats/response.go +++ b/typedapi/indices/fieldusagestats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package fieldusagestats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package fieldusagestats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L28-L30 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L28-L30 type Response struct { FieldsUsageBody map[string]types.UsageStatsIndex `json:"-"` Shards_ types.ShardStatistics `json:"_shards"` diff --git a/typedapi/indices/flush/flush.go b/typedapi/indices/flush/flush.go index 9f54f76dd7..2dc9d0172c 100644 --- a/typedapi/indices/flush/flush.go +++ b/typedapi/indices/flush/flush.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Performs the flush operation on one or more indices. package flush import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Flush struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewFlush type alias for index. @@ -75,13 +78,18 @@ func NewFlushFunc(tp elastictransport.Interface) NewFlush { // Performs the flush operation on one or more indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-flush.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html func New(tp elastictransport.Interface) *Flush { r := &Flush{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *Flush) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_flush") @@ -122,9 +133,9 @@ func (r *Flush) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *Flush) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Flush) Perform(ctx context.Context) (*http.Response, error) { +func (r Flush) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.flush") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.flush") + if reader := instrument.RecordRequestBody(ctx, "indices.flush", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.flush") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Flush query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Flush query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a flush.Response -func (r Flush) Do(ctx context.Context) (*Response, error) { +func (r Flush) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.flush") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r Flush) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r Flush) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r Flush) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Flush) IsSuccess(ctx context.Context) (bool, error) { +func (r Flush) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.flush") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r Flush) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Flush query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/flush/response.go b/typedapi/indices/flush/response.go index d18946355c..bafbb5c588 100644 --- a/typedapi/indices/flush/response.go +++ b/typedapi/indices/flush/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package flush @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package flush // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/flush/IndicesFlushResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/flush/IndicesFlushResponse.ts#L22-L24 type Response struct { Shards_ types.ShardStatistics `json:"_shards"` } diff --git a/typedapi/indices/forcemerge/forcemerge.go b/typedapi/indices/forcemerge/forcemerge.go index b42db446a1..5eb61cc2a0 100644 --- a/typedapi/indices/forcemerge/forcemerge.go +++ b/typedapi/indices/forcemerge/forcemerge.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Performs the force merge operation on one or more indices. package forcemerge import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Forcemerge struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewForcemerge type alias for index. @@ -75,13 +78,18 @@ func NewForcemergeFunc(tp elastictransport.Interface) NewForcemerge { // Performs the force merge operation on one or more indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html func New(tp elastictransport.Interface) *Forcemerge { r := &Forcemerge{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *Forcemerge) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_forcemerge") @@ -122,9 +133,9 @@ func (r *Forcemerge) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *Forcemerge) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Forcemerge) Perform(ctx context.Context) (*http.Response, error) { +func (r Forcemerge) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.forcemerge") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.forcemerge") + if reader := instrument.RecordRequestBody(ctx, "indices.forcemerge", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.forcemerge") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Forcemerge query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Forcemerge query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a forcemerge.Response -func (r Forcemerge) Do(ctx context.Context) (*Response, error) { +func (r Forcemerge) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.forcemerge") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r Forcemerge) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r Forcemerge) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r Forcemerge) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Forcemerge) IsSuccess(ctx context.Context) (bool, error) { +func (r Forcemerge) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.forcemerge") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r Forcemerge) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Forcemerge query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/forcemerge/response.go b/typedapi/indices/forcemerge/response.go index 4f49adbfdd..87b49fffe0 100644 --- a/typedapi/indices/forcemerge/response.go +++ b/typedapi/indices/forcemerge/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package forcemerge @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package forcemerge // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/forcemerge/IndicesForceMergeResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/forcemerge/IndicesForceMergeResponse.ts#L22-L24 type Response struct { Shards_ types.ShardStatistics `json:"_shards"` // Task task contains a task id returned when wait_for_completion=false, diff --git a/typedapi/indices/get/get.go b/typedapi/indices/get/get.go index 3aefeba18c..fa3bbc01d8 100644 --- a/typedapi/indices/get/get.go +++ b/typedapi/indices/get/get.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about one or more indices. package get import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type Get struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGet type alias for index. @@ -78,13 +81,18 @@ func NewGetFunc(tp elastictransport.Interface) NewGet { // Returns information about one or more indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html func New(tp elastictransport.Interface) *Get { r := &Get{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) method = http.MethodGet @@ -118,9 +129,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -137,27 +148,66 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Get) Perform(ctx context.Context) (*http.Response, error) { +func (r Get) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.get") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get") + if reader := instrument.RecordRequestBody(ctx, "indices.get", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Get query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Get query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a get.Response -func (r Get) Do(ctx context.Context) (Response, error) { +func (r Get) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -165,6 +215,9 @@ func (r Get) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -174,6 +227,9 @@ func (r Get) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,12 +237,25 @@ func (r Get) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Get) IsSuccess(ctx context.Context) (bool, error) { +func (r Get) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -202,6 +271,14 @@ func (r Get) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Get query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/get/response.go b/typedapi/indices/get/response.go index ae48c00540..b8749fe3f2 100644 --- a/typedapi/indices/get/response.go +++ b/typedapi/indices/get/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package get @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package get // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get/IndicesGetResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get/IndicesGetResponse.ts#L24-L26 type Response map[string]types.IndexState diff --git a/typedapi/indices/getalias/get_alias.go b/typedapi/indices/getalias/get_alias.go index 30555a8e87..3a587ef16c 100644 --- a/typedapi/indices/getalias/get_alias.go +++ b/typedapi/indices/getalias/get_alias.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns an alias. package getalias @@ -55,12 +55,16 @@ type GetAlias struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetAlias type alias for index. @@ -78,13 +82,18 @@ func NewGetAliasFunc(tp elastictransport.Interface) NewGetAlias { // Returns an alias. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html func New(tp elastictransport.Interface) *GetAlias { r := &GetAlias{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,23 +121,35 @@ func (r *GetAlias) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_alias") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet case r.paramSet == indexMask|nameMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_alias") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_alias") @@ -144,9 +165,9 @@ func (r *GetAlias) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -163,27 +184,66 @@ func (r *GetAlias) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetAlias) Perform(ctx context.Context) (*http.Response, error) { +func (r GetAlias) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.get_alias") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_alias") + if reader := instrument.RecordRequestBody(ctx, "indices.get_alias", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_alias") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetAlias query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetAlias query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getalias.Response -func (r GetAlias) Do(ctx context.Context) (Response, error) { +func (r GetAlias) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -191,6 +251,9 @@ func (r GetAlias) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -200,30 +263,45 @@ func (r GetAlias) Do(ctx context.Context) (Response, error) { if res.StatusCode == 404 { data, err := ioutil.ReadAll(res.Body) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(gobytes.NewReader(data)).Decode(&errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } if errorResponse.Status == 0 { err = json.NewDecoder(gobytes.NewReader(data)).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } return response, nil } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,12 +309,25 @@ func (r GetAlias) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetAlias) IsSuccess(ctx context.Context) (bool, error) { +func (r GetAlias) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -252,6 +343,14 @@ func (r GetAlias) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetAlias query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/getalias/response.go b/typedapi/indices/getalias/response.go index a2e676ff54..3db411e1d8 100644 --- a/typedapi/indices/getalias/response.go +++ b/typedapi/indices/getalias/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getalias @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getalias // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_alias/IndicesGetAliasResponse.ts#L26-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_alias/IndicesGetAliasResponse.ts#L26-L34 type Response map[string]types.IndexAliases diff --git a/typedapi/indices/getdatalifecycle/get_data_lifecycle.go b/typedapi/indices/getdatalifecycle/get_data_lifecycle.go index 5c5a3dc1a7..c55056c077 100644 --- a/typedapi/indices/getdatalifecycle/get_data_lifecycle.go +++ b/typedapi/indices/getdatalifecycle/get_data_lifecycle.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the data stream lifecycle of the selected data streams. package getdatalifecycle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type GetDataLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetDataLifecycle type alias for index. @@ -77,13 +80,18 @@ func NewGetDataLifecycleFunc(tp elastictransport.Interface) NewGetDataLifecycle // Returns the data stream lifecycle of the selected data streams. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-get-lifecycle.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-get-lifecycle.html func New(tp elastictransport.Interface) *GetDataLifecycle { r := &GetDataLifecycle{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *GetDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_data_stream") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) path.WriteString("/") path.WriteString("_lifecycle") @@ -121,9 +132,9 @@ func (r *GetDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *GetDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetDataLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r GetDataLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.get_data_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_data_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "indices.get_data_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_data_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetDataLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetDataLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getdatalifecycle.Response -func (r GetDataLifecycle) Do(ctx context.Context) (*Response, error) { +func (r GetDataLifecycle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r GetDataLifecycle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r GetDataLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r GetDataLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetDataLifecycle) IsSuccess(ctx context.Context) (bool, error) { +func (r GetDataLifecycle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r GetDataLifecycle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetDataLifecycle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/getdatalifecycle/response.go b/typedapi/indices/getdatalifecycle/response.go index 8affc5349b..0b0c3efb93 100644 --- a/typedapi/indices/getdatalifecycle/response.go +++ b/typedapi/indices/getdatalifecycle/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getdatalifecycle @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getdatalifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_data_lifecycle/IndicesGetDataLifecycleResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_data_lifecycle/IndicesGetDataLifecycleResponse.ts#L23-L25 type Response struct { DataStreams []types.DataStreamWithLifecycle `json:"data_streams"` } diff --git a/typedapi/indices/getdatastream/get_data_stream.go b/typedapi/indices/getdatastream/get_data_stream.go index 1b5148daae..8b05211f05 100644 --- a/typedapi/indices/getdatastream/get_data_stream.go +++ b/typedapi/indices/getdatastream/get_data_stream.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns data streams. package getdatastream import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type GetDataStream struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetDataStream type alias for index. @@ -75,13 +78,18 @@ func NewGetDataStreamFunc(tp elastictransport.Interface) NewGetDataStream { // Returns data streams. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html func New(tp elastictransport.Interface) *GetDataStream { r := &GetDataStream{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,6 +117,9 @@ func (r *GetDataStream) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("_data_stream") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -122,9 +133,9 @@ func (r *GetDataStream) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *GetDataStream) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetDataStream) Perform(ctx context.Context) (*http.Response, error) { +func (r GetDataStream) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.get_data_stream") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_data_stream") + if reader := instrument.RecordRequestBody(ctx, "indices.get_data_stream", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_data_stream") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetDataStream query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetDataStream query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getdatastream.Response -func (r GetDataStream) Do(ctx context.Context) (*Response, error) { +func (r GetDataStream) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r GetDataStream) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r GetDataStream) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r GetDataStream) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetDataStream) IsSuccess(ctx context.Context) (bool, error) { +func (r GetDataStream) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r GetDataStream) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetDataStream query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/getdatastream/response.go b/typedapi/indices/getdatastream/response.go index aa7d5eecd2..69a2ab4f50 100644 --- a/typedapi/indices/getdatastream/response.go +++ b/typedapi/indices/getdatastream/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getdatastream @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getdatastream // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_data_stream/IndicesGetDataStreamResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_data_stream/IndicesGetDataStreamResponse.ts#L22-L24 type Response struct { DataStreams []types.DataStream `json:"data_streams"` } diff --git a/typedapi/indices/getfieldmapping/get_field_mapping.go b/typedapi/indices/getfieldmapping/get_field_mapping.go index a46793b8eb..3aff201605 100644 --- a/typedapi/indices/getfieldmapping/get_field_mapping.go +++ b/typedapi/indices/getfieldmapping/get_field_mapping.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns mapping for one or more fields. package getfieldmapping import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -55,12 +54,16 @@ type GetFieldMapping struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int fields string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetFieldMapping type alias for index. @@ -80,13 +83,18 @@ func NewGetFieldMappingFunc(tp elastictransport.Interface) NewGetFieldMapping { // Returns mapping for one or more fields. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html func New(tp elastictransport.Interface) *GetFieldMapping { r := &GetFieldMapping{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,12 +119,18 @@ func (r *GetFieldMapping) HttpRequest(ctx context.Context) (*http.Request, error path.WriteString("field") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "fields", r.fields) + } path.WriteString(r.fields) method = http.MethodGet case r.paramSet == indexMask|fieldsMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_mapping") @@ -124,6 +138,9 @@ func (r *GetFieldMapping) HttpRequest(ctx context.Context) (*http.Request, error path.WriteString("field") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "fields", r.fields) + } path.WriteString(r.fields) method = http.MethodGet @@ -137,9 +154,9 @@ func (r *GetFieldMapping) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -156,27 +173,66 @@ func (r *GetFieldMapping) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetFieldMapping) Perform(ctx context.Context) (*http.Response, error) { +func (r GetFieldMapping) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.get_field_mapping") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_field_mapping") + if reader := instrument.RecordRequestBody(ctx, "indices.get_field_mapping", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_field_mapping") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetFieldMapping query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetFieldMapping query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getfieldmapping.Response -func (r GetFieldMapping) Do(ctx context.Context) (Response, error) { +func (r GetFieldMapping) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_field_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -184,6 +240,9 @@ func (r GetFieldMapping) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -193,6 +252,9 @@ func (r GetFieldMapping) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -200,12 +262,25 @@ func (r GetFieldMapping) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetFieldMapping) IsSuccess(ctx context.Context) (bool, error) { +func (r GetFieldMapping) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_field_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -221,6 +296,14 @@ func (r GetFieldMapping) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetFieldMapping query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/getfieldmapping/response.go b/typedapi/indices/getfieldmapping/response.go index 6fea42b3a2..28461896c8 100644 --- a/typedapi/indices/getfieldmapping/response.go +++ b/typedapi/indices/getfieldmapping/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getfieldmapping @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getfieldmapping // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_field_mapping/IndicesGetFieldMappingResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_field_mapping/IndicesGetFieldMappingResponse.ts#L24-L26 type Response map[string]types.TypeFieldMappings diff --git a/typedapi/indices/getindextemplate/get_index_template.go b/typedapi/indices/getindextemplate/get_index_template.go index e667ebf6fd..9a71063101 100644 --- a/typedapi/indices/getindextemplate/get_index_template.go +++ b/typedapi/indices/getindextemplate/get_index_template.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns an index template. package getindextemplate import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetIndexTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetIndexTemplate type alias for index. @@ -74,13 +77,18 @@ func NewGetIndexTemplateFunc(tp elastictransport.Interface) NewGetIndexTemplate // Returns an index template. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-template.html func New(tp elastictransport.Interface) *GetIndexTemplate { r := &GetIndexTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *GetIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_index_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -121,9 +132,9 @@ func (r *GetIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *GetIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetIndexTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r GetIndexTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.get_index_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_index_template") + if reader := instrument.RecordRequestBody(ctx, "indices.get_index_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_index_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetIndexTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetIndexTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getindextemplate.Response -func (r GetIndexTemplate) Do(ctx context.Context) (*Response, error) { +func (r GetIndexTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r GetIndexTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r GetIndexTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r GetIndexTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetIndexTemplate) IsSuccess(ctx context.Context) (bool, error) { +func (r GetIndexTemplate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r GetIndexTemplate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetIndexTemplate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/getindextemplate/response.go b/typedapi/indices/getindextemplate/response.go index 64d931e661..6b56bcc36f 100644 --- a/typedapi/indices/getindextemplate/response.go +++ b/typedapi/indices/getindextemplate/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getindextemplate @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getindextemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_index_template/IndicesGetIndexTemplateResponse.ts#L23-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_index_template/IndicesGetIndexTemplateResponse.ts#L23-L27 type Response struct { IndexTemplates []types.IndexTemplateItem `json:"index_templates"` } diff --git a/typedapi/indices/getmapping/get_mapping.go b/typedapi/indices/getmapping/get_mapping.go index 64acb8095c..b2ec70fa70 100644 --- a/typedapi/indices/getmapping/get_mapping.go +++ b/typedapi/indices/getmapping/get_mapping.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns mappings for one or more indices. package getmapping import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type GetMapping struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetMapping type alias for index. @@ -75,13 +78,18 @@ func NewGetMappingFunc(tp elastictransport.Interface) NewGetMapping { // Returns mappings for one or more indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html func New(tp elastictransport.Interface) *GetMapping { r := &GetMapping{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *GetMapping) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_mapping") @@ -122,9 +133,9 @@ func (r *GetMapping) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *GetMapping) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetMapping) Perform(ctx context.Context) (*http.Response, error) { +func (r GetMapping) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.get_mapping") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_mapping") + if reader := instrument.RecordRequestBody(ctx, "indices.get_mapping", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_mapping") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetMapping query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetMapping query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getmapping.Response -func (r GetMapping) Do(ctx context.Context) (Response, error) { +func (r GetMapping) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r GetMapping) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r GetMapping) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r GetMapping) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetMapping) IsSuccess(ctx context.Context) (bool, error) { +func (r GetMapping) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r GetMapping) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetMapping query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/getmapping/response.go b/typedapi/indices/getmapping/response.go index d34e13bec4..d847751eff 100644 --- a/typedapi/indices/getmapping/response.go +++ b/typedapi/indices/getmapping/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getmapping @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getmapping // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_mapping/IndicesGetMappingResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_mapping/IndicesGetMappingResponse.ts#L24-L26 type Response map[string]types.IndexMappingRecord diff --git a/typedapi/indices/getsettings/get_settings.go b/typedapi/indices/getsettings/get_settings.go index ec1fa021ac..3e0366fa73 100644 --- a/typedapi/indices/getsettings/get_settings.go +++ b/typedapi/indices/getsettings/get_settings.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns settings for one or more indices. package getsettings import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -55,12 +54,16 @@ type GetSettings struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetSettings type alias for index. @@ -78,13 +81,18 @@ func NewGetSettingsFunc(tp elastictransport.Interface) NewGetSettings { // Returns settings for one or more indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html func New(tp elastictransport.Interface) *GetSettings { r := &GetSettings{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,6 +118,9 @@ func (r *GetSettings) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_settings") @@ -118,11 +129,17 @@ func (r *GetSettings) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask|nameMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_settings") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -131,6 +148,9 @@ func (r *GetSettings) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_settings") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -144,9 +164,9 @@ func (r *GetSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -163,27 +183,66 @@ func (r *GetSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetSettings) Perform(ctx context.Context) (*http.Response, error) { +func (r GetSettings) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.get_settings") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_settings") + if reader := instrument.RecordRequestBody(ctx, "indices.get_settings", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_settings") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetSettings query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetSettings query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getsettings.Response -func (r GetSettings) Do(ctx context.Context) (Response, error) { +func (r GetSettings) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -191,6 +250,9 @@ func (r GetSettings) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -200,6 +262,9 @@ func (r GetSettings) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -207,12 +272,25 @@ func (r GetSettings) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetSettings) IsSuccess(ctx context.Context) (bool, error) { +func (r GetSettings) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -228,6 +306,14 @@ func (r GetSettings) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetSettings query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/getsettings/response.go b/typedapi/indices/getsettings/response.go index dbd772b320..2710c8d0dd 100644 --- a/typedapi/indices/getsettings/response.go +++ b/typedapi/indices/getsettings/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getsettings @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getsettings // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_settings/IndicesGetSettingsResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_settings/IndicesGetSettingsResponse.ts#L24-L26 type Response map[string]types.IndexState diff --git a/typedapi/indices/gettemplate/get_template.go b/typedapi/indices/gettemplate/get_template.go index 0ab5f69272..42f3671dfd 100644 --- a/typedapi/indices/gettemplate/get_template.go +++ b/typedapi/indices/gettemplate/get_template.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns an index template. package gettemplate import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetTemplate type alias for index. @@ -74,13 +77,18 @@ func NewGetTemplateFunc(tp elastictransport.Interface) NewGetTemplate { // Returns an index template. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-template-v1.html func New(tp elastictransport.Interface) *GetTemplate { r := &GetTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *GetTemplate) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -121,9 +132,9 @@ func (r *GetTemplate) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *GetTemplate) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r GetTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.get_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.get_template") + if reader := instrument.RecordRequestBody(ctx, "indices.get_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.get_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a gettemplate.Response -func (r GetTemplate) Do(ctx context.Context) (Response, error) { +func (r GetTemplate) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r GetTemplate) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r GetTemplate) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r GetTemplate) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetTemplate) IsSuccess(ctx context.Context) (bool, error) { +func (r GetTemplate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.get_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r GetTemplate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetTemplate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/gettemplate/response.go b/typedapi/indices/gettemplate/response.go index 91a9ce772f..c3e2e48fb9 100644 --- a/typedapi/indices/gettemplate/response.go +++ b/typedapi/indices/gettemplate/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package gettemplate @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package gettemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_template/IndicesGetTemplateResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_template/IndicesGetTemplateResponse.ts#L23-L25 type Response map[string]types.TemplateMapping diff --git a/typedapi/indices/migratetodatastream/migrate_to_data_stream.go b/typedapi/indices/migratetodatastream/migrate_to_data_stream.go index 531d539a39..bbf173708f 100644 --- a/typedapi/indices/migratetodatastream/migrate_to_data_stream.go +++ b/typedapi/indices/migratetodatastream/migrate_to_data_stream.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Migrates an alias to a data stream package migratetodatastream import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type MigrateToDataStream struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMigrateToDataStream type alias for index. @@ -75,13 +78,18 @@ func NewMigrateToDataStreamFunc(tp elastictransport.Interface) NewMigrateToDataS // Migrates an alias to a data stream // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html func New(tp elastictransport.Interface) *MigrateToDataStream { r := &MigrateToDataStream{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *MigrateToDataStream) HttpRequest(ctx context.Context) (*http.Request, e path.WriteString("_migrate") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPost @@ -119,9 +130,9 @@ func (r *MigrateToDataStream) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *MigrateToDataStream) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r MigrateToDataStream) Perform(ctx context.Context) (*http.Response, error) { +func (r MigrateToDataStream) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.migrate_to_data_stream") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.migrate_to_data_stream") + if reader := instrument.RecordRequestBody(ctx, "indices.migrate_to_data_stream", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.migrate_to_data_stream") + } if err != nil { - return nil, fmt.Errorf("an error happened during the MigrateToDataStream query execution: %w", err) + localErr := fmt.Errorf("an error happened during the MigrateToDataStream query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a migratetodatastream.Response -func (r MigrateToDataStream) Do(ctx context.Context) (*Response, error) { +func (r MigrateToDataStream) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.migrate_to_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r MigrateToDataStream) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r MigrateToDataStream) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r MigrateToDataStream) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r MigrateToDataStream) IsSuccess(ctx context.Context) (bool, error) { +func (r MigrateToDataStream) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.migrate_to_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r MigrateToDataStream) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the MigrateToDataStream query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/migratetodatastream/response.go b/typedapi/indices/migratetodatastream/response.go index 59cb67bddf..a826122fd9 100644 --- a/typedapi/indices/migratetodatastream/response.go +++ b/typedapi/indices/migratetodatastream/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package migratetodatastream // Response holds the response body struct for the package migratetodatastream // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/migrate_to_data_stream/IndicesMigrateToDataStreamResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/migrate_to_data_stream/IndicesMigrateToDataStreamResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/modifydatastream/modify_data_stream.go b/typedapi/indices/modifydatastream/modify_data_stream.go index 7db4750ea7..ce4bc00c00 100644 --- a/typedapi/indices/modifydatastream/modify_data_stream.go +++ b/typedapi/indices/modifydatastream/modify_data_stream.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Modifies a data stream package modifydatastream @@ -46,13 +46,17 @@ type ModifyDataStream struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewModifyDataStream type alias for index. @@ -70,17 +74,24 @@ func NewModifyDataStreamFunc(tp elastictransport.Interface) NewModifyDataStream // Modifies a data stream // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html func New(tp elastictransport.Interface) *ModifyDataStream { r := &ModifyDataStream{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *ModifyDataStream) HttpRequest(ctx context.Context) (*http.Request, erro } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *ModifyDataStream) HttpRequest(ctx context.Context) (*http.Request, erro } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,15 +164,15 @@ func (r *ModifyDataStream) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -176,27 +189,66 @@ func (r *ModifyDataStream) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ModifyDataStream) Perform(ctx context.Context) (*http.Response, error) { +func (r ModifyDataStream) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.modify_data_stream") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.modify_data_stream") + if reader := instrument.RecordRequestBody(ctx, "indices.modify_data_stream", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.modify_data_stream") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ModifyDataStream query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ModifyDataStream query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a modifydatastream.Response -func (r ModifyDataStream) Do(ctx context.Context) (*Response, error) { +func (r ModifyDataStream) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.modify_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -204,6 +256,9 @@ func (r ModifyDataStream) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -213,6 +268,9 @@ func (r ModifyDataStream) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -220,6 +278,9 @@ func (r ModifyDataStream) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/modifydatastream/request.go b/typedapi/indices/modifydatastream/request.go index 831e871164..29ce1cda4a 100644 --- a/typedapi/indices/modifydatastream/request.go +++ b/typedapi/indices/modifydatastream/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package modifydatastream @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package modifydatastream // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/modify_data_stream/IndicesModifyDataStreamRequest.ts#L23-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/modify_data_stream/IndicesModifyDataStreamRequest.ts#L23-L36 type Request struct { // Actions Actions to perform. diff --git a/typedapi/indices/modifydatastream/response.go b/typedapi/indices/modifydatastream/response.go index e2c7ae75cb..5d6109f65a 100644 --- a/typedapi/indices/modifydatastream/response.go +++ b/typedapi/indices/modifydatastream/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package modifydatastream // Response holds the response body struct for the package modifydatastream // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/modify_data_stream/IndicesModifyDataStreamResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/modify_data_stream/IndicesModifyDataStreamResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/open/open.go b/typedapi/indices/open/open.go index 82142904c4..2fa8d7a6de 100644 --- a/typedapi/indices/open/open.go +++ b/typedapi/indices/open/open.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Opens an index. package open import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Open struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewOpen type alias for index. @@ -77,13 +80,18 @@ func NewOpenFunc(tp elastictransport.Interface) NewOpen { // Opens an index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html func New(tp elastictransport.Interface) *Open { r := &Open{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *Open) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_open") @@ -119,9 +130,9 @@ func (r *Open) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *Open) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Open) Perform(ctx context.Context) (*http.Response, error) { +func (r Open) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.open") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.open") + if reader := instrument.RecordRequestBody(ctx, "indices.open", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.open") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Open query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Open query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a open.Response -func (r Open) Do(ctx context.Context) (*Response, error) { +func (r Open) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.open") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r Open) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r Open) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r Open) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Open) IsSuccess(ctx context.Context) (bool, error) { +func (r Open) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.open") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r Open) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Open query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/open/response.go b/typedapi/indices/open/response.go index 0749eb2542..911498b784 100644 --- a/typedapi/indices/open/response.go +++ b/typedapi/indices/open/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package open // Response holds the response body struct for the package open // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/open/IndicesOpenResponse.ts#L20-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/open/IndicesOpenResponse.ts#L20-L25 type Response struct { Acknowledged bool `json:"acknowledged"` ShardsAcknowledged bool `json:"shards_acknowledged"` diff --git a/typedapi/indices/promotedatastream/promote_data_stream.go b/typedapi/indices/promotedatastream/promote_data_stream.go index b6fa82a115..becfcce51b 100644 --- a/typedapi/indices/promotedatastream/promote_data_stream.go +++ b/typedapi/indices/promotedatastream/promote_data_stream.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Promotes a data stream from a replicated data stream managed by CCR to a // regular data stream package promotedatastream import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type PromoteDataStream struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPromoteDataStream type alias for index. @@ -77,13 +80,18 @@ func NewPromoteDataStreamFunc(tp elastictransport.Interface) NewPromoteDataStrea // Promotes a data stream from a replicated data stream managed by CCR to a // regular data stream // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html func New(tp elastictransport.Interface) *PromoteDataStream { r := &PromoteDataStream{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *PromoteDataStream) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("_promote") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPost @@ -121,9 +132,9 @@ func (r *PromoteDataStream) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *PromoteDataStream) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PromoteDataStream) Perform(ctx context.Context) (*http.Response, error) { +func (r PromoteDataStream) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.promote_data_stream") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.promote_data_stream") + if reader := instrument.RecordRequestBody(ctx, "indices.promote_data_stream", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.promote_data_stream") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PromoteDataStream query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PromoteDataStream query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a promotedatastream.Response -func (r PromoteDataStream) Do(ctx context.Context) (Response, error) { +func (r PromoteDataStream) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.promote_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := new(Response) res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r PromoteDataStream) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r PromoteDataStream) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r PromoteDataStream) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PromoteDataStream) IsSuccess(ctx context.Context) (bool, error) { +func (r PromoteDataStream) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.promote_data_stream") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r PromoteDataStream) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PromoteDataStream query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/promotedatastream/response.go b/typedapi/indices/promotedatastream/response.go index 0fe4fe2f3f..d0cb05e661 100644 --- a/typedapi/indices/promotedatastream/response.go +++ b/typedapi/indices/promotedatastream/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package promotedatastream @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package promotedatastream // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/promote_data_stream/IndicesPromoteDataStreamResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/promote_data_stream/IndicesPromoteDataStreamResponse.ts#L22-L24 type Response = json.RawMessage diff --git a/typedapi/indices/putalias/put_alias.go b/typedapi/indices/putalias/put_alias.go index d79e5881e8..ea8f502760 100644 --- a/typedapi/indices/putalias/put_alias.go +++ b/typedapi/indices/putalias/put_alias.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates an alias. package putalias @@ -52,16 +52,20 @@ type PutAlias struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutAlias type alias for index. @@ -83,17 +87,24 @@ func NewPutAliasFunc(tp elastictransport.Interface) NewPutAlias { // Creates or updates an alias. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html func New(tp elastictransport.Interface) *PutAlias { r := &PutAlias{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -130,9 +141,7 @@ func (r *PutAlias) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -144,28 +153,44 @@ func (r *PutAlias) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|nameMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_alias") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut case r.paramSet == indexMask|nameMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_aliases") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -179,15 +204,15 @@ func (r *PutAlias) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -204,27 +229,66 @@ func (r *PutAlias) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutAlias) Perform(ctx context.Context) (*http.Response, error) { +func (r PutAlias) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.put_alias") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_alias") + if reader := instrument.RecordRequestBody(ctx, "indices.put_alias", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_alias") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutAlias query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutAlias query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putalias.Response -func (r PutAlias) Do(ctx context.Context) (*Response, error) { +func (r PutAlias) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -232,6 +296,9 @@ func (r PutAlias) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -241,6 +308,9 @@ func (r PutAlias) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -248,6 +318,9 @@ func (r PutAlias) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/putalias/request.go b/typedapi/indices/putalias/request.go index b35b7578f3..11d7d0935c 100644 --- a/typedapi/indices/putalias/request.go +++ b/typedapi/indices/putalias/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putalias @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putalias // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_alias/IndicesPutAliasRequest.ts#L25-L91 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_alias/IndicesPutAliasRequest.ts#L25-L91 type Request struct { // Filter Query used to limit documents the alias can access. diff --git a/typedapi/indices/putalias/response.go b/typedapi/indices/putalias/response.go index f79fc5af85..813259dfd4 100644 --- a/typedapi/indices/putalias/response.go +++ b/typedapi/indices/putalias/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putalias // Response holds the response body struct for the package putalias // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_alias/IndicesPutAliasResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_alias/IndicesPutAliasResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/putdatalifecycle/put_data_lifecycle.go b/typedapi/indices/putdatalifecycle/put_data_lifecycle.go index 97262b63fe..107f11cee9 100644 --- a/typedapi/indices/putdatalifecycle/put_data_lifecycle.go +++ b/typedapi/indices/putdatalifecycle/put_data_lifecycle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates the data stream lifecycle of the selected data streams. package putdatalifecycle @@ -51,15 +51,19 @@ type PutDataLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutDataLifecycle type alias for index. @@ -79,17 +83,24 @@ func NewPutDataLifecycleFunc(tp elastictransport.Interface) NewPutDataLifecycle // Updates the data stream lifecycle of the selected data streams. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-put-lifecycle.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-put-lifecycle.html func New(tp elastictransport.Interface) *PutDataLifecycle { r := &PutDataLifecycle{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *PutDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *PutDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -148,6 +161,9 @@ func (r *PutDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_data_stream") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) path.WriteString("/") path.WriteString("_lifecycle") @@ -163,9 +179,9 @@ func (r *PutDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -182,27 +198,66 @@ func (r *PutDataLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutDataLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r PutDataLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.put_data_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_data_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "indices.put_data_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_data_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutDataLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutDataLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putdatalifecycle.Response -func (r PutDataLifecycle) Do(ctx context.Context) (*Response, error) { +func (r PutDataLifecycle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_data_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -210,6 +265,9 @@ func (r PutDataLifecycle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -219,6 +277,9 @@ func (r PutDataLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +287,9 @@ func (r PutDataLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/putdatalifecycle/request.go b/typedapi/indices/putdatalifecycle/request.go index c213c0b159..c8c2bf02db 100644 --- a/typedapi/indices/putdatalifecycle/request.go +++ b/typedapi/indices/putdatalifecycle/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putdatalifecycle @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putdatalifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_data_lifecycle/IndicesPutDataLifecycleRequest.ts#L25-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_data_lifecycle/IndicesPutDataLifecycleRequest.ts#L25-L75 type Request struct { // DataRetention If defined, every document added to this data stream will be stored at least diff --git a/typedapi/indices/putdatalifecycle/response.go b/typedapi/indices/putdatalifecycle/response.go index 06fd85a6ab..6ccde7e42e 100644 --- a/typedapi/indices/putdatalifecycle/response.go +++ b/typedapi/indices/putdatalifecycle/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putdatalifecycle // Response holds the response body struct for the package putdatalifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_data_lifecycle/IndicesPutDataLifecycleResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_data_lifecycle/IndicesPutDataLifecycleResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/putindextemplate/put_index_template.go b/typedapi/indices/putindextemplate/put_index_template.go index c703b31158..72c91fba8a 100644 --- a/typedapi/indices/putindextemplate/put_index_template.go +++ b/typedapi/indices/putindextemplate/put_index_template.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates an index template. package putindextemplate @@ -51,15 +51,19 @@ type PutIndexTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutIndexTemplate type alias for index. @@ -79,17 +83,24 @@ func NewPutIndexTemplateFunc(tp elastictransport.Interface) NewPutIndexTemplate // Creates or updates an index template. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-template.html func New(tp elastictransport.Interface) *PutIndexTemplate { r := &PutIndexTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *PutIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, erro } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *PutIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, erro } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -148,6 +161,9 @@ func (r *PutIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_index_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -161,15 +177,15 @@ func (r *PutIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -186,27 +202,66 @@ func (r *PutIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutIndexTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r PutIndexTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.put_index_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_index_template") + if reader := instrument.RecordRequestBody(ctx, "indices.put_index_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_index_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutIndexTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutIndexTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putindextemplate.Response -func (r PutIndexTemplate) Do(ctx context.Context) (*Response, error) { +func (r PutIndexTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -214,6 +269,9 @@ func (r PutIndexTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r PutIndexTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +291,9 @@ func (r PutIndexTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/putindextemplate/request.go b/typedapi/indices/putindextemplate/request.go index 879647bbde..a1d7fa1b06 100644 --- a/typedapi/indices/putindextemplate/request.go +++ b/typedapi/indices/putindextemplate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putindextemplate @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putindextemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_index_template/IndicesPutIndexTemplateRequest.ts#L36-L95 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_index_template/IndicesPutIndexTemplateRequest.ts#L36-L95 type Request struct { // ComposedOf An ordered list of component template names. diff --git a/typedapi/indices/putindextemplate/response.go b/typedapi/indices/putindextemplate/response.go index 6cb2ee352b..30f9b92a86 100644 --- a/typedapi/indices/putindextemplate/response.go +++ b/typedapi/indices/putindextemplate/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putindextemplate // Response holds the response body struct for the package putindextemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_index_template/IndicesPutIndexTemplateResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_index_template/IndicesPutIndexTemplateResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/putmapping/put_mapping.go b/typedapi/indices/putmapping/put_mapping.go index f5ebc3cb74..06f5427fbd 100644 --- a/typedapi/indices/putmapping/put_mapping.go +++ b/typedapi/indices/putmapping/put_mapping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates the index mappings. package putmapping @@ -53,15 +53,19 @@ type PutMapping struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutMapping type alias for index. @@ -81,17 +85,24 @@ func NewPutMappingFunc(tp elastictransport.Interface) NewPutMapping { // Updates the index mappings. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html func New(tp elastictransport.Interface) *PutMapping { r := &PutMapping{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -128,9 +139,7 @@ func (r *PutMapping) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -142,12 +151,19 @@ func (r *PutMapping) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_mapping") @@ -163,15 +179,15 @@ func (r *PutMapping) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -188,27 +204,66 @@ func (r *PutMapping) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutMapping) Perform(ctx context.Context) (*http.Response, error) { +func (r PutMapping) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.put_mapping") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_mapping") + if reader := instrument.RecordRequestBody(ctx, "indices.put_mapping", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_mapping") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutMapping query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutMapping query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putmapping.Response -func (r PutMapping) Do(ctx context.Context) (*Response, error) { +func (r PutMapping) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -216,6 +271,9 @@ func (r PutMapping) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -225,6 +283,9 @@ func (r PutMapping) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +293,9 @@ func (r PutMapping) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/putmapping/request.go b/typedapi/indices/putmapping/request.go index c880f8f70f..0472c4f3ef 100644 --- a/typedapi/indices/putmapping/request.go +++ b/typedapi/indices/putmapping/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putmapping @@ -30,7 +30,7 @@ import ( // Request holds the request body struct for the package putmapping // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_mapping/IndicesPutMappingRequest.ts#L42-L149 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_mapping/IndicesPutMappingRequest.ts#L42-L149 type Request struct { // DateDetection Controls whether dynamic date detection is enabled. diff --git a/typedapi/indices/putmapping/response.go b/typedapi/indices/putmapping/response.go index 0982d633de..e722bb43b8 100644 --- a/typedapi/indices/putmapping/response.go +++ b/typedapi/indices/putmapping/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putmapping @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package putmapping // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_mapping/IndicesPutMappingResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_mapping/IndicesPutMappingResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/putsettings/put_settings.go b/typedapi/indices/putsettings/put_settings.go index def368093c..d4cd82a9ef 100644 --- a/typedapi/indices/putsettings/put_settings.go +++ b/typedapi/indices/putsettings/put_settings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates the index settings. package putsettings @@ -53,15 +53,19 @@ type PutSettings struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutSettings type alias for index. @@ -79,13 +83,20 @@ func NewPutSettingsFunc(tp elastictransport.Interface) NewPutSettings { // Updates the index settings. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html func New(tp elastictransport.Interface) *PutSettings { r := &PutSettings{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -124,9 +135,7 @@ func (r *PutSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -138,6 +147,10 @@ func (r *PutSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutSettings) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_settings") @@ -164,15 +180,15 @@ func (r *PutSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *PutSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutSettings) Perform(ctx context.Context) (*http.Response, error) { +func (r PutSettings) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.put_settings") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_settings") + if reader := instrument.RecordRequestBody(ctx, "indices.put_settings", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_settings") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutSettings query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutSettings query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putsettings.Response -func (r PutSettings) Do(ctx context.Context) (*Response, error) { +func (r PutSettings) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r PutSettings) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r PutSettings) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r PutSettings) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } @@ -243,6 +307,17 @@ func (r *PutSettings) Header(key, value string) *PutSettings { return r } +// Indices Comma-separated list of data streams, indices, and aliases used to limit +// the request. Supports wildcards (`*`). To target all data streams and +// indices, omit this parameter or use `*` or `_all`. +// API Name: index +func (r *PutSettings) Indices(index string) *PutSettings { + r.paramSet |= indexMask + r.index = index + + return r +} + // AllowNoIndices If `false`, the request returns an error if any wildcard expression, index // alias, or `_all` value targets only missing or closed indices. This // behavior applies even if the request targets other open indices. For diff --git a/typedapi/indices/putsettings/request.go b/typedapi/indices/putsettings/request.go index ccd62c2196..e37e14e09b 100644 --- a/typedapi/indices/putsettings/request.go +++ b/typedapi/indices/putsettings/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putsettings @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package putsettings // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_settings/IndicesPutSettingsRequest.ts#L25-L92 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_settings/IndicesPutSettingsRequest.ts#L25-L92 type Request = types.IndexSettings diff --git a/typedapi/indices/putsettings/response.go b/typedapi/indices/putsettings/response.go index 30c35c0647..9d91ad4f7f 100644 --- a/typedapi/indices/putsettings/response.go +++ b/typedapi/indices/putsettings/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putsettings // Response holds the response body struct for the package putsettings // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_settings/IndicesPutSettingsResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_settings/IndicesPutSettingsResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/puttemplate/put_template.go b/typedapi/indices/puttemplate/put_template.go index 45ef755fb2..50d6a9a007 100644 --- a/typedapi/indices/puttemplate/put_template.go +++ b/typedapi/indices/puttemplate/put_template.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates an index template. package puttemplate @@ -51,15 +51,19 @@ type PutTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutTemplate type alias for index. @@ -79,17 +83,24 @@ func NewPutTemplateFunc(tp elastictransport.Interface) NewPutTemplate { // Creates or updates an index template. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html func New(tp elastictransport.Interface) *PutTemplate { r := &PutTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *PutTemplate) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *PutTemplate) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -148,6 +161,9 @@ func (r *PutTemplate) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_template") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -161,15 +177,15 @@ func (r *PutTemplate) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -186,27 +202,66 @@ func (r *PutTemplate) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r PutTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.put_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.put_template") + if reader := instrument.RecordRequestBody(ctx, "indices.put_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.put_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a puttemplate.Response -func (r PutTemplate) Do(ctx context.Context) (*Response, error) { +func (r PutTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.put_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -214,6 +269,9 @@ func (r PutTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r PutTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +291,9 @@ func (r PutTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/puttemplate/request.go b/typedapi/indices/puttemplate/request.go index d61a4d0ceb..923244da05 100644 --- a/typedapi/indices/puttemplate/request.go +++ b/typedapi/indices/puttemplate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttemplate @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package puttemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_template/IndicesPutTemplateRequest.ts#L29-L105 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_template/IndicesPutTemplateRequest.ts#L29-L105 type Request struct { // Aliases Aliases for the index. diff --git a/typedapi/indices/puttemplate/response.go b/typedapi/indices/puttemplate/response.go index 5ca2fbfcb1..dd9f632eee 100644 --- a/typedapi/indices/puttemplate/response.go +++ b/typedapi/indices/puttemplate/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttemplate // Response holds the response body struct for the package puttemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_template/IndicesPutTemplateResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_template/IndicesPutTemplateResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/recovery/recovery.go b/typedapi/indices/recovery/recovery.go index 26508e279e..d07f90b5e7 100644 --- a/typedapi/indices/recovery/recovery.go +++ b/typedapi/indices/recovery/recovery.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about ongoing index shard recoveries. package recovery import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Recovery struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRecovery type alias for index. @@ -74,13 +77,18 @@ func NewRecoveryFunc(tp elastictransport.Interface) NewRecovery { // Returns information about ongoing index shard recoveries. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-recovery.html func New(tp elastictransport.Interface) *Recovery { r := &Recovery{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *Recovery) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_recovery") @@ -121,9 +132,9 @@ func (r *Recovery) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *Recovery) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Recovery) Perform(ctx context.Context) (*http.Response, error) { +func (r Recovery) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.recovery") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.recovery") + if reader := instrument.RecordRequestBody(ctx, "indices.recovery", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.recovery") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Recovery query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Recovery query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a recovery.Response -func (r Recovery) Do(ctx context.Context) (Response, error) { +func (r Recovery) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.recovery") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r Recovery) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r Recovery) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r Recovery) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Recovery) IsSuccess(ctx context.Context) (bool, error) { +func (r Recovery) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.recovery") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r Recovery) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Recovery query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/recovery/response.go b/typedapi/indices/recovery/response.go index d11592ffdb..58b1bfcb86 100644 --- a/typedapi/indices/recovery/response.go +++ b/typedapi/indices/recovery/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package recovery @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package recovery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/IndicesRecoveryResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/IndicesRecoveryResponse.ts#L24-L26 type Response map[string]types.RecoveryStatus diff --git a/typedapi/indices/refresh/refresh.go b/typedapi/indices/refresh/refresh.go index 47386407e9..05de38290e 100644 --- a/typedapi/indices/refresh/refresh.go +++ b/typedapi/indices/refresh/refresh.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Performs the refresh operation in one or more indices. package refresh import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Refresh struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRefresh type alias for index. @@ -75,13 +78,18 @@ func NewRefreshFunc(tp elastictransport.Interface) NewRefresh { // Performs the refresh operation in one or more indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html func New(tp elastictransport.Interface) *Refresh { r := &Refresh{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *Refresh) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_refresh") @@ -122,9 +133,9 @@ func (r *Refresh) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *Refresh) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Refresh) Perform(ctx context.Context) (*http.Response, error) { +func (r Refresh) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.refresh") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.refresh") + if reader := instrument.RecordRequestBody(ctx, "indices.refresh", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.refresh") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Refresh query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Refresh query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a refresh.Response -func (r Refresh) Do(ctx context.Context) (*Response, error) { +func (r Refresh) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.refresh") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r Refresh) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r Refresh) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r Refresh) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Refresh) IsSuccess(ctx context.Context) (bool, error) { +func (r Refresh) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.refresh") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r Refresh) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Refresh query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/refresh/response.go b/typedapi/indices/refresh/response.go index d5c10b2909..00ef2f08f3 100644 --- a/typedapi/indices/refresh/response.go +++ b/typedapi/indices/refresh/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package refresh @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package refresh // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/refresh/IndicesRefreshResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/refresh/IndicesRefreshResponse.ts#L22-L24 type Response struct { Shards_ types.ShardStatistics `json:"_shards"` } diff --git a/typedapi/indices/reloadsearchanalyzers/reload_search_analyzers.go b/typedapi/indices/reloadsearchanalyzers/reload_search_analyzers.go index 5c8580f4a7..9e5d3b6659 100644 --- a/typedapi/indices/reloadsearchanalyzers/reload_search_analyzers.go +++ b/typedapi/indices/reloadsearchanalyzers/reload_search_analyzers.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Reloads an index's search analyzers and their resources. package reloadsearchanalyzers import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type ReloadSearchAnalyzers struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewReloadSearchAnalyzers type alias for index. @@ -77,13 +80,18 @@ func NewReloadSearchAnalyzersFunc(tp elastictransport.Interface) NewReloadSearch // Reloads an index's search analyzers and their resources. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-reload-analyzers.html func New(tp elastictransport.Interface) *ReloadSearchAnalyzers { r := &ReloadSearchAnalyzers{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *ReloadSearchAnalyzers) HttpRequest(ctx context.Context) (*http.Request, case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_reload_search_analyzers") @@ -119,9 +130,9 @@ func (r *ReloadSearchAnalyzers) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *ReloadSearchAnalyzers) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ReloadSearchAnalyzers) Perform(ctx context.Context) (*http.Response, error) { +func (r ReloadSearchAnalyzers) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.reload_search_analyzers") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.reload_search_analyzers") + if reader := instrument.RecordRequestBody(ctx, "indices.reload_search_analyzers", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.reload_search_analyzers") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ReloadSearchAnalyzers query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ReloadSearchAnalyzers query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a reloadsearchanalyzers.Response -func (r ReloadSearchAnalyzers) Do(ctx context.Context) (*Response, error) { +func (r ReloadSearchAnalyzers) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.reload_search_analyzers") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r ReloadSearchAnalyzers) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r ReloadSearchAnalyzers) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r ReloadSearchAnalyzers) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ReloadSearchAnalyzers) IsSuccess(ctx context.Context) (bool, error) { +func (r ReloadSearchAnalyzers) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.reload_search_analyzers") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r ReloadSearchAnalyzers) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ReloadSearchAnalyzers query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/reloadsearchanalyzers/response.go b/typedapi/indices/reloadsearchanalyzers/response.go index 21802bd06a..d94b4def8f 100644 --- a/typedapi/indices/reloadsearchanalyzers/response.go +++ b/typedapi/indices/reloadsearchanalyzers/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package reloadsearchanalyzers @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package reloadsearchanalyzers // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/reload_search_analyzers/ReloadSearchAnalyzersResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/reload_search_analyzers/ReloadSearchAnalyzersResponse.ts#L22-L24 type Response struct { ReloadDetails []types.ReloadDetails `json:"reload_details"` Shards_ types.ShardStatistics `json:"_shards"` diff --git a/typedapi/indices/resolveindex/resolve_index.go b/typedapi/indices/resolveindex/resolve_index.go index 7b78d33e3f..b4a49db507 100644 --- a/typedapi/indices/resolveindex/resolve_index.go +++ b/typedapi/indices/resolveindex/resolve_index.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about any matching indices, aliases, and data streams package resolveindex import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type ResolveIndex struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewResolveIndex type alias for index. @@ -76,13 +79,18 @@ func NewResolveIndexFunc(tp elastictransport.Interface) NewResolveIndex { // Returns information about any matching indices, aliases, and data streams // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-resolve-index-api.html func New(tp elastictransport.Interface) *ResolveIndex { r := &ResolveIndex{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *ResolveIndex) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("index") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -120,9 +131,9 @@ func (r *ResolveIndex) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,27 +150,66 @@ func (r *ResolveIndex) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ResolveIndex) Perform(ctx context.Context) (*http.Response, error) { +func (r ResolveIndex) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.resolve_index") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.resolve_index") + if reader := instrument.RecordRequestBody(ctx, "indices.resolve_index", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.resolve_index") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ResolveIndex query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ResolveIndex query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a resolveindex.Response -func (r ResolveIndex) Do(ctx context.Context) (*Response, error) { +func (r ResolveIndex) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.resolve_index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -167,6 +217,9 @@ func (r ResolveIndex) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,6 +229,9 @@ func (r ResolveIndex) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,12 +239,25 @@ func (r ResolveIndex) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ResolveIndex) IsSuccess(ctx context.Context) (bool, error) { +func (r ResolveIndex) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.resolve_index") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -204,6 +273,14 @@ func (r ResolveIndex) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ResolveIndex query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/resolveindex/response.go b/typedapi/indices/resolveindex/response.go index b97186bfdf..9ab95a4683 100644 --- a/typedapi/indices/resolveindex/response.go +++ b/typedapi/indices/resolveindex/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package resolveindex @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package resolveindex // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/resolve_index/ResolveIndexResponse.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/resolve_index/ResolveIndexResponse.ts#L22-L28 type Response struct { Aliases []types.ResolveIndexAliasItem `json:"aliases"` DataStreams []types.ResolveIndexDataStreamsItem `json:"data_streams"` diff --git a/typedapi/indices/rollover/request.go b/typedapi/indices/rollover/request.go index 55c0cf369b..1c236384e9 100644 --- a/typedapi/indices/rollover/request.go +++ b/typedapi/indices/rollover/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package rollover @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package rollover // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/rollover/IndicesRolloverRequest.ts#L29-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/rollover/IndicesRolloverRequest.ts#L29-L99 type Request struct { // Aliases Aliases for the target index. diff --git a/typedapi/indices/rollover/response.go b/typedapi/indices/rollover/response.go index 3301afd9f0..f4e1271eb7 100644 --- a/typedapi/indices/rollover/response.go +++ b/typedapi/indices/rollover/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package rollover // Response holds the response body struct for the package rollover // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/rollover/IndicesRolloverResponse.ts#L22-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/rollover/IndicesRolloverResponse.ts#L22-L32 type Response struct { Acknowledged bool `json:"acknowledged"` Conditions map[string]bool `json:"conditions"` diff --git a/typedapi/indices/rollover/rollover.go b/typedapi/indices/rollover/rollover.go index 15e6916d49..41e46f92a5 100644 --- a/typedapi/indices/rollover/rollover.go +++ b/typedapi/indices/rollover/rollover.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates an alias to point to a new index when the existing index // is considered to be too large or too old. @@ -54,16 +54,20 @@ type Rollover struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int alias string newindex string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRollover type alias for index. @@ -84,17 +88,24 @@ func NewRolloverFunc(tp elastictransport.Interface) NewRollover { // Updates an alias to point to a new index when the existing index // is considered to be too large or too old. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-rollover-index.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-rollover-index.html func New(tp elastictransport.Interface) *Rollover { r := &Rollover{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -131,9 +142,7 @@ func (r *Rollover) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -145,12 +154,19 @@ func (r *Rollover) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == aliasMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "alias", r.alias) + } path.WriteString(r.alias) path.WriteString("/") path.WriteString("_rollover") @@ -159,11 +175,17 @@ func (r *Rollover) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == aliasMask|newindexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "alias", r.alias) + } path.WriteString(r.alias) path.WriteString("/") path.WriteString("_rollover") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "newindex", r.newindex) + } path.WriteString(r.newindex) method = http.MethodPost @@ -177,15 +199,15 @@ func (r *Rollover) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -202,27 +224,66 @@ func (r *Rollover) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Rollover) Perform(ctx context.Context) (*http.Response, error) { +func (r Rollover) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.rollover") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.rollover") + if reader := instrument.RecordRequestBody(ctx, "indices.rollover", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.rollover") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Rollover query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Rollover query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a rollover.Response -func (r Rollover) Do(ctx context.Context) (*Response, error) { +func (r Rollover) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.rollover") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -230,6 +291,9 @@ func (r Rollover) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -239,6 +303,9 @@ func (r Rollover) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -246,6 +313,9 @@ func (r Rollover) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/segments/response.go b/typedapi/indices/segments/response.go index 0c96f6501b..f8d27b4929 100644 --- a/typedapi/indices/segments/response.go +++ b/typedapi/indices/segments/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package segments @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package segments // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/segments/IndicesSegmentsResponse.ts#L24-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/segments/IndicesSegmentsResponse.ts#L24-L29 type Response struct { Indices map[string]types.IndexSegment `json:"indices"` Shards_ types.ShardStatistics `json:"_shards"` diff --git a/typedapi/indices/segments/segments.go b/typedapi/indices/segments/segments.go index 47367319f5..346174b10b 100644 --- a/typedapi/indices/segments/segments.go +++ b/typedapi/indices/segments/segments.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Provides low-level information about segments in a Lucene index. package segments import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Segments struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSegments type alias for index. @@ -75,13 +78,18 @@ func NewSegmentsFunc(tp elastictransport.Interface) NewSegments { // Provides low-level information about segments in a Lucene index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-segments.html func New(tp elastictransport.Interface) *Segments { r := &Segments{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *Segments) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_segments") @@ -122,9 +133,9 @@ func (r *Segments) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *Segments) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Segments) Perform(ctx context.Context) (*http.Response, error) { +func (r Segments) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.segments") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.segments") + if reader := instrument.RecordRequestBody(ctx, "indices.segments", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.segments") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Segments query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Segments query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a segments.Response -func (r Segments) Do(ctx context.Context) (*Response, error) { +func (r Segments) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.segments") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r Segments) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r Segments) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r Segments) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Segments) IsSuccess(ctx context.Context) (bool, error) { +func (r Segments) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.segments") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r Segments) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Segments query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/shardstores/response.go b/typedapi/indices/shardstores/response.go index 34fd25ea4d..cdba4f0785 100644 --- a/typedapi/indices/shardstores/response.go +++ b/typedapi/indices/shardstores/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package shardstores @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package shardstores // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/shard_stores/IndicesShardStoresResponse.ts#L24-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/shard_stores/IndicesShardStoresResponse.ts#L24-L26 type Response struct { Indices map[string]types.IndicesShardStores `json:"indices"` } diff --git a/typedapi/indices/shardstores/shard_stores.go b/typedapi/indices/shardstores/shard_stores.go index aa5955d34c..72d6dfb67f 100644 --- a/typedapi/indices/shardstores/shard_stores.go +++ b/typedapi/indices/shardstores/shard_stores.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Provides store information for shard copies of indices. package shardstores import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type ShardStores struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewShardStores type alias for index. @@ -76,13 +79,18 @@ func NewShardStoresFunc(tp elastictransport.Interface) NewShardStores { // Provides store information for shard copies of indices. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shards-stores.html func New(tp elastictransport.Interface) *ShardStores { r := &ShardStores{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *ShardStores) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_shard_stores") @@ -123,9 +134,9 @@ func (r *ShardStores) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -142,27 +153,66 @@ func (r *ShardStores) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ShardStores) Perform(ctx context.Context) (*http.Response, error) { +func (r ShardStores) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.shard_stores") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.shard_stores") + if reader := instrument.RecordRequestBody(ctx, "indices.shard_stores", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.shard_stores") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ShardStores query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ShardStores query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a shardstores.Response -func (r ShardStores) Do(ctx context.Context) (*Response, error) { +func (r ShardStores) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.shard_stores") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -170,6 +220,9 @@ func (r ShardStores) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -179,6 +232,9 @@ func (r ShardStores) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -186,12 +242,25 @@ func (r ShardStores) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ShardStores) IsSuccess(ctx context.Context) (bool, error) { +func (r ShardStores) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.shard_stores") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -207,6 +276,14 @@ func (r ShardStores) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ShardStores query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/shrink/request.go b/typedapi/indices/shrink/request.go index 195126ea8c..b499a4b022 100644 --- a/typedapi/indices/shrink/request.go +++ b/typedapi/indices/shrink/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package shrink @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package shrink // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/shrink/IndicesShrinkRequest.ts#L27-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/shrink/IndicesShrinkRequest.ts#L27-L75 type Request struct { // Aliases The key is the alias name. diff --git a/typedapi/indices/shrink/response.go b/typedapi/indices/shrink/response.go index f332954442..52f655862e 100644 --- a/typedapi/indices/shrink/response.go +++ b/typedapi/indices/shrink/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package shrink // Response holds the response body struct for the package shrink // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/shrink/IndicesShrinkResponse.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/shrink/IndicesShrinkResponse.ts#L22-L28 type Response struct { Acknowledged bool `json:"acknowledged"` Index string `json:"index"` diff --git a/typedapi/indices/shrink/shrink.go b/typedapi/indices/shrink/shrink.go index f306bfdf0d..19b00ba4a3 100644 --- a/typedapi/indices/shrink/shrink.go +++ b/typedapi/indices/shrink/shrink.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allow to shrink an existing index into a new index with fewer primary shards. package shrink @@ -52,16 +52,20 @@ type Shrink struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string target string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewShrink type alias for index. @@ -83,17 +87,24 @@ func NewShrinkFunc(tp elastictransport.Interface) NewShrink { // Allow to shrink an existing index into a new index with fewer primary shards. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-shrink-index.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html func New(tp elastictransport.Interface) *Shrink { r := &Shrink{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -130,9 +141,7 @@ func (r *Shrink) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -144,17 +153,27 @@ func (r *Shrink) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|targetMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_shrink") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "target", r.target) + } path.WriteString(r.target) method = http.MethodPut @@ -168,15 +187,15 @@ func (r *Shrink) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -193,27 +212,66 @@ func (r *Shrink) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Shrink) Perform(ctx context.Context) (*http.Response, error) { +func (r Shrink) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.shrink") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.shrink") + if reader := instrument.RecordRequestBody(ctx, "indices.shrink", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.shrink") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Shrink query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Shrink query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a shrink.Response -func (r Shrink) Do(ctx context.Context) (*Response, error) { +func (r Shrink) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.shrink") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -221,6 +279,9 @@ func (r Shrink) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +291,9 @@ func (r Shrink) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -237,6 +301,9 @@ func (r Shrink) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/simulateindextemplate/request.go b/typedapi/indices/simulateindextemplate/request.go index 9793ffb2b4..e4ef5a2672 100644 --- a/typedapi/indices/simulateindextemplate/request.go +++ b/typedapi/indices/simulateindextemplate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package simulateindextemplate @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package simulateindextemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/simulate_index_template/IndicesSimulateIndexTemplateRequest.ts#L33-L115 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/simulate_index_template/IndicesSimulateIndexTemplateRequest.ts#L33-L115 type Request struct { // AllowAutoCreate This setting overrides the value of the `action.auto_create_index` cluster diff --git a/typedapi/indices/simulateindextemplate/response.go b/typedapi/indices/simulateindextemplate/response.go index 3ccb062507..4f4486f64f 100644 --- a/typedapi/indices/simulateindextemplate/response.go +++ b/typedapi/indices/simulateindextemplate/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package simulateindextemplate // Response holds the response body struct for the package simulateindextemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/simulate_index_template/IndicesSimulateIndexTemplateResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/simulate_index_template/IndicesSimulateIndexTemplateResponse.ts#L20-L22 type Response struct { } diff --git a/typedapi/indices/simulateindextemplate/simulate_index_template.go b/typedapi/indices/simulateindextemplate/simulate_index_template.go index 4b677d30fd..8bbc7fb557 100644 --- a/typedapi/indices/simulateindextemplate/simulate_index_template.go +++ b/typedapi/indices/simulateindextemplate/simulate_index_template.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Simulate matching the given index name against the index templates in the // system @@ -52,15 +52,19 @@ type SimulateIndexTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSimulateIndexTemplate type alias for index. @@ -81,17 +85,24 @@ func NewSimulateIndexTemplateFunc(tp elastictransport.Interface) NewSimulateInde // Simulate matching the given index name against the index templates in the // system // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-simulate-index.html func New(tp elastictransport.Interface) *SimulateIndexTemplate { r := &SimulateIndexTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -128,9 +139,7 @@ func (r *SimulateIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -142,6 +151,10 @@ func (r *SimulateIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -152,6 +165,9 @@ func (r *SimulateIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("_simulate_index") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPost @@ -165,15 +181,15 @@ func (r *SimulateIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -190,27 +206,66 @@ func (r *SimulateIndexTemplate) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SimulateIndexTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r SimulateIndexTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.simulate_index_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.simulate_index_template") + if reader := instrument.RecordRequestBody(ctx, "indices.simulate_index_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.simulate_index_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SimulateIndexTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SimulateIndexTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a simulateindextemplate.Response -func (r SimulateIndexTemplate) Do(ctx context.Context) (*Response, error) { +func (r SimulateIndexTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.simulate_index_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -218,6 +273,9 @@ func (r SimulateIndexTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -227,6 +285,9 @@ func (r SimulateIndexTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +295,9 @@ func (r SimulateIndexTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/simulatetemplate/request.go b/typedapi/indices/simulatetemplate/request.go index 6a9e15ef35..2f8bb23d9b 100644 --- a/typedapi/indices/simulatetemplate/request.go +++ b/typedapi/indices/simulatetemplate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package simulatetemplate @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package simulatetemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/simulate_template/IndicesSimulateTemplateRequest.ts#L25-L61 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/simulate_template/IndicesSimulateTemplateRequest.ts#L25-L61 type Request = types.IndexTemplate diff --git a/typedapi/indices/simulatetemplate/response.go b/typedapi/indices/simulatetemplate/response.go index 2626e6b51f..527976f361 100644 --- a/typedapi/indices/simulatetemplate/response.go +++ b/typedapi/indices/simulatetemplate/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package simulatetemplate @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package simulatetemplate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/simulate_template/IndicesSimulateTemplateResponse.ts#L26-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/simulate_template/IndicesSimulateTemplateResponse.ts#L26-L31 type Response struct { Overlapping []types.Overlapping `json:"overlapping,omitempty"` Template types.Template `json:"template"` diff --git a/typedapi/indices/simulatetemplate/simulate_template.go b/typedapi/indices/simulatetemplate/simulate_template.go index 48130bf59b..205030190f 100644 --- a/typedapi/indices/simulatetemplate/simulate_template.go +++ b/typedapi/indices/simulatetemplate/simulate_template.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Simulate resolving the given template name or body package simulatetemplate @@ -51,15 +51,19 @@ type SimulateTemplate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSimulateTemplate type alias for index. @@ -77,13 +81,20 @@ func NewSimulateTemplateFunc(tp elastictransport.Interface) NewSimulateTemplate // Simulate resolving the given template name or body // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-simulate-template.html func New(tp elastictransport.Interface) *SimulateTemplate { r := &SimulateTemplate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -122,9 +133,7 @@ func (r *SimulateTemplate) HttpRequest(ctx context.Context) (*http.Request, erro } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -136,6 +145,10 @@ func (r *SimulateTemplate) HttpRequest(ctx context.Context) (*http.Request, erro } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,6 +166,9 @@ func (r *SimulateTemplate) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_simulate") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPost @@ -166,15 +182,15 @@ func (r *SimulateTemplate) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -191,27 +207,66 @@ func (r *SimulateTemplate) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SimulateTemplate) Perform(ctx context.Context) (*http.Response, error) { +func (r SimulateTemplate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.simulate_template") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.simulate_template") + if reader := instrument.RecordRequestBody(ctx, "indices.simulate_template", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.simulate_template") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SimulateTemplate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SimulateTemplate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a simulatetemplate.Response -func (r SimulateTemplate) Do(ctx context.Context) (*Response, error) { +func (r SimulateTemplate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.simulate_template") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -219,6 +274,9 @@ func (r SimulateTemplate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -228,6 +286,9 @@ func (r SimulateTemplate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +296,9 @@ func (r SimulateTemplate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/split/request.go b/typedapi/indices/split/request.go index 9191909a40..b057ea3bdf 100644 --- a/typedapi/indices/split/request.go +++ b/typedapi/indices/split/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package split @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package split // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/split/IndicesSplitRequest.ts#L27-L74 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/split/IndicesSplitRequest.ts#L27-L74 type Request struct { // Aliases Aliases for the resulting index. diff --git a/typedapi/indices/split/response.go b/typedapi/indices/split/response.go index 1db031f19c..ad5f9ab8cc 100644 --- a/typedapi/indices/split/response.go +++ b/typedapi/indices/split/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package split // Response holds the response body struct for the package split // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/split/IndicesSplitResponse.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/split/IndicesSplitResponse.ts#L22-L28 type Response struct { Acknowledged bool `json:"acknowledged"` Index string `json:"index"` diff --git a/typedapi/indices/split/split.go b/typedapi/indices/split/split.go index e075eeb3b0..58f03276f4 100644 --- a/typedapi/indices/split/split.go +++ b/typedapi/indices/split/split.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows you to split an existing index into a new index with more primary // shards. @@ -53,16 +53,20 @@ type Split struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string target string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSplit type alias for index. @@ -85,17 +89,24 @@ func NewSplitFunc(tp elastictransport.Interface) NewSplit { // Allows you to split an existing index into a new index with more primary // shards. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-split-index.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html func New(tp elastictransport.Interface) *Split { r := &Split{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -132,9 +143,7 @@ func (r *Split) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -146,17 +155,27 @@ func (r *Split) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask|targetMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_split") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "target", r.target) + } path.WriteString(r.target) method = http.MethodPut @@ -170,15 +189,15 @@ func (r *Split) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -195,27 +214,66 @@ func (r *Split) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Split) Perform(ctx context.Context) (*http.Response, error) { +func (r Split) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.split") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.split") + if reader := instrument.RecordRequestBody(ctx, "indices.split", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.split") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Split query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Split query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a split.Response -func (r Split) Do(ctx context.Context) (*Response, error) { +func (r Split) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.split") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -223,6 +281,9 @@ func (r Split) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +293,9 @@ func (r Split) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -239,6 +303,9 @@ func (r Split) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/stats/response.go b/typedapi/indices/stats/response.go index bd0e7b5f53..a8e1a7ea79 100644 --- a/typedapi/indices/stats/response.go +++ b/typedapi/indices/stats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package stats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/IndicesStatsResponse.ts#L24-L30 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/IndicesStatsResponse.ts#L24-L30 type Response struct { All_ types.IndicesStats `json:"_all"` Indices map[string]types.IndicesStats `json:"indices,omitempty"` diff --git a/typedapi/indices/stats/stats.go b/typedapi/indices/stats/stats.go index 771516f96e..8ca4924f2d 100644 --- a/typedapi/indices/stats/stats.go +++ b/typedapi/indices/stats/stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Provides statistics on operations happening in an index. package stats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -56,12 +55,16 @@ type Stats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int metric string index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStats type alias for index. @@ -79,13 +82,18 @@ func NewStatsFunc(tp elastictransport.Interface) NewStats { // Provides statistics on operations happening in an index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html func New(tp elastictransport.Interface) *Stats { r := &Stats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -113,12 +121,18 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_stats") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) method = http.MethodGet case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_stats") @@ -127,11 +141,17 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask|metricMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_stats") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) method = http.MethodGet @@ -145,9 +165,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -164,27 +184,66 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Stats) Perform(ctx context.Context) (*http.Response, error) { +func (r Stats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.stats") + if reader := instrument.RecordRequestBody(ctx, "indices.stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Stats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Stats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stats.Response -func (r Stats) Do(ctx context.Context) (*Response, error) { +func (r Stats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -192,6 +251,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -201,6 +263,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -208,12 +273,25 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Stats) IsSuccess(ctx context.Context) (bool, error) { +func (r Stats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -229,6 +307,14 @@ func (r Stats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Stats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/unfreeze/response.go b/typedapi/indices/unfreeze/response.go index 8eb5c95ab7..09c5e490a4 100644 --- a/typedapi/indices/unfreeze/response.go +++ b/typedapi/indices/unfreeze/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package unfreeze // Response holds the response body struct for the package unfreeze // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/unfreeze/IndicesUnfreezeResponse.ts#L20-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/unfreeze/IndicesUnfreezeResponse.ts#L20-L25 type Response struct { Acknowledged bool `json:"acknowledged"` ShardsAcknowledged bool `json:"shards_acknowledged"` diff --git a/typedapi/indices/unfreeze/unfreeze.go b/typedapi/indices/unfreeze/unfreeze.go index 34ffdff964..9edbb1c8c9 100644 --- a/typedapi/indices/unfreeze/unfreeze.go +++ b/typedapi/indices/unfreeze/unfreeze.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Unfreezes an index. When a frozen index is unfrozen, the index goes through // the normal recovery process and becomes writeable again. package unfreeze import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type Unfreeze struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUnfreeze type alias for index. @@ -85,7 +88,12 @@ func New(tp elastictransport.Interface) *Unfreeze { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *Unfreeze) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_unfreeze") @@ -121,9 +132,9 @@ func (r *Unfreeze) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *Unfreeze) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Unfreeze) Perform(ctx context.Context) (*http.Response, error) { +func (r Unfreeze) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.unfreeze") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.unfreeze") + if reader := instrument.RecordRequestBody(ctx, "indices.unfreeze", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.unfreeze") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Unfreeze query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Unfreeze query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a unfreeze.Response -func (r Unfreeze) Do(ctx context.Context) (*Response, error) { +func (r Unfreeze) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.unfreeze") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r Unfreeze) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r Unfreeze) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r Unfreeze) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Unfreeze) IsSuccess(ctx context.Context) (bool, error) { +func (r Unfreeze) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.unfreeze") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r Unfreeze) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Unfreeze query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/indices/updatealiases/request.go b/typedapi/indices/updatealiases/request.go index b8ed1689eb..9424775472 100644 --- a/typedapi/indices/updatealiases/request.go +++ b/typedapi/indices/updatealiases/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatealiases @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package updatealiases // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/update_aliases/IndicesUpdateAliasesRequest.ts#L24-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/update_aliases/IndicesUpdateAliasesRequest.ts#L24-L51 type Request struct { // Actions Actions to perform. diff --git a/typedapi/indices/updatealiases/response.go b/typedapi/indices/updatealiases/response.go index 2de64ba3df..58b91a7bbe 100644 --- a/typedapi/indices/updatealiases/response.go +++ b/typedapi/indices/updatealiases/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatealiases // Response holds the response body struct for the package updatealiases // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/update_aliases/IndicesUpdateAliasesResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/update_aliases/IndicesUpdateAliasesResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/indices/updatealiases/update_aliases.go b/typedapi/indices/updatealiases/update_aliases.go index 5dd1b75b83..5cb8c96cd5 100644 --- a/typedapi/indices/updatealiases/update_aliases.go +++ b/typedapi/indices/updatealiases/update_aliases.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates index aliases. package updatealiases @@ -46,13 +46,17 @@ type UpdateAliases struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateAliases type alias for index. @@ -70,17 +74,24 @@ func NewUpdateAliasesFunc(tp elastictransport.Interface) NewUpdateAliases { // Updates index aliases. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html func New(tp elastictransport.Interface) *UpdateAliases { r := &UpdateAliases{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *UpdateAliases) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *UpdateAliases) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,15 +162,15 @@ func (r *UpdateAliases) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -174,27 +187,66 @@ func (r *UpdateAliases) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateAliases) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateAliases) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.update_aliases") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.update_aliases") + if reader := instrument.RecordRequestBody(ctx, "indices.update_aliases", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.update_aliases") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateAliases query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateAliases query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updatealiases.Response -func (r UpdateAliases) Do(ctx context.Context) (*Response, error) { +func (r UpdateAliases) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.update_aliases") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -202,6 +254,9 @@ func (r UpdateAliases) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -211,6 +266,9 @@ func (r UpdateAliases) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -218,6 +276,9 @@ func (r UpdateAliases) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/indices/validatequery/request.go b/typedapi/indices/validatequery/request.go index 1e2682a853..6c690f4cdd 100644 --- a/typedapi/indices/validatequery/request.go +++ b/typedapi/indices/validatequery/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package validatequery @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package validatequery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/validate_query/IndicesValidateQueryRequest.ts#L25-L111 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/validate_query/IndicesValidateQueryRequest.ts#L25-L111 type Request struct { // Query Query in the Lucene query string syntax. diff --git a/typedapi/indices/validatequery/response.go b/typedapi/indices/validatequery/response.go index 5d63bf1fa0..346d46533f 100644 --- a/typedapi/indices/validatequery/response.go +++ b/typedapi/indices/validatequery/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package validatequery @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package validatequery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/validate_query/IndicesValidateQueryResponse.ts#L23-L30 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/validate_query/IndicesValidateQueryResponse.ts#L23-L30 type Response struct { Error *string `json:"error,omitempty"` Explanations []types.IndicesValidationExplanation `json:"explanations,omitempty"` diff --git a/typedapi/indices/validatequery/validate_query.go b/typedapi/indices/validatequery/validate_query.go index 3496832962..917f3f6981 100644 --- a/typedapi/indices/validatequery/validate_query.go +++ b/typedapi/indices/validatequery/validate_query.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows a user to validate a potentially expensive query without executing it. package validatequery @@ -53,15 +53,19 @@ type ValidateQuery struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewValidateQuery type alias for index. @@ -79,17 +83,24 @@ func NewValidateQueryFunc(tp elastictransport.Interface) NewValidateQuery { // Allows a user to validate a potentially expensive query without executing it. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-validate.html func New(tp elastictransport.Interface) *ValidateQuery { r := &ValidateQuery{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *ValidateQuery) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *ValidateQuery) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,6 +166,9 @@ func (r *ValidateQuery) HttpRequest(ctx context.Context) (*http.Request, error) case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_validate") @@ -170,15 +186,15 @@ func (r *ValidateQuery) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -195,27 +211,66 @@ func (r *ValidateQuery) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ValidateQuery) Perform(ctx context.Context) (*http.Response, error) { +func (r ValidateQuery) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "indices.validate_query") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "indices.validate_query") + if reader := instrument.RecordRequestBody(ctx, "indices.validate_query", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "indices.validate_query") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ValidateQuery query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ValidateQuery query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a validatequery.Response -func (r ValidateQuery) Do(ctx context.Context) (*Response, error) { +func (r ValidateQuery) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "indices.validate_query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -223,6 +278,9 @@ func (r ValidateQuery) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +290,9 @@ func (r ValidateQuery) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -239,6 +300,9 @@ func (r ValidateQuery) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/inference/deletemodel/delete_model.go b/typedapi/inference/deletemodel/delete_model.go new file mode 100644 index 0000000000..6f3ddf6e86 --- /dev/null +++ b/typedapi/inference/deletemodel/delete_model.go @@ -0,0 +1,318 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +// Delete model in the Inference API +package deletemodel + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/elastic/elastic-transport-go/v8/elastictransport" + "github.com/elastic/go-elasticsearch/v8/typedapi/types" +) + +const ( + tasktypeMask = iota + 1 + + modelidMask +) + +// ErrBuildPath is returned in case of missing parameters within the build of the request. +var ErrBuildPath = errors.New("cannot build path, check for missing path parameters") + +type DeleteModel struct { + transport elastictransport.Interface + + headers http.Header + values url.Values + path url.URL + + raw io.Reader + + paramSet int + + tasktype string + modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation +} + +// NewDeleteModel type alias for index. +type NewDeleteModel func(tasktype, modelid string) *DeleteModel + +// NewDeleteModelFunc returns a new instance of DeleteModel with the provided transport. +// Used in the index of the library this allows to retrieve every apis in once place. +func NewDeleteModelFunc(tp elastictransport.Interface) NewDeleteModel { + return func(tasktype, modelid string) *DeleteModel { + n := New(tp) + + n._tasktype(tasktype) + + n._modelid(modelid) + + return n + } +} + +// Delete model in the Inference API +// +// https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference-api.html +func New(tp elastictransport.Interface) *DeleteModel { + r := &DeleteModel{ + transport: tp, + values: make(url.Values), + headers: make(http.Header), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + + return r +} + +// HttpRequest returns the http.Request object built from the +// given parameters. +func (r *DeleteModel) HttpRequest(ctx context.Context) (*http.Request, error) { + var path strings.Builder + var method string + var req *http.Request + + var err error + + r.path.Scheme = "http" + + switch { + case r.paramSet == tasktypeMask|modelidMask: + path.WriteString("/") + path.WriteString("_inference") + path.WriteString("/") + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "tasktype", r.tasktype) + } + path.WriteString(r.tasktype) + path.WriteString("/") + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } + path.WriteString(r.modelid) + + method = http.MethodDelete + } + + r.path.Path = path.String() + r.path.RawQuery = r.values.Encode() + + if r.path.Path == "" { + return nil, ErrBuildPath + } + + if ctx != nil { + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) + } else { + req, err = http.NewRequest(method, r.path.String(), r.raw) + } + + req.Header = r.headers.Clone() + + if req.Header.Get("Accept") == "" { + req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=8") + } + + if err != nil { + return req, fmt.Errorf("could not build http.Request: %w", err) + } + + return req, nil +} + +// Perform runs the http.Request through the provided transport and returns an http.Response. +func (r DeleteModel) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "inference.delete_model") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + + req, err := r.HttpRequest(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "inference.delete_model") + if reader := instrument.RecordRequestBody(ctx, "inference.delete_model", r.raw); reader != nil { + req.Body = reader + } + } + res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "inference.delete_model") + } + if err != nil { + localErr := fmt.Errorf("an error happened during the DeleteModel query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr + } + + return res, nil +} + +// Do runs the request through the transport, handle the response and returns a deletemodel.Response +func (r DeleteModel) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "inference.delete_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + response := NewResponse() + + res, err := r.Perform(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + defer res.Body.Close() + + if res.StatusCode < 299 { + err = json.NewDecoder(res.Body).Decode(response) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + return response, nil + } + + errorResponse := types.NewElasticsearchError() + err = json.NewDecoder(res.Body).Decode(errorResponse) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if errorResponse.Status == 0 { + errorResponse.Status = res.StatusCode + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } + return nil, errorResponse +} + +// IsSuccess allows to run a query with a context and retrieve the result as a boolean. +// This only exists for endpoints without a request payload and allows for quick control flow. +func (r DeleteModel) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "inference.delete_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + res, err := r.Perform(ctx) + + if err != nil { + return false, err + } + io.Copy(ioutil.Discard, res.Body) + err = res.Body.Close() + if err != nil { + return false, err + } + + if res.StatusCode >= 200 && res.StatusCode < 300 { + return true, nil + } + + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteModel query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + + return false, nil +} + +// Header set a key, value pair in the DeleteModel headers map. +func (r *DeleteModel) Header(key, value string) *DeleteModel { + r.headers.Set(key, value) + + return r +} + +// TaskType The model task type +// API Name: tasktype +func (r *DeleteModel) _tasktype(tasktype string) *DeleteModel { + r.paramSet |= tasktypeMask + r.tasktype = tasktype + + return r +} + +// ModelId The unique identifier of the inference model. +// API Name: modelid +func (r *DeleteModel) _modelid(modelid string) *DeleteModel { + r.paramSet |= modelidMask + r.modelid = modelid + + return r +} diff --git a/typedapi/inference/deletemodel/response.go b/typedapi/inference/deletemodel/response.go new file mode 100644 index 0000000000..0acad94fee --- /dev/null +++ b/typedapi/inference/deletemodel/response.go @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package deletemodel + +// Response holds the response body struct for the package deletemodel +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/delete_model/DeleteModelResponse.ts#L22-L24 +type Response struct { + + // Acknowledged For a successful response, this value is always true. On failure, an + // exception is returned instead. + Acknowledged bool `json:"acknowledged"` +} + +// NewResponse returns a Response +func NewResponse() *Response { + r := &Response{} + return r +} diff --git a/typedapi/inference/getmodel/get_model.go b/typedapi/inference/getmodel/get_model.go new file mode 100644 index 0000000000..1a2956fc40 --- /dev/null +++ b/typedapi/inference/getmodel/get_model.go @@ -0,0 +1,318 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +// Get a model in the Inference API +package getmodel + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/elastic/elastic-transport-go/v8/elastictransport" + "github.com/elastic/go-elasticsearch/v8/typedapi/types" +) + +const ( + tasktypeMask = iota + 1 + + modelidMask +) + +// ErrBuildPath is returned in case of missing parameters within the build of the request. +var ErrBuildPath = errors.New("cannot build path, check for missing path parameters") + +type GetModel struct { + transport elastictransport.Interface + + headers http.Header + values url.Values + path url.URL + + raw io.Reader + + paramSet int + + tasktype string + modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation +} + +// NewGetModel type alias for index. +type NewGetModel func(tasktype, modelid string) *GetModel + +// NewGetModelFunc returns a new instance of GetModel with the provided transport. +// Used in the index of the library this allows to retrieve every apis in once place. +func NewGetModelFunc(tp elastictransport.Interface) NewGetModel { + return func(tasktype, modelid string) *GetModel { + n := New(tp) + + n._tasktype(tasktype) + + n._modelid(modelid) + + return n + } +} + +// Get a model in the Inference API +// +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-inference-api.html +func New(tp elastictransport.Interface) *GetModel { + r := &GetModel{ + transport: tp, + values: make(url.Values), + headers: make(http.Header), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + + return r +} + +// HttpRequest returns the http.Request object built from the +// given parameters. +func (r *GetModel) HttpRequest(ctx context.Context) (*http.Request, error) { + var path strings.Builder + var method string + var req *http.Request + + var err error + + r.path.Scheme = "http" + + switch { + case r.paramSet == tasktypeMask|modelidMask: + path.WriteString("/") + path.WriteString("_inference") + path.WriteString("/") + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "tasktype", r.tasktype) + } + path.WriteString(r.tasktype) + path.WriteString("/") + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } + path.WriteString(r.modelid) + + method = http.MethodGet + } + + r.path.Path = path.String() + r.path.RawQuery = r.values.Encode() + + if r.path.Path == "" { + return nil, ErrBuildPath + } + + if ctx != nil { + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) + } else { + req, err = http.NewRequest(method, r.path.String(), r.raw) + } + + req.Header = r.headers.Clone() + + if req.Header.Get("Accept") == "" { + req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=8") + } + + if err != nil { + return req, fmt.Errorf("could not build http.Request: %w", err) + } + + return req, nil +} + +// Perform runs the http.Request through the provided transport and returns an http.Response. +func (r GetModel) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "inference.get_model") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + + req, err := r.HttpRequest(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "inference.get_model") + if reader := instrument.RecordRequestBody(ctx, "inference.get_model", r.raw); reader != nil { + req.Body = reader + } + } + res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "inference.get_model") + } + if err != nil { + localErr := fmt.Errorf("an error happened during the GetModel query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr + } + + return res, nil +} + +// Do runs the request through the transport, handle the response and returns a getmodel.Response +func (r GetModel) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "inference.get_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + response := NewResponse() + + res, err := r.Perform(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + defer res.Body.Close() + + if res.StatusCode < 299 { + err = json.NewDecoder(res.Body).Decode(response) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + return response, nil + } + + errorResponse := types.NewElasticsearchError() + err = json.NewDecoder(res.Body).Decode(errorResponse) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if errorResponse.Status == 0 { + errorResponse.Status = res.StatusCode + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } + return nil, errorResponse +} + +// IsSuccess allows to run a query with a context and retrieve the result as a boolean. +// This only exists for endpoints without a request payload and allows for quick control flow. +func (r GetModel) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "inference.get_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + res, err := r.Perform(ctx) + + if err != nil { + return false, err + } + io.Copy(ioutil.Discard, res.Body) + err = res.Body.Close() + if err != nil { + return false, err + } + + if res.StatusCode >= 200 && res.StatusCode < 300 { + return true, nil + } + + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetModel query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + + return false, nil +} + +// Header set a key, value pair in the GetModel headers map. +func (r *GetModel) Header(key, value string) *GetModel { + r.headers.Set(key, value) + + return r +} + +// TaskType The model task type +// API Name: tasktype +func (r *GetModel) _tasktype(tasktype string) *GetModel { + r.paramSet |= tasktypeMask + r.tasktype = tasktype + + return r +} + +// ModelId The unique identifier of the inference model. +// API Name: modelid +func (r *GetModel) _modelid(modelid string) *GetModel { + r.paramSet |= modelidMask + r.modelid = modelid + + return r +} diff --git a/typedapi/inference/getmodel/response.go b/typedapi/inference/getmodel/response.go new file mode 100644 index 0000000000..76f03ae5a3 --- /dev/null +++ b/typedapi/inference/getmodel/response.go @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package getmodel + +import ( + "github.com/elastic/go-elasticsearch/v8/typedapi/types" +) + +// Response holds the response body struct for the package getmodel +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/get_model/GetModelResponse.ts#L22-L26 +type Response struct { + Models []types.ModelConfigContainer `json:"models"` +} + +// NewResponse returns a Response +func NewResponse() *Response { + r := &Response{} + return r +} diff --git a/typedapi/inference/inference/inference.go b/typedapi/inference/inference/inference.go new file mode 100644 index 0000000000..ff13498d5d --- /dev/null +++ b/typedapi/inference/inference/inference.go @@ -0,0 +1,344 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +// Perform inference on a model +package inference + +import ( + gobytes "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/elastic/elastic-transport-go/v8/elastictransport" + "github.com/elastic/go-elasticsearch/v8/typedapi/types" +) + +const ( + tasktypeMask = iota + 1 + + modelidMask +) + +// ErrBuildPath is returned in case of missing parameters within the build of the request. +var ErrBuildPath = errors.New("cannot build path, check for missing path parameters") + +type Inference struct { + transport elastictransport.Interface + + headers http.Header + values url.Values + path url.URL + + raw io.Reader + + req *Request + deferred []func(request *Request) error + buf *gobytes.Buffer + + paramSet int + + tasktype string + modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation +} + +// NewInference type alias for index. +type NewInference func(tasktype, modelid string) *Inference + +// NewInferenceFunc returns a new instance of Inference with the provided transport. +// Used in the index of the library this allows to retrieve every apis in once place. +func NewInferenceFunc(tp elastictransport.Interface) NewInference { + return func(tasktype, modelid string) *Inference { + n := New(tp) + + n._tasktype(tasktype) + + n._modelid(modelid) + + return n + } +} + +// Perform inference on a model +// +// https://www.elastic.co/guide/en/elasticsearch/reference/current/post-inference-api.html +func New(tp elastictransport.Interface) *Inference { + r := &Inference{ + transport: tp, + values: make(url.Values), + headers: make(http.Header), + + buf: gobytes.NewBuffer(nil), + + req: NewRequest(), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + + return r +} + +// Raw takes a json payload as input which is then passed to the http.Request +// If specified Raw takes precedence on Request method. +func (r *Inference) Raw(raw io.Reader) *Inference { + r.raw = raw + + return r +} + +// Request allows to set the request property with the appropriate payload. +func (r *Inference) Request(req *Request) *Inference { + r.req = req + + return r +} + +// HttpRequest returns the http.Request object built from the +// given parameters. +func (r *Inference) HttpRequest(ctx context.Context) (*http.Request, error) { + var path strings.Builder + var method string + var req *http.Request + + var err error + + if len(r.deferred) > 0 { + for _, f := range r.deferred { + deferredErr := f(r.req) + if deferredErr != nil { + return nil, deferredErr + } + } + } + + if r.raw == nil && r.req != nil { + + data, err := json.Marshal(r.req) + + if err != nil { + return nil, fmt.Errorf("could not serialise request for Inference: %w", err) + } + + r.buf.Write(data) + + } + + if r.buf.Len() > 0 { + r.raw = r.buf + } + + r.path.Scheme = "http" + + switch { + case r.paramSet == tasktypeMask|modelidMask: + path.WriteString("/") + path.WriteString("_inference") + path.WriteString("/") + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "tasktype", r.tasktype) + } + path.WriteString(r.tasktype) + path.WriteString("/") + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } + path.WriteString(r.modelid) + + method = http.MethodPost + } + + r.path.Path = path.String() + r.path.RawQuery = r.values.Encode() + + if r.path.Path == "" { + return nil, ErrBuildPath + } + + if ctx != nil { + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) + } else { + req, err = http.NewRequest(method, r.path.String(), r.raw) + } + + req.Header = r.headers.Clone() + + if req.Header.Get("Accept") == "" { + req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=8") + } + + if err != nil { + return req, fmt.Errorf("could not build http.Request: %w", err) + } + + return req, nil +} + +// Perform runs the http.Request through the provided transport and returns an http.Response. +func (r Inference) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "inference.inference") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + + req, err := r.HttpRequest(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "inference.inference") + if reader := instrument.RecordRequestBody(ctx, "inference.inference", r.raw); reader != nil { + req.Body = reader + } + } + res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "inference.inference") + } + if err != nil { + localErr := fmt.Errorf("an error happened during the Inference query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr + } + + return res, nil +} + +// Do runs the request through the transport, handle the response and returns a inference.Response +func (r Inference) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "inference.inference") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + response := NewResponse() + + res, err := r.Perform(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + defer res.Body.Close() + + if res.StatusCode < 299 { + err = json.NewDecoder(res.Body).Decode(response) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + return response, nil + } + + errorResponse := types.NewElasticsearchError() + err = json.NewDecoder(res.Body).Decode(errorResponse) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if errorResponse.Status == 0 { + errorResponse.Status = res.StatusCode + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } + return nil, errorResponse +} + +// Header set a key, value pair in the Inference headers map. +func (r *Inference) Header(key, value string) *Inference { + r.headers.Set(key, value) + + return r +} + +// TaskType The model task type +// API Name: tasktype +func (r *Inference) _tasktype(tasktype string) *Inference { + r.paramSet |= tasktypeMask + r.tasktype = tasktype + + return r +} + +// ModelId The unique identifier of the inference model. +// API Name: modelid +func (r *Inference) _modelid(modelid string) *Inference { + r.paramSet |= modelidMask + r.modelid = modelid + + return r +} + +// Input Text input to the model. +// Either a string or an array of strings. +// API name: input +func (r *Inference) Input(inputs ...string) *Inference { + r.req.Input = inputs + + return r +} + +// TaskSettings Optional task settings +// API name: task_settings +func (r *Inference) TaskSettings(tasksettings json.RawMessage) *Inference { + r.req.TaskSettings = tasksettings + + return r +} diff --git a/typedapi/inference/inference/request.go b/typedapi/inference/inference/request.go new file mode 100644 index 0000000000..ab9d2296d7 --- /dev/null +++ b/typedapi/inference/inference/request.go @@ -0,0 +1,56 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package inference + +import ( + "encoding/json" + "fmt" +) + +// Request holds the request body struct for the package inference +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/inference/InferenceRequest.ts#L25-L53 +type Request struct { + + // Input Text input to the model. + // Either a string or an array of strings. + Input []string `json:"input"` + // TaskSettings Optional task settings + TaskSettings json.RawMessage `json:"task_settings,omitempty"` +} + +// NewRequest returns a Request +func NewRequest() *Request { + r := &Request{} + return r +} + +// FromJSON allows to load an arbitrary json into the request structure +func (r *Request) FromJSON(data string) (*Request, error) { + var req Request + err := json.Unmarshal([]byte(data), &req) + + if err != nil { + return nil, fmt.Errorf("could not deserialise json into Inference request: %w", err) + } + + return &req, nil +} diff --git a/typedapi/inference/inference/response.go b/typedapi/inference/inference/response.go new file mode 100644 index 0000000000..4a069ba001 --- /dev/null +++ b/typedapi/inference/inference/response.go @@ -0,0 +1,39 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package inference + +import ( + "github.com/elastic/go-elasticsearch/v8/typedapi/types" +) + +// Response holds the response body struct for the package inference +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/inference/InferenceResponse.ts#L22-L24 +type Response struct { + SparseEmbedding []types.SparseEmbeddingResult `json:"sparse_embedding,omitempty"` + TextEmbedding []types.TextEmbeddingResult `json:"text_embedding,omitempty"` +} + +// NewResponse returns a Response +func NewResponse() *Response { + r := &Response{} + return r +} diff --git a/typedapi/inference/putmodel/put_model.go b/typedapi/inference/putmodel/put_model.go new file mode 100644 index 0000000000..38dbecf833 --- /dev/null +++ b/typedapi/inference/putmodel/put_model.go @@ -0,0 +1,350 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +// Configure a model for use in the Inference API +package putmodel + +import ( + gobytes "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/elastic/elastic-transport-go/v8/elastictransport" + "github.com/elastic/go-elasticsearch/v8/typedapi/types" +) + +const ( + tasktypeMask = iota + 1 + + modelidMask +) + +// ErrBuildPath is returned in case of missing parameters within the build of the request. +var ErrBuildPath = errors.New("cannot build path, check for missing path parameters") + +type PutModel struct { + transport elastictransport.Interface + + headers http.Header + values url.Values + path url.URL + + raw io.Reader + + req *Request + deferred []func(request *Request) error + buf *gobytes.Buffer + + paramSet int + + tasktype string + modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation +} + +// NewPutModel type alias for index. +type NewPutModel func(tasktype, modelid string) *PutModel + +// NewPutModelFunc returns a new instance of PutModel with the provided transport. +// Used in the index of the library this allows to retrieve every apis in once place. +func NewPutModelFunc(tp elastictransport.Interface) NewPutModel { + return func(tasktype, modelid string) *PutModel { + n := New(tp) + + n._tasktype(tasktype) + + n._modelid(modelid) + + return n + } +} + +// Configure a model for use in the Inference API +// +// https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference-api.html +func New(tp elastictransport.Interface) *PutModel { + r := &PutModel{ + transport: tp, + values: make(url.Values), + headers: make(http.Header), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + + return r +} + +// Raw takes a json payload as input which is then passed to the http.Request +// If specified Raw takes precedence on Request method. +func (r *PutModel) Raw(raw io.Reader) *PutModel { + r.raw = raw + + return r +} + +// Request allows to set the request property with the appropriate payload. +func (r *PutModel) Request(req *Request) *PutModel { + r.req = req + + return r +} + +// HttpRequest returns the http.Request object built from the +// given parameters. +func (r *PutModel) HttpRequest(ctx context.Context) (*http.Request, error) { + var path strings.Builder + var method string + var req *http.Request + + var err error + + if len(r.deferred) > 0 { + for _, f := range r.deferred { + deferredErr := f(r.req) + if deferredErr != nil { + return nil, deferredErr + } + } + } + + if r.raw == nil && r.req != nil { + + data, err := json.Marshal(r.req) + + if err != nil { + return nil, fmt.Errorf("could not serialise request for PutModel: %w", err) + } + + r.buf.Write(data) + + } + + if r.buf.Len() > 0 { + r.raw = r.buf + } + + r.path.Scheme = "http" + + switch { + case r.paramSet == tasktypeMask|modelidMask: + path.WriteString("/") + path.WriteString("_inference") + path.WriteString("/") + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "tasktype", r.tasktype) + } + path.WriteString(r.tasktype) + path.WriteString("/") + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } + path.WriteString(r.modelid) + + method = http.MethodPut + } + + r.path.Path = path.String() + r.path.RawQuery = r.values.Encode() + + if r.path.Path == "" { + return nil, ErrBuildPath + } + + if ctx != nil { + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) + } else { + req, err = http.NewRequest(method, r.path.String(), r.raw) + } + + req.Header = r.headers.Clone() + + if req.Header.Get("Accept") == "" { + req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=8") + } + + if err != nil { + return req, fmt.Errorf("could not build http.Request: %w", err) + } + + return req, nil +} + +// Perform runs the http.Request through the provided transport and returns an http.Response. +func (r PutModel) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "inference.put_model") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + + req, err := r.HttpRequest(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "inference.put_model") + if reader := instrument.RecordRequestBody(ctx, "inference.put_model", r.raw); reader != nil { + req.Body = reader + } + } + res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "inference.put_model") + } + if err != nil { + localErr := fmt.Errorf("an error happened during the PutModel query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr + } + + return res, nil +} + +// Do runs the request through the transport, handle the response and returns a putmodel.Response +func (r PutModel) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "inference.put_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + response := NewResponse() + + res, err := r.Perform(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + defer res.Body.Close() + + if res.StatusCode < 299 { + err = json.NewDecoder(res.Body).Decode(response) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + return response, nil + } + + errorResponse := types.NewElasticsearchError() + err = json.NewDecoder(res.Body).Decode(errorResponse) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if errorResponse.Status == 0 { + errorResponse.Status = res.StatusCode + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } + return nil, errorResponse +} + +// Header set a key, value pair in the PutModel headers map. +func (r *PutModel) Header(key, value string) *PutModel { + r.headers.Set(key, value) + + return r +} + +// TaskType The model task type +// API Name: tasktype +func (r *PutModel) _tasktype(tasktype string) *PutModel { + r.paramSet |= tasktypeMask + r.tasktype = tasktype + + return r +} + +// ModelId The unique identifier of the inference model. +// API Name: modelid +func (r *PutModel) _modelid(modelid string) *PutModel { + r.paramSet |= modelidMask + r.modelid = modelid + + return r +} + +// Service The service type +// API name: service +func (r *PutModel) Service(service string) *PutModel { + + r.req.Service = service + + return r +} + +// ServiceSettings Settings specific to the service +// API name: service_settings +func (r *PutModel) ServiceSettings(servicesettings json.RawMessage) *PutModel { + r.req.ServiceSettings = servicesettings + + return r +} + +// TaskSettings Task settings specific to the service and model +// API name: task_settings +func (r *PutModel) TaskSettings(tasksettings json.RawMessage) *PutModel { + r.req.TaskSettings = tasksettings + + return r +} diff --git a/typedapi/inference/putmodel/request.go b/typedapi/inference/putmodel/request.go new file mode 100644 index 0000000000..caf01a3e39 --- /dev/null +++ b/typedapi/inference/putmodel/request.go @@ -0,0 +1,30 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package putmodel + +import ( + "github.com/elastic/go-elasticsearch/v8/typedapi/types" +) + +// Request holds the request body struct for the package putmodel +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/put_model/PutModelRequest.ts#L25-L44 +type Request = types.ModelConfig diff --git a/typedapi/inference/putmodel/response.go b/typedapi/inference/putmodel/response.go new file mode 100644 index 0000000000..7e10756f32 --- /dev/null +++ b/typedapi/inference/putmodel/response.go @@ -0,0 +1,50 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package putmodel + +import ( + "encoding/json" + + "github.com/elastic/go-elasticsearch/v8/typedapi/types/enums/tasktype" +) + +// Response holds the response body struct for the package putmodel +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/put_model/PutModelResponse.ts#L22-L24 +type Response struct { + + // ModelId The model Id + ModelId string `json:"model_id"` + // Service The service type + Service string `json:"service"` + // ServiceSettings Settings specific to the service + ServiceSettings json.RawMessage `json:"service_settings"` + // TaskSettings Task settings specific to the service and model + TaskSettings json.RawMessage `json:"task_settings"` + // TaskType The model's task type + TaskType tasktype.TaskType `json:"task_type"` +} + +// NewResponse returns a Response +func NewResponse() *Response { + r := &Response{} + return r +} diff --git a/typedapi/ingest/deletepipeline/delete_pipeline.go b/typedapi/ingest/deletepipeline/delete_pipeline.go index 14c5292f47..de5a7d4120 100644 --- a/typedapi/ingest/deletepipeline/delete_pipeline.go +++ b/typedapi/ingest/deletepipeline/delete_pipeline.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a pipeline. package deletepipeline import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeletePipeline struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeletePipeline type alias for index. @@ -75,13 +78,18 @@ func NewDeletePipelineFunc(tp elastictransport.Interface) NewDeletePipeline { // Deletes a pipeline. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-pipeline-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-pipeline-api.html func New(tp elastictransport.Interface) *DeletePipeline { r := &DeletePipeline{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeletePipeline) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("pipeline") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *DeletePipeline) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *DeletePipeline) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeletePipeline) Perform(ctx context.Context) (*http.Response, error) { +func (r DeletePipeline) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ingest.delete_pipeline") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.delete_pipeline") + if reader := instrument.RecordRequestBody(ctx, "ingest.delete_pipeline", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.delete_pipeline") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeletePipeline query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeletePipeline query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletepipeline.Response -func (r DeletePipeline) Do(ctx context.Context) (*Response, error) { +func (r DeletePipeline) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.delete_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r DeletePipeline) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r DeletePipeline) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r DeletePipeline) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeletePipeline) IsSuccess(ctx context.Context) (bool, error) { +func (r DeletePipeline) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.delete_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r DeletePipeline) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeletePipeline query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ingest/deletepipeline/response.go b/typedapi/ingest/deletepipeline/response.go index 0f9bd656c9..bd8fd425a7 100644 --- a/typedapi/ingest/deletepipeline/response.go +++ b/typedapi/ingest/deletepipeline/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletepipeline // Response holds the response body struct for the package deletepipeline // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/delete_pipeline/DeletePipelineResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/delete_pipeline/DeletePipelineResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ingest/geoipstats/geo_ip_stats.go b/typedapi/ingest/geoipstats/geo_ip_stats.go index 214e5dcf23..99d915b562 100644 --- a/typedapi/ingest/geoipstats/geo_ip_stats.go +++ b/typedapi/ingest/geoipstats/geo_ip_stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns statistical information about geoip databases package geoipstats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type GeoIpStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGeoIpStats type alias for index. @@ -67,13 +70,18 @@ func NewGeoIpStatsFunc(tp elastictransport.Interface) NewGeoIpStats { // Returns statistical information about geoip databases // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/geoip-processor.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/geoip-processor.html func New(tp elastictransport.Interface) *GeoIpStats { r := &GeoIpStats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *GeoIpStats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *GeoIpStats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GeoIpStats) Perform(ctx context.Context) (*http.Response, error) { +func (r GeoIpStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ingest.geo_ip_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.geo_ip_stats") + if reader := instrument.RecordRequestBody(ctx, "ingest.geo_ip_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.geo_ip_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GeoIpStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GeoIpStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a geoipstats.Response -func (r GeoIpStats) Do(ctx context.Context) (*Response, error) { +func (r GeoIpStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.geo_ip_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r GeoIpStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r GeoIpStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r GeoIpStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GeoIpStats) IsSuccess(ctx context.Context) (bool, error) { +func (r GeoIpStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.geo_ip_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r GeoIpStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GeoIpStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ingest/geoipstats/response.go b/typedapi/ingest/geoipstats/response.go index d3d7ce2f02..2de3564773 100644 --- a/typedapi/ingest/geoipstats/response.go +++ b/typedapi/ingest/geoipstats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package geoipstats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package geoipstats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/geo_ip_stats/IngestGeoIpStatsResponse.ts#L24-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/geo_ip_stats/IngestGeoIpStatsResponse.ts#L24-L31 type Response struct { // Nodes Downloaded GeoIP2 databases for each node. diff --git a/typedapi/ingest/getpipeline/get_pipeline.go b/typedapi/ingest/getpipeline/get_pipeline.go index 7c474ad11e..ef8a9e7da9 100644 --- a/typedapi/ingest/getpipeline/get_pipeline.go +++ b/typedapi/ingest/getpipeline/get_pipeline.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns a pipeline. package getpipeline import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetPipeline struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetPipeline type alias for index. @@ -74,13 +77,18 @@ func NewGetPipelineFunc(tp elastictransport.Interface) NewGetPipeline { // Returns a pipeline. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-pipeline-api.html func New(tp elastictransport.Interface) *GetPipeline { r := &GetPipeline{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,6 +120,9 @@ func (r *GetPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("pipeline") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -125,9 +136,9 @@ func (r *GetPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *GetPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetPipeline) Perform(ctx context.Context) (*http.Response, error) { +func (r GetPipeline) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ingest.get_pipeline") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.get_pipeline") + if reader := instrument.RecordRequestBody(ctx, "ingest.get_pipeline", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.get_pipeline") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetPipeline query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetPipeline query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getpipeline.Response -func (r GetPipeline) Do(ctx context.Context) (Response, error) { +func (r GetPipeline) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.get_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r GetPipeline) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r GetPipeline) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r GetPipeline) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetPipeline) IsSuccess(ctx context.Context) (bool, error) { +func (r GetPipeline) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.get_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r GetPipeline) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetPipeline query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ingest/getpipeline/response.go b/typedapi/ingest/getpipeline/response.go index adf6a8abf1..fa92c27dbe 100644 --- a/typedapi/ingest/getpipeline/response.go +++ b/typedapi/ingest/getpipeline/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getpipeline @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getpipeline // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/get_pipeline/GetPipelineResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/get_pipeline/GetPipelineResponse.ts#L23-L25 type Response map[string]types.IngestPipeline diff --git a/typedapi/ingest/processorgrok/processor_grok.go b/typedapi/ingest/processorgrok/processor_grok.go index 6c64cf101e..808fa03652 100644 --- a/typedapi/ingest/processorgrok/processor_grok.go +++ b/typedapi/ingest/processorgrok/processor_grok.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns a list of the built-in patterns. package processorgrok import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type ProcessorGrok struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewProcessorGrok type alias for index. @@ -67,13 +70,18 @@ func NewProcessorGrokFunc(tp elastictransport.Interface) NewProcessorGrok { // Returns a list of the built-in patterns. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/grok-processor.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/grok-processor.html func New(tp elastictransport.Interface) *ProcessorGrok { r := &ProcessorGrok{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *ProcessorGrok) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *ProcessorGrok) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ProcessorGrok) Perform(ctx context.Context) (*http.Response, error) { +func (r ProcessorGrok) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ingest.processor_grok") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.processor_grok") + if reader := instrument.RecordRequestBody(ctx, "ingest.processor_grok", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.processor_grok") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ProcessorGrok query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ProcessorGrok query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a processorgrok.Response -func (r ProcessorGrok) Do(ctx context.Context) (*Response, error) { +func (r ProcessorGrok) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.processor_grok") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r ProcessorGrok) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r ProcessorGrok) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r ProcessorGrok) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ProcessorGrok) IsSuccess(ctx context.Context) (bool, error) { +func (r ProcessorGrok) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.processor_grok") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r ProcessorGrok) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ProcessorGrok query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ingest/processorgrok/response.go b/typedapi/ingest/processorgrok/response.go index be2daf0872..df0d6f2a4f 100644 --- a/typedapi/ingest/processorgrok/response.go +++ b/typedapi/ingest/processorgrok/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package processorgrok // Response holds the response body struct for the package processorgrok // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/processor_grok/GrokProcessorPatternsResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/processor_grok/GrokProcessorPatternsResponse.ts#L22-L24 type Response struct { Patterns map[string]string `json:"patterns"` } diff --git a/typedapi/ingest/putpipeline/put_pipeline.go b/typedapi/ingest/putpipeline/put_pipeline.go index 9dd01d7318..801e649244 100644 --- a/typedapi/ingest/putpipeline/put_pipeline.go +++ b/typedapi/ingest/putpipeline/put_pipeline.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates a pipeline. package putpipeline @@ -50,15 +50,19 @@ type PutPipeline struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutPipeline type alias for index. @@ -78,17 +82,24 @@ func NewPutPipelineFunc(tp elastictransport.Interface) NewPutPipeline { // Creates or updates a pipeline. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ingest.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html func New(tp elastictransport.Interface) *PutPipeline { r := &PutPipeline{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("pipeline") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPut @@ -162,15 +178,15 @@ func (r *PutPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *PutPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutPipeline) Perform(ctx context.Context) (*http.Response, error) { +func (r PutPipeline) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ingest.put_pipeline") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.put_pipeline") + if reader := instrument.RecordRequestBody(ctx, "ingest.put_pipeline", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.put_pipeline") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutPipeline query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutPipeline query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putpipeline.Response -func (r PutPipeline) Do(ctx context.Context) (*Response, error) { +func (r PutPipeline) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.put_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r PutPipeline) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r PutPipeline) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r PutPipeline) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ingest/putpipeline/request.go b/typedapi/ingest/putpipeline/request.go index 1a66ebd29a..d347095cff 100644 --- a/typedapi/ingest/putpipeline/request.go +++ b/typedapi/ingest/putpipeline/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putpipeline @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putpipeline // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/put_pipeline/PutPipelineRequest.ts#L25-L77 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/put_pipeline/PutPipelineRequest.ts#L25-L77 type Request struct { // Description Description of the ingest pipeline. diff --git a/typedapi/ingest/putpipeline/response.go b/typedapi/ingest/putpipeline/response.go index 6cddb6f6e8..625e72e67c 100644 --- a/typedapi/ingest/putpipeline/response.go +++ b/typedapi/ingest/putpipeline/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putpipeline // Response holds the response body struct for the package putpipeline // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/put_pipeline/PutPipelineResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/put_pipeline/PutPipelineResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ingest/simulate/request.go b/typedapi/ingest/simulate/request.go index 9d81eb2297..f7e295d05b 100644 --- a/typedapi/ingest/simulate/request.go +++ b/typedapi/ingest/simulate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package simulate @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package simulate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/simulate/SimulatePipelineRequest.ts#L25-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/simulate/SimulatePipelineRequest.ts#L25-L57 type Request struct { // Docs Sample documents to test in the pipeline. diff --git a/typedapi/ingest/simulate/response.go b/typedapi/ingest/simulate/response.go index caabcb9510..6dd088f12c 100644 --- a/typedapi/ingest/simulate/response.go +++ b/typedapi/ingest/simulate/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package simulate @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package simulate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/simulate/SimulatePipelineResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/simulate/SimulatePipelineResponse.ts#L22-L24 type Response struct { Docs []types.PipelineSimulation `json:"docs"` } diff --git a/typedapi/ingest/simulate/simulate.go b/typedapi/ingest/simulate/simulate.go index ca09809c91..6d918af62d 100644 --- a/typedapi/ingest/simulate/simulate.go +++ b/typedapi/ingest/simulate/simulate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows to simulate a pipeline with example documents. package simulate @@ -51,15 +51,19 @@ type Simulate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSimulate type alias for index. @@ -77,17 +81,24 @@ func NewSimulateFunc(tp elastictransport.Interface) NewSimulate { // Allows to simulate a pipeline with example documents. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/simulate-pipeline-api.html func New(tp elastictransport.Interface) *Simulate { r := &Simulate{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -124,9 +135,7 @@ func (r *Simulate) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -138,6 +147,10 @@ func (r *Simulate) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -157,6 +170,9 @@ func (r *Simulate) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("pipeline") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") path.WriteString("_simulate") @@ -172,15 +188,15 @@ func (r *Simulate) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -197,27 +213,66 @@ func (r *Simulate) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Simulate) Perform(ctx context.Context) (*http.Response, error) { +func (r Simulate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ingest.simulate") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ingest.simulate") + if reader := instrument.RecordRequestBody(ctx, "ingest.simulate", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ingest.simulate") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Simulate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Simulate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a simulate.Response -func (r Simulate) Do(ctx context.Context) (*Response, error) { +func (r Simulate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ingest.simulate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -225,6 +280,9 @@ func (r Simulate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +292,9 @@ func (r Simulate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -241,6 +302,9 @@ func (r Simulate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/license/delete/delete.go b/typedapi/license/delete/delete.go index e0687f95d1..d950ef59f6 100644 --- a/typedapi/license/delete/delete.go +++ b/typedapi/license/delete/delete.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes licensing information for the cluster package delete import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Delete struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDelete type alias for index. @@ -67,13 +70,18 @@ func NewDeleteFunc(tp elastictransport.Interface) NewDelete { // Deletes licensing information for the cluster // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-license.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-license.html func New(tp elastictransport.Interface) *Delete { r := &Delete{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,9 +114,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -125,27 +133,66 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Delete) Perform(ctx context.Context) (*http.Response, error) { +func (r Delete) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "license.delete") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "license.delete") + if reader := instrument.RecordRequestBody(ctx, "license.delete", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.delete") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Delete query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Delete query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a delete.Response -func (r Delete) Do(ctx context.Context) (*Response, error) { +func (r Delete) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -153,6 +200,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -162,6 +212,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -169,12 +222,25 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Delete) IsSuccess(ctx context.Context) (bool, error) { +func (r Delete) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -190,6 +256,14 @@ func (r Delete) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Delete query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/license/delete/response.go b/typedapi/license/delete/response.go index a53f05e525..953084f0a9 100644 --- a/typedapi/license/delete/response.go +++ b/typedapi/license/delete/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package delete // Response holds the response body struct for the package delete // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/delete/DeleteLicenseResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/delete/DeleteLicenseResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/license/get/get.go b/typedapi/license/get/get.go index 0450de61da..234bb449c2 100644 --- a/typedapi/license/get/get.go +++ b/typedapi/license/get/get.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves licensing information for the cluster package get import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type Get struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGet type alias for index. @@ -68,13 +71,18 @@ func NewGetFunc(tp elastictransport.Interface) NewGet { // Retrieves licensing information for the cluster // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-license.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-license.html func New(tp elastictransport.Interface) *Get { r := &Get{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,9 +115,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -126,27 +134,66 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Get) Perform(ctx context.Context) (*http.Response, error) { +func (r Get) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "license.get") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "license.get") + if reader := instrument.RecordRequestBody(ctx, "license.get", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.get") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Get query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Get query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a get.Response -func (r Get) Do(ctx context.Context) (*Response, error) { +func (r Get) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -154,6 +201,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -163,6 +213,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -170,12 +223,25 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Get) IsSuccess(ctx context.Context) (bool, error) { +func (r Get) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -191,6 +257,14 @@ func (r Get) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Get query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/license/get/response.go b/typedapi/license/get/response.go index 582ae4da9b..d6bf665880 100644 --- a/typedapi/license/get/response.go +++ b/typedapi/license/get/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package get @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package get // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/get/GetLicenseResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/get/GetLicenseResponse.ts#L22-L24 type Response struct { License types.LicenseInformation `json:"license"` } diff --git a/typedapi/license/getbasicstatus/get_basic_status.go b/typedapi/license/getbasicstatus/get_basic_status.go index efe93b3c45..b28d212f13 100644 --- a/typedapi/license/getbasicstatus/get_basic_status.go +++ b/typedapi/license/getbasicstatus/get_basic_status.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about the status of the basic license. package getbasicstatus import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type GetBasicStatus struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetBasicStatus type alias for index. @@ -67,13 +70,18 @@ func NewGetBasicStatusFunc(tp elastictransport.Interface) NewGetBasicStatus { // Retrieves information about the status of the basic license. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-basic-status.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-basic-status.html func New(tp elastictransport.Interface) *GetBasicStatus { r := &GetBasicStatus{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *GetBasicStatus) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *GetBasicStatus) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetBasicStatus) Perform(ctx context.Context) (*http.Response, error) { +func (r GetBasicStatus) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "license.get_basic_status") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "license.get_basic_status") + if reader := instrument.RecordRequestBody(ctx, "license.get_basic_status", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.get_basic_status") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetBasicStatus query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetBasicStatus query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getbasicstatus.Response -func (r GetBasicStatus) Do(ctx context.Context) (*Response, error) { +func (r GetBasicStatus) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.get_basic_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r GetBasicStatus) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r GetBasicStatus) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r GetBasicStatus) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetBasicStatus) IsSuccess(ctx context.Context) (bool, error) { +func (r GetBasicStatus) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.get_basic_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r GetBasicStatus) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetBasicStatus query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/license/getbasicstatus/response.go b/typedapi/license/getbasicstatus/response.go index 3948af613c..09c9663399 100644 --- a/typedapi/license/getbasicstatus/response.go +++ b/typedapi/license/getbasicstatus/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getbasicstatus // Response holds the response body struct for the package getbasicstatus // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/get_basic_status/GetBasicLicenseStatusResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/get_basic_status/GetBasicLicenseStatusResponse.ts#L20-L22 type Response struct { EligibleToStartBasic bool `json:"eligible_to_start_basic"` } diff --git a/typedapi/license/gettrialstatus/get_trial_status.go b/typedapi/license/gettrialstatus/get_trial_status.go index f265b7d444..866b1fbeae 100644 --- a/typedapi/license/gettrialstatus/get_trial_status.go +++ b/typedapi/license/gettrialstatus/get_trial_status.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about the status of the trial license. package gettrialstatus import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type GetTrialStatus struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetTrialStatus type alias for index. @@ -67,13 +70,18 @@ func NewGetTrialStatusFunc(tp elastictransport.Interface) NewGetTrialStatus { // Retrieves information about the status of the trial license. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trial-status.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trial-status.html func New(tp elastictransport.Interface) *GetTrialStatus { r := &GetTrialStatus{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *GetTrialStatus) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *GetTrialStatus) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetTrialStatus) Perform(ctx context.Context) (*http.Response, error) { +func (r GetTrialStatus) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "license.get_trial_status") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "license.get_trial_status") + if reader := instrument.RecordRequestBody(ctx, "license.get_trial_status", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.get_trial_status") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetTrialStatus query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetTrialStatus query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a gettrialstatus.Response -func (r GetTrialStatus) Do(ctx context.Context) (*Response, error) { +func (r GetTrialStatus) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.get_trial_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r GetTrialStatus) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r GetTrialStatus) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r GetTrialStatus) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetTrialStatus) IsSuccess(ctx context.Context) (bool, error) { +func (r GetTrialStatus) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.get_trial_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r GetTrialStatus) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetTrialStatus query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/license/gettrialstatus/response.go b/typedapi/license/gettrialstatus/response.go index 90b8f92706..0996f717a1 100644 --- a/typedapi/license/gettrialstatus/response.go +++ b/typedapi/license/gettrialstatus/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package gettrialstatus // Response holds the response body struct for the package gettrialstatus // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/get_trial_status/GetTrialLicenseStatusResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/get_trial_status/GetTrialLicenseStatusResponse.ts#L20-L22 type Response struct { EligibleToStartTrial bool `json:"eligible_to_start_trial"` } diff --git a/typedapi/license/post/post.go b/typedapi/license/post/post.go index 5f4c6f6b51..51fa37b1ed 100644 --- a/typedapi/license/post/post.go +++ b/typedapi/license/post/post.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates the license for the cluster. package post @@ -47,13 +47,17 @@ type Post struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPost type alias for index. @@ -71,17 +75,24 @@ func NewPostFunc(tp elastictransport.Interface) NewPost { // Updates the license for the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/update-license.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/update-license.html func New(tp elastictransport.Interface) *Post { r := &Post{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -118,9 +129,7 @@ func (r *Post) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -132,6 +141,10 @@ func (r *Post) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,15 +163,15 @@ func (r *Post) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -175,27 +188,66 @@ func (r *Post) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Post) Perform(ctx context.Context) (*http.Response, error) { +func (r Post) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "license.post") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "license.post") + if reader := instrument.RecordRequestBody(ctx, "license.post", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.post") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Post query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Post query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a post.Response -func (r Post) Do(ctx context.Context) (*Response, error) { +func (r Post) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.post") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -203,6 +255,9 @@ func (r Post) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -212,6 +267,9 @@ func (r Post) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -219,6 +277,9 @@ func (r Post) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/license/post/request.go b/typedapi/license/post/request.go index 586860321a..ef1409e1f2 100644 --- a/typedapi/license/post/request.go +++ b/typedapi/license/post/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package post @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package post // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/post/PostLicenseRequest.ts#L23-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/post/PostLicenseRequest.ts#L23-L43 type Request struct { License *types.License `json:"license,omitempty"` // Licenses A sequence of one or more JSON documents containing the license information. diff --git a/typedapi/license/post/response.go b/typedapi/license/post/response.go index 9f0248139a..7e235e37b5 100644 --- a/typedapi/license/post/response.go +++ b/typedapi/license/post/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package post @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package post // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/post/PostLicenseResponse.ts#L23-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/post/PostLicenseResponse.ts#L23-L29 type Response struct { Acknowledge *types.Acknowledgement `json:"acknowledge,omitempty"` Acknowledged bool `json:"acknowledged"` diff --git a/typedapi/license/poststartbasic/post_start_basic.go b/typedapi/license/poststartbasic/post_start_basic.go index 019564014f..5708b5b821 100644 --- a/typedapi/license/poststartbasic/post_start_basic.go +++ b/typedapi/license/poststartbasic/post_start_basic.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Starts an indefinite basic license. package poststartbasic import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type PostStartBasic struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPostStartBasic type alias for index. @@ -68,13 +71,18 @@ func NewPostStartBasicFunc(tp elastictransport.Interface) NewPostStartBasic { // Starts an indefinite basic license. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/start-basic.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/start-basic.html func New(tp elastictransport.Interface) *PostStartBasic { r := &PostStartBasic{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,9 +117,9 @@ func (r *PostStartBasic) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -128,27 +136,66 @@ func (r *PostStartBasic) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PostStartBasic) Perform(ctx context.Context) (*http.Response, error) { +func (r PostStartBasic) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "license.post_start_basic") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "license.post_start_basic") + if reader := instrument.RecordRequestBody(ctx, "license.post_start_basic", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.post_start_basic") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PostStartBasic query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PostStartBasic query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a poststartbasic.Response -func (r PostStartBasic) Do(ctx context.Context) (*Response, error) { +func (r PostStartBasic) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.post_start_basic") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -156,6 +203,9 @@ func (r PostStartBasic) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -165,6 +215,9 @@ func (r PostStartBasic) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -172,12 +225,25 @@ func (r PostStartBasic) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PostStartBasic) IsSuccess(ctx context.Context) (bool, error) { +func (r PostStartBasic) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.post_start_basic") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -193,6 +259,14 @@ func (r PostStartBasic) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PostStartBasic query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/license/poststartbasic/response.go b/typedapi/license/poststartbasic/response.go index a8e962d03a..6209304865 100644 --- a/typedapi/license/poststartbasic/response.go +++ b/typedapi/license/poststartbasic/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package poststartbasic @@ -32,8 +32,7 @@ import ( // Response holds the response body struct for the package poststartbasic // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/post_start_basic/StartBasicLicenseResponse.ts#L23-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/post_start_basic/StartBasicLicenseResponse.ts#L23-L31 type Response struct { Acknowledge map[string][]string `json:"acknowledge,omitempty"` Acknowledged bool `json:"acknowledged"` diff --git a/typedapi/license/poststarttrial/post_start_trial.go b/typedapi/license/poststarttrial/post_start_trial.go index f2c7d66ccc..4fdaa15a85 100644 --- a/typedapi/license/poststarttrial/post_start_trial.go +++ b/typedapi/license/poststarttrial/post_start_trial.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // starts a limited time trial license. package poststarttrial import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type PostStartTrial struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPostStartTrial type alias for index. @@ -68,13 +71,18 @@ func NewPostStartTrialFunc(tp elastictransport.Interface) NewPostStartTrial { // starts a limited time trial license. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trial.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/start-trial.html func New(tp elastictransport.Interface) *PostStartTrial { r := &PostStartTrial{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,9 +117,9 @@ func (r *PostStartTrial) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -128,27 +136,66 @@ func (r *PostStartTrial) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PostStartTrial) Perform(ctx context.Context) (*http.Response, error) { +func (r PostStartTrial) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "license.post_start_trial") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "license.post_start_trial") + if reader := instrument.RecordRequestBody(ctx, "license.post_start_trial", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "license.post_start_trial") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PostStartTrial query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PostStartTrial query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a poststarttrial.Response -func (r PostStartTrial) Do(ctx context.Context) (*Response, error) { +func (r PostStartTrial) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.post_start_trial") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -156,6 +203,9 @@ func (r PostStartTrial) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -165,6 +215,9 @@ func (r PostStartTrial) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -172,12 +225,25 @@ func (r PostStartTrial) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PostStartTrial) IsSuccess(ctx context.Context) (bool, error) { +func (r PostStartTrial) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "license.post_start_trial") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -193,6 +259,14 @@ func (r PostStartTrial) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PostStartTrial query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/license/poststarttrial/response.go b/typedapi/license/poststarttrial/response.go index 733229af67..9133ebd184 100644 --- a/typedapi/license/poststarttrial/response.go +++ b/typedapi/license/poststarttrial/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package poststarttrial @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package poststarttrial // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/post_start_trial/StartTrialLicenseResponse.ts#L22-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/post_start_trial/StartTrialLicenseResponse.ts#L22-L29 type Response struct { Acknowledged bool `json:"acknowledged"` ErrorMessage *string `json:"error_message,omitempty"` diff --git a/typedapi/logstash/deletepipeline/delete_pipeline.go b/typedapi/logstash/deletepipeline/delete_pipeline.go index 3e857c0369..16a4f5a3f9 100644 --- a/typedapi/logstash/deletepipeline/delete_pipeline.go +++ b/typedapi/logstash/deletepipeline/delete_pipeline.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes Logstash Pipelines used by Central Management package deletepipeline import ( - gobytes "bytes" "context" "errors" "fmt" @@ -49,11 +48,15 @@ type DeletePipeline struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeletePipeline type alias for index. @@ -79,7 +82,12 @@ func New(tp elastictransport.Interface) *DeletePipeline { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *DeletePipeline) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("pipeline") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -117,9 +128,9 @@ func (r *DeletePipeline) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,15 +147,42 @@ func (r *DeletePipeline) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeletePipeline) Perform(ctx context.Context) (*http.Response, error) { +func (r DeletePipeline) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "logstash.delete_pipeline") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "logstash.delete_pipeline") + if reader := instrument.RecordRequestBody(ctx, "logstash.delete_pipeline", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "logstash.delete_pipeline") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeletePipeline query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeletePipeline query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -157,7 +195,17 @@ func (r DeletePipeline) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeletePipeline) IsSuccess(ctx context.Context) (bool, error) { +func (r DeletePipeline) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "logstash.delete_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -173,6 +221,14 @@ func (r DeletePipeline) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeletePipeline query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/logstash/getpipeline/get_pipeline.go b/typedapi/logstash/getpipeline/get_pipeline.go index 3341a3a683..60074c36f7 100644 --- a/typedapi/logstash/getpipeline/get_pipeline.go +++ b/typedapi/logstash/getpipeline/get_pipeline.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves Logstash Pipelines used by Central Management package getpipeline import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type GetPipeline struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetPipeline type alias for index. @@ -79,7 +82,12 @@ func New(tp elastictransport.Interface) *GetPipeline { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,6 +119,9 @@ func (r *GetPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("pipeline") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -124,9 +135,9 @@ func (r *GetPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -143,27 +154,66 @@ func (r *GetPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetPipeline) Perform(ctx context.Context) (*http.Response, error) { +func (r GetPipeline) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "logstash.get_pipeline") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "logstash.get_pipeline") + if reader := instrument.RecordRequestBody(ctx, "logstash.get_pipeline", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "logstash.get_pipeline") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetPipeline query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetPipeline query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getpipeline.Response -func (r GetPipeline) Do(ctx context.Context) (Response, error) { +func (r GetPipeline) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "logstash.get_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -171,6 +221,9 @@ func (r GetPipeline) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,6 +233,9 @@ func (r GetPipeline) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,12 +243,25 @@ func (r GetPipeline) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetPipeline) IsSuccess(ctx context.Context) (bool, error) { +func (r GetPipeline) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "logstash.get_pipeline") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -208,6 +277,14 @@ func (r GetPipeline) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetPipeline query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/logstash/getpipeline/response.go b/typedapi/logstash/getpipeline/response.go index 26e34ffaad..d38902ef70 100644 --- a/typedapi/logstash/getpipeline/response.go +++ b/typedapi/logstash/getpipeline/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getpipeline @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getpipeline // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/logstash/get_pipeline/LogstashGetPipelineResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/logstash/get_pipeline/LogstashGetPipelineResponse.ts#L24-L26 type Response map[string]types.LogstashPipeline diff --git a/typedapi/logstash/putpipeline/put_pipeline.go b/typedapi/logstash/putpipeline/put_pipeline.go index 9f930e1507..a65acddddb 100644 --- a/typedapi/logstash/putpipeline/put_pipeline.go +++ b/typedapi/logstash/putpipeline/put_pipeline.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Adds and updates Logstash Pipelines used for Central Management package putpipeline @@ -50,15 +50,19 @@ type PutPipeline struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutPipeline type alias for index. @@ -84,7 +88,14 @@ func New(tp elastictransport.Interface) *PutPipeline { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -123,9 +134,7 @@ func (r *PutPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -137,6 +146,10 @@ func (r *PutPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -147,6 +160,9 @@ func (r *PutPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("pipeline") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPut @@ -160,15 +176,15 @@ func (r *PutPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -185,15 +201,42 @@ func (r *PutPipeline) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutPipeline) Perform(ctx context.Context) (*http.Response, error) { +func (r PutPipeline) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "logstash.put_pipeline") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "logstash.put_pipeline") + if reader := instrument.RecordRequestBody(ctx, "logstash.put_pipeline", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "logstash.put_pipeline") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutPipeline query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutPipeline query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil diff --git a/typedapi/logstash/putpipeline/request.go b/typedapi/logstash/putpipeline/request.go index 737def4977..6325786df8 100644 --- a/typedapi/logstash/putpipeline/request.go +++ b/typedapi/logstash/putpipeline/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putpipeline @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package putpipeline // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/logstash/put_pipeline/LogstashPutPipelineRequest.ts#L24-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/logstash/put_pipeline/LogstashPutPipelineRequest.ts#L24-L39 type Request = types.LogstashPipeline diff --git a/typedapi/migration/deprecations/deprecations.go b/typedapi/migration/deprecations/deprecations.go index 6b3dc02ff1..333325e722 100644 --- a/typedapi/migration/deprecations/deprecations.go +++ b/typedapi/migration/deprecations/deprecations.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about different cluster, node, and index level settings // that use deprecated features that will be removed or changed in the next @@ -24,7 +24,6 @@ package deprecations import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type Deprecations struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeprecations type alias for index. @@ -83,7 +86,12 @@ func New(tp elastictransport.Interface) *Deprecations { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,6 +119,9 @@ func (r *Deprecations) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_migration") @@ -128,9 +139,9 @@ func (r *Deprecations) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -147,27 +158,66 @@ func (r *Deprecations) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Deprecations) Perform(ctx context.Context) (*http.Response, error) { +func (r Deprecations) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "migration.deprecations") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "migration.deprecations") + if reader := instrument.RecordRequestBody(ctx, "migration.deprecations", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "migration.deprecations") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Deprecations query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Deprecations query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deprecations.Response -func (r Deprecations) Do(ctx context.Context) (*Response, error) { +func (r Deprecations) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "migration.deprecations") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -175,6 +225,9 @@ func (r Deprecations) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,6 +237,9 @@ func (r Deprecations) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -191,12 +247,25 @@ func (r Deprecations) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Deprecations) IsSuccess(ctx context.Context) (bool, error) { +func (r Deprecations) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "migration.deprecations") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -212,6 +281,14 @@ func (r Deprecations) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Deprecations query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/migration/deprecations/response.go b/typedapi/migration/deprecations/response.go index 611c326f35..ad1ffeb7cd 100644 --- a/typedapi/migration/deprecations/response.go +++ b/typedapi/migration/deprecations/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deprecations @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package deprecations // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/migration/deprecations/DeprecationInfoResponse.ts#L23-L30 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/migration/deprecations/DeprecationInfoResponse.ts#L23-L30 type Response struct { ClusterSettings []types.Deprecation `json:"cluster_settings"` IndexSettings map[string][]types.Deprecation `json:"index_settings"` diff --git a/typedapi/migration/getfeatureupgradestatus/get_feature_upgrade_status.go b/typedapi/migration/getfeatureupgradestatus/get_feature_upgrade_status.go index a2c211a6a7..2bfdad5207 100644 --- a/typedapi/migration/getfeatureupgradestatus/get_feature_upgrade_status.go +++ b/typedapi/migration/getfeatureupgradestatus/get_feature_upgrade_status.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Find out whether system features need to be upgraded or not package getfeatureupgradestatus import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type GetFeatureUpgradeStatus struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetFeatureUpgradeStatus type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *GetFeatureUpgradeStatus { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *GetFeatureUpgradeStatus) HttpRequest(ctx context.Context) (*http.Reques } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *GetFeatureUpgradeStatus) HttpRequest(ctx context.Context) (*http.Reques } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetFeatureUpgradeStatus) Perform(ctx context.Context) (*http.Response, error) { +func (r GetFeatureUpgradeStatus) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "migration.get_feature_upgrade_status") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "migration.get_feature_upgrade_status") + if reader := instrument.RecordRequestBody(ctx, "migration.get_feature_upgrade_status", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "migration.get_feature_upgrade_status") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetFeatureUpgradeStatus query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetFeatureUpgradeStatus query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getfeatureupgradestatus.Response -func (r GetFeatureUpgradeStatus) Do(ctx context.Context) (*Response, error) { +func (r GetFeatureUpgradeStatus) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "migration.get_feature_upgrade_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r GetFeatureUpgradeStatus) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r GetFeatureUpgradeStatus) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r GetFeatureUpgradeStatus) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetFeatureUpgradeStatus) IsSuccess(ctx context.Context) (bool, error) { +func (r GetFeatureUpgradeStatus) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "migration.get_feature_upgrade_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r GetFeatureUpgradeStatus) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetFeatureUpgradeStatus query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/migration/getfeatureupgradestatus/response.go b/typedapi/migration/getfeatureupgradestatus/response.go index 6dd4a3f602..82624e8a17 100644 --- a/typedapi/migration/getfeatureupgradestatus/response.go +++ b/typedapi/migration/getfeatureupgradestatus/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getfeatureupgradestatus @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package getfeatureupgradestatus // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L23-L28 type Response struct { Features []types.GetMigrationFeature `json:"features"` MigrationStatus migrationstatus.MigrationStatus `json:"migration_status"` diff --git a/typedapi/migration/postfeatureupgrade/post_feature_upgrade.go b/typedapi/migration/postfeatureupgrade/post_feature_upgrade.go index 6a47dfdcd7..044f2e6d3b 100644 --- a/typedapi/migration/postfeatureupgrade/post_feature_upgrade.go +++ b/typedapi/migration/postfeatureupgrade/post_feature_upgrade.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Begin upgrades for system features package postfeatureupgrade import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type PostFeatureUpgrade struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPostFeatureUpgrade type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *PostFeatureUpgrade { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *PostFeatureUpgrade) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *PostFeatureUpgrade) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PostFeatureUpgrade) Perform(ctx context.Context) (*http.Response, error) { +func (r PostFeatureUpgrade) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "migration.post_feature_upgrade") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "migration.post_feature_upgrade") + if reader := instrument.RecordRequestBody(ctx, "migration.post_feature_upgrade", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "migration.post_feature_upgrade") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PostFeatureUpgrade query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PostFeatureUpgrade query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a postfeatureupgrade.Response -func (r PostFeatureUpgrade) Do(ctx context.Context) (*Response, error) { +func (r PostFeatureUpgrade) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "migration.post_feature_upgrade") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r PostFeatureUpgrade) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r PostFeatureUpgrade) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r PostFeatureUpgrade) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PostFeatureUpgrade) IsSuccess(ctx context.Context) (bool, error) { +func (r PostFeatureUpgrade) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "migration.post_feature_upgrade") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r PostFeatureUpgrade) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PostFeatureUpgrade query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/migration/postfeatureupgrade/response.go b/typedapi/migration/postfeatureupgrade/response.go index 7f712fcc38..a665060d46 100644 --- a/typedapi/migration/postfeatureupgrade/response.go +++ b/typedapi/migration/postfeatureupgrade/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package postfeatureupgrade @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package postfeatureupgrade // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/migration/post_feature_upgrade/PostFeatureUpgradeResponse.ts#L20-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/migration/post_feature_upgrade/PostFeatureUpgradeResponse.ts#L20-L25 type Response struct { Accepted bool `json:"accepted"` Features []types.PostMigrationFeature `json:"features"` diff --git a/typedapi/ml/cleartrainedmodeldeploymentcache/clear_trained_model_deployment_cache.go b/typedapi/ml/cleartrainedmodeldeploymentcache/clear_trained_model_deployment_cache.go index a5add41093..fd532b99f8 100644 --- a/typedapi/ml/cleartrainedmodeldeploymentcache/clear_trained_model_deployment_cache.go +++ b/typedapi/ml/cleartrainedmodeldeploymentcache/clear_trained_model_deployment_cache.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Clear the cached results from a trained model deployment package cleartrainedmodeldeploymentcache import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type ClearTrainedModelDeploymentCache struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearTrainedModelDeploymentCache type alias for index. @@ -75,13 +78,18 @@ func NewClearTrainedModelDeploymentCacheFunc(tp elastictransport.Interface) NewC // Clear the cached results from a trained model deployment // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/clear-trained-model-deployment-cache.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-trained-model-deployment-cache.html func New(tp elastictransport.Interface) *ClearTrainedModelDeploymentCache { r := &ClearTrainedModelDeploymentCache{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *ClearTrainedModelDeploymentCache) HttpRequest(ctx context.Context) (*ht path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) path.WriteString("/") path.WriteString("deployment") @@ -125,15 +136,15 @@ func (r *ClearTrainedModelDeploymentCache) HttpRequest(ctx context.Context) (*ht } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -150,27 +161,66 @@ func (r *ClearTrainedModelDeploymentCache) HttpRequest(ctx context.Context) (*ht } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearTrainedModelDeploymentCache) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearTrainedModelDeploymentCache) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.clear_trained_model_deployment_cache") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.clear_trained_model_deployment_cache") + if reader := instrument.RecordRequestBody(ctx, "ml.clear_trained_model_deployment_cache", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.clear_trained_model_deployment_cache") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearTrainedModelDeploymentCache query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearTrainedModelDeploymentCache query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a cleartrainedmodeldeploymentcache.Response -func (r ClearTrainedModelDeploymentCache) Do(ctx context.Context) (*Response, error) { +func (r ClearTrainedModelDeploymentCache) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.clear_trained_model_deployment_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -178,6 +228,9 @@ func (r ClearTrainedModelDeploymentCache) Do(ctx context.Context) (*Response, er if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,6 +240,9 @@ func (r ClearTrainedModelDeploymentCache) Do(ctx context.Context) (*Response, er errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -194,12 +250,25 @@ func (r ClearTrainedModelDeploymentCache) Do(ctx context.Context) (*Response, er errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ClearTrainedModelDeploymentCache) IsSuccess(ctx context.Context) (bool, error) { +func (r ClearTrainedModelDeploymentCache) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.clear_trained_model_deployment_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -215,6 +284,14 @@ func (r ClearTrainedModelDeploymentCache) IsSuccess(ctx context.Context) (bool, return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ClearTrainedModelDeploymentCache query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/cleartrainedmodeldeploymentcache/response.go b/typedapi/ml/cleartrainedmodeldeploymentcache/response.go index 88893cd855..039a69fd53 100644 --- a/typedapi/ml/cleartrainedmodeldeploymentcache/response.go +++ b/typedapi/ml/cleartrainedmodeldeploymentcache/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package cleartrainedmodeldeploymentcache // Response holds the response body struct for the package cleartrainedmodeldeploymentcache // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/clear_trained_model_deployment_cache/MlClearTrainedModelDeploymentCacheResponse.ts#L20-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/clear_trained_model_deployment_cache/MlClearTrainedModelDeploymentCacheResponse.ts#L20-L24 type Response struct { Cleared bool `json:"cleared"` } diff --git a/typedapi/ml/closejob/close_job.go b/typedapi/ml/closejob/close_job.go index 149337ea55..7ef869611c 100644 --- a/typedapi/ml/closejob/close_job.go +++ b/typedapi/ml/closejob/close_job.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Closes one or more anomaly detection jobs. A job can be opened and closed // multiple times throughout its lifecycle. @@ -51,15 +51,19 @@ type CloseJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCloseJob type alias for index. @@ -80,17 +84,24 @@ func NewCloseJobFunc(tp elastictransport.Interface) NewCloseJob { // Closes one or more anomaly detection jobs. A job can be opened and closed // multiple times throughout its lifecycle. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ml-close-job.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html func New(tp elastictransport.Interface) *CloseJob { r := &CloseJob{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *CloseJob) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,6 +150,10 @@ func (r *CloseJob) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *CloseJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("_close") @@ -166,15 +182,15 @@ func (r *CloseJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -191,27 +207,66 @@ func (r *CloseJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r CloseJob) Perform(ctx context.Context) (*http.Response, error) { +func (r CloseJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.close_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.close_job") + if reader := instrument.RecordRequestBody(ctx, "ml.close_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.close_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the CloseJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the CloseJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a closejob.Response -func (r CloseJob) Do(ctx context.Context) (*Response, error) { +func (r CloseJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.close_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -219,6 +274,9 @@ func (r CloseJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -228,6 +286,9 @@ func (r CloseJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +296,9 @@ func (r CloseJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/closejob/request.go b/typedapi/ml/closejob/request.go index cf406c3fa6..bb4de45af7 100644 --- a/typedapi/ml/closejob/request.go +++ b/typedapi/ml/closejob/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package closejob @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package closejob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/close_job/MlCloseJobRequest.ts#L24-L77 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/close_job/MlCloseJobRequest.ts#L24-L77 type Request struct { // AllowNoMatch Refer to the description for the `allow_no_match` query parameter. diff --git a/typedapi/ml/closejob/response.go b/typedapi/ml/closejob/response.go index 33fed7923c..7199261746 100644 --- a/typedapi/ml/closejob/response.go +++ b/typedapi/ml/closejob/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package closejob // Response holds the response body struct for the package closejob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/close_job/MlCloseJobResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/close_job/MlCloseJobResponse.ts#L20-L22 type Response struct { Closed bool `json:"closed"` } diff --git a/typedapi/ml/deletecalendar/delete_calendar.go b/typedapi/ml/deletecalendar/delete_calendar.go index 7d5486aa65..d370f55129 100644 --- a/typedapi/ml/deletecalendar/delete_calendar.go +++ b/typedapi/ml/deletecalendar/delete_calendar.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a calendar. package deletecalendar import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteCalendar struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int calendarid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteCalendar type alias for index. @@ -75,13 +78,18 @@ func NewDeleteCalendarFunc(tp elastictransport.Interface) NewDeleteCalendar { // Deletes a calendar. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ml-delete-calendar.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar.html func New(tp elastictransport.Interface) *DeleteCalendar { r := &DeleteCalendar{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeleteCalendar) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("calendars") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendarid", r.calendarid) + } path.WriteString(r.calendarid) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *DeleteCalendar) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *DeleteCalendar) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteCalendar) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteCalendar) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_calendar") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_calendar") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_calendar", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_calendar") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteCalendar query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteCalendar query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletecalendar.Response -func (r DeleteCalendar) Do(ctx context.Context) (*Response, error) { +func (r DeleteCalendar) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_calendar") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r DeleteCalendar) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r DeleteCalendar) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r DeleteCalendar) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteCalendar) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteCalendar) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_calendar") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r DeleteCalendar) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteCalendar query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deletecalendar/response.go b/typedapi/ml/deletecalendar/response.go index 81b5dcc1f9..42edcf2e93 100644 --- a/typedapi/ml/deletecalendar/response.go +++ b/typedapi/ml/deletecalendar/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletecalendar // Response holds the response body struct for the package deletecalendar // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_calendar/MlDeleteCalendarResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_calendar/MlDeleteCalendarResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/deletecalendarevent/delete_calendar_event.go b/typedapi/ml/deletecalendarevent/delete_calendar_event.go index e3580b1c2f..e853e5da65 100644 --- a/typedapi/ml/deletecalendarevent/delete_calendar_event.go +++ b/typedapi/ml/deletecalendarevent/delete_calendar_event.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes scheduled events from a calendar. package deletecalendarevent import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type DeleteCalendarEvent struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int calendarid string eventid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteCalendarEvent type alias for index. @@ -80,13 +83,18 @@ func NewDeleteCalendarEventFunc(tp elastictransport.Interface) NewDeleteCalendar // Deletes scheduled events from a calendar. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ml-delete-calendar-event.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-event.html func New(tp elastictransport.Interface) *DeleteCalendarEvent { r := &DeleteCalendarEvent{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,11 +119,17 @@ func (r *DeleteCalendarEvent) HttpRequest(ctx context.Context) (*http.Request, e path.WriteString("calendars") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendarid", r.calendarid) + } path.WriteString(r.calendarid) path.WriteString("/") path.WriteString("events") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "eventid", r.eventid) + } path.WriteString(r.eventid) method = http.MethodDelete @@ -129,9 +143,9 @@ func (r *DeleteCalendarEvent) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +162,66 @@ func (r *DeleteCalendarEvent) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteCalendarEvent) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteCalendarEvent) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_calendar_event") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_calendar_event") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_calendar_event", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_calendar_event") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteCalendarEvent query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteCalendarEvent query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletecalendarevent.Response -func (r DeleteCalendarEvent) Do(ctx context.Context) (*Response, error) { +func (r DeleteCalendarEvent) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_calendar_event") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +229,9 @@ func (r DeleteCalendarEvent) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +241,9 @@ func (r DeleteCalendarEvent) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +251,25 @@ func (r DeleteCalendarEvent) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteCalendarEvent) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteCalendarEvent) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_calendar_event") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +285,14 @@ func (r DeleteCalendarEvent) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteCalendarEvent query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deletecalendarevent/response.go b/typedapi/ml/deletecalendarevent/response.go index e785e134e1..4127911dd5 100644 --- a/typedapi/ml/deletecalendarevent/response.go +++ b/typedapi/ml/deletecalendarevent/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletecalendarevent // Response holds the response body struct for the package deletecalendarevent // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_calendar_event/MlDeleteCalendarEventResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_calendar_event/MlDeleteCalendarEventResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/deletecalendarjob/delete_calendar_job.go b/typedapi/ml/deletecalendarjob/delete_calendar_job.go index 68df04bee7..a69014153d 100644 --- a/typedapi/ml/deletecalendarjob/delete_calendar_job.go +++ b/typedapi/ml/deletecalendarjob/delete_calendar_job.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes anomaly detection jobs from a calendar. package deletecalendarjob import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type DeleteCalendarJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int calendarid string jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteCalendarJob type alias for index. @@ -80,13 +83,18 @@ func NewDeleteCalendarJobFunc(tp elastictransport.Interface) NewDeleteCalendarJo // Deletes anomaly detection jobs from a calendar. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ml-delete-calendar-job.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-job.html func New(tp elastictransport.Interface) *DeleteCalendarJob { r := &DeleteCalendarJob{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,11 +119,17 @@ func (r *DeleteCalendarJob) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("calendars") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendarid", r.calendarid) + } path.WriteString(r.calendarid) path.WriteString("/") path.WriteString("jobs") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) method = http.MethodDelete @@ -129,9 +143,9 @@ func (r *DeleteCalendarJob) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +162,66 @@ func (r *DeleteCalendarJob) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteCalendarJob) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteCalendarJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_calendar_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_calendar_job") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_calendar_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_calendar_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteCalendarJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteCalendarJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletecalendarjob.Response -func (r DeleteCalendarJob) Do(ctx context.Context) (*Response, error) { +func (r DeleteCalendarJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_calendar_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +229,9 @@ func (r DeleteCalendarJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +241,9 @@ func (r DeleteCalendarJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +251,25 @@ func (r DeleteCalendarJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteCalendarJob) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteCalendarJob) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_calendar_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +285,14 @@ func (r DeleteCalendarJob) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteCalendarJob query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deletecalendarjob/response.go b/typedapi/ml/deletecalendarjob/response.go index 8aaffe58f9..0e5ab5ea6f 100644 --- a/typedapi/ml/deletecalendarjob/response.go +++ b/typedapi/ml/deletecalendarjob/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletecalendarjob @@ -30,8 +30,7 @@ import ( // Response holds the response body struct for the package deletecalendarjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_calendar_job/MlDeleteCalendarJobResponse.ts#L22-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_calendar_job/MlDeleteCalendarJobResponse.ts#L22-L31 type Response struct { // CalendarId A string that uniquely identifies a calendar. diff --git a/typedapi/ml/deletedatafeed/delete_datafeed.go b/typedapi/ml/deletedatafeed/delete_datafeed.go index d3381faaec..4a5ad4ac6b 100644 --- a/typedapi/ml/deletedatafeed/delete_datafeed.go +++ b/typedapi/ml/deletedatafeed/delete_datafeed.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an existing datafeed. package deletedatafeed import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteDatafeed struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int datafeedid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteDatafeed type alias for index. @@ -76,13 +79,18 @@ func NewDeleteDatafeedFunc(tp elastictransport.Interface) NewDeleteDatafeed { // Deletes an existing datafeed. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ml-delete-datafeed.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html func New(tp elastictransport.Interface) *DeleteDatafeed { r := &DeleteDatafeed{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *DeleteDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("datafeeds") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeedid", r.datafeedid) + } path.WriteString(r.datafeedid) method = http.MethodDelete @@ -120,9 +131,9 @@ func (r *DeleteDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,27 +150,66 @@ func (r *DeleteDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteDatafeed) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteDatafeed) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_datafeed") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_datafeed", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_datafeed") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteDatafeed query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteDatafeed query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletedatafeed.Response -func (r DeleteDatafeed) Do(ctx context.Context) (*Response, error) { +func (r DeleteDatafeed) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -167,6 +217,9 @@ func (r DeleteDatafeed) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,6 +229,9 @@ func (r DeleteDatafeed) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,12 +239,25 @@ func (r DeleteDatafeed) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteDatafeed) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteDatafeed) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -204,6 +273,14 @@ func (r DeleteDatafeed) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteDatafeed query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deletedatafeed/response.go b/typedapi/ml/deletedatafeed/response.go index f539fb2eeb..52f698db86 100644 --- a/typedapi/ml/deletedatafeed/response.go +++ b/typedapi/ml/deletedatafeed/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletedatafeed // Response holds the response body struct for the package deletedatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_datafeed/MlDeleteDatafeedResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_datafeed/MlDeleteDatafeedResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/deletedataframeanalytics/delete_data_frame_analytics.go b/typedapi/ml/deletedataframeanalytics/delete_data_frame_analytics.go index 093a75892f..3bb2a62d7c 100644 --- a/typedapi/ml/deletedataframeanalytics/delete_data_frame_analytics.go +++ b/typedapi/ml/deletedataframeanalytics/delete_data_frame_analytics.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an existing data frame analytics job. package deletedataframeanalytics import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteDataFrameAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteDataFrameAnalytics type alias for index. @@ -76,13 +79,18 @@ func NewDeleteDataFrameAnalyticsFunc(tp elastictransport.Interface) NewDeleteDat // Deletes an existing data frame analytics job. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-dfanalytics.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-dfanalytics.html func New(tp elastictransport.Interface) *DeleteDataFrameAnalytics { r := &DeleteDataFrameAnalytics{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,6 +117,9 @@ func (r *DeleteDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reque path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -122,9 +133,9 @@ func (r *DeleteDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reque } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *DeleteDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reque } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteDataFrameAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteDataFrameAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_data_frame_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_data_frame_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_data_frame_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteDataFrameAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteDataFrameAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletedataframeanalytics.Response -func (r DeleteDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { +func (r DeleteDataFrameAnalytics) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r DeleteDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r DeleteDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r DeleteDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteDataFrameAnalytics) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteDataFrameAnalytics) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r DeleteDataFrameAnalytics) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteDataFrameAnalytics query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deletedataframeanalytics/response.go b/typedapi/ml/deletedataframeanalytics/response.go index 59aa966cd7..629e7b94bf 100644 --- a/typedapi/ml/deletedataframeanalytics/response.go +++ b/typedapi/ml/deletedataframeanalytics/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletedataframeanalytics // Response holds the response body struct for the package deletedataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_data_frame_analytics/MlDeleteDataFrameAnalyticsResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_data_frame_analytics/MlDeleteDataFrameAnalyticsResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/deleteexpireddata/delete_expired_data.go b/typedapi/ml/deleteexpireddata/delete_expired_data.go index 639c6d6313..6844ee99d7 100644 --- a/typedapi/ml/deleteexpireddata/delete_expired_data.go +++ b/typedapi/ml/deleteexpireddata/delete_expired_data.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes expired and unused machine learning data. package deleteexpireddata @@ -50,15 +50,19 @@ type DeleteExpiredData struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteExpiredData type alias for index. @@ -82,11 +86,18 @@ func New(tp elastictransport.Interface) *DeleteExpiredData { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -123,9 +134,7 @@ func (r *DeleteExpiredData) HttpRequest(ctx context.Context) (*http.Request, err } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -137,6 +146,10 @@ func (r *DeleteExpiredData) HttpRequest(ctx context.Context) (*http.Request, err } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -147,6 +160,9 @@ func (r *DeleteExpiredData) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("_delete_expired_data") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) method = http.MethodDelete @@ -167,15 +183,15 @@ func (r *DeleteExpiredData) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -192,27 +208,66 @@ func (r *DeleteExpiredData) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteExpiredData) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteExpiredData) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_expired_data") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_expired_data") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_expired_data", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_expired_data") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteExpiredData query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteExpiredData query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleteexpireddata.Response -func (r DeleteExpiredData) Do(ctx context.Context) (*Response, error) { +func (r DeleteExpiredData) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_expired_data") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -220,6 +275,9 @@ func (r DeleteExpiredData) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +287,9 @@ func (r DeleteExpiredData) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +297,9 @@ func (r DeleteExpiredData) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/deleteexpireddata/request.go b/typedapi/ml/deleteexpireddata/request.go index 76fa91262b..d3b6e1ccc8 100644 --- a/typedapi/ml/deleteexpireddata/request.go +++ b/typedapi/ml/deleteexpireddata/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleteexpireddata @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package deleteexpireddata // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_expired_data/MlDeleteExpiredDataRequest.ts#L25-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_expired_data/MlDeleteExpiredDataRequest.ts#L25-L72 type Request struct { // RequestsPerSecond The desired requests per second for the deletion processes. The default diff --git a/typedapi/ml/deleteexpireddata/response.go b/typedapi/ml/deleteexpireddata/response.go index 78573a05ac..30083ac330 100644 --- a/typedapi/ml/deleteexpireddata/response.go +++ b/typedapi/ml/deleteexpireddata/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleteexpireddata // Response holds the response body struct for the package deleteexpireddata // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_expired_data/MlDeleteExpiredDataResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_expired_data/MlDeleteExpiredDataResponse.ts#L20-L22 type Response struct { Deleted bool `json:"deleted"` } diff --git a/typedapi/ml/deletefilter/delete_filter.go b/typedapi/ml/deletefilter/delete_filter.go index c871e6475b..63953a2a4b 100644 --- a/typedapi/ml/deletefilter/delete_filter.go +++ b/typedapi/ml/deletefilter/delete_filter.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a filter. package deletefilter import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteFilter struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int filterid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteFilter type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *DeleteFilter { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeleteFilter) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("filters") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "filterid", r.filterid) + } path.WriteString(r.filterid) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *DeleteFilter) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *DeleteFilter) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteFilter) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteFilter) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_filter") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_filter") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_filter", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_filter") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteFilter query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteFilter query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletefilter.Response -func (r DeleteFilter) Do(ctx context.Context) (*Response, error) { +func (r DeleteFilter) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_filter") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r DeleteFilter) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r DeleteFilter) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r DeleteFilter) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteFilter) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteFilter) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_filter") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r DeleteFilter) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteFilter query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deletefilter/response.go b/typedapi/ml/deletefilter/response.go index f0b9e9facd..e0effa56b9 100644 --- a/typedapi/ml/deletefilter/response.go +++ b/typedapi/ml/deletefilter/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletefilter // Response holds the response body struct for the package deletefilter // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_filter/MlDeleteFilterResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_filter/MlDeleteFilterResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/deleteforecast/delete_forecast.go b/typedapi/ml/deleteforecast/delete_forecast.go index 56e09f546b..d3c39f279a 100644 --- a/typedapi/ml/deleteforecast/delete_forecast.go +++ b/typedapi/ml/deleteforecast/delete_forecast.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes forecasts from a machine learning job. package deleteforecast import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,12 +53,16 @@ type DeleteForecast struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int jobid string forecastid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteForecast type alias for index. @@ -85,7 +88,12 @@ func New(tp elastictransport.Interface) *DeleteForecast { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,6 +118,9 @@ func (r *DeleteForecast) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("_forecast") @@ -122,11 +133,17 @@ func (r *DeleteForecast) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("_forecast") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "forecastid", r.forecastid) + } path.WriteString(r.forecastid) method = http.MethodDelete @@ -140,9 +157,9 @@ func (r *DeleteForecast) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -159,27 +176,66 @@ func (r *DeleteForecast) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteForecast) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteForecast) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_forecast") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_forecast") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_forecast", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_forecast") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteForecast query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteForecast query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleteforecast.Response -func (r DeleteForecast) Do(ctx context.Context) (*Response, error) { +func (r DeleteForecast) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_forecast") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -187,6 +243,9 @@ func (r DeleteForecast) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -196,6 +255,9 @@ func (r DeleteForecast) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -203,12 +265,25 @@ func (r DeleteForecast) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteForecast) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteForecast) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_forecast") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -224,6 +299,14 @@ func (r DeleteForecast) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteForecast query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deleteforecast/response.go b/typedapi/ml/deleteforecast/response.go index f8a02f2cb1..5d4dba2034 100644 --- a/typedapi/ml/deleteforecast/response.go +++ b/typedapi/ml/deleteforecast/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleteforecast // Response holds the response body struct for the package deleteforecast // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_forecast/MlDeleteForecastResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_forecast/MlDeleteForecastResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/deletejob/delete_job.go b/typedapi/ml/deletejob/delete_job.go index 4b2f810c6c..d08571b46e 100644 --- a/typedapi/ml/deletejob/delete_job.go +++ b/typedapi/ml/deletejob/delete_job.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an existing anomaly detection job. package deletejob import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteJob type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *DeleteJob { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *DeleteJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) method = http.MethodDelete @@ -120,9 +131,9 @@ func (r *DeleteJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,27 +150,66 @@ func (r *DeleteJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteJob) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_job") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletejob.Response -func (r DeleteJob) Do(ctx context.Context) (*Response, error) { +func (r DeleteJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -167,6 +217,9 @@ func (r DeleteJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,6 +229,9 @@ func (r DeleteJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,12 +239,25 @@ func (r DeleteJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteJob) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteJob) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -204,6 +273,14 @@ func (r DeleteJob) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteJob query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deletejob/response.go b/typedapi/ml/deletejob/response.go index 70f1727754..38f71f2cf4 100644 --- a/typedapi/ml/deletejob/response.go +++ b/typedapi/ml/deletejob/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletejob // Response holds the response body struct for the package deletejob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_job/MlDeleteJobResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_job/MlDeleteJobResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/deletemodelsnapshot/delete_model_snapshot.go b/typedapi/ml/deletemodelsnapshot/delete_model_snapshot.go index cd2cd91c99..a535f198a0 100644 --- a/typedapi/ml/deletemodelsnapshot/delete_model_snapshot.go +++ b/typedapi/ml/deletemodelsnapshot/delete_model_snapshot.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an existing model snapshot. package deletemodelsnapshot import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type DeleteModelSnapshot struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int jobid string snapshotid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteModelSnapshot type alias for index. @@ -86,7 +89,12 @@ func New(tp elastictransport.Interface) *DeleteModelSnapshot { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,11 +119,17 @@ func (r *DeleteModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshotid", r.snapshotid) + } path.WriteString(r.snapshotid) method = http.MethodDelete @@ -129,9 +143,9 @@ func (r *DeleteModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +162,66 @@ func (r *DeleteModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteModelSnapshot) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteModelSnapshot) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_model_snapshot") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_model_snapshot") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_model_snapshot", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_model_snapshot") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteModelSnapshot query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteModelSnapshot query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletemodelsnapshot.Response -func (r DeleteModelSnapshot) Do(ctx context.Context) (*Response, error) { +func (r DeleteModelSnapshot) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_model_snapshot") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +229,9 @@ func (r DeleteModelSnapshot) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +241,9 @@ func (r DeleteModelSnapshot) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +251,25 @@ func (r DeleteModelSnapshot) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteModelSnapshot) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteModelSnapshot) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_model_snapshot") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +285,14 @@ func (r DeleteModelSnapshot) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteModelSnapshot query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deletemodelsnapshot/response.go b/typedapi/ml/deletemodelsnapshot/response.go index 8775905f93..d374548073 100644 --- a/typedapi/ml/deletemodelsnapshot/response.go +++ b/typedapi/ml/deletemodelsnapshot/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletemodelsnapshot // Response holds the response body struct for the package deletemodelsnapshot // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_model_snapshot/MlDeleteModelSnapshotResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_model_snapshot/MlDeleteModelSnapshotResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/deletetrainedmodel/delete_trained_model.go b/typedapi/ml/deletetrainedmodel/delete_trained_model.go index e07bdf658e..2abbace529 100644 --- a/typedapi/ml/deletetrainedmodel/delete_trained_model.go +++ b/typedapi/ml/deletetrainedmodel/delete_trained_model.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an existing trained inference model that is currently not referenced // by an ingest pipeline. package deletetrainedmodel import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type DeleteTrainedModel struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteTrainedModel type alias for index. @@ -84,7 +87,12 @@ func New(tp elastictransport.Interface) *DeleteTrainedModel { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,6 +117,9 @@ func (r *DeleteTrainedModel) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) method = http.MethodDelete @@ -122,9 +133,9 @@ func (r *DeleteTrainedModel) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *DeleteTrainedModel) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteTrainedModel) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteTrainedModel) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_trained_model") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_trained_model") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_trained_model", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_trained_model") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteTrainedModel query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteTrainedModel query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletetrainedmodel.Response -func (r DeleteTrainedModel) Do(ctx context.Context) (*Response, error) { +func (r DeleteTrainedModel) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_trained_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r DeleteTrainedModel) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r DeleteTrainedModel) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r DeleteTrainedModel) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteTrainedModel) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteTrainedModel) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_trained_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r DeleteTrainedModel) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteTrainedModel query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deletetrainedmodel/response.go b/typedapi/ml/deletetrainedmodel/response.go index 49f4ee2623..93dd47b639 100644 --- a/typedapi/ml/deletetrainedmodel/response.go +++ b/typedapi/ml/deletetrainedmodel/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletetrainedmodel // Response holds the response body struct for the package deletetrainedmodel // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_trained_model/MlDeleteTrainedModelResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_trained_model/MlDeleteTrainedModelResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/deletetrainedmodelalias/delete_trained_model_alias.go b/typedapi/ml/deletetrainedmodelalias/delete_trained_model_alias.go index b2129f2783..de32cf8034 100644 --- a/typedapi/ml/deletetrainedmodelalias/delete_trained_model_alias.go +++ b/typedapi/ml/deletetrainedmodelalias/delete_trained_model_alias.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a model alias that refers to the trained model package deletetrainedmodelalias import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type DeleteTrainedModelAlias struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int modelalias string modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteTrainedModelAlias type alias for index. @@ -86,7 +89,12 @@ func New(tp elastictransport.Interface) *DeleteTrainedModelAlias { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,11 +119,17 @@ func (r *DeleteTrainedModelAlias) HttpRequest(ctx context.Context) (*http.Reques path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) path.WriteString("/") path.WriteString("model_aliases") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelalias", r.modelalias) + } path.WriteString(r.modelalias) method = http.MethodDelete @@ -129,15 +143,15 @@ func (r *DeleteTrainedModelAlias) HttpRequest(ctx context.Context) (*http.Reques } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -154,27 +168,66 @@ func (r *DeleteTrainedModelAlias) HttpRequest(ctx context.Context) (*http.Reques } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteTrainedModelAlias) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteTrainedModelAlias) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.delete_trained_model_alias") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.delete_trained_model_alias") + if reader := instrument.RecordRequestBody(ctx, "ml.delete_trained_model_alias", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.delete_trained_model_alias") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteTrainedModelAlias query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteTrainedModelAlias query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletetrainedmodelalias.Response -func (r DeleteTrainedModelAlias) Do(ctx context.Context) (*Response, error) { +func (r DeleteTrainedModelAlias) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_trained_model_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -182,6 +235,9 @@ func (r DeleteTrainedModelAlias) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -191,6 +247,9 @@ func (r DeleteTrainedModelAlias) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -198,12 +257,25 @@ func (r DeleteTrainedModelAlias) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteTrainedModelAlias) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteTrainedModelAlias) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.delete_trained_model_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -219,6 +291,14 @@ func (r DeleteTrainedModelAlias) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteTrainedModelAlias query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/deletetrainedmodelalias/response.go b/typedapi/ml/deletetrainedmodelalias/response.go index 69bb0b3db4..7c3c9068a5 100644 --- a/typedapi/ml/deletetrainedmodelalias/response.go +++ b/typedapi/ml/deletetrainedmodelalias/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletetrainedmodelalias // Response holds the response body struct for the package deletetrainedmodelalias // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/delete_trained_model_alias/MlDeleteTrainedModelAliasResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/delete_trained_model_alias/MlDeleteTrainedModelAliasResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/estimatemodelmemory/estimate_model_memory.go b/typedapi/ml/estimatemodelmemory/estimate_model_memory.go index 6b6eb46caf..f2b7ed5352 100644 --- a/typedapi/ml/estimatemodelmemory/estimate_model_memory.go +++ b/typedapi/ml/estimatemodelmemory/estimate_model_memory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Estimates the model memory package estimatemodelmemory @@ -46,13 +46,17 @@ type EstimateModelMemory struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewEstimateModelMemory type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *EstimateModelMemory { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *EstimateModelMemory) HttpRequest(ctx context.Context) (*http.Request, e } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *EstimateModelMemory) HttpRequest(ctx context.Context) (*http.Request, e } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,15 +166,15 @@ func (r *EstimateModelMemory) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -178,27 +191,66 @@ func (r *EstimateModelMemory) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r EstimateModelMemory) Perform(ctx context.Context) (*http.Response, error) { +func (r EstimateModelMemory) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.estimate_model_memory") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.estimate_model_memory") + if reader := instrument.RecordRequestBody(ctx, "ml.estimate_model_memory", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.estimate_model_memory") + } if err != nil { - return nil, fmt.Errorf("an error happened during the EstimateModelMemory query execution: %w", err) + localErr := fmt.Errorf("an error happened during the EstimateModelMemory query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a estimatemodelmemory.Response -func (r EstimateModelMemory) Do(ctx context.Context) (*Response, error) { +func (r EstimateModelMemory) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.estimate_model_memory") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -206,6 +258,9 @@ func (r EstimateModelMemory) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -215,6 +270,9 @@ func (r EstimateModelMemory) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r EstimateModelMemory) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/estimatemodelmemory/request.go b/typedapi/ml/estimatemodelmemory/request.go index aa7bba98fa..aca923bc80 100644 --- a/typedapi/ml/estimatemodelmemory/request.go +++ b/typedapi/ml/estimatemodelmemory/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package estimatemodelmemory @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package estimatemodelmemory // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/estimate_model_memory/MlEstimateModelMemoryRequest.ts#L26-L61 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/estimate_model_memory/MlEstimateModelMemoryRequest.ts#L26-L61 type Request struct { // AnalysisConfig For a list of the properties that you can specify in the diff --git a/typedapi/ml/estimatemodelmemory/response.go b/typedapi/ml/estimatemodelmemory/response.go index fc5dc4a3d1..959032a201 100644 --- a/typedapi/ml/estimatemodelmemory/response.go +++ b/typedapi/ml/estimatemodelmemory/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package estimatemodelmemory // Response holds the response body struct for the package estimatemodelmemory // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/estimate_model_memory/MlEstimateModelMemoryResponse.ts#L20-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/estimate_model_memory/MlEstimateModelMemoryResponse.ts#L20-L24 type Response struct { ModelMemoryEstimate string `json:"model_memory_estimate"` } diff --git a/typedapi/ml/evaluatedataframe/evaluate_data_frame.go b/typedapi/ml/evaluatedataframe/evaluate_data_frame.go index 90fde9c65b..2bddcb230d 100644 --- a/typedapi/ml/evaluatedataframe/evaluate_data_frame.go +++ b/typedapi/ml/evaluatedataframe/evaluate_data_frame.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Evaluates the data frame analytics for an annotated index. package evaluatedataframe @@ -46,13 +46,17 @@ type EvaluateDataFrame struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewEvaluateDataFrame type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *EvaluateDataFrame { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *EvaluateDataFrame) HttpRequest(ctx context.Context) (*http.Request, err } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *EvaluateDataFrame) HttpRequest(ctx context.Context) (*http.Request, err } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,15 +166,15 @@ func (r *EvaluateDataFrame) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -178,27 +191,66 @@ func (r *EvaluateDataFrame) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r EvaluateDataFrame) Perform(ctx context.Context) (*http.Response, error) { +func (r EvaluateDataFrame) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.evaluate_data_frame") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.evaluate_data_frame") + if reader := instrument.RecordRequestBody(ctx, "ml.evaluate_data_frame", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.evaluate_data_frame") + } if err != nil { - return nil, fmt.Errorf("an error happened during the EvaluateDataFrame query execution: %w", err) + localErr := fmt.Errorf("an error happened during the EvaluateDataFrame query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a evaluatedataframe.Response -func (r EvaluateDataFrame) Do(ctx context.Context) (*Response, error) { +func (r EvaluateDataFrame) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.evaluate_data_frame") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -206,6 +258,9 @@ func (r EvaluateDataFrame) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -215,6 +270,9 @@ func (r EvaluateDataFrame) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r EvaluateDataFrame) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/evaluatedataframe/request.go b/typedapi/ml/evaluatedataframe/request.go index d69421e291..0fdfdfba54 100644 --- a/typedapi/ml/evaluatedataframe/request.go +++ b/typedapi/ml/evaluatedataframe/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package evaluatedataframe @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package evaluatedataframe // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/MlEvaluateDataFrameRequest.ts#L25-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/MlEvaluateDataFrameRequest.ts#L25-L52 type Request struct { // Evaluation Defines the type of evaluation you want to perform. diff --git a/typedapi/ml/evaluatedataframe/response.go b/typedapi/ml/evaluatedataframe/response.go index a1e4b53cb7..9677e40488 100644 --- a/typedapi/ml/evaluatedataframe/response.go +++ b/typedapi/ml/evaluatedataframe/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package evaluatedataframe @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package evaluatedataframe // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/MlEvaluateDataFrameResponse.ts#L26-L33 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/MlEvaluateDataFrameResponse.ts#L26-L33 type Response struct { Classification *types.DataframeClassificationSummary `json:"classification,omitempty"` OutlierDetection *types.DataframeOutlierDetectionSummary `json:"outlier_detection,omitempty"` diff --git a/typedapi/ml/explaindataframeanalytics/explain_data_frame_analytics.go b/typedapi/ml/explaindataframeanalytics/explain_data_frame_analytics.go index 5a60e2209e..4b7c1256e8 100644 --- a/typedapi/ml/explaindataframeanalytics/explain_data_frame_analytics.go +++ b/typedapi/ml/explaindataframeanalytics/explain_data_frame_analytics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Explains a data frame analytics config. package explaindataframeanalytics @@ -50,15 +50,19 @@ type ExplainDataFrameAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExplainDataFrameAnalytics type alias for index. @@ -82,11 +86,18 @@ func New(tp elastictransport.Interface) *ExplainDataFrameAnalytics { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -123,9 +134,7 @@ func (r *ExplainDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Requ } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -137,6 +146,10 @@ func (r *ExplainDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Requ } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -160,6 +173,9 @@ func (r *ExplainDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Requ path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") path.WriteString("_explain") @@ -175,15 +191,15 @@ func (r *ExplainDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Requ } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -200,27 +216,66 @@ func (r *ExplainDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Requ } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExplainDataFrameAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r ExplainDataFrameAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.explain_data_frame_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.explain_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.explain_data_frame_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.explain_data_frame_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExplainDataFrameAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExplainDataFrameAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a explaindataframeanalytics.Response -func (r ExplainDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { +func (r ExplainDataFrameAnalytics) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.explain_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -228,6 +283,9 @@ func (r ExplainDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -237,6 +295,9 @@ func (r ExplainDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -244,6 +305,9 @@ func (r ExplainDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/explaindataframeanalytics/request.go b/typedapi/ml/explaindataframeanalytics/request.go index 57e0b903fa..e2d8bb090b 100644 --- a/typedapi/ml/explaindataframeanalytics/request.go +++ b/typedapi/ml/explaindataframeanalytics/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package explaindataframeanalytics @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package explaindataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/explain_data_frame_analytics/MlExplainDataFrameAnalyticsRequest.ts#L30-L107 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/explain_data_frame_analytics/MlExplainDataFrameAnalyticsRequest.ts#L30-L107 type Request struct { // AllowLazyStart Specifies whether this job can start when there is insufficient machine diff --git a/typedapi/ml/explaindataframeanalytics/response.go b/typedapi/ml/explaindataframeanalytics/response.go index 14f1e3b988..29ce2d131c 100644 --- a/typedapi/ml/explaindataframeanalytics/response.go +++ b/typedapi/ml/explaindataframeanalytics/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package explaindataframeanalytics @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package explaindataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/explain_data_frame_analytics/MlExplainDataFrameAnalyticsResponse.ts#L25-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/explain_data_frame_analytics/MlExplainDataFrameAnalyticsResponse.ts#L25-L32 type Response struct { // FieldSelection An array of objects that explain selection for each field, sorted by the diff --git a/typedapi/ml/flushjob/flush_job.go b/typedapi/ml/flushjob/flush_job.go index d45e648853..ca579fdd71 100644 --- a/typedapi/ml/flushjob/flush_job.go +++ b/typedapi/ml/flushjob/flush_job.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Forces any buffered data to be processed by the job. package flushjob @@ -50,15 +50,19 @@ type FlushJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewFlushJob type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *FlushJob { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *FlushJob) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *FlushJob) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *FlushJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("_flush") @@ -164,15 +180,15 @@ func (r *FlushJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *FlushJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r FlushJob) Perform(ctx context.Context) (*http.Response, error) { +func (r FlushJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.flush_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.flush_job") + if reader := instrument.RecordRequestBody(ctx, "ml.flush_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.flush_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the FlushJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the FlushJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a flushjob.Response -func (r FlushJob) Do(ctx context.Context) (*Response, error) { +func (r FlushJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.flush_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r FlushJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r FlushJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r FlushJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/flushjob/request.go b/typedapi/ml/flushjob/request.go index e66055f33c..bbe35854db 100644 --- a/typedapi/ml/flushjob/request.go +++ b/typedapi/ml/flushjob/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package flushjob @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package flushjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/flush_job/MlFlushJobRequest.ts#L24-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/flush_job/MlFlushJobRequest.ts#L24-L99 type Request struct { // AdvanceTime Refer to the description for the `advance_time` query parameter. diff --git a/typedapi/ml/flushjob/response.go b/typedapi/ml/flushjob/response.go index 11a2e84e9a..8190b4fc39 100644 --- a/typedapi/ml/flushjob/response.go +++ b/typedapi/ml/flushjob/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package flushjob // Response holds the response body struct for the package flushjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/flush_job/MlFlushJobResponse.ts#L22-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/flush_job/MlFlushJobResponse.ts#L22-L31 type Response struct { Flushed bool `json:"flushed"` // LastFinalizedBucketEnd Provides the timestamp (in milliseconds since the epoch) of the end of diff --git a/typedapi/ml/forecast/forecast.go b/typedapi/ml/forecast/forecast.go index 0e700fc1fd..701baa0897 100644 --- a/typedapi/ml/forecast/forecast.go +++ b/typedapi/ml/forecast/forecast.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Predicts the future behavior of a time series by using its historical // behavior. @@ -51,15 +51,19 @@ type Forecast struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewForecast type alias for index. @@ -86,11 +90,18 @@ func New(tp elastictransport.Interface) *Forecast { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *Forecast) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,6 +150,10 @@ func (r *Forecast) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *Forecast) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("_forecast") @@ -166,15 +182,15 @@ func (r *Forecast) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -191,27 +207,66 @@ func (r *Forecast) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Forecast) Perform(ctx context.Context) (*http.Response, error) { +func (r Forecast) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.forecast") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.forecast") + if reader := instrument.RecordRequestBody(ctx, "ml.forecast", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.forecast") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Forecast query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Forecast query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a forecast.Response -func (r Forecast) Do(ctx context.Context) (*Response, error) { +func (r Forecast) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.forecast") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -219,6 +274,9 @@ func (r Forecast) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -228,6 +286,9 @@ func (r Forecast) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +296,9 @@ func (r Forecast) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/forecast/request.go b/typedapi/ml/forecast/request.go index dd71039b85..b1ab2b7450 100644 --- a/typedapi/ml/forecast/request.go +++ b/typedapi/ml/forecast/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package forecast @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package forecast // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/forecast/MlForecastJobRequest.ts#L24-L87 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/forecast/MlForecastJobRequest.ts#L24-L87 type Request struct { // Duration Refer to the description for the `duration` query parameter. diff --git a/typedapi/ml/forecast/response.go b/typedapi/ml/forecast/response.go index 6a40984448..2ab78c2b06 100644 --- a/typedapi/ml/forecast/response.go +++ b/typedapi/ml/forecast/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package forecast // Response holds the response body struct for the package forecast // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/forecast/MlForecastJobResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/forecast/MlForecastJobResponse.ts#L22-L27 type Response struct { Acknowledged bool `json:"acknowledged"` ForecastId string `json:"forecast_id"` diff --git a/typedapi/ml/getbuckets/get_buckets.go b/typedapi/ml/getbuckets/get_buckets.go index 9c828c18d6..fb59fd2116 100644 --- a/typedapi/ml/getbuckets/get_buckets.go +++ b/typedapi/ml/getbuckets/get_buckets.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves anomaly detection job results for one or more buckets. package getbuckets @@ -53,16 +53,20 @@ type GetBuckets struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string timestamp string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetBuckets type alias for index. @@ -88,11 +92,18 @@ func New(tp elastictransport.Interface) *GetBuckets { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -129,9 +140,7 @@ func (r *GetBuckets) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -143,6 +152,10 @@ func (r *GetBuckets) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,6 +166,9 @@ func (r *GetBuckets) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("results") @@ -160,6 +176,9 @@ func (r *GetBuckets) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("buckets") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "timestamp", r.timestamp) + } path.WriteString(r.timestamp) method = http.MethodPost @@ -170,6 +189,9 @@ func (r *GetBuckets) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("results") @@ -187,15 +209,15 @@ func (r *GetBuckets) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -212,27 +234,66 @@ func (r *GetBuckets) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetBuckets) Perform(ctx context.Context) (*http.Response, error) { +func (r GetBuckets) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_buckets") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_buckets") + if reader := instrument.RecordRequestBody(ctx, "ml.get_buckets", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_buckets") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetBuckets query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetBuckets query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getbuckets.Response -func (r GetBuckets) Do(ctx context.Context) (*Response, error) { +func (r GetBuckets) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_buckets") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -240,6 +301,9 @@ func (r GetBuckets) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -249,6 +313,9 @@ func (r GetBuckets) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -256,6 +323,9 @@ func (r GetBuckets) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/getbuckets/request.go b/typedapi/ml/getbuckets/request.go index 4595c36acb..ffc848ab31 100644 --- a/typedapi/ml/getbuckets/request.go +++ b/typedapi/ml/getbuckets/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getbuckets @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package getbuckets // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_buckets/MlGetBucketsRequest.ts#L26-L133 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_buckets/MlGetBucketsRequest.ts#L26-L133 type Request struct { // AnomalyScore Refer to the description for the `anomaly_score` query parameter. diff --git a/typedapi/ml/getbuckets/response.go b/typedapi/ml/getbuckets/response.go index cfee65e11d..a50d36012f 100644 --- a/typedapi/ml/getbuckets/response.go +++ b/typedapi/ml/getbuckets/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getbuckets @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getbuckets // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_buckets/MlGetBucketsResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_buckets/MlGetBucketsResponse.ts#L23-L28 type Response struct { Buckets []types.BucketSummary `json:"buckets"` Count int64 `json:"count"` diff --git a/typedapi/ml/getcalendarevents/get_calendar_events.go b/typedapi/ml/getcalendarevents/get_calendar_events.go index 27aaf6ea9f..913dd395bb 100644 --- a/typedapi/ml/getcalendarevents/get_calendar_events.go +++ b/typedapi/ml/getcalendarevents/get_calendar_events.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about the scheduled events in calendars. package getcalendarevents import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetCalendarEvents struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int calendarid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetCalendarEvents type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *GetCalendarEvents { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *GetCalendarEvents) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("calendars") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendarid", r.calendarid) + } path.WriteString(r.calendarid) path.WriteString("/") path.WriteString("events") @@ -122,9 +133,9 @@ func (r *GetCalendarEvents) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *GetCalendarEvents) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetCalendarEvents) Perform(ctx context.Context) (*http.Response, error) { +func (r GetCalendarEvents) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_calendar_events") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_calendar_events") + if reader := instrument.RecordRequestBody(ctx, "ml.get_calendar_events", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_calendar_events") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetCalendarEvents query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetCalendarEvents query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getcalendarevents.Response -func (r GetCalendarEvents) Do(ctx context.Context) (*Response, error) { +func (r GetCalendarEvents) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_calendar_events") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r GetCalendarEvents) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r GetCalendarEvents) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r GetCalendarEvents) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetCalendarEvents) IsSuccess(ctx context.Context) (bool, error) { +func (r GetCalendarEvents) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_calendar_events") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r GetCalendarEvents) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetCalendarEvents query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/getcalendarevents/response.go b/typedapi/ml/getcalendarevents/response.go index 805fea0722..f1ff1a0e53 100644 --- a/typedapi/ml/getcalendarevents/response.go +++ b/typedapi/ml/getcalendarevents/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getcalendarevents @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getcalendarevents // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_calendar_events/MlGetCalendarEventsResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_calendar_events/MlGetCalendarEventsResponse.ts#L23-L28 type Response struct { Count int64 `json:"count"` Events []types.CalendarEvent `json:"events"` diff --git a/typedapi/ml/getcalendars/get_calendars.go b/typedapi/ml/getcalendars/get_calendars.go index cdebb1cf57..3e6e32c9f6 100644 --- a/typedapi/ml/getcalendars/get_calendars.go +++ b/typedapi/ml/getcalendars/get_calendars.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves configuration information for calendars. package getcalendars @@ -51,15 +51,19 @@ type GetCalendars struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int calendarid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetCalendars type alias for index. @@ -83,11 +87,18 @@ func New(tp elastictransport.Interface) *GetCalendars { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -124,9 +135,7 @@ func (r *GetCalendars) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -138,6 +147,10 @@ func (r *GetCalendars) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -155,6 +168,9 @@ func (r *GetCalendars) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("calendars") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendarid", r.calendarid) + } path.WriteString(r.calendarid) method = http.MethodPost @@ -168,15 +184,15 @@ func (r *GetCalendars) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -193,27 +209,66 @@ func (r *GetCalendars) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetCalendars) Perform(ctx context.Context) (*http.Response, error) { +func (r GetCalendars) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_calendars") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_calendars") + if reader := instrument.RecordRequestBody(ctx, "ml.get_calendars", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_calendars") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetCalendars query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetCalendars query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getcalendars.Response -func (r GetCalendars) Do(ctx context.Context) (*Response, error) { +func (r GetCalendars) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_calendars") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -221,6 +276,9 @@ func (r GetCalendars) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +288,9 @@ func (r GetCalendars) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -237,6 +298,9 @@ func (r GetCalendars) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/getcalendars/request.go b/typedapi/ml/getcalendars/request.go index 0462ec649a..a625400b82 100644 --- a/typedapi/ml/getcalendars/request.go +++ b/typedapi/ml/getcalendars/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getcalendars @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package getcalendars // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_calendars/MlGetCalendarsRequest.ts#L25-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_calendars/MlGetCalendarsRequest.ts#L25-L51 type Request struct { // Page This object is supported only when you omit the calendar identifier. diff --git a/typedapi/ml/getcalendars/response.go b/typedapi/ml/getcalendars/response.go index 111bf91ecd..7c9bec3d40 100644 --- a/typedapi/ml/getcalendars/response.go +++ b/typedapi/ml/getcalendars/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getcalendars @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getcalendars // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_calendars/MlGetCalendarsResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_calendars/MlGetCalendarsResponse.ts#L23-L25 type Response struct { Calendars []types.Calendar `json:"calendars"` Count int64 `json:"count"` diff --git a/typedapi/ml/getcategories/get_categories.go b/typedapi/ml/getcategories/get_categories.go index 71346a48f4..5aa0a10725 100644 --- a/typedapi/ml/getcategories/get_categories.go +++ b/typedapi/ml/getcategories/get_categories.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves anomaly detection job results for one or more categories. package getcategories @@ -53,16 +53,20 @@ type GetCategories struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string categoryid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetCategories type alias for index. @@ -88,11 +92,18 @@ func New(tp elastictransport.Interface) *GetCategories { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -129,9 +140,7 @@ func (r *GetCategories) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -143,6 +152,10 @@ func (r *GetCategories) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,6 +166,9 @@ func (r *GetCategories) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("results") @@ -160,6 +176,9 @@ func (r *GetCategories) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("categories") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "categoryid", r.categoryid) + } path.WriteString(r.categoryid) method = http.MethodPost @@ -170,6 +189,9 @@ func (r *GetCategories) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("results") @@ -187,15 +209,15 @@ func (r *GetCategories) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -212,27 +234,66 @@ func (r *GetCategories) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetCategories) Perform(ctx context.Context) (*http.Response, error) { +func (r GetCategories) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_categories") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_categories") + if reader := instrument.RecordRequestBody(ctx, "ml.get_categories", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_categories") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetCategories query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetCategories query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getcategories.Response -func (r GetCategories) Do(ctx context.Context) (*Response, error) { +func (r GetCategories) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_categories") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -240,6 +301,9 @@ func (r GetCategories) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -249,6 +313,9 @@ func (r GetCategories) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -256,6 +323,9 @@ func (r GetCategories) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/getcategories/request.go b/typedapi/ml/getcategories/request.go index f17cce7a6e..6cdab6f0c0 100644 --- a/typedapi/ml/getcategories/request.go +++ b/typedapi/ml/getcategories/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getcategories @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package getcategories // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_categories/MlGetCategoriesRequest.ts#L25-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_categories/MlGetCategoriesRequest.ts#L25-L70 type Request struct { // Page Configures pagination. diff --git a/typedapi/ml/getcategories/response.go b/typedapi/ml/getcategories/response.go index 70ce3093d7..e9be2d08ed 100644 --- a/typedapi/ml/getcategories/response.go +++ b/typedapi/ml/getcategories/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getcategories @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getcategories // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_categories/MlGetCategoriesResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_categories/MlGetCategoriesResponse.ts#L23-L28 type Response struct { Categories []types.Category `json:"categories"` Count int64 `json:"count"` diff --git a/typedapi/ml/getdatafeeds/get_datafeeds.go b/typedapi/ml/getdatafeeds/get_datafeeds.go index 68649b2d5a..9de168dd88 100644 --- a/typedapi/ml/getdatafeeds/get_datafeeds.go +++ b/typedapi/ml/getdatafeeds/get_datafeeds.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves configuration information for datafeeds. package getdatafeeds import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetDatafeeds struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int datafeedid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetDatafeeds type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetDatafeeds { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *GetDatafeeds) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("datafeeds") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeedid", r.datafeedid) + } path.WriteString(r.datafeedid) method = http.MethodGet @@ -125,9 +136,9 @@ func (r *GetDatafeeds) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *GetDatafeeds) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetDatafeeds) Perform(ctx context.Context) (*http.Response, error) { +func (r GetDatafeeds) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_datafeeds") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_datafeeds") + if reader := instrument.RecordRequestBody(ctx, "ml.get_datafeeds", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_datafeeds") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetDatafeeds query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetDatafeeds query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getdatafeeds.Response -func (r GetDatafeeds) Do(ctx context.Context) (*Response, error) { +func (r GetDatafeeds) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_datafeeds") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r GetDatafeeds) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r GetDatafeeds) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r GetDatafeeds) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetDatafeeds) IsSuccess(ctx context.Context) (bool, error) { +func (r GetDatafeeds) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_datafeeds") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r GetDatafeeds) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetDatafeeds query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/getdatafeeds/response.go b/typedapi/ml/getdatafeeds/response.go index 0d97e096f9..db7c310f27 100644 --- a/typedapi/ml/getdatafeeds/response.go +++ b/typedapi/ml/getdatafeeds/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getdatafeeds @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getdatafeeds // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_datafeeds/MlGetDatafeedsResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_datafeeds/MlGetDatafeedsResponse.ts#L23-L28 type Response struct { Count int64 `json:"count"` Datafeeds []types.MLDatafeed `json:"datafeeds"` diff --git a/typedapi/ml/getdatafeedstats/get_datafeed_stats.go b/typedapi/ml/getdatafeedstats/get_datafeed_stats.go index 29ac2dacf9..46c39adc85 100644 --- a/typedapi/ml/getdatafeedstats/get_datafeed_stats.go +++ b/typedapi/ml/getdatafeedstats/get_datafeed_stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves usage information for datafeeds. package getdatafeedstats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetDatafeedStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int datafeedid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetDatafeedStats type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetDatafeedStats { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *GetDatafeedStats) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("datafeeds") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeedid", r.datafeedid) + } path.WriteString(r.datafeedid) path.WriteString("/") path.WriteString("_stats") @@ -129,9 +140,9 @@ func (r *GetDatafeedStats) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +159,66 @@ func (r *GetDatafeedStats) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetDatafeedStats) Perform(ctx context.Context) (*http.Response, error) { +func (r GetDatafeedStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_datafeed_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_datafeed_stats") + if reader := instrument.RecordRequestBody(ctx, "ml.get_datafeed_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_datafeed_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetDatafeedStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetDatafeedStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getdatafeedstats.Response -func (r GetDatafeedStats) Do(ctx context.Context) (*Response, error) { +func (r GetDatafeedStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_datafeed_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +226,9 @@ func (r GetDatafeedStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +238,9 @@ func (r GetDatafeedStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +248,25 @@ func (r GetDatafeedStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetDatafeedStats) IsSuccess(ctx context.Context) (bool, error) { +func (r GetDatafeedStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_datafeed_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +282,14 @@ func (r GetDatafeedStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetDatafeedStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/getdatafeedstats/response.go b/typedapi/ml/getdatafeedstats/response.go index 136feffcdf..6df9973693 100644 --- a/typedapi/ml/getdatafeedstats/response.go +++ b/typedapi/ml/getdatafeedstats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getdatafeedstats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getdatafeedstats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_datafeed_stats/MlGetDatafeedStatsResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_datafeed_stats/MlGetDatafeedStatsResponse.ts#L23-L28 type Response struct { Count int64 `json:"count"` Datafeeds []types.DatafeedStats `json:"datafeeds"` diff --git a/typedapi/ml/getdataframeanalytics/get_data_frame_analytics.go b/typedapi/ml/getdataframeanalytics/get_data_frame_analytics.go index 2986a3d414..92aa30d61e 100644 --- a/typedapi/ml/getdataframeanalytics/get_data_frame_analytics.go +++ b/typedapi/ml/getdataframeanalytics/get_data_frame_analytics.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves configuration information for data frame analytics jobs. package getdataframeanalytics import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetDataFrameAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetDataFrameAnalytics type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetDataFrameAnalytics { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *GetDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -129,9 +140,9 @@ func (r *GetDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +159,66 @@ func (r *GetDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetDataFrameAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r GetDataFrameAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_data_frame_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.get_data_frame_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_data_frame_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetDataFrameAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetDataFrameAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getdataframeanalytics.Response -func (r GetDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { +func (r GetDataFrameAnalytics) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +226,9 @@ func (r GetDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +238,9 @@ func (r GetDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +248,25 @@ func (r GetDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetDataFrameAnalytics) IsSuccess(ctx context.Context) (bool, error) { +func (r GetDataFrameAnalytics) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +282,14 @@ func (r GetDataFrameAnalytics) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetDataFrameAnalytics query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/getdataframeanalytics/response.go b/typedapi/ml/getdataframeanalytics/response.go index cf2cd218b1..69f89bb902 100644 --- a/typedapi/ml/getdataframeanalytics/response.go +++ b/typedapi/ml/getdataframeanalytics/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getdataframeanalytics @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getdataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_data_frame_analytics/MlGetDataFrameAnalyticsResponse.ts#L23-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_data_frame_analytics/MlGetDataFrameAnalyticsResponse.ts#L23-L29 type Response struct { Count int `json:"count"` // DataFrameAnalytics An array of data frame analytics job resources, which are sorted by the id diff --git a/typedapi/ml/getdataframeanalyticsstats/get_data_frame_analytics_stats.go b/typedapi/ml/getdataframeanalyticsstats/get_data_frame_analytics_stats.go index 1d5dc55a5f..01f9c4737c 100644 --- a/typedapi/ml/getdataframeanalyticsstats/get_data_frame_analytics_stats.go +++ b/typedapi/ml/getdataframeanalyticsstats/get_data_frame_analytics_stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves usage information for data frame analytics jobs. package getdataframeanalyticsstats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetDataFrameAnalyticsStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetDataFrameAnalyticsStats type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetDataFrameAnalyticsStats { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -118,6 +126,9 @@ func (r *GetDataFrameAnalyticsStats) HttpRequest(ctx context.Context) (*http.Req path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") path.WriteString("_stats") @@ -133,9 +144,9 @@ func (r *GetDataFrameAnalyticsStats) HttpRequest(ctx context.Context) (*http.Req } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -152,27 +163,66 @@ func (r *GetDataFrameAnalyticsStats) HttpRequest(ctx context.Context) (*http.Req } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetDataFrameAnalyticsStats) Perform(ctx context.Context) (*http.Response, error) { +func (r GetDataFrameAnalyticsStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_data_frame_analytics_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_data_frame_analytics_stats") + if reader := instrument.RecordRequestBody(ctx, "ml.get_data_frame_analytics_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_data_frame_analytics_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetDataFrameAnalyticsStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetDataFrameAnalyticsStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getdataframeanalyticsstats.Response -func (r GetDataFrameAnalyticsStats) Do(ctx context.Context) (*Response, error) { +func (r GetDataFrameAnalyticsStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_data_frame_analytics_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -180,6 +230,9 @@ func (r GetDataFrameAnalyticsStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,6 +242,9 @@ func (r GetDataFrameAnalyticsStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -196,12 +252,25 @@ func (r GetDataFrameAnalyticsStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetDataFrameAnalyticsStats) IsSuccess(ctx context.Context) (bool, error) { +func (r GetDataFrameAnalyticsStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_data_frame_analytics_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -217,6 +286,14 @@ func (r GetDataFrameAnalyticsStats) IsSuccess(ctx context.Context) (bool, error) return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetDataFrameAnalyticsStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/getdataframeanalyticsstats/response.go b/typedapi/ml/getdataframeanalyticsstats/response.go index f9ae3d7a62..89266383b9 100644 --- a/typedapi/ml/getdataframeanalyticsstats/response.go +++ b/typedapi/ml/getdataframeanalyticsstats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getdataframeanalyticsstats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getdataframeanalyticsstats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_data_frame_analytics_stats/MlGetDataFrameAnalyticsStatsResponse.ts#L24-L30 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_data_frame_analytics_stats/MlGetDataFrameAnalyticsStatsResponse.ts#L24-L30 type Response struct { Count int64 `json:"count"` // DataFrameAnalytics An array of objects that contain usage information for data frame analytics diff --git a/typedapi/ml/getfilters/get_filters.go b/typedapi/ml/getfilters/get_filters.go index dda9c880d7..019ec93adc 100644 --- a/typedapi/ml/getfilters/get_filters.go +++ b/typedapi/ml/getfilters/get_filters.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves filters. package getfilters import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetFilters struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int filterid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetFilters type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetFilters { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,6 +120,9 @@ func (r *GetFilters) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("filters") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "filterid", r.filterid) + } path.WriteString(r.filterid) method = http.MethodGet @@ -125,9 +136,9 @@ func (r *GetFilters) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *GetFilters) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetFilters) Perform(ctx context.Context) (*http.Response, error) { +func (r GetFilters) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_filters") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_filters") + if reader := instrument.RecordRequestBody(ctx, "ml.get_filters", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_filters") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetFilters query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetFilters query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getfilters.Response -func (r GetFilters) Do(ctx context.Context) (*Response, error) { +func (r GetFilters) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_filters") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r GetFilters) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r GetFilters) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r GetFilters) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetFilters) IsSuccess(ctx context.Context) (bool, error) { +func (r GetFilters) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_filters") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r GetFilters) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetFilters query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/getfilters/response.go b/typedapi/ml/getfilters/response.go index b52002fda5..3698b8cbe8 100644 --- a/typedapi/ml/getfilters/response.go +++ b/typedapi/ml/getfilters/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getfilters @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getfilters // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_filters/MlGetFiltersResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_filters/MlGetFiltersResponse.ts#L23-L28 type Response struct { Count int64 `json:"count"` Filters []types.MLFilter `json:"filters"` diff --git a/typedapi/ml/getinfluencers/get_influencers.go b/typedapi/ml/getinfluencers/get_influencers.go index 3c54e2b5f1..8a6642b64c 100644 --- a/typedapi/ml/getinfluencers/get_influencers.go +++ b/typedapi/ml/getinfluencers/get_influencers.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves anomaly detection job results for one or more influencers. package getinfluencers @@ -51,15 +51,19 @@ type GetInfluencers struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetInfluencers type alias for index. @@ -85,11 +89,18 @@ func New(tp elastictransport.Interface) *GetInfluencers { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *GetInfluencers) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *GetInfluencers) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,6 +163,9 @@ func (r *GetInfluencers) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("results") @@ -167,15 +183,15 @@ func (r *GetInfluencers) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -192,27 +208,66 @@ func (r *GetInfluencers) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetInfluencers) Perform(ctx context.Context) (*http.Response, error) { +func (r GetInfluencers) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_influencers") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_influencers") + if reader := instrument.RecordRequestBody(ctx, "ml.get_influencers", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_influencers") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetInfluencers query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetInfluencers query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getinfluencers.Response -func (r GetInfluencers) Do(ctx context.Context) (*Response, error) { +func (r GetInfluencers) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_influencers") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -220,6 +275,9 @@ func (r GetInfluencers) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +287,9 @@ func (r GetInfluencers) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +297,9 @@ func (r GetInfluencers) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/getinfluencers/request.go b/typedapi/ml/getinfluencers/request.go index a0a1003fdd..c62c9d8b33 100644 --- a/typedapi/ml/getinfluencers/request.go +++ b/typedapi/ml/getinfluencers/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getinfluencers @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package getinfluencers // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_influencers/MlGetInfluencersRequest.ts#L26-L97 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_influencers/MlGetInfluencersRequest.ts#L26-L97 type Request struct { // Page Configures pagination. diff --git a/typedapi/ml/getinfluencers/response.go b/typedapi/ml/getinfluencers/response.go index 07c3e12597..e32de1e331 100644 --- a/typedapi/ml/getinfluencers/response.go +++ b/typedapi/ml/getinfluencers/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getinfluencers @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getinfluencers // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_influencers/MlGetInfluencersResponse.ts#L23-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_influencers/MlGetInfluencersResponse.ts#L23-L29 type Response struct { Count int64 `json:"count"` // Influencers Array of influencer objects diff --git a/typedapi/ml/getjobs/get_jobs.go b/typedapi/ml/getjobs/get_jobs.go index 0f95424597..975543a76d 100644 --- a/typedapi/ml/getjobs/get_jobs.go +++ b/typedapi/ml/getjobs/get_jobs.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves configuration information for anomaly detection jobs. package getjobs import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetJobs struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetJobs type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetJobs { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *GetJobs) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) method = http.MethodGet @@ -125,9 +136,9 @@ func (r *GetJobs) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *GetJobs) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetJobs) Perform(ctx context.Context) (*http.Response, error) { +func (r GetJobs) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_jobs") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_jobs") + if reader := instrument.RecordRequestBody(ctx, "ml.get_jobs", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_jobs") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetJobs query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetJobs query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getjobs.Response -func (r GetJobs) Do(ctx context.Context) (*Response, error) { +func (r GetJobs) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_jobs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r GetJobs) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r GetJobs) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r GetJobs) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetJobs) IsSuccess(ctx context.Context) (bool, error) { +func (r GetJobs) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_jobs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r GetJobs) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetJobs query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/getjobs/response.go b/typedapi/ml/getjobs/response.go index 4e323b1df1..6e16ca9070 100644 --- a/typedapi/ml/getjobs/response.go +++ b/typedapi/ml/getjobs/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getjobs @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getjobs // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_jobs/MlGetJobsResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_jobs/MlGetJobsResponse.ts#L23-L28 type Response struct { Count int64 `json:"count"` Jobs []types.Job `json:"jobs"` diff --git a/typedapi/ml/getjobstats/get_job_stats.go b/typedapi/ml/getjobstats/get_job_stats.go index 10b8073a88..0b1882f340 100644 --- a/typedapi/ml/getjobstats/get_job_stats.go +++ b/typedapi/ml/getjobstats/get_job_stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves usage information for anomaly detection jobs. package getjobstats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetJobStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetJobStats type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetJobStats { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,6 +122,9 @@ func (r *GetJobStats) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("_stats") @@ -129,9 +140,9 @@ func (r *GetJobStats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +159,66 @@ func (r *GetJobStats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetJobStats) Perform(ctx context.Context) (*http.Response, error) { +func (r GetJobStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_job_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_job_stats") + if reader := instrument.RecordRequestBody(ctx, "ml.get_job_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_job_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetJobStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetJobStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getjobstats.Response -func (r GetJobStats) Do(ctx context.Context) (*Response, error) { +func (r GetJobStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_job_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +226,9 @@ func (r GetJobStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +238,9 @@ func (r GetJobStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +248,25 @@ func (r GetJobStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetJobStats) IsSuccess(ctx context.Context) (bool, error) { +func (r GetJobStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_job_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +282,14 @@ func (r GetJobStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetJobStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/getjobstats/response.go b/typedapi/ml/getjobstats/response.go index 7cf55ed541..c8b0cba57b 100644 --- a/typedapi/ml/getjobstats/response.go +++ b/typedapi/ml/getjobstats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getjobstats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getjobstats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_job_stats/MlGetJobStatsResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_job_stats/MlGetJobStatsResponse.ts#L23-L28 type Response struct { Count int64 `json:"count"` Jobs []types.JobStats `json:"jobs"` diff --git a/typedapi/ml/getmemorystats/get_memory_stats.go b/typedapi/ml/getmemorystats/get_memory_stats.go index f3a63e7e9e..6b082cf59b 100644 --- a/typedapi/ml/getmemorystats/get_memory_stats.go +++ b/typedapi/ml/getmemorystats/get_memory_stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information on how ML is using memory. package getmemorystats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetMemoryStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetMemoryStats type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetMemoryStats { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,6 +122,9 @@ func (r *GetMemoryStats) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("memory") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("_stats") @@ -129,9 +140,9 @@ func (r *GetMemoryStats) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +159,66 @@ func (r *GetMemoryStats) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetMemoryStats) Perform(ctx context.Context) (*http.Response, error) { +func (r GetMemoryStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_memory_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_memory_stats") + if reader := instrument.RecordRequestBody(ctx, "ml.get_memory_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_memory_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetMemoryStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetMemoryStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getmemorystats.Response -func (r GetMemoryStats) Do(ctx context.Context) (*Response, error) { +func (r GetMemoryStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_memory_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +226,9 @@ func (r GetMemoryStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +238,9 @@ func (r GetMemoryStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +248,25 @@ func (r GetMemoryStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetMemoryStats) IsSuccess(ctx context.Context) (bool, error) { +func (r GetMemoryStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_memory_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +282,14 @@ func (r GetMemoryStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetMemoryStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/getmemorystats/response.go b/typedapi/ml/getmemorystats/response.go index eaa6d88085..29355ff53f 100644 --- a/typedapi/ml/getmemorystats/response.go +++ b/typedapi/ml/getmemorystats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getmemorystats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getmemorystats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_memory_stats/MlGetMemoryStatsResponse.ts#L25-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_memory_stats/MlGetMemoryStatsResponse.ts#L25-L31 type Response struct { ClusterName string `json:"cluster_name"` NodeStats types.NodeStatistics `json:"_nodes"` diff --git a/typedapi/ml/getmodelsnapshots/get_model_snapshots.go b/typedapi/ml/getmodelsnapshots/get_model_snapshots.go index 7d8789fef2..fe1848f1d8 100644 --- a/typedapi/ml/getmodelsnapshots/get_model_snapshots.go +++ b/typedapi/ml/getmodelsnapshots/get_model_snapshots.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about model snapshots. package getmodelsnapshots @@ -53,16 +53,20 @@ type GetModelSnapshots struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string snapshotid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetModelSnapshots type alias for index. @@ -88,11 +92,18 @@ func New(tp elastictransport.Interface) *GetModelSnapshots { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -129,9 +140,7 @@ func (r *GetModelSnapshots) HttpRequest(ctx context.Context) (*http.Request, err } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -143,6 +152,10 @@ func (r *GetModelSnapshots) HttpRequest(ctx context.Context) (*http.Request, err } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,11 +166,17 @@ func (r *GetModelSnapshots) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshotid", r.snapshotid) + } path.WriteString(r.snapshotid) method = http.MethodPost @@ -168,6 +187,9 @@ func (r *GetModelSnapshots) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("model_snapshots") @@ -183,15 +205,15 @@ func (r *GetModelSnapshots) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -208,27 +230,66 @@ func (r *GetModelSnapshots) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetModelSnapshots) Perform(ctx context.Context) (*http.Response, error) { +func (r GetModelSnapshots) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_model_snapshots") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_model_snapshots") + if reader := instrument.RecordRequestBody(ctx, "ml.get_model_snapshots", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_model_snapshots") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetModelSnapshots query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetModelSnapshots query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getmodelsnapshots.Response -func (r GetModelSnapshots) Do(ctx context.Context) (*Response, error) { +func (r GetModelSnapshots) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_model_snapshots") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -236,6 +297,9 @@ func (r GetModelSnapshots) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -245,6 +309,9 @@ func (r GetModelSnapshots) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -252,6 +319,9 @@ func (r GetModelSnapshots) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/getmodelsnapshots/request.go b/typedapi/ml/getmodelsnapshots/request.go index f41b58acf9..e89f67d499 100644 --- a/typedapi/ml/getmodelsnapshots/request.go +++ b/typedapi/ml/getmodelsnapshots/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getmodelsnapshots @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package getmodelsnapshots // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_model_snapshots/MlGetModelSnapshotsRequest.ts#L26-L96 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_model_snapshots/MlGetModelSnapshotsRequest.ts#L26-L96 type Request struct { // Desc Refer to the description for the `desc` query parameter. diff --git a/typedapi/ml/getmodelsnapshots/response.go b/typedapi/ml/getmodelsnapshots/response.go index ccdca41966..4a5e5484aa 100644 --- a/typedapi/ml/getmodelsnapshots/response.go +++ b/typedapi/ml/getmodelsnapshots/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getmodelsnapshots @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getmodelsnapshots // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_model_snapshots/MlGetModelSnapshotsResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_model_snapshots/MlGetModelSnapshotsResponse.ts#L23-L28 type Response struct { Count int64 `json:"count"` ModelSnapshots []types.ModelSnapshot `json:"model_snapshots"` diff --git a/typedapi/ml/getmodelsnapshotupgradestats/get_model_snapshot_upgrade_stats.go b/typedapi/ml/getmodelsnapshotupgradestats/get_model_snapshot_upgrade_stats.go index da4efcab9f..ec84d80857 100644 --- a/typedapi/ml/getmodelsnapshotupgradestats/get_model_snapshot_upgrade_stats.go +++ b/typedapi/ml/getmodelsnapshotupgradestats/get_model_snapshot_upgrade_stats.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Gets stats for anomaly detection job model snapshot upgrades that are in // progress. package getmodelsnapshotupgradestats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -55,12 +54,16 @@ type GetModelSnapshotUpgradeStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int jobid string snapshotid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetModelSnapshotUpgradeStats type alias for index. @@ -89,7 +92,12 @@ func New(tp elastictransport.Interface) *GetModelSnapshotUpgradeStats { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,11 +122,17 @@ func (r *GetModelSnapshotUpgradeStats) HttpRequest(ctx context.Context) (*http.R path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshotid", r.snapshotid) + } path.WriteString(r.snapshotid) path.WriteString("/") path.WriteString("_upgrade") @@ -136,9 +150,9 @@ func (r *GetModelSnapshotUpgradeStats) HttpRequest(ctx context.Context) (*http.R } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -155,27 +169,66 @@ func (r *GetModelSnapshotUpgradeStats) HttpRequest(ctx context.Context) (*http.R } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetModelSnapshotUpgradeStats) Perform(ctx context.Context) (*http.Response, error) { +func (r GetModelSnapshotUpgradeStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_model_snapshot_upgrade_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_model_snapshot_upgrade_stats") + if reader := instrument.RecordRequestBody(ctx, "ml.get_model_snapshot_upgrade_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_model_snapshot_upgrade_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetModelSnapshotUpgradeStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetModelSnapshotUpgradeStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getmodelsnapshotupgradestats.Response -func (r GetModelSnapshotUpgradeStats) Do(ctx context.Context) (*Response, error) { +func (r GetModelSnapshotUpgradeStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_model_snapshot_upgrade_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -183,6 +236,9 @@ func (r GetModelSnapshotUpgradeStats) Do(ctx context.Context) (*Response, error) if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,6 +248,9 @@ func (r GetModelSnapshotUpgradeStats) Do(ctx context.Context) (*Response, error) errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -199,12 +258,25 @@ func (r GetModelSnapshotUpgradeStats) Do(ctx context.Context) (*Response, error) errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetModelSnapshotUpgradeStats) IsSuccess(ctx context.Context) (bool, error) { +func (r GetModelSnapshotUpgradeStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_model_snapshot_upgrade_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -220,6 +292,14 @@ func (r GetModelSnapshotUpgradeStats) IsSuccess(ctx context.Context) (bool, erro return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetModelSnapshotUpgradeStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/getmodelsnapshotupgradestats/response.go b/typedapi/ml/getmodelsnapshotupgradestats/response.go index 2038cf88c2..90be55a5fa 100644 --- a/typedapi/ml/getmodelsnapshotupgradestats/response.go +++ b/typedapi/ml/getmodelsnapshotupgradestats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getmodelsnapshotupgradestats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getmodelsnapshotupgradestats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_model_snapshot_upgrade_stats/MlGetModelSnapshotUpgradeStatsResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_model_snapshot_upgrade_stats/MlGetModelSnapshotUpgradeStatsResponse.ts#L23-L28 type Response struct { Count int64 `json:"count"` ModelSnapshotUpgrades []types.ModelSnapshotUpgrade `json:"model_snapshot_upgrades"` diff --git a/typedapi/ml/getoverallbuckets/get_overall_buckets.go b/typedapi/ml/getoverallbuckets/get_overall_buckets.go index a196f5f30e..a7d28c6234 100644 --- a/typedapi/ml/getoverallbuckets/get_overall_buckets.go +++ b/typedapi/ml/getoverallbuckets/get_overall_buckets.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves overall bucket results that summarize the bucket results of // multiple anomaly detection jobs. @@ -51,15 +51,19 @@ type GetOverallBuckets struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetOverallBuckets type alias for index. @@ -86,11 +90,18 @@ func New(tp elastictransport.Interface) *GetOverallBuckets { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *GetOverallBuckets) HttpRequest(ctx context.Context) (*http.Request, err } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,6 +150,10 @@ func (r *GetOverallBuckets) HttpRequest(ctx context.Context) (*http.Request, err } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *GetOverallBuckets) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("results") @@ -168,15 +184,15 @@ func (r *GetOverallBuckets) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -193,27 +209,66 @@ func (r *GetOverallBuckets) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetOverallBuckets) Perform(ctx context.Context) (*http.Response, error) { +func (r GetOverallBuckets) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_overall_buckets") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_overall_buckets") + if reader := instrument.RecordRequestBody(ctx, "ml.get_overall_buckets", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_overall_buckets") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetOverallBuckets query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetOverallBuckets query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getoverallbuckets.Response -func (r GetOverallBuckets) Do(ctx context.Context) (*Response, error) { +func (r GetOverallBuckets) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_overall_buckets") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -221,6 +276,9 @@ func (r GetOverallBuckets) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +288,9 @@ func (r GetOverallBuckets) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -237,6 +298,9 @@ func (r GetOverallBuckets) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/getoverallbuckets/request.go b/typedapi/ml/getoverallbuckets/request.go index 27553a0307..3d43f67663 100644 --- a/typedapi/ml/getoverallbuckets/request.go +++ b/typedapi/ml/getoverallbuckets/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getoverallbuckets @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package getoverallbuckets // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_overall_buckets/MlGetOverallBucketsRequest.ts#L25-L143 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_overall_buckets/MlGetOverallBucketsRequest.ts#L25-L143 type Request struct { // AllowNoMatch Refer to the description for the `allow_no_match` query parameter. diff --git a/typedapi/ml/getoverallbuckets/response.go b/typedapi/ml/getoverallbuckets/response.go index 9191178f5f..56b578a762 100644 --- a/typedapi/ml/getoverallbuckets/response.go +++ b/typedapi/ml/getoverallbuckets/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getoverallbuckets @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getoverallbuckets // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_overall_buckets/MlGetOverallBucketsResponse.ts#L23-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_overall_buckets/MlGetOverallBucketsResponse.ts#L23-L29 type Response struct { Count int64 `json:"count"` // OverallBuckets Array of overall bucket objects diff --git a/typedapi/ml/getrecords/get_records.go b/typedapi/ml/getrecords/get_records.go index afd969cb5a..c535b5989e 100644 --- a/typedapi/ml/getrecords/get_records.go +++ b/typedapi/ml/getrecords/get_records.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves anomaly records for an anomaly detection job. package getrecords @@ -51,15 +51,19 @@ type GetRecords struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetRecords type alias for index. @@ -85,11 +89,18 @@ func New(tp elastictransport.Interface) *GetRecords { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *GetRecords) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *GetRecords) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,6 +163,9 @@ func (r *GetRecords) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("results") @@ -167,15 +183,15 @@ func (r *GetRecords) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -192,27 +208,66 @@ func (r *GetRecords) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetRecords) Perform(ctx context.Context) (*http.Response, error) { +func (r GetRecords) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_records") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_records") + if reader := instrument.RecordRequestBody(ctx, "ml.get_records", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_records") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetRecords query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetRecords query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getrecords.Response -func (r GetRecords) Do(ctx context.Context) (*Response, error) { +func (r GetRecords) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_records") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -220,6 +275,9 @@ func (r GetRecords) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +287,9 @@ func (r GetRecords) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +297,9 @@ func (r GetRecords) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/getrecords/request.go b/typedapi/ml/getrecords/request.go index 3ad2c6b1bf..a2a37661bd 100644 --- a/typedapi/ml/getrecords/request.go +++ b/typedapi/ml/getrecords/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getrecords @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package getrecords // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_records/MlGetAnomalyRecordsRequest.ts#L26-L127 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_records/MlGetAnomalyRecordsRequest.ts#L26-L127 type Request struct { // Desc Refer to the description for the `desc` query parameter. diff --git a/typedapi/ml/getrecords/response.go b/typedapi/ml/getrecords/response.go index d708bd08ea..063a96572c 100644 --- a/typedapi/ml/getrecords/response.go +++ b/typedapi/ml/getrecords/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getrecords @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getrecords // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_records/MlGetAnomalyRecordsResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_records/MlGetAnomalyRecordsResponse.ts#L23-L28 type Response struct { Count int64 `json:"count"` Records []types.Anomaly `json:"records"` diff --git a/typedapi/ml/gettrainedmodels/get_trained_models.go b/typedapi/ml/gettrainedmodels/get_trained_models.go index 0cec921e5e..7c0f416d36 100644 --- a/typedapi/ml/gettrainedmodels/get_trained_models.go +++ b/typedapi/ml/gettrainedmodels/get_trained_models.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves configuration information for a trained inference model. package gettrainedmodels import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type GetTrainedModels struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetTrainedModels type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *GetTrainedModels { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *GetTrainedModels) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) method = http.MethodGet @@ -126,9 +137,9 @@ func (r *GetTrainedModels) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -145,27 +156,66 @@ func (r *GetTrainedModels) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetTrainedModels) Perform(ctx context.Context) (*http.Response, error) { +func (r GetTrainedModels) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_trained_models") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_trained_models") + if reader := instrument.RecordRequestBody(ctx, "ml.get_trained_models", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_trained_models") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetTrainedModels query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetTrainedModels query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a gettrainedmodels.Response -func (r GetTrainedModels) Do(ctx context.Context) (*Response, error) { +func (r GetTrainedModels) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_trained_models") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -173,6 +223,9 @@ func (r GetTrainedModels) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,6 +235,9 @@ func (r GetTrainedModels) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,12 +245,25 @@ func (r GetTrainedModels) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetTrainedModels) IsSuccess(ctx context.Context) (bool, error) { +func (r GetTrainedModels) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_trained_models") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -210,6 +279,14 @@ func (r GetTrainedModels) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetTrainedModels query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/gettrainedmodels/response.go b/typedapi/ml/gettrainedmodels/response.go index eb88d9187f..6a8f546782 100644 --- a/typedapi/ml/gettrainedmodels/response.go +++ b/typedapi/ml/gettrainedmodels/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package gettrainedmodels @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package gettrainedmodels // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_trained_models/MlGetTrainedModelResponse.ts#L23-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_trained_models/MlGetTrainedModelResponse.ts#L23-L34 type Response struct { Count int `json:"count"` // TrainedModelConfigs An array of trained model resources, which are sorted by the model_id value diff --git a/typedapi/ml/gettrainedmodelsstats/get_trained_models_stats.go b/typedapi/ml/gettrainedmodelsstats/get_trained_models_stats.go index 92b0fafd54..9725fd8d9f 100644 --- a/typedapi/ml/gettrainedmodelsstats/get_trained_models_stats.go +++ b/typedapi/ml/gettrainedmodelsstats/get_trained_models_stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves usage information for trained inference models. package gettrainedmodelsstats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetTrainedModelsStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetTrainedModelsStats type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetTrainedModelsStats { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *GetTrainedModelsStats) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) path.WriteString("/") path.WriteString("_stats") @@ -129,9 +140,9 @@ func (r *GetTrainedModelsStats) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +159,66 @@ func (r *GetTrainedModelsStats) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetTrainedModelsStats) Perform(ctx context.Context) (*http.Response, error) { +func (r GetTrainedModelsStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.get_trained_models_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.get_trained_models_stats") + if reader := instrument.RecordRequestBody(ctx, "ml.get_trained_models_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.get_trained_models_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetTrainedModelsStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetTrainedModelsStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a gettrainedmodelsstats.Response -func (r GetTrainedModelsStats) Do(ctx context.Context) (*Response, error) { +func (r GetTrainedModelsStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_trained_models_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +226,9 @@ func (r GetTrainedModelsStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +238,9 @@ func (r GetTrainedModelsStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +248,25 @@ func (r GetTrainedModelsStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetTrainedModelsStats) IsSuccess(ctx context.Context) (bool, error) { +func (r GetTrainedModelsStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.get_trained_models_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +282,14 @@ func (r GetTrainedModelsStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetTrainedModelsStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/gettrainedmodelsstats/response.go b/typedapi/ml/gettrainedmodelsstats/response.go index 01d44b08b0..fe7bdca518 100644 --- a/typedapi/ml/gettrainedmodelsstats/response.go +++ b/typedapi/ml/gettrainedmodelsstats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package gettrainedmodelsstats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package gettrainedmodelsstats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_trained_models_stats/MlGetTrainedModelStatsResponse.ts#L23-L33 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_trained_models_stats/MlGetTrainedModelStatsResponse.ts#L23-L33 type Response struct { // Count The total number of trained model statistics that matched the requested ID diff --git a/typedapi/ml/infertrainedmodel/infer_trained_model.go b/typedapi/ml/infertrainedmodel/infer_trained_model.go index 57d4cec804..165f09cea6 100644 --- a/typedapi/ml/infertrainedmodel/infer_trained_model.go +++ b/typedapi/ml/infertrainedmodel/infer_trained_model.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Evaluate a trained model. package infertrainedmodel @@ -50,15 +50,19 @@ type InferTrainedModel struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewInferTrainedModel type alias for index. @@ -78,17 +82,24 @@ func NewInferTrainedModelFunc(tp elastictransport.Interface) NewInferTrainedMode // Evaluate a trained model. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/infer-trained-model.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-trained-model.html func New(tp elastictransport.Interface) *InferTrainedModel { r := &InferTrainedModel{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *InferTrainedModel) HttpRequest(ctx context.Context) (*http.Request, err } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *InferTrainedModel) HttpRequest(ctx context.Context) (*http.Request, err } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *InferTrainedModel) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) path.WriteString("/") path.WriteString("_infer") @@ -161,6 +177,9 @@ func (r *InferTrainedModel) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) path.WriteString("/") path.WriteString("deployment") @@ -178,15 +197,15 @@ func (r *InferTrainedModel) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -203,27 +222,66 @@ func (r *InferTrainedModel) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r InferTrainedModel) Perform(ctx context.Context) (*http.Response, error) { +func (r InferTrainedModel) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.infer_trained_model") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.infer_trained_model") + if reader := instrument.RecordRequestBody(ctx, "ml.infer_trained_model", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.infer_trained_model") + } if err != nil { - return nil, fmt.Errorf("an error happened during the InferTrainedModel query execution: %w", err) + localErr := fmt.Errorf("an error happened during the InferTrainedModel query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a infertrainedmodel.Response -func (r InferTrainedModel) Do(ctx context.Context) (*Response, error) { +func (r InferTrainedModel) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.infer_trained_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -231,6 +289,9 @@ func (r InferTrainedModel) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -240,6 +301,9 @@ func (r InferTrainedModel) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -247,6 +311,9 @@ func (r InferTrainedModel) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/infertrainedmodel/request.go b/typedapi/ml/infertrainedmodel/request.go index 5cebeff275..9c10f6bec7 100644 --- a/typedapi/ml/infertrainedmodel/request.go +++ b/typedapi/ml/infertrainedmodel/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package infertrainedmodel @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package infertrainedmodel // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/infer_trained_model/MlInferTrainedModelRequest.ts#L27-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/infer_trained_model/MlInferTrainedModelRequest.ts#L27-L59 type Request struct { // Docs An array of objects to pass to the model for inference. The objects should diff --git a/typedapi/ml/infertrainedmodel/response.go b/typedapi/ml/infertrainedmodel/response.go index 58eded7327..1780afeefe 100644 --- a/typedapi/ml/infertrainedmodel/response.go +++ b/typedapi/ml/infertrainedmodel/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package infertrainedmodel @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package infertrainedmodel // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/infer_trained_model/MlInferTrainedModelResponse.ts#L22-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/infer_trained_model/MlInferTrainedModelResponse.ts#L22-L26 type Response struct { InferenceResults []types.InferenceResponseResult `json:"inference_results"` } diff --git a/typedapi/ml/info/info.go b/typedapi/ml/info/info.go index 921616fed1..8a29258a87 100644 --- a/typedapi/ml/info/info.go +++ b/typedapi/ml/info/info.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns defaults and limits used by machine learning. package info import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Info struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewInfo type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *Info { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Info) Perform(ctx context.Context) (*http.Response, error) { +func (r Info) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.info") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.info") + if reader := instrument.RecordRequestBody(ctx, "ml.info", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.info") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Info query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Info query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a info.Response -func (r Info) Do(ctx context.Context) (*Response, error) { +func (r Info) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Info) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Info) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Info) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Info) IsSuccess(ctx context.Context) (bool, error) { +func (r Info) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Info) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Info query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/info/response.go b/typedapi/ml/info/response.go index cd35942fb4..37d3c1ba2f 100644 --- a/typedapi/ml/info/response.go +++ b/typedapi/ml/info/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package info @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package info // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/info/MlInfoResponse.ts#L22-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/info/MlInfoResponse.ts#L22-L29 type Response struct { Defaults types.Defaults `json:"defaults"` Limits types.Limits `json:"limits"` diff --git a/typedapi/ml/openjob/open_job.go b/typedapi/ml/openjob/open_job.go index fefbcdf2d8..f9cc1e2813 100644 --- a/typedapi/ml/openjob/open_job.go +++ b/typedapi/ml/openjob/open_job.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Opens one or more anomaly detection jobs. package openjob @@ -50,15 +50,19 @@ type OpenJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewOpenJob type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *OpenJob { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *OpenJob) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *OpenJob) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *OpenJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("_open") @@ -164,15 +180,15 @@ func (r *OpenJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *OpenJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r OpenJob) Perform(ctx context.Context) (*http.Response, error) { +func (r OpenJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.open_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.open_job") + if reader := instrument.RecordRequestBody(ctx, "ml.open_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.open_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the OpenJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the OpenJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a openjob.Response -func (r OpenJob) Do(ctx context.Context) (*Response, error) { +func (r OpenJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.open_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r OpenJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r OpenJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r OpenJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/openjob/request.go b/typedapi/ml/openjob/request.go index b8b97e2ae4..97b799fb4e 100644 --- a/typedapi/ml/openjob/request.go +++ b/typedapi/ml/openjob/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package openjob @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package openjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/open_job/MlOpenJobRequest.ts#L24-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/open_job/MlOpenJobRequest.ts#L24-L59 type Request struct { // Timeout Refer to the description for the `timeout` query parameter. diff --git a/typedapi/ml/openjob/response.go b/typedapi/ml/openjob/response.go index 9b8682482c..945e1ea4d0 100644 --- a/typedapi/ml/openjob/response.go +++ b/typedapi/ml/openjob/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package openjob // Response holds the response body struct for the package openjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/open_job/MlOpenJobResponse.ts#L22-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/open_job/MlOpenJobResponse.ts#L22-L31 type Response struct { // Node The ID of the node that the job was started on. In serverless this will be diff --git a/typedapi/ml/postcalendarevents/post_calendar_events.go b/typedapi/ml/postcalendarevents/post_calendar_events.go index 33301202d0..6658eff325 100644 --- a/typedapi/ml/postcalendarevents/post_calendar_events.go +++ b/typedapi/ml/postcalendarevents/post_calendar_events.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Posts scheduled events in a calendar. package postcalendarevents @@ -50,15 +50,19 @@ type PostCalendarEvents struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int calendarid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPostCalendarEvents type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *PostCalendarEvents { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PostCalendarEvents) HttpRequest(ctx context.Context) (*http.Request, er } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PostCalendarEvents) HttpRequest(ctx context.Context) (*http.Request, er } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PostCalendarEvents) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("calendars") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendarid", r.calendarid) + } path.WriteString(r.calendarid) path.WriteString("/") path.WriteString("events") @@ -164,15 +180,15 @@ func (r *PostCalendarEvents) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *PostCalendarEvents) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PostCalendarEvents) Perform(ctx context.Context) (*http.Response, error) { +func (r PostCalendarEvents) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.post_calendar_events") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.post_calendar_events") + if reader := instrument.RecordRequestBody(ctx, "ml.post_calendar_events", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.post_calendar_events") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PostCalendarEvents query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PostCalendarEvents query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a postcalendarevents.Response -func (r PostCalendarEvents) Do(ctx context.Context) (*Response, error) { +func (r PostCalendarEvents) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.post_calendar_events") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r PostCalendarEvents) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r PostCalendarEvents) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r PostCalendarEvents) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/postcalendarevents/request.go b/typedapi/ml/postcalendarevents/request.go index 97b82c3349..f2840e38fc 100644 --- a/typedapi/ml/postcalendarevents/request.go +++ b/typedapi/ml/postcalendarevents/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package postcalendarevents @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package postcalendarevents // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/post_calendar_events/MlPostCalendarEventsRequest.ts#L24-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/post_calendar_events/MlPostCalendarEventsRequest.ts#L24-L40 type Request struct { // Events A list of one of more scheduled events. The event’s start and end times can diff --git a/typedapi/ml/postcalendarevents/response.go b/typedapi/ml/postcalendarevents/response.go index e3a88307dc..b238bb57a5 100644 --- a/typedapi/ml/postcalendarevents/response.go +++ b/typedapi/ml/postcalendarevents/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package postcalendarevents @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package postcalendarevents // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/post_calendar_events/MlPostCalendarEventsResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/post_calendar_events/MlPostCalendarEventsResponse.ts#L22-L24 type Response struct { Events []types.CalendarEvent `json:"events"` } diff --git a/typedapi/ml/postdata/post_data.go b/typedapi/ml/postdata/post_data.go index f95b95a69d..55a9717da0 100644 --- a/typedapi/ml/postdata/post_data.go +++ b/typedapi/ml/postdata/post_data.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Sends data to an anomaly detection job for analysis. package postdata @@ -50,15 +50,19 @@ type PostData struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPostData type alias for index. @@ -84,7 +88,14 @@ func New(tp elastictransport.Interface) *PostData { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -123,9 +134,7 @@ func (r *PostData) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -137,6 +146,10 @@ func (r *PostData) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -147,6 +160,9 @@ func (r *PostData) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("_data") @@ -162,15 +178,15 @@ func (r *PostData) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *PostData) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PostData) Perform(ctx context.Context) (*http.Response, error) { +func (r PostData) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.post_data") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.post_data") + if reader := instrument.RecordRequestBody(ctx, "ml.post_data", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.post_data") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PostData query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PostData query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a postdata.Response -func (r PostData) Do(ctx context.Context) (*Response, error) { +func (r PostData) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.post_data") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r PostData) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r PostData) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r PostData) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/postdata/request.go b/typedapi/ml/postdata/request.go index 417482f354..39e3fd356e 100644 --- a/typedapi/ml/postdata/request.go +++ b/typedapi/ml/postdata/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package postdata @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package postdata // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/post_data/MlPostJobDataRequest.ts#L24-L68 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/post_data/MlPostJobDataRequest.ts#L24-L68 type Request = []json.RawMessage diff --git a/typedapi/ml/postdata/response.go b/typedapi/ml/postdata/response.go index 6be28e3800..dcb71eba22 100644 --- a/typedapi/ml/postdata/response.go +++ b/typedapi/ml/postdata/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package postdata // Response holds the response body struct for the package postdata // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/post_data/MlPostJobDataResponse.ts#L23-L41 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/post_data/MlPostJobDataResponse.ts#L23-L41 type Response struct { BucketCount int64 `json:"bucket_count"` EarliestRecordTimestamp int64 `json:"earliest_record_timestamp"` diff --git a/typedapi/ml/previewdatafeed/preview_datafeed.go b/typedapi/ml/previewdatafeed/preview_datafeed.go index 80ad5c8c3b..ffd6b6374b 100644 --- a/typedapi/ml/previewdatafeed/preview_datafeed.go +++ b/typedapi/ml/previewdatafeed/preview_datafeed.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Previews a datafeed. package previewdatafeed @@ -50,15 +50,19 @@ type PreviewDatafeed struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int datafeedid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPreviewDatafeed type alias for index. @@ -82,11 +86,18 @@ func New(tp elastictransport.Interface) *PreviewDatafeed { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -123,9 +134,7 @@ func (r *PreviewDatafeed) HttpRequest(ctx context.Context) (*http.Request, error } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -137,6 +146,10 @@ func (r *PreviewDatafeed) HttpRequest(ctx context.Context) (*http.Request, error } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -147,6 +160,9 @@ func (r *PreviewDatafeed) HttpRequest(ctx context.Context) (*http.Request, error path.WriteString("datafeeds") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeedid", r.datafeedid) + } path.WriteString(r.datafeedid) path.WriteString("/") path.WriteString("_preview") @@ -171,15 +187,15 @@ func (r *PreviewDatafeed) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -196,27 +212,66 @@ func (r *PreviewDatafeed) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PreviewDatafeed) Perform(ctx context.Context) (*http.Response, error) { +func (r PreviewDatafeed) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.preview_datafeed") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.preview_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.preview_datafeed", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.preview_datafeed") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PreviewDatafeed query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PreviewDatafeed query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a previewdatafeed.Response -func (r PreviewDatafeed) Do(ctx context.Context) (Response, error) { +func (r PreviewDatafeed) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.preview_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -224,6 +279,9 @@ func (r PreviewDatafeed) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +291,9 @@ func (r PreviewDatafeed) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -240,6 +301,9 @@ func (r PreviewDatafeed) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/previewdatafeed/request.go b/typedapi/ml/previewdatafeed/request.go index 36f25a4d80..3ce43cff84 100644 --- a/typedapi/ml/previewdatafeed/request.go +++ b/typedapi/ml/previewdatafeed/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package previewdatafeed @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package previewdatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/preview_datafeed/MlPreviewDatafeedRequest.ts#L26-L69 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/preview_datafeed/MlPreviewDatafeedRequest.ts#L26-L69 type Request struct { // DatafeedConfig The datafeed definition to preview. diff --git a/typedapi/ml/previewdatafeed/response.go b/typedapi/ml/previewdatafeed/response.go index 7de3608444..043cebb74c 100644 --- a/typedapi/ml/previewdatafeed/response.go +++ b/typedapi/ml/previewdatafeed/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package previewdatafeed @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package previewdatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/preview_datafeed/MlPreviewDatafeedResponse.ts#L20-L22 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/preview_datafeed/MlPreviewDatafeedResponse.ts#L20-L22 type Response []json.RawMessage diff --git a/typedapi/ml/previewdataframeanalytics/preview_data_frame_analytics.go b/typedapi/ml/previewdataframeanalytics/preview_data_frame_analytics.go index 36552a8859..1dc30b6221 100644 --- a/typedapi/ml/previewdataframeanalytics/preview_data_frame_analytics.go +++ b/typedapi/ml/previewdataframeanalytics/preview_data_frame_analytics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Previews that will be analyzed given a data frame analytics config. package previewdataframeanalytics @@ -50,15 +50,19 @@ type PreviewDataFrameAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPreviewDataFrameAnalytics type alias for index. @@ -82,11 +86,18 @@ func New(tp elastictransport.Interface) *PreviewDataFrameAnalytics { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -123,9 +134,7 @@ func (r *PreviewDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Requ } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -137,6 +146,10 @@ func (r *PreviewDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Requ } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -160,6 +173,9 @@ func (r *PreviewDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Requ path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") path.WriteString("_preview") @@ -175,15 +191,15 @@ func (r *PreviewDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Requ } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -200,27 +216,66 @@ func (r *PreviewDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Requ } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PreviewDataFrameAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r PreviewDataFrameAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.preview_data_frame_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.preview_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.preview_data_frame_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.preview_data_frame_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PreviewDataFrameAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PreviewDataFrameAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a previewdataframeanalytics.Response -func (r PreviewDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { +func (r PreviewDataFrameAnalytics) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.preview_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -228,6 +283,9 @@ func (r PreviewDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -237,6 +295,9 @@ func (r PreviewDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -244,6 +305,9 @@ func (r PreviewDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/previewdataframeanalytics/request.go b/typedapi/ml/previewdataframeanalytics/request.go index a17c22ef92..4d951aa4aa 100644 --- a/typedapi/ml/previewdataframeanalytics/request.go +++ b/typedapi/ml/previewdataframeanalytics/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package previewdataframeanalytics @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package previewdataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/preview_data_frame_analytics/MlPreviewDataFrameAnalyticsRequest.ts#L24-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/preview_data_frame_analytics/MlPreviewDataFrameAnalyticsRequest.ts#L24-L47 type Request struct { // Config A data frame analytics config as described in create data frame analytics diff --git a/typedapi/ml/previewdataframeanalytics/response.go b/typedapi/ml/previewdataframeanalytics/response.go index abc826758b..465b2442ab 100644 --- a/typedapi/ml/previewdataframeanalytics/response.go +++ b/typedapi/ml/previewdataframeanalytics/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package previewdataframeanalytics // Response holds the response body struct for the package previewdataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/preview_data_frame_analytics/MlPreviewDataFrameAnalyticsResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/preview_data_frame_analytics/MlPreviewDataFrameAnalyticsResponse.ts#L23-L28 type Response struct { // FeatureValues An array of objects that contain feature name and value pairs. The features diff --git a/typedapi/ml/putcalendar/put_calendar.go b/typedapi/ml/putcalendar/put_calendar.go index 8118912a21..61e1375a7f 100644 --- a/typedapi/ml/putcalendar/put_calendar.go +++ b/typedapi/ml/putcalendar/put_calendar.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Instantiates a calendar. package putcalendar @@ -50,15 +50,19 @@ type PutCalendar struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int calendarid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutCalendar type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *PutCalendar { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutCalendar) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutCalendar) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutCalendar) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("calendars") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendarid", r.calendarid) + } path.WriteString(r.calendarid) method = http.MethodPut @@ -162,15 +178,15 @@ func (r *PutCalendar) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *PutCalendar) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutCalendar) Perform(ctx context.Context) (*http.Response, error) { +func (r PutCalendar) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.put_calendar") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_calendar") + if reader := instrument.RecordRequestBody(ctx, "ml.put_calendar", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_calendar") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutCalendar query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutCalendar query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putcalendar.Response -func (r PutCalendar) Do(ctx context.Context) (*Response, error) { +func (r PutCalendar) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_calendar") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r PutCalendar) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r PutCalendar) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r PutCalendar) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/putcalendar/request.go b/typedapi/ml/putcalendar/request.go index cf06f03bc1..3e3776fbab 100644 --- a/typedapi/ml/putcalendar/request.go +++ b/typedapi/ml/putcalendar/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putcalendar @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package putcalendar // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_calendar/MlPutCalendarRequest.ts#L23-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_calendar/MlPutCalendarRequest.ts#L23-L43 type Request struct { // Description A description of the calendar. diff --git a/typedapi/ml/putcalendar/response.go b/typedapi/ml/putcalendar/response.go index 65e631bbe5..16f4e0e9c9 100644 --- a/typedapi/ml/putcalendar/response.go +++ b/typedapi/ml/putcalendar/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putcalendar @@ -30,8 +30,7 @@ import ( // Response holds the response body struct for the package putcalendar // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_calendar/MlPutCalendarResponse.ts#L22-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_calendar/MlPutCalendarResponse.ts#L22-L31 type Response struct { // CalendarId A string that uniquely identifies a calendar. diff --git a/typedapi/ml/putcalendarjob/put_calendar_job.go b/typedapi/ml/putcalendarjob/put_calendar_job.go index 2f0ca24ce7..e44bdab941 100644 --- a/typedapi/ml/putcalendarjob/put_calendar_job.go +++ b/typedapi/ml/putcalendarjob/put_calendar_job.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Adds an anomaly detection job to a calendar. package putcalendarjob import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type PutCalendarJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int calendarid string jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutCalendarJob type alias for index. @@ -86,7 +89,12 @@ func New(tp elastictransport.Interface) *PutCalendarJob { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,11 +119,17 @@ func (r *PutCalendarJob) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("calendars") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "calendarid", r.calendarid) + } path.WriteString(r.calendarid) path.WriteString("/") path.WriteString("jobs") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) method = http.MethodPut @@ -129,9 +143,9 @@ func (r *PutCalendarJob) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +162,66 @@ func (r *PutCalendarJob) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutCalendarJob) Perform(ctx context.Context) (*http.Response, error) { +func (r PutCalendarJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.put_calendar_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_calendar_job") + if reader := instrument.RecordRequestBody(ctx, "ml.put_calendar_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_calendar_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutCalendarJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutCalendarJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putcalendarjob.Response -func (r PutCalendarJob) Do(ctx context.Context) (*Response, error) { +func (r PutCalendarJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_calendar_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +229,9 @@ func (r PutCalendarJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +241,9 @@ func (r PutCalendarJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +251,25 @@ func (r PutCalendarJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PutCalendarJob) IsSuccess(ctx context.Context) (bool, error) { +func (r PutCalendarJob) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_calendar_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +285,14 @@ func (r PutCalendarJob) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PutCalendarJob query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/putcalendarjob/response.go b/typedapi/ml/putcalendarjob/response.go index 315cc76966..9dcefd61fb 100644 --- a/typedapi/ml/putcalendarjob/response.go +++ b/typedapi/ml/putcalendarjob/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putcalendarjob @@ -30,8 +30,7 @@ import ( // Response holds the response body struct for the package putcalendarjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_calendar_job/MlPutCalendarJobResponse.ts#L22-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_calendar_job/MlPutCalendarJobResponse.ts#L22-L31 type Response struct { // CalendarId A string that uniquely identifies a calendar. diff --git a/typedapi/ml/putdatafeed/put_datafeed.go b/typedapi/ml/putdatafeed/put_datafeed.go index 7e5322b716..1d79bc4ef4 100644 --- a/typedapi/ml/putdatafeed/put_datafeed.go +++ b/typedapi/ml/putdatafeed/put_datafeed.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Instantiates a datafeed. package putdatafeed @@ -52,15 +52,19 @@ type PutDatafeed struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int datafeedid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutDatafeed type alias for index. @@ -86,11 +90,18 @@ func New(tp elastictransport.Interface) *PutDatafeed { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *PutDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,6 +150,10 @@ func (r *PutDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *PutDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("datafeeds") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeedid", r.datafeedid) + } path.WriteString(r.datafeedid) method = http.MethodPut @@ -164,15 +180,15 @@ func (r *PutDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *PutDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutDatafeed) Perform(ctx context.Context) (*http.Response, error) { +func (r PutDatafeed) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.put_datafeed") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.put_datafeed", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_datafeed") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutDatafeed query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutDatafeed query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putdatafeed.Response -func (r PutDatafeed) Do(ctx context.Context) (*Response, error) { +func (r PutDatafeed) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r PutDatafeed) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r PutDatafeed) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r PutDatafeed) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/putdatafeed/request.go b/typedapi/ml/putdatafeed/request.go index d2dc0d6479..69bbfc0dd5 100644 --- a/typedapi/ml/putdatafeed/request.go +++ b/typedapi/ml/putdatafeed/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putdatafeed @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putdatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_datafeed/MlPutDatafeedRequest.ts#L37-L172 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_datafeed/MlPutDatafeedRequest.ts#L37-L172 type Request struct { // Aggregations If set, the datafeed performs aggregation searches. diff --git a/typedapi/ml/putdatafeed/response.go b/typedapi/ml/putdatafeed/response.go index fd49d79bcc..c0cc8c735f 100644 --- a/typedapi/ml/putdatafeed/response.go +++ b/typedapi/ml/putdatafeed/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putdatafeed @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package putdatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_datafeed/MlPutDatafeedResponse.ts#L31-L49 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_datafeed/MlPutDatafeedResponse.ts#L31-L49 type Response struct { Aggregations map[string]types.Aggregations `json:"aggregations,omitempty"` Authorization *types.DatafeedAuthorization `json:"authorization,omitempty"` diff --git a/typedapi/ml/putdataframeanalytics/put_data_frame_analytics.go b/typedapi/ml/putdataframeanalytics/put_data_frame_analytics.go index 2d620fb6cd..fe0c01368a 100644 --- a/typedapi/ml/putdataframeanalytics/put_data_frame_analytics.go +++ b/typedapi/ml/putdataframeanalytics/put_data_frame_analytics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Instantiates a data frame analytics job. package putdataframeanalytics @@ -50,15 +50,19 @@ type PutDataFrameAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutDataFrameAnalytics type alias for index. @@ -78,17 +82,24 @@ func NewPutDataFrameAnalyticsFunc(tp elastictransport.Interface) NewPutDataFrame // Instantiates a data frame analytics job. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/put-dfanalytics.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/put-dfanalytics.html func New(tp elastictransport.Interface) *PutDataFrameAnalytics { r := &PutDataFrameAnalytics{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *PutDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPut @@ -164,15 +180,15 @@ func (r *PutDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *PutDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutDataFrameAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r PutDataFrameAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.put_data_frame_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.put_data_frame_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_data_frame_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutDataFrameAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutDataFrameAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putdataframeanalytics.Response -func (r PutDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { +func (r PutDataFrameAnalytics) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r PutDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r PutDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r PutDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/putdataframeanalytics/request.go b/typedapi/ml/putdataframeanalytics/request.go index 36a644d3dd..f91845626c 100644 --- a/typedapi/ml/putdataframeanalytics/request.go +++ b/typedapi/ml/putdataframeanalytics/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putdataframeanalytics @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putdataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_data_frame_analytics/MlPutDataFrameAnalyticsRequest.ts#L30-L141 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_data_frame_analytics/MlPutDataFrameAnalyticsRequest.ts#L30-L141 type Request struct { // AllowLazyStart Specifies whether this job can start when there is insufficient machine diff --git a/typedapi/ml/putdataframeanalytics/response.go b/typedapi/ml/putdataframeanalytics/response.go index 6f8e747c2f..74ec2b7976 100644 --- a/typedapi/ml/putdataframeanalytics/response.go +++ b/typedapi/ml/putdataframeanalytics/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putdataframeanalytics @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package putdataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_data_frame_analytics/MlPutDataFrameAnalyticsResponse.ts#L31-L46 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_data_frame_analytics/MlPutDataFrameAnalyticsResponse.ts#L31-L46 type Response struct { AllowLazyStart bool `json:"allow_lazy_start"` Analysis types.DataframeAnalysisContainer `json:"analysis"` diff --git a/typedapi/ml/putfilter/put_filter.go b/typedapi/ml/putfilter/put_filter.go index a459fa903c..527c05229d 100644 --- a/typedapi/ml/putfilter/put_filter.go +++ b/typedapi/ml/putfilter/put_filter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Instantiates a filter. package putfilter @@ -50,15 +50,19 @@ type PutFilter struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int filterid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutFilter type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *PutFilter { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutFilter) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutFilter) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutFilter) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("filters") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "filterid", r.filterid) + } path.WriteString(r.filterid) method = http.MethodPut @@ -162,15 +178,15 @@ func (r *PutFilter) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *PutFilter) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutFilter) Perform(ctx context.Context) (*http.Response, error) { +func (r PutFilter) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.put_filter") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_filter") + if reader := instrument.RecordRequestBody(ctx, "ml.put_filter", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_filter") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutFilter query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutFilter query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putfilter.Response -func (r PutFilter) Do(ctx context.Context) (*Response, error) { +func (r PutFilter) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_filter") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r PutFilter) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r PutFilter) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r PutFilter) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/putfilter/request.go b/typedapi/ml/putfilter/request.go index fcb9645800..705b69dec3 100644 --- a/typedapi/ml/putfilter/request.go +++ b/typedapi/ml/putfilter/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putfilter @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package putfilter // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_filter/MlPutFilterRequest.ts#L23-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_filter/MlPutFilterRequest.ts#L23-L50 type Request struct { // Description A description of the filter. diff --git a/typedapi/ml/putfilter/response.go b/typedapi/ml/putfilter/response.go index 78bd328b21..308d04737e 100644 --- a/typedapi/ml/putfilter/response.go +++ b/typedapi/ml/putfilter/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putfilter // Response holds the response body struct for the package putfilter // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_filter/MlPutFilterResponse.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_filter/MlPutFilterResponse.ts#L22-L28 type Response struct { Description string `json:"description"` FilterId string `json:"filter_id"` diff --git a/typedapi/ml/putjob/put_job.go b/typedapi/ml/putjob/put_job.go index e97e4ed91e..1f125866e5 100644 --- a/typedapi/ml/putjob/put_job.go +++ b/typedapi/ml/putjob/put_job.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Instantiates an anomaly detection job. package putjob @@ -50,15 +50,19 @@ type PutJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutJob type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *PutJob { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutJob) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutJob) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) method = http.MethodPut @@ -162,15 +178,15 @@ func (r *PutJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *PutJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutJob) Perform(ctx context.Context) (*http.Response, error) { +func (r PutJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.put_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_job") + if reader := instrument.RecordRequestBody(ctx, "ml.put_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putjob.Response -func (r PutJob) Do(ctx context.Context) (*Response, error) { +func (r PutJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r PutJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r PutJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r PutJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/putjob/request.go b/typedapi/ml/putjob/request.go index a3ab7c6588..c278401d25 100644 --- a/typedapi/ml/putjob/request.go +++ b/typedapi/ml/putjob/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putjob @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_job/MlPutJobRequest.ts#L30-L111 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_job/MlPutJobRequest.ts#L30-L111 type Request struct { // AllowLazyOpen Advanced configuration option. Specifies whether this job can open when there diff --git a/typedapi/ml/putjob/response.go b/typedapi/ml/putjob/response.go index d0f5b2b1bf..3c3ba7c996 100644 --- a/typedapi/ml/putjob/response.go +++ b/typedapi/ml/putjob/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putjob @@ -28,8 +28,7 @@ import ( // Response holds the response body struct for the package putjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_job/MlPutJobResponse.ts#L29-L52 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_job/MlPutJobResponse.ts#L29-L52 type Response struct { AllowLazyOpen bool `json:"allow_lazy_open"` AnalysisConfig types.AnalysisConfigRead `json:"analysis_config"` diff --git a/typedapi/ml/puttrainedmodel/put_trained_model.go b/typedapi/ml/puttrainedmodel/put_trained_model.go index e6767569b4..8e8f3ebac0 100644 --- a/typedapi/ml/puttrainedmodel/put_trained_model.go +++ b/typedapi/ml/puttrainedmodel/put_trained_model.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates an inference trained model. package puttrainedmodel @@ -52,15 +52,19 @@ type PutTrainedModel struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutTrainedModel type alias for index. @@ -86,11 +90,18 @@ func New(tp elastictransport.Interface) *PutTrainedModel { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *PutTrainedModel) HttpRequest(ctx context.Context) (*http.Request, error } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,6 +150,10 @@ func (r *PutTrainedModel) HttpRequest(ctx context.Context) (*http.Request, error } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *PutTrainedModel) HttpRequest(ctx context.Context) (*http.Request, error path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) method = http.MethodPut @@ -164,15 +180,15 @@ func (r *PutTrainedModel) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *PutTrainedModel) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutTrainedModel) Perform(ctx context.Context) (*http.Response, error) { +func (r PutTrainedModel) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.put_trained_model") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_trained_model") + if reader := instrument.RecordRequestBody(ctx, "ml.put_trained_model", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_trained_model") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutTrainedModel query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutTrainedModel query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a puttrainedmodel.Response -func (r PutTrainedModel) Do(ctx context.Context) (*Response, error) { +func (r PutTrainedModel) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_trained_model") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r PutTrainedModel) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r PutTrainedModel) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r PutTrainedModel) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/puttrainedmodel/request.go b/typedapi/ml/puttrainedmodel/request.go index 317b343d3d..0211b3525d 100644 --- a/typedapi/ml/puttrainedmodel/request.go +++ b/typedapi/ml/puttrainedmodel/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttrainedmodel @@ -30,7 +30,7 @@ import ( // Request holds the request body struct for the package puttrainedmodel // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts#L28-L106 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts#L28-L106 type Request struct { // CompressedDefinition The compressed (GZipped and Base64 encoded) inference definition of the diff --git a/typedapi/ml/puttrainedmodel/response.go b/typedapi/ml/puttrainedmodel/response.go index 664e6f8408..b5f81e4faa 100644 --- a/typedapi/ml/puttrainedmodel/response.go +++ b/typedapi/ml/puttrainedmodel/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttrainedmodel @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package puttrainedmodel // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/MlPutTrainedModelResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/MlPutTrainedModelResponse.ts#L22-L24 type Response struct { CompressedDefinition *string `json:"compressed_definition,omitempty"` // CreateTime The time when the trained model was created. diff --git a/typedapi/ml/puttrainedmodelalias/put_trained_model_alias.go b/typedapi/ml/puttrainedmodelalias/put_trained_model_alias.go index 0ae6818e0b..13c0b26b38 100644 --- a/typedapi/ml/puttrainedmodelalias/put_trained_model_alias.go +++ b/typedapi/ml/puttrainedmodelalias/put_trained_model_alias.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a new model alias (or reassigns an existing one) to refer to the // trained model package puttrainedmodelalias import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -55,12 +54,16 @@ type PutTrainedModelAlias struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int modelalias string modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutTrainedModelAlias type alias for index. @@ -89,7 +92,12 @@ func New(tp elastictransport.Interface) *PutTrainedModelAlias { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,11 +122,17 @@ func (r *PutTrainedModelAlias) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) path.WriteString("/") path.WriteString("model_aliases") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelalias", r.modelalias) + } path.WriteString(r.modelalias) method = http.MethodPut @@ -132,15 +146,15 @@ func (r *PutTrainedModelAlias) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -157,27 +171,66 @@ func (r *PutTrainedModelAlias) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutTrainedModelAlias) Perform(ctx context.Context) (*http.Response, error) { +func (r PutTrainedModelAlias) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.put_trained_model_alias") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_trained_model_alias") + if reader := instrument.RecordRequestBody(ctx, "ml.put_trained_model_alias", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_trained_model_alias") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutTrainedModelAlias query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutTrainedModelAlias query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a puttrainedmodelalias.Response -func (r PutTrainedModelAlias) Do(ctx context.Context) (*Response, error) { +func (r PutTrainedModelAlias) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_trained_model_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -185,6 +238,9 @@ func (r PutTrainedModelAlias) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -194,6 +250,9 @@ func (r PutTrainedModelAlias) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -201,12 +260,25 @@ func (r PutTrainedModelAlias) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PutTrainedModelAlias) IsSuccess(ctx context.Context) (bool, error) { +func (r PutTrainedModelAlias) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_trained_model_alias") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -222,6 +294,14 @@ func (r PutTrainedModelAlias) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PutTrainedModelAlias query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/puttrainedmodelalias/response.go b/typedapi/ml/puttrainedmodelalias/response.go index 88f5537deb..6ae92456e0 100644 --- a/typedapi/ml/puttrainedmodelalias/response.go +++ b/typedapi/ml/puttrainedmodelalias/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttrainedmodelalias // Response holds the response body struct for the package puttrainedmodelalias // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model_alias/MlPutTrainedModelAliasResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model_alias/MlPutTrainedModelAliasResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/puttrainedmodeldefinitionpart/put_trained_model_definition_part.go b/typedapi/ml/puttrainedmodeldefinitionpart/put_trained_model_definition_part.go index 5c646dbebf..a20fd5e647 100644 --- a/typedapi/ml/puttrainedmodeldefinitionpart/put_trained_model_definition_part.go +++ b/typedapi/ml/puttrainedmodeldefinitionpart/put_trained_model_definition_part.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates part of a trained model definition package puttrainedmodeldefinitionpart @@ -52,16 +52,20 @@ type PutTrainedModelDefinitionPart struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int modelid string part string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutTrainedModelDefinitionPart type alias for index. @@ -89,11 +93,18 @@ func New(tp elastictransport.Interface) *PutTrainedModelDefinitionPart { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -130,9 +141,7 @@ func (r *PutTrainedModelDefinitionPart) HttpRequest(ctx context.Context) (*http. } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -144,6 +153,10 @@ func (r *PutTrainedModelDefinitionPart) HttpRequest(ctx context.Context) (*http. } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,11 +167,17 @@ func (r *PutTrainedModelDefinitionPart) HttpRequest(ctx context.Context) (*http. path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) path.WriteString("/") path.WriteString("definition") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "part", r.part) + } path.WriteString(r.part) method = http.MethodPut @@ -172,15 +191,15 @@ func (r *PutTrainedModelDefinitionPart) HttpRequest(ctx context.Context) (*http. } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -197,27 +216,66 @@ func (r *PutTrainedModelDefinitionPart) HttpRequest(ctx context.Context) (*http. } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutTrainedModelDefinitionPart) Perform(ctx context.Context) (*http.Response, error) { +func (r PutTrainedModelDefinitionPart) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.put_trained_model_definition_part") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_trained_model_definition_part") + if reader := instrument.RecordRequestBody(ctx, "ml.put_trained_model_definition_part", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_trained_model_definition_part") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutTrainedModelDefinitionPart query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutTrainedModelDefinitionPart query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a puttrainedmodeldefinitionpart.Response -func (r PutTrainedModelDefinitionPart) Do(ctx context.Context) (*Response, error) { +func (r PutTrainedModelDefinitionPart) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_trained_model_definition_part") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -225,6 +283,9 @@ func (r PutTrainedModelDefinitionPart) Do(ctx context.Context) (*Response, error if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +295,9 @@ func (r PutTrainedModelDefinitionPart) Do(ctx context.Context) (*Response, error errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -241,6 +305,9 @@ func (r PutTrainedModelDefinitionPart) Do(ctx context.Context) (*Response, error errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/puttrainedmodeldefinitionpart/request.go b/typedapi/ml/puttrainedmodeldefinitionpart/request.go index 033887ed20..8ce9105bf9 100644 --- a/typedapi/ml/puttrainedmodeldefinitionpart/request.go +++ b/typedapi/ml/puttrainedmodeldefinitionpart/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttrainedmodeldefinitionpart @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package puttrainedmodeldefinitionpart // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model_definition_part/MlPutTrainedModelDefinitionPartRequest.ts#L24-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model_definition_part/MlPutTrainedModelDefinitionPartRequest.ts#L24-L57 type Request struct { // Definition The definition part for the model. Must be a base64 encoded string. diff --git a/typedapi/ml/puttrainedmodeldefinitionpart/response.go b/typedapi/ml/puttrainedmodeldefinitionpart/response.go index 5336297a4c..db403030b8 100644 --- a/typedapi/ml/puttrainedmodeldefinitionpart/response.go +++ b/typedapi/ml/puttrainedmodeldefinitionpart/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttrainedmodeldefinitionpart // Response holds the response body struct for the package puttrainedmodeldefinitionpart // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model_definition_part/MlPutTrainedModelDefinitionPartResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model_definition_part/MlPutTrainedModelDefinitionPartResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/puttrainedmodelvocabulary/put_trained_model_vocabulary.go b/typedapi/ml/puttrainedmodelvocabulary/put_trained_model_vocabulary.go index 05339be9fc..3b9dd72e2a 100644 --- a/typedapi/ml/puttrainedmodelvocabulary/put_trained_model_vocabulary.go +++ b/typedapi/ml/puttrainedmodelvocabulary/put_trained_model_vocabulary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a trained model vocabulary package puttrainedmodelvocabulary @@ -50,15 +50,19 @@ type PutTrainedModelVocabulary struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutTrainedModelVocabulary type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *PutTrainedModelVocabulary { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutTrainedModelVocabulary) HttpRequest(ctx context.Context) (*http.Requ } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutTrainedModelVocabulary) HttpRequest(ctx context.Context) (*http.Requ } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutTrainedModelVocabulary) HttpRequest(ctx context.Context) (*http.Requ path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) path.WriteString("/") path.WriteString("vocabulary") @@ -164,15 +180,15 @@ func (r *PutTrainedModelVocabulary) HttpRequest(ctx context.Context) (*http.Requ } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *PutTrainedModelVocabulary) HttpRequest(ctx context.Context) (*http.Requ } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutTrainedModelVocabulary) Perform(ctx context.Context) (*http.Response, error) { +func (r PutTrainedModelVocabulary) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.put_trained_model_vocabulary") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.put_trained_model_vocabulary") + if reader := instrument.RecordRequestBody(ctx, "ml.put_trained_model_vocabulary", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.put_trained_model_vocabulary") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutTrainedModelVocabulary query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutTrainedModelVocabulary query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a puttrainedmodelvocabulary.Response -func (r PutTrainedModelVocabulary) Do(ctx context.Context) (*Response, error) { +func (r PutTrainedModelVocabulary) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.put_trained_model_vocabulary") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r PutTrainedModelVocabulary) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r PutTrainedModelVocabulary) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r PutTrainedModelVocabulary) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/puttrainedmodelvocabulary/request.go b/typedapi/ml/puttrainedmodelvocabulary/request.go index 7381efca05..feed25e52c 100644 --- a/typedapi/ml/puttrainedmodelvocabulary/request.go +++ b/typedapi/ml/puttrainedmodelvocabulary/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttrainedmodelvocabulary @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package puttrainedmodelvocabulary // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model_vocabulary/MlPutTrainedModelVocabularyRequest.ts#L24-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model_vocabulary/MlPutTrainedModelVocabularyRequest.ts#L24-L60 type Request struct { // Merges The optional model merges if required by the tokenizer. diff --git a/typedapi/ml/puttrainedmodelvocabulary/response.go b/typedapi/ml/puttrainedmodelvocabulary/response.go index 165f07e657..8bbfef3f29 100644 --- a/typedapi/ml/puttrainedmodelvocabulary/response.go +++ b/typedapi/ml/puttrainedmodelvocabulary/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttrainedmodelvocabulary // Response holds the response body struct for the package puttrainedmodelvocabulary // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model_vocabulary/MlPutTrainedModelVocabularyResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model_vocabulary/MlPutTrainedModelVocabularyResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/resetjob/reset_job.go b/typedapi/ml/resetjob/reset_job.go index 905263bf7c..089dd975db 100644 --- a/typedapi/ml/resetjob/reset_job.go +++ b/typedapi/ml/resetjob/reset_job.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Resets an existing anomaly detection job. package resetjob import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type ResetJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewResetJob type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *ResetJob { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *ResetJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("_reset") @@ -122,9 +133,9 @@ func (r *ResetJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *ResetJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ResetJob) Perform(ctx context.Context) (*http.Response, error) { +func (r ResetJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.reset_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.reset_job") + if reader := instrument.RecordRequestBody(ctx, "ml.reset_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.reset_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ResetJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ResetJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a resetjob.Response -func (r ResetJob) Do(ctx context.Context) (*Response, error) { +func (r ResetJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.reset_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r ResetJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r ResetJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r ResetJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ResetJob) IsSuccess(ctx context.Context) (bool, error) { +func (r ResetJob) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.reset_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r ResetJob) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ResetJob query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/resetjob/response.go b/typedapi/ml/resetjob/response.go index f79b4e247f..379bbabc1f 100644 --- a/typedapi/ml/resetjob/response.go +++ b/typedapi/ml/resetjob/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package resetjob // Response holds the response body struct for the package resetjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/reset_job/MlResetJobResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/reset_job/MlResetJobResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/revertmodelsnapshot/request.go b/typedapi/ml/revertmodelsnapshot/request.go index ec5e77b9d1..22ec1ef606 100644 --- a/typedapi/ml/revertmodelsnapshot/request.go +++ b/typedapi/ml/revertmodelsnapshot/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package revertmodelsnapshot @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package revertmodelsnapshot // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/revert_model_snapshot/MlRevertModelSnapshotRequest.ts#L23-L69 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/revert_model_snapshot/MlRevertModelSnapshotRequest.ts#L23-L69 type Request struct { // DeleteInterveningResults Refer to the description for the `delete_intervening_results` query diff --git a/typedapi/ml/revertmodelsnapshot/response.go b/typedapi/ml/revertmodelsnapshot/response.go index 1c65bafaf8..9fc4e8dcbb 100644 --- a/typedapi/ml/revertmodelsnapshot/response.go +++ b/typedapi/ml/revertmodelsnapshot/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package revertmodelsnapshot @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package revertmodelsnapshot // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/revert_model_snapshot/MlRevertModelSnapshotResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/revert_model_snapshot/MlRevertModelSnapshotResponse.ts#L22-L24 type Response struct { Model types.ModelSnapshot `json:"model"` } diff --git a/typedapi/ml/revertmodelsnapshot/revert_model_snapshot.go b/typedapi/ml/revertmodelsnapshot/revert_model_snapshot.go index 59c9596177..22b13ee422 100644 --- a/typedapi/ml/revertmodelsnapshot/revert_model_snapshot.go +++ b/typedapi/ml/revertmodelsnapshot/revert_model_snapshot.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Reverts to a specific snapshot. package revertmodelsnapshot @@ -52,16 +52,20 @@ type RevertModelSnapshot struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string snapshotid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRevertModelSnapshot type alias for index. @@ -89,11 +93,18 @@ func New(tp elastictransport.Interface) *RevertModelSnapshot { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -130,9 +141,7 @@ func (r *RevertModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -144,6 +153,10 @@ func (r *RevertModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,11 +167,17 @@ func (r *RevertModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshotid", r.snapshotid) + } path.WriteString(r.snapshotid) path.WriteString("/") path.WriteString("_revert") @@ -174,15 +193,15 @@ func (r *RevertModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -199,27 +218,66 @@ func (r *RevertModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r RevertModelSnapshot) Perform(ctx context.Context) (*http.Response, error) { +func (r RevertModelSnapshot) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.revert_model_snapshot") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.revert_model_snapshot") + if reader := instrument.RecordRequestBody(ctx, "ml.revert_model_snapshot", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.revert_model_snapshot") + } if err != nil { - return nil, fmt.Errorf("an error happened during the RevertModelSnapshot query execution: %w", err) + localErr := fmt.Errorf("an error happened during the RevertModelSnapshot query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a revertmodelsnapshot.Response -func (r RevertModelSnapshot) Do(ctx context.Context) (*Response, error) { +func (r RevertModelSnapshot) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.revert_model_snapshot") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -227,6 +285,9 @@ func (r RevertModelSnapshot) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +297,9 @@ func (r RevertModelSnapshot) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -243,6 +307,9 @@ func (r RevertModelSnapshot) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/setupgrademode/response.go b/typedapi/ml/setupgrademode/response.go index 03bdc41be6..4eef7cc00e 100644 --- a/typedapi/ml/setupgrademode/response.go +++ b/typedapi/ml/setupgrademode/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package setupgrademode // Response holds the response body struct for the package setupgrademode // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/set_upgrade_mode/MlSetUpgradeModeResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/set_upgrade_mode/MlSetUpgradeModeResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/setupgrademode/set_upgrade_mode.go b/typedapi/ml/setupgrademode/set_upgrade_mode.go index 927e9cf851..d35709a057 100644 --- a/typedapi/ml/setupgrademode/set_upgrade_mode.go +++ b/typedapi/ml/setupgrademode/set_upgrade_mode.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Sets a cluster wide upgrade_mode setting that prepares machine learning // indices for an upgrade. package setupgrademode import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -49,9 +48,13 @@ type SetUpgradeMode struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSetUpgradeMode type alias for index. @@ -76,7 +79,12 @@ func New(tp elastictransport.Interface) *SetUpgradeMode { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,9 +119,9 @@ func (r *SetUpgradeMode) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -130,27 +138,66 @@ func (r *SetUpgradeMode) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SetUpgradeMode) Perform(ctx context.Context) (*http.Response, error) { +func (r SetUpgradeMode) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.set_upgrade_mode") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.set_upgrade_mode") + if reader := instrument.RecordRequestBody(ctx, "ml.set_upgrade_mode", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.set_upgrade_mode") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SetUpgradeMode query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SetUpgradeMode query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a setupgrademode.Response -func (r SetUpgradeMode) Do(ctx context.Context) (*Response, error) { +func (r SetUpgradeMode) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.set_upgrade_mode") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -158,6 +205,9 @@ func (r SetUpgradeMode) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -167,6 +217,9 @@ func (r SetUpgradeMode) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -174,12 +227,25 @@ func (r SetUpgradeMode) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r SetUpgradeMode) IsSuccess(ctx context.Context) (bool, error) { +func (r SetUpgradeMode) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.set_upgrade_mode") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -195,6 +261,14 @@ func (r SetUpgradeMode) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the SetUpgradeMode query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/startdatafeed/request.go b/typedapi/ml/startdatafeed/request.go index 9d2666e6e1..360fd09c89 100644 --- a/typedapi/ml/startdatafeed/request.go +++ b/typedapi/ml/startdatafeed/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package startdatafeed @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package startdatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/start_datafeed/MlStartDatafeedRequest.ts#L24-L91 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/start_datafeed/MlStartDatafeedRequest.ts#L24-L91 type Request struct { // End Refer to the description for the `end` query parameter. diff --git a/typedapi/ml/startdatafeed/response.go b/typedapi/ml/startdatafeed/response.go index cce58447c6..44994fb2f6 100644 --- a/typedapi/ml/startdatafeed/response.go +++ b/typedapi/ml/startdatafeed/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package startdatafeed @@ -30,8 +30,7 @@ import ( // Response holds the response body struct for the package startdatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/start_datafeed/MlStartDatafeedResponse.ts#L22-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/start_datafeed/MlStartDatafeedResponse.ts#L22-L34 type Response struct { // Node The ID of the node that the job was started on. In serverless this will be diff --git a/typedapi/ml/startdatafeed/start_datafeed.go b/typedapi/ml/startdatafeed/start_datafeed.go index 117b5dece6..7d571da0e3 100644 --- a/typedapi/ml/startdatafeed/start_datafeed.go +++ b/typedapi/ml/startdatafeed/start_datafeed.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Starts one or more datafeeds. package startdatafeed @@ -50,15 +50,19 @@ type StartDatafeed struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int datafeedid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStartDatafeed type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *StartDatafeed { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *StartDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *StartDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *StartDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("datafeeds") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeedid", r.datafeedid) + } path.WriteString(r.datafeedid) path.WriteString("/") path.WriteString("_start") @@ -164,15 +180,15 @@ func (r *StartDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *StartDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r StartDatafeed) Perform(ctx context.Context) (*http.Response, error) { +func (r StartDatafeed) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.start_datafeed") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.start_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.start_datafeed", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.start_datafeed") + } if err != nil { - return nil, fmt.Errorf("an error happened during the StartDatafeed query execution: %w", err) + localErr := fmt.Errorf("an error happened during the StartDatafeed query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a startdatafeed.Response -func (r StartDatafeed) Do(ctx context.Context) (*Response, error) { +func (r StartDatafeed) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.start_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r StartDatafeed) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r StartDatafeed) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r StartDatafeed) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/startdataframeanalytics/response.go b/typedapi/ml/startdataframeanalytics/response.go index cda35c684c..c2e266c390 100644 --- a/typedapi/ml/startdataframeanalytics/response.go +++ b/typedapi/ml/startdataframeanalytics/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package startdataframeanalytics // Response holds the response body struct for the package startdataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/start_data_frame_analytics/MlStartDataFrameAnalyticsResponse.ts#L22-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/start_data_frame_analytics/MlStartDataFrameAnalyticsResponse.ts#L22-L34 type Response struct { Acknowledged bool `json:"acknowledged"` // Node The ID of the node that the job was started on. If the job is allowed to open diff --git a/typedapi/ml/startdataframeanalytics/start_data_frame_analytics.go b/typedapi/ml/startdataframeanalytics/start_data_frame_analytics.go index 8080c4d344..b27fb435e9 100644 --- a/typedapi/ml/startdataframeanalytics/start_data_frame_analytics.go +++ b/typedapi/ml/startdataframeanalytics/start_data_frame_analytics.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Starts a data frame analytics job. package startdataframeanalytics import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type StartDataFrameAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStartDataFrameAnalytics type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *StartDataFrameAnalytics { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *StartDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reques path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") path.WriteString("_start") @@ -123,15 +134,15 @@ func (r *StartDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reques } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -148,27 +159,66 @@ func (r *StartDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reques } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r StartDataFrameAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r StartDataFrameAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.start_data_frame_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.start_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.start_data_frame_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.start_data_frame_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the StartDataFrameAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the StartDataFrameAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a startdataframeanalytics.Response -func (r StartDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { +func (r StartDataFrameAnalytics) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.start_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +226,9 @@ func (r StartDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +238,9 @@ func (r StartDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +248,25 @@ func (r StartDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r StartDataFrameAnalytics) IsSuccess(ctx context.Context) (bool, error) { +func (r StartDataFrameAnalytics) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.start_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +282,14 @@ func (r StartDataFrameAnalytics) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the StartDataFrameAnalytics query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/starttrainedmodeldeployment/response.go b/typedapi/ml/starttrainedmodeldeployment/response.go index 27d49aa9de..1e5273cbc4 100644 --- a/typedapi/ml/starttrainedmodeldeployment/response.go +++ b/typedapi/ml/starttrainedmodeldeployment/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package starttrainedmodeldeployment @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package starttrainedmodeldeployment // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/start_trained_model_deployment/MlStartTrainedModelDeploymentResponse.ts#L22-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/start_trained_model_deployment/MlStartTrainedModelDeploymentResponse.ts#L22-L26 type Response struct { Assignment types.TrainedModelAssignment `json:"assignment"` } diff --git a/typedapi/ml/starttrainedmodeldeployment/start_trained_model_deployment.go b/typedapi/ml/starttrainedmodeldeployment/start_trained_model_deployment.go index 24e1d9948e..3934897423 100644 --- a/typedapi/ml/starttrainedmodeldeployment/start_trained_model_deployment.go +++ b/typedapi/ml/starttrainedmodeldeployment/start_trained_model_deployment.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Start a trained model deployment. package starttrainedmodeldeployment import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type StartTrainedModelDeployment struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStartTrainedModelDeployment type alias for index. @@ -78,13 +81,18 @@ func NewStartTrainedModelDeploymentFunc(tp elastictransport.Interface) NewStartT // Start a trained model deployment. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trained-model-deployment.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/start-trained-model-deployment.html func New(tp elastictransport.Interface) *StartTrainedModelDeployment { r := &StartTrainedModelDeployment{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,6 +117,9 @@ func (r *StartTrainedModelDeployment) HttpRequest(ctx context.Context) (*http.Re path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) path.WriteString("/") path.WriteString("deployment") @@ -126,15 +137,15 @@ func (r *StartTrainedModelDeployment) HttpRequest(ctx context.Context) (*http.Re } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -151,27 +162,66 @@ func (r *StartTrainedModelDeployment) HttpRequest(ctx context.Context) (*http.Re } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r StartTrainedModelDeployment) Perform(ctx context.Context) (*http.Response, error) { +func (r StartTrainedModelDeployment) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.start_trained_model_deployment") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.start_trained_model_deployment") + if reader := instrument.RecordRequestBody(ctx, "ml.start_trained_model_deployment", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.start_trained_model_deployment") + } if err != nil { - return nil, fmt.Errorf("an error happened during the StartTrainedModelDeployment query execution: %w", err) + localErr := fmt.Errorf("an error happened during the StartTrainedModelDeployment query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a starttrainedmodeldeployment.Response -func (r StartTrainedModelDeployment) Do(ctx context.Context) (*Response, error) { +func (r StartTrainedModelDeployment) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.start_trained_model_deployment") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -179,6 +229,9 @@ func (r StartTrainedModelDeployment) Do(ctx context.Context) (*Response, error) if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,6 +241,9 @@ func (r StartTrainedModelDeployment) Do(ctx context.Context) (*Response, error) errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -195,12 +251,25 @@ func (r StartTrainedModelDeployment) Do(ctx context.Context) (*Response, error) errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r StartTrainedModelDeployment) IsSuccess(ctx context.Context) (bool, error) { +func (r StartTrainedModelDeployment) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.start_trained_model_deployment") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -216,6 +285,14 @@ func (r StartTrainedModelDeployment) IsSuccess(ctx context.Context) (bool, error return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the StartTrainedModelDeployment query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } @@ -248,6 +325,14 @@ func (r *StartTrainedModelDeployment) CacheSize(bytesize string) *StartTrainedMo return r } +// DeploymentId A unique identifier for the deployment of the model. +// API name: deployment_id +func (r *StartTrainedModelDeployment) DeploymentId(deploymentid string) *StartTrainedModelDeployment { + r.values.Set("deployment_id", deploymentid) + + return r +} + // NumberOfAllocations The number of model allocations on each node where the model is deployed. // All allocations on a node share the same copy of the model in memory but use // a separate set of threads to evaluate the model. diff --git a/typedapi/ml/stopdatafeed/request.go b/typedapi/ml/stopdatafeed/request.go index 0a73ba1898..9d24a833b3 100644 --- a/typedapi/ml/stopdatafeed/request.go +++ b/typedapi/ml/stopdatafeed/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stopdatafeed @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package stopdatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/stop_datafeed/MlStopDatafeedRequest.ts#L24-L78 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/stop_datafeed/MlStopDatafeedRequest.ts#L24-L78 type Request struct { // AllowNoMatch Refer to the description for the `allow_no_match` query parameter. diff --git a/typedapi/ml/stopdatafeed/response.go b/typedapi/ml/stopdatafeed/response.go index db91c57359..4a564fe343 100644 --- a/typedapi/ml/stopdatafeed/response.go +++ b/typedapi/ml/stopdatafeed/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stopdatafeed // Response holds the response body struct for the package stopdatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/stop_datafeed/MlStopDatafeedResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/stop_datafeed/MlStopDatafeedResponse.ts#L20-L22 type Response struct { Stopped bool `json:"stopped"` } diff --git a/typedapi/ml/stopdatafeed/stop_datafeed.go b/typedapi/ml/stopdatafeed/stop_datafeed.go index ca91b97338..4b12377f80 100644 --- a/typedapi/ml/stopdatafeed/stop_datafeed.go +++ b/typedapi/ml/stopdatafeed/stop_datafeed.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Stops one or more datafeeds. package stopdatafeed @@ -50,15 +50,19 @@ type StopDatafeed struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int datafeedid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStopDatafeed type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *StopDatafeed { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *StopDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *StopDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *StopDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("datafeeds") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeedid", r.datafeedid) + } path.WriteString(r.datafeedid) path.WriteString("/") path.WriteString("_stop") @@ -164,15 +180,15 @@ func (r *StopDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *StopDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r StopDatafeed) Perform(ctx context.Context) (*http.Response, error) { +func (r StopDatafeed) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.stop_datafeed") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.stop_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.stop_datafeed", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.stop_datafeed") + } if err != nil { - return nil, fmt.Errorf("an error happened during the StopDatafeed query execution: %w", err) + localErr := fmt.Errorf("an error happened during the StopDatafeed query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stopdatafeed.Response -func (r StopDatafeed) Do(ctx context.Context) (*Response, error) { +func (r StopDatafeed) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.stop_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r StopDatafeed) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r StopDatafeed) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r StopDatafeed) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/stopdataframeanalytics/response.go b/typedapi/ml/stopdataframeanalytics/response.go index 9841e2fb82..031318757a 100644 --- a/typedapi/ml/stopdataframeanalytics/response.go +++ b/typedapi/ml/stopdataframeanalytics/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stopdataframeanalytics // Response holds the response body struct for the package stopdataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/stop_data_frame_analytics/MlStopDataFrameAnalyticsResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/stop_data_frame_analytics/MlStopDataFrameAnalyticsResponse.ts#L20-L22 type Response struct { Stopped bool `json:"stopped"` } diff --git a/typedapi/ml/stopdataframeanalytics/stop_data_frame_analytics.go b/typedapi/ml/stopdataframeanalytics/stop_data_frame_analytics.go index 06e700febe..77571821b1 100644 --- a/typedapi/ml/stopdataframeanalytics/stop_data_frame_analytics.go +++ b/typedapi/ml/stopdataframeanalytics/stop_data_frame_analytics.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Stops one or more data frame analytics jobs. package stopdataframeanalytics import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type StopDataFrameAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStopDataFrameAnalytics type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *StopDataFrameAnalytics { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,6 +117,9 @@ func (r *StopDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") path.WriteString("_stop") @@ -124,15 +135,15 @@ func (r *StopDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -149,27 +160,66 @@ func (r *StopDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Request } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r StopDataFrameAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r StopDataFrameAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.stop_data_frame_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.stop_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.stop_data_frame_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.stop_data_frame_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the StopDataFrameAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the StopDataFrameAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stopdataframeanalytics.Response -func (r StopDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { +func (r StopDataFrameAnalytics) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.stop_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -177,6 +227,9 @@ func (r StopDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -186,6 +239,9 @@ func (r StopDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -193,12 +249,25 @@ func (r StopDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r StopDataFrameAnalytics) IsSuccess(ctx context.Context) (bool, error) { +func (r StopDataFrameAnalytics) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.stop_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -214,6 +283,14 @@ func (r StopDataFrameAnalytics) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the StopDataFrameAnalytics query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/stoptrainedmodeldeployment/response.go b/typedapi/ml/stoptrainedmodeldeployment/response.go index 60be2b784e..66523ea070 100644 --- a/typedapi/ml/stoptrainedmodeldeployment/response.go +++ b/typedapi/ml/stoptrainedmodeldeployment/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stoptrainedmodeldeployment // Response holds the response body struct for the package stoptrainedmodeldeployment // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/stop_trained_model_deployment/MlStopTrainedModelDeploymentResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/stop_trained_model_deployment/MlStopTrainedModelDeploymentResponse.ts#L20-L22 type Response struct { Stopped bool `json:"stopped"` } diff --git a/typedapi/ml/stoptrainedmodeldeployment/stop_trained_model_deployment.go b/typedapi/ml/stoptrainedmodeldeployment/stop_trained_model_deployment.go index 14b39be3de..a75a626a9a 100644 --- a/typedapi/ml/stoptrainedmodeldeployment/stop_trained_model_deployment.go +++ b/typedapi/ml/stoptrainedmodeldeployment/stop_trained_model_deployment.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Stop a trained model deployment. package stoptrainedmodeldeployment import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type StopTrainedModelDeployment struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int modelid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStopTrainedModelDeployment type alias for index. @@ -76,13 +79,18 @@ func NewStopTrainedModelDeploymentFunc(tp elastictransport.Interface) NewStopTra // Stop a trained model deployment. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/stop-trained-model-deployment.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-trained-model-deployment.html func New(tp elastictransport.Interface) *StopTrainedModelDeployment { r := &StopTrainedModelDeployment{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *StopTrainedModelDeployment) HttpRequest(ctx context.Context) (*http.Req path.WriteString("trained_models") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "modelid", r.modelid) + } path.WriteString(r.modelid) path.WriteString("/") path.WriteString("deployment") @@ -124,15 +135,15 @@ func (r *StopTrainedModelDeployment) HttpRequest(ctx context.Context) (*http.Req } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -149,27 +160,66 @@ func (r *StopTrainedModelDeployment) HttpRequest(ctx context.Context) (*http.Req } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r StopTrainedModelDeployment) Perform(ctx context.Context) (*http.Response, error) { +func (r StopTrainedModelDeployment) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.stop_trained_model_deployment") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.stop_trained_model_deployment") + if reader := instrument.RecordRequestBody(ctx, "ml.stop_trained_model_deployment", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.stop_trained_model_deployment") + } if err != nil { - return nil, fmt.Errorf("an error happened during the StopTrainedModelDeployment query execution: %w", err) + localErr := fmt.Errorf("an error happened during the StopTrainedModelDeployment query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stoptrainedmodeldeployment.Response -func (r StopTrainedModelDeployment) Do(ctx context.Context) (*Response, error) { +func (r StopTrainedModelDeployment) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.stop_trained_model_deployment") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -177,6 +227,9 @@ func (r StopTrainedModelDeployment) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -186,6 +239,9 @@ func (r StopTrainedModelDeployment) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -193,12 +249,25 @@ func (r StopTrainedModelDeployment) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r StopTrainedModelDeployment) IsSuccess(ctx context.Context) (bool, error) { +func (r StopTrainedModelDeployment) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.stop_trained_model_deployment") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -214,6 +283,14 @@ func (r StopTrainedModelDeployment) IsSuccess(ctx context.Context) (bool, error) return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the StopTrainedModelDeployment query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/updatedatafeed/request.go b/typedapi/ml/updatedatafeed/request.go index bef4bdf5d7..e3bff47246 100644 --- a/typedapi/ml/updatedatafeed/request.go +++ b/typedapi/ml/updatedatafeed/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatedatafeed @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package updatedatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/update_datafeed/MlUpdateDatafeedRequest.ts#L31-L162 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/update_datafeed/MlUpdateDatafeedRequest.ts#L31-L162 type Request struct { // Aggregations If set, the datafeed performs aggregation searches. Support for aggregations diff --git a/typedapi/ml/updatedatafeed/response.go b/typedapi/ml/updatedatafeed/response.go index 87abafb046..51be1b8615 100644 --- a/typedapi/ml/updatedatafeed/response.go +++ b/typedapi/ml/updatedatafeed/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatedatafeed @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package updatedatafeed // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/update_datafeed/MlUpdateDatafeedResponse.ts#L31-L49 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/update_datafeed/MlUpdateDatafeedResponse.ts#L31-L49 type Response struct { Aggregations map[string]types.Aggregations `json:"aggregations,omitempty"` Authorization *types.DatafeedAuthorization `json:"authorization,omitempty"` diff --git a/typedapi/ml/updatedatafeed/update_datafeed.go b/typedapi/ml/updatedatafeed/update_datafeed.go index 73a7ed4963..0ea9c6d9b8 100644 --- a/typedapi/ml/updatedatafeed/update_datafeed.go +++ b/typedapi/ml/updatedatafeed/update_datafeed.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates certain properties of a datafeed. package updatedatafeed @@ -52,15 +52,19 @@ type UpdateDatafeed struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int datafeedid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateDatafeed type alias for index. @@ -86,11 +90,18 @@ func New(tp elastictransport.Interface) *UpdateDatafeed { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *UpdateDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,6 +150,10 @@ func (r *UpdateDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *UpdateDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("datafeeds") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "datafeedid", r.datafeedid) + } path.WriteString(r.datafeedid) path.WriteString("/") path.WriteString("_update") @@ -166,15 +182,15 @@ func (r *UpdateDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -191,27 +207,66 @@ func (r *UpdateDatafeed) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateDatafeed) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateDatafeed) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.update_datafeed") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_datafeed") + if reader := instrument.RecordRequestBody(ctx, "ml.update_datafeed", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_datafeed") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateDatafeed query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateDatafeed query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updatedatafeed.Response -func (r UpdateDatafeed) Do(ctx context.Context) (*Response, error) { +func (r UpdateDatafeed) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_datafeed") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -219,6 +274,9 @@ func (r UpdateDatafeed) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -228,6 +286,9 @@ func (r UpdateDatafeed) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +296,9 @@ func (r UpdateDatafeed) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/updatedataframeanalytics/request.go b/typedapi/ml/updatedataframeanalytics/request.go index 3d1b9a6969..5b4ec9daa0 100644 --- a/typedapi/ml/updatedataframeanalytics/request.go +++ b/typedapi/ml/updatedataframeanalytics/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatedataframeanalytics @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package updatedataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/update_data_frame_analytics/MlUpdateDataFrameAnalyticsRequest.ts#L24-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/update_data_frame_analytics/MlUpdateDataFrameAnalyticsRequest.ts#L24-L72 type Request struct { // AllowLazyStart Specifies whether this job can start when there is insufficient machine diff --git a/typedapi/ml/updatedataframeanalytics/response.go b/typedapi/ml/updatedataframeanalytics/response.go index 816aa0eeb4..77d3c0ff42 100644 --- a/typedapi/ml/updatedataframeanalytics/response.go +++ b/typedapi/ml/updatedataframeanalytics/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatedataframeanalytics @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package updatedataframeanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/update_data_frame_analytics/MlUpdateDataFrameAnalyticsResponse.ts#L30-L45 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/update_data_frame_analytics/MlUpdateDataFrameAnalyticsResponse.ts#L30-L45 type Response struct { AllowLazyStart bool `json:"allow_lazy_start"` Analysis types.DataframeAnalysisContainer `json:"analysis"` diff --git a/typedapi/ml/updatedataframeanalytics/update_data_frame_analytics.go b/typedapi/ml/updatedataframeanalytics/update_data_frame_analytics.go index 6f49aba2df..b7c35c5e52 100644 --- a/typedapi/ml/updatedataframeanalytics/update_data_frame_analytics.go +++ b/typedapi/ml/updatedataframeanalytics/update_data_frame_analytics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates certain properties of a data frame analytics job. package updatedataframeanalytics @@ -50,15 +50,19 @@ type UpdateDataFrameAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateDataFrameAnalytics type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *UpdateDataFrameAnalytics { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *UpdateDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reque } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *UpdateDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reque } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *UpdateDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reque path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") path.WriteString("_update") @@ -166,15 +182,15 @@ func (r *UpdateDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reque } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -191,27 +207,66 @@ func (r *UpdateDataFrameAnalytics) HttpRequest(ctx context.Context) (*http.Reque } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateDataFrameAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateDataFrameAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.update_data_frame_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_data_frame_analytics") + if reader := instrument.RecordRequestBody(ctx, "ml.update_data_frame_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_data_frame_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateDataFrameAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateDataFrameAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updatedataframeanalytics.Response -func (r UpdateDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { +func (r UpdateDataFrameAnalytics) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_data_frame_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -219,6 +274,9 @@ func (r UpdateDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -228,6 +286,9 @@ func (r UpdateDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +296,9 @@ func (r UpdateDataFrameAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/updatefilter/request.go b/typedapi/ml/updatefilter/request.go index 0cc7fd8fd2..bf730dfa68 100644 --- a/typedapi/ml/updatefilter/request.go +++ b/typedapi/ml/updatefilter/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatefilter @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package updatefilter // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/update_filter/MlUpdateFilterRequest.ts#L23-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/update_filter/MlUpdateFilterRequest.ts#L23-L51 type Request struct { // AddItems The items to add to the filter. diff --git a/typedapi/ml/updatefilter/response.go b/typedapi/ml/updatefilter/response.go index 7c3a7578d9..cdb6bda56e 100644 --- a/typedapi/ml/updatefilter/response.go +++ b/typedapi/ml/updatefilter/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatefilter // Response holds the response body struct for the package updatefilter // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/update_filter/MlUpdateFilterResponse.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/update_filter/MlUpdateFilterResponse.ts#L22-L28 type Response struct { Description string `json:"description"` FilterId string `json:"filter_id"` diff --git a/typedapi/ml/updatefilter/update_filter.go b/typedapi/ml/updatefilter/update_filter.go index cc3b19eb0a..5240917845 100644 --- a/typedapi/ml/updatefilter/update_filter.go +++ b/typedapi/ml/updatefilter/update_filter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates the description of a filter, adds items, or removes items. package updatefilter @@ -50,15 +50,19 @@ type UpdateFilter struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int filterid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateFilter type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *UpdateFilter { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *UpdateFilter) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *UpdateFilter) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *UpdateFilter) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("filters") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "filterid", r.filterid) + } path.WriteString(r.filterid) path.WriteString("/") path.WriteString("_update") @@ -164,15 +180,15 @@ func (r *UpdateFilter) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *UpdateFilter) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateFilter) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateFilter) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.update_filter") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_filter") + if reader := instrument.RecordRequestBody(ctx, "ml.update_filter", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_filter") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateFilter query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateFilter query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updatefilter.Response -func (r UpdateFilter) Do(ctx context.Context) (*Response, error) { +func (r UpdateFilter) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_filter") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r UpdateFilter) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r UpdateFilter) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r UpdateFilter) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/updatejob/request.go b/typedapi/ml/updatejob/request.go index 0c5231dc31..b99f201b61 100644 --- a/typedapi/ml/updatejob/request.go +++ b/typedapi/ml/updatejob/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatejob @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package updatejob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/update_job/MlUpdateJobRequest.ts#L33-L138 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/update_job/MlUpdateJobRequest.ts#L33-L138 type Request struct { // AllowLazyOpen Advanced configuration option. Specifies whether this job can open when diff --git a/typedapi/ml/updatejob/response.go b/typedapi/ml/updatejob/response.go index 237a94963a..b13e0aa082 100644 --- a/typedapi/ml/updatejob/response.go +++ b/typedapi/ml/updatejob/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatejob @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package updatejob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/update_job/MlUpdateJobResponse.ts#L29-L53 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/update_job/MlUpdateJobResponse.ts#L29-L53 type Response struct { AllowLazyOpen bool `json:"allow_lazy_open"` AnalysisConfig types.AnalysisConfigRead `json:"analysis_config"` diff --git a/typedapi/ml/updatejob/update_job.go b/typedapi/ml/updatejob/update_job.go index 55c79e177d..c64c9cf062 100644 --- a/typedapi/ml/updatejob/update_job.go +++ b/typedapi/ml/updatejob/update_job.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates certain properties of an anomaly detection job. package updatejob @@ -50,15 +50,19 @@ type UpdateJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateJob type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *UpdateJob { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *UpdateJob) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *UpdateJob) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *UpdateJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("_update") @@ -164,15 +180,15 @@ func (r *UpdateJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *UpdateJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateJob) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.update_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_job") + if reader := instrument.RecordRequestBody(ctx, "ml.update_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updatejob.Response -func (r UpdateJob) Do(ctx context.Context) (*Response, error) { +func (r UpdateJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r UpdateJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r UpdateJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r UpdateJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/updatemodelsnapshot/request.go b/typedapi/ml/updatemodelsnapshot/request.go index cf6fa1f124..28fcc9b2fe 100644 --- a/typedapi/ml/updatemodelsnapshot/request.go +++ b/typedapi/ml/updatemodelsnapshot/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatemodelsnapshot @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package updatemodelsnapshot // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/update_model_snapshot/MlUpdateModelSnapshotRequest.ts#L23-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/update_model_snapshot/MlUpdateModelSnapshotRequest.ts#L23-L54 type Request struct { // Description A description of the model snapshot. diff --git a/typedapi/ml/updatemodelsnapshot/response.go b/typedapi/ml/updatemodelsnapshot/response.go index 2ab11ffc76..6a02ecab17 100644 --- a/typedapi/ml/updatemodelsnapshot/response.go +++ b/typedapi/ml/updatemodelsnapshot/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatemodelsnapshot @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package updatemodelsnapshot // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/update_model_snapshot/MlUpdateModelSnapshotResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/update_model_snapshot/MlUpdateModelSnapshotResponse.ts#L22-L27 type Response struct { Acknowledged bool `json:"acknowledged"` Model types.ModelSnapshot `json:"model"` diff --git a/typedapi/ml/updatemodelsnapshot/update_model_snapshot.go b/typedapi/ml/updatemodelsnapshot/update_model_snapshot.go index aef39126e8..81bd6a615d 100644 --- a/typedapi/ml/updatemodelsnapshot/update_model_snapshot.go +++ b/typedapi/ml/updatemodelsnapshot/update_model_snapshot.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates certain properties of a snapshot. package updatemodelsnapshot @@ -52,16 +52,20 @@ type UpdateModelSnapshot struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int jobid string snapshotid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateModelSnapshot type alias for index. @@ -89,11 +93,18 @@ func New(tp elastictransport.Interface) *UpdateModelSnapshot { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -130,9 +141,7 @@ func (r *UpdateModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -144,6 +153,10 @@ func (r *UpdateModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,11 +167,17 @@ func (r *UpdateModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshotid", r.snapshotid) + } path.WriteString(r.snapshotid) path.WriteString("/") path.WriteString("_update") @@ -174,15 +193,15 @@ func (r *UpdateModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -199,27 +218,66 @@ func (r *UpdateModelSnapshot) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateModelSnapshot) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateModelSnapshot) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.update_model_snapshot") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.update_model_snapshot") + if reader := instrument.RecordRequestBody(ctx, "ml.update_model_snapshot", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.update_model_snapshot") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateModelSnapshot query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateModelSnapshot query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updatemodelsnapshot.Response -func (r UpdateModelSnapshot) Do(ctx context.Context) (*Response, error) { +func (r UpdateModelSnapshot) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.update_model_snapshot") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -227,6 +285,9 @@ func (r UpdateModelSnapshot) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +297,9 @@ func (r UpdateModelSnapshot) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -243,6 +307,9 @@ func (r UpdateModelSnapshot) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/upgradejobsnapshot/response.go b/typedapi/ml/upgradejobsnapshot/response.go index 1a199445b1..f9645e3243 100644 --- a/typedapi/ml/upgradejobsnapshot/response.go +++ b/typedapi/ml/upgradejobsnapshot/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package upgradejobsnapshot // Response holds the response body struct for the package upgradejobsnapshot // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/upgrade_job_snapshot/MlUpgradeJobSnapshotResponse.ts#L22-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/upgrade_job_snapshot/MlUpgradeJobSnapshotResponse.ts#L22-L31 type Response struct { // Completed When true, this means the task is complete. When false, it is still running. diff --git a/typedapi/ml/upgradejobsnapshot/upgrade_job_snapshot.go b/typedapi/ml/upgradejobsnapshot/upgrade_job_snapshot.go index b386d3e249..e481bc8486 100644 --- a/typedapi/ml/upgradejobsnapshot/upgrade_job_snapshot.go +++ b/typedapi/ml/upgradejobsnapshot/upgrade_job_snapshot.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Upgrades a given job snapshot to the current major version. package upgradejobsnapshot import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,12 +53,16 @@ type UpgradeJobSnapshot struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int jobid string snapshotid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpgradeJobSnapshot type alias for index. @@ -87,7 +90,12 @@ func New(tp elastictransport.Interface) *UpgradeJobSnapshot { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,11 +120,17 @@ func (r *UpgradeJobSnapshot) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("anomaly_detectors") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "jobid", r.jobid) + } path.WriteString(r.jobid) path.WriteString("/") path.WriteString("model_snapshots") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshotid", r.snapshotid) + } path.WriteString(r.snapshotid) path.WriteString("/") path.WriteString("_upgrade") @@ -132,9 +146,9 @@ func (r *UpgradeJobSnapshot) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -151,27 +165,66 @@ func (r *UpgradeJobSnapshot) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpgradeJobSnapshot) Perform(ctx context.Context) (*http.Response, error) { +func (r UpgradeJobSnapshot) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.upgrade_job_snapshot") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.upgrade_job_snapshot") + if reader := instrument.RecordRequestBody(ctx, "ml.upgrade_job_snapshot", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.upgrade_job_snapshot") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpgradeJobSnapshot query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpgradeJobSnapshot query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a upgradejobsnapshot.Response -func (r UpgradeJobSnapshot) Do(ctx context.Context) (*Response, error) { +func (r UpgradeJobSnapshot) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.upgrade_job_snapshot") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -179,6 +232,9 @@ func (r UpgradeJobSnapshot) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,6 +244,9 @@ func (r UpgradeJobSnapshot) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -195,12 +254,25 @@ func (r UpgradeJobSnapshot) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r UpgradeJobSnapshot) IsSuccess(ctx context.Context) (bool, error) { +func (r UpgradeJobSnapshot) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.upgrade_job_snapshot") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -216,6 +288,14 @@ func (r UpgradeJobSnapshot) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the UpgradeJobSnapshot query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ml/validate/request.go b/typedapi/ml/validate/request.go index 703780283a..e3ec7838f9 100644 --- a/typedapi/ml/validate/request.go +++ b/typedapi/ml/validate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package validate @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package validate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/validate/MlValidateJobRequest.ts#L27-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/validate/MlValidateJobRequest.ts#L27-L44 type Request struct { AnalysisConfig *types.AnalysisConfig `json:"analysis_config,omitempty"` AnalysisLimits *types.AnalysisLimits `json:"analysis_limits,omitempty"` diff --git a/typedapi/ml/validate/response.go b/typedapi/ml/validate/response.go index 7734a15fa4..6ca762cb3b 100644 --- a/typedapi/ml/validate/response.go +++ b/typedapi/ml/validate/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package validate // Response holds the response body struct for the package validate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/validate/MlValidateJobResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/validate/MlValidateJobResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/validate/validate.go b/typedapi/ml/validate/validate.go index 8a55135b76..17af272f38 100644 --- a/typedapi/ml/validate/validate.go +++ b/typedapi/ml/validate/validate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Validates an anomaly detection job. package validate @@ -46,13 +46,17 @@ type Validate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewValidate type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *Validate { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *Validate) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *Validate) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,15 +166,15 @@ func (r *Validate) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -178,27 +191,66 @@ func (r *Validate) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Validate) Perform(ctx context.Context) (*http.Response, error) { +func (r Validate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.validate") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.validate") + if reader := instrument.RecordRequestBody(ctx, "ml.validate", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.validate") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Validate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Validate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a validate.Response -func (r Validate) Do(ctx context.Context) (*Response, error) { +func (r Validate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.validate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -206,6 +258,9 @@ func (r Validate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -215,6 +270,9 @@ func (r Validate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r Validate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ml/validatedetector/request.go b/typedapi/ml/validatedetector/request.go index 99c1d285e6..155ca6dda2 100644 --- a/typedapi/ml/validatedetector/request.go +++ b/typedapi/ml/validatedetector/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package validatedetector @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package validatedetector // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/validate_detector/MlValidateDetectorRequest.ts#L23-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/validate_detector/MlValidateDetectorRequest.ts#L23-L31 type Request = types.Detector diff --git a/typedapi/ml/validatedetector/response.go b/typedapi/ml/validatedetector/response.go index 0b4aa4edc2..e173430c3f 100644 --- a/typedapi/ml/validatedetector/response.go +++ b/typedapi/ml/validatedetector/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package validatedetector // Response holds the response body struct for the package validatedetector // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/validate_detector/MlValidateDetectorResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/validate_detector/MlValidateDetectorResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/ml/validatedetector/validate_detector.go b/typedapi/ml/validatedetector/validate_detector.go index 1452e0439e..c907deb7bb 100644 --- a/typedapi/ml/validatedetector/validate_detector.go +++ b/typedapi/ml/validatedetector/validate_detector.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Validates an anomaly detection detector. package validatedetector @@ -47,13 +47,17 @@ type ValidateDetector struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewValidateDetector type alias for index. @@ -77,7 +81,14 @@ func New(tp elastictransport.Interface) *ValidateDetector { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -116,9 +127,7 @@ func (r *ValidateDetector) HttpRequest(ctx context.Context) (*http.Request, erro } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -130,6 +139,10 @@ func (r *ValidateDetector) HttpRequest(ctx context.Context) (*http.Request, erro } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,15 +167,15 @@ func (r *ValidateDetector) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -179,27 +192,66 @@ func (r *ValidateDetector) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ValidateDetector) Perform(ctx context.Context) (*http.Response, error) { +func (r ValidateDetector) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ml.validate_detector") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ml.validate_detector") + if reader := instrument.RecordRequestBody(ctx, "ml.validate_detector", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ml.validate_detector") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ValidateDetector query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ValidateDetector query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a validatedetector.Response -func (r ValidateDetector) Do(ctx context.Context) (*Response, error) { +func (r ValidateDetector) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ml.validate_detector") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -207,6 +259,9 @@ func (r ValidateDetector) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -216,6 +271,9 @@ func (r ValidateDetector) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r ValidateDetector) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/monitoring/bulk/bulk.go b/typedapi/monitoring/bulk/bulk.go index 9bc08cdabb..b35dd83fbd 100644 --- a/typedapi/monitoring/bulk/bulk.go +++ b/typedapi/monitoring/bulk/bulk.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Used by the monitoring features to send monitoring data. package bulk @@ -50,15 +50,19 @@ type Bulk struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int type_ string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewBulk type alias for index. @@ -76,13 +80,20 @@ func NewBulkFunc(tp elastictransport.Interface) NewBulk { // Used by the monitoring features to send monitoring data. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/monitor-elasticsearch-cluster.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/monitor-elasticsearch-cluster.html func New(tp elastictransport.Interface) *Bulk { r := &Bulk{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -121,9 +132,7 @@ func (r *Bulk) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { for _, elem := range *r.req { data, err := json.Marshal(elem) @@ -140,6 +149,10 @@ func (r *Bulk) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -155,6 +168,9 @@ func (r *Bulk) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_monitoring") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "type_", r.type_) + } path.WriteString(r.type_) path.WriteString("/") path.WriteString("bulk") @@ -170,15 +186,15 @@ func (r *Bulk) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+x-ndjson;compatible-with=8") } } @@ -195,27 +211,66 @@ func (r *Bulk) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Bulk) Perform(ctx context.Context) (*http.Response, error) { +func (r Bulk) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "monitoring.bulk") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "monitoring.bulk") + if reader := instrument.RecordRequestBody(ctx, "monitoring.bulk", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "monitoring.bulk") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Bulk query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Bulk query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a bulk.Response -func (r Bulk) Do(ctx context.Context) (*Response, error) { +func (r Bulk) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "monitoring.bulk") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -223,6 +278,9 @@ func (r Bulk) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +290,9 @@ func (r Bulk) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -239,6 +300,9 @@ func (r Bulk) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/monitoring/bulk/request.go b/typedapi/monitoring/bulk/request.go index fa534792f8..a672342a4b 100644 --- a/typedapi/monitoring/bulk/request.go +++ b/typedapi/monitoring/bulk/request.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package bulk // Request holds the request body struct for the package bulk // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/monitoring/bulk/BulkMonitoringRequest.ts#L24-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/monitoring/bulk/BulkMonitoringRequest.ts#L24-L59 type Request = []interface{} diff --git a/typedapi/monitoring/bulk/response.go b/typedapi/monitoring/bulk/response.go index fe79b70600..8721871928 100644 --- a/typedapi/monitoring/bulk/response.go +++ b/typedapi/monitoring/bulk/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package bulk @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package bulk // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/monitoring/bulk/BulkMonitoringResponse.ts#L23-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/monitoring/bulk/BulkMonitoringResponse.ts#L23-L32 type Response struct { Error *types.ErrorCause `json:"error,omitempty"` // Errors True if there is was an error diff --git a/typedapi/nodes/clearrepositoriesmeteringarchive/clear_repositories_metering_archive.go b/typedapi/nodes/clearrepositoriesmeteringarchive/clear_repositories_metering_archive.go index 6e4aa370a4..f7d32e2266 100644 --- a/typedapi/nodes/clearrepositoriesmeteringarchive/clear_repositories_metering_archive.go +++ b/typedapi/nodes/clearrepositoriesmeteringarchive/clear_repositories_metering_archive.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Removes the archived repositories metering information present in the // cluster. package clearrepositoriesmeteringarchive import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,12 +53,16 @@ type ClearRepositoriesMeteringArchive struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string maxarchiveversion string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearRepositoriesMeteringArchive type alias for index. @@ -88,7 +91,12 @@ func New(tp elastictransport.Interface) *ClearRepositoriesMeteringArchive { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,11 +119,17 @@ func (r *ClearRepositoriesMeteringArchive) HttpRequest(ctx context.Context) (*ht path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("_repositories_metering") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "maxarchiveversion", r.maxarchiveversion) + } path.WriteString(r.maxarchiveversion) method = http.MethodDelete @@ -129,9 +143,9 @@ func (r *ClearRepositoriesMeteringArchive) HttpRequest(ctx context.Context) (*ht } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +162,66 @@ func (r *ClearRepositoriesMeteringArchive) HttpRequest(ctx context.Context) (*ht } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearRepositoriesMeteringArchive) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearRepositoriesMeteringArchive) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "nodes.clear_repositories_metering_archive") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.clear_repositories_metering_archive") + if reader := instrument.RecordRequestBody(ctx, "nodes.clear_repositories_metering_archive", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.clear_repositories_metering_archive") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearRepositoriesMeteringArchive query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearRepositoriesMeteringArchive query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clearrepositoriesmeteringarchive.Response -func (r ClearRepositoriesMeteringArchive) Do(ctx context.Context) (*Response, error) { +func (r ClearRepositoriesMeteringArchive) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.clear_repositories_metering_archive") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +229,9 @@ func (r ClearRepositoriesMeteringArchive) Do(ctx context.Context) (*Response, er if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +241,9 @@ func (r ClearRepositoriesMeteringArchive) Do(ctx context.Context) (*Response, er errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +251,25 @@ func (r ClearRepositoriesMeteringArchive) Do(ctx context.Context) (*Response, er errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ClearRepositoriesMeteringArchive) IsSuccess(ctx context.Context) (bool, error) { +func (r ClearRepositoriesMeteringArchive) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.clear_repositories_metering_archive") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +285,14 @@ func (r ClearRepositoriesMeteringArchive) IsSuccess(ctx context.Context) (bool, return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ClearRepositoriesMeteringArchive query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/nodes/clearrepositoriesmeteringarchive/response.go b/typedapi/nodes/clearrepositoriesmeteringarchive/response.go index dc0ea99e2c..2b161453b6 100644 --- a/typedapi/nodes/clearrepositoriesmeteringarchive/response.go +++ b/typedapi/nodes/clearrepositoriesmeteringarchive/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearrepositoriesmeteringarchive @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package clearrepositoriesmeteringarchive // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/clear_repositories_metering_archive/ClearRepositoriesMeteringArchiveResponse.ts#L36-L38 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/clear_repositories_metering_archive/ClearRepositoriesMeteringArchiveResponse.ts#L36-L38 type Response struct { // ClusterName Name of the cluster. Based on the [Cluster name diff --git a/typedapi/nodes/getrepositoriesmeteringinfo/get_repositories_metering_info.go b/typedapi/nodes/getrepositoriesmeteringinfo/get_repositories_metering_info.go index 31cd621599..2d26d25e96 100644 --- a/typedapi/nodes/getrepositoriesmeteringinfo/get_repositories_metering_info.go +++ b/typedapi/nodes/getrepositoriesmeteringinfo/get_repositories_metering_info.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns cluster repositories metering information. package getrepositoriesmeteringinfo import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type GetRepositoriesMeteringInfo struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetRepositoriesMeteringInfo type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *GetRepositoriesMeteringInfo { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *GetRepositoriesMeteringInfo) HttpRequest(ctx context.Context) (*http.Re path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("_repositories_metering") @@ -119,9 +130,9 @@ func (r *GetRepositoriesMeteringInfo) HttpRequest(ctx context.Context) (*http.Re } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *GetRepositoriesMeteringInfo) HttpRequest(ctx context.Context) (*http.Re } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetRepositoriesMeteringInfo) Perform(ctx context.Context) (*http.Response, error) { +func (r GetRepositoriesMeteringInfo) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "nodes.get_repositories_metering_info") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.get_repositories_metering_info") + if reader := instrument.RecordRequestBody(ctx, "nodes.get_repositories_metering_info", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.get_repositories_metering_info") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetRepositoriesMeteringInfo query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetRepositoriesMeteringInfo query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getrepositoriesmeteringinfo.Response -func (r GetRepositoriesMeteringInfo) Do(ctx context.Context) (*Response, error) { +func (r GetRepositoriesMeteringInfo) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.get_repositories_metering_info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r GetRepositoriesMeteringInfo) Do(ctx context.Context) (*Response, error) if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r GetRepositoriesMeteringInfo) Do(ctx context.Context) (*Response, error) errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r GetRepositoriesMeteringInfo) Do(ctx context.Context) (*Response, error) errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetRepositoriesMeteringInfo) IsSuccess(ctx context.Context) (bool, error) { +func (r GetRepositoriesMeteringInfo) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.get_repositories_metering_info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r GetRepositoriesMeteringInfo) IsSuccess(ctx context.Context) (bool, error return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetRepositoriesMeteringInfo query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/nodes/getrepositoriesmeteringinfo/response.go b/typedapi/nodes/getrepositoriesmeteringinfo/response.go index 575907ff9a..781f553249 100644 --- a/typedapi/nodes/getrepositoriesmeteringinfo/response.go +++ b/typedapi/nodes/getrepositoriesmeteringinfo/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getrepositoriesmeteringinfo @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getrepositoriesmeteringinfo // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/get_repositories_metering_info/GetRepositoriesMeteringInfoResponse.ts#L36-L38 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/get_repositories_metering_info/GetRepositoriesMeteringInfoResponse.ts#L36-L38 type Response struct { // ClusterName Name of the cluster. Based on the [Cluster name diff --git a/typedapi/nodes/hotthreads/hot_threads.go b/typedapi/nodes/hotthreads/hot_threads.go index 277af6e352..23bbe58e1f 100644 --- a/typedapi/nodes/hotthreads/hot_threads.go +++ b/typedapi/nodes/hotthreads/hot_threads.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about hot threads on each node in the cluster. package hotthreads import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type HotThreads struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewHotThreads type alias for index. @@ -75,13 +78,18 @@ func NewHotThreadsFunc(tp elastictransport.Interface) NewHotThreads { // Returns information about hot threads on each node in the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-nodes-hot-threads.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html func New(tp elastictransport.Interface) *HotThreads { r := &HotThreads{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,6 +119,9 @@ func (r *HotThreads) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("hot_threads") @@ -126,9 +137,9 @@ func (r *HotThreads) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -145,27 +156,66 @@ func (r *HotThreads) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r HotThreads) Perform(ctx context.Context) (*http.Response, error) { +func (r HotThreads) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "nodes.hot_threads") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.hot_threads") + if reader := instrument.RecordRequestBody(ctx, "nodes.hot_threads", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.hot_threads") + } if err != nil { - return nil, fmt.Errorf("an error happened during the HotThreads query execution: %w", err) + localErr := fmt.Errorf("an error happened during the HotThreads query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a hotthreads.Response -func (r HotThreads) Do(ctx context.Context) (*Response, error) { +func (r HotThreads) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.hot_threads") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -173,6 +223,9 @@ func (r HotThreads) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,6 +235,9 @@ func (r HotThreads) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,12 +245,25 @@ func (r HotThreads) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r HotThreads) IsSuccess(ctx context.Context) (bool, error) { +func (r HotThreads) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.hot_threads") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -210,6 +279,14 @@ func (r HotThreads) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the HotThreads query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/nodes/hotthreads/response.go b/typedapi/nodes/hotthreads/response.go index 78713fe3f8..602ce8a4ce 100644 --- a/typedapi/nodes/hotthreads/response.go +++ b/typedapi/nodes/hotthreads/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package hotthreads @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package hotthreads // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/hot_threads/NodesHotThreadsResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/hot_threads/NodesHotThreadsResponse.ts#L22-L24 type Response struct { HotThreads []types.HotThread `json:"hot_threads"` } diff --git a/typedapi/nodes/info/info.go b/typedapi/nodes/info/info.go index fe52b1337a..85ab35c303 100644 --- a/typedapi/nodes/info/info.go +++ b/typedapi/nodes/info/info.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about nodes in the cluster. package info import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,12 +53,16 @@ type Info struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string metric string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewInfo type alias for index. @@ -77,13 +80,18 @@ func NewInfoFunc(tp elastictransport.Interface) NewInfo { // Returns information about nodes in the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-nodes-info.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-info.html func New(tp elastictransport.Interface) *Info { r := &Info{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,6 +119,9 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) method = http.MethodGet @@ -119,6 +130,9 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) method = http.MethodGet @@ -127,9 +141,15 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) method = http.MethodGet @@ -143,9 +163,9 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -162,27 +182,66 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Info) Perform(ctx context.Context) (*http.Response, error) { +func (r Info) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "nodes.info") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.info") + if reader := instrument.RecordRequestBody(ctx, "nodes.info", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.info") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Info query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Info query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a info.Response -func (r Info) Do(ctx context.Context) (*Response, error) { +func (r Info) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -190,6 +249,9 @@ func (r Info) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -199,6 +261,9 @@ func (r Info) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -206,12 +271,25 @@ func (r Info) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Info) IsSuccess(ctx context.Context) (bool, error) { +func (r Info) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -227,6 +305,14 @@ func (r Info) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Info query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/nodes/info/response.go b/typedapi/nodes/info/response.go index 66d3f19466..299212a643 100644 --- a/typedapi/nodes/info/response.go +++ b/typedapi/nodes/info/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package info @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package info // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/NodesInfoResponse.ts#L30-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/NodesInfoResponse.ts#L30-L32 type Response struct { ClusterName string `json:"cluster_name"` // NodeStats Contains statistics about the number of nodes selected by the request’s node diff --git a/typedapi/nodes/reloadsecuresettings/reload_secure_settings.go b/typedapi/nodes/reloadsecuresettings/reload_secure_settings.go index c565f91815..94c7e90c90 100644 --- a/typedapi/nodes/reloadsecuresettings/reload_secure_settings.go +++ b/typedapi/nodes/reloadsecuresettings/reload_secure_settings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Reloads secure settings. package reloadsecuresettings @@ -50,15 +50,19 @@ type ReloadSecureSettings struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int nodeid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewReloadSecureSettings type alias for index. @@ -76,17 +80,24 @@ func NewReloadSecureSettingsFunc(tp elastictransport.Interface) NewReloadSecureS // Reloads secure settings. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings +// https://www.elastic.co/guide/en/elasticsearch/reference/current/secure-settings.html#reloadable-secure-settings func New(tp elastictransport.Interface) *ReloadSecureSettings { r := &ReloadSecureSettings{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -123,9 +134,7 @@ func (r *ReloadSecureSettings) HttpRequest(ctx context.Context) (*http.Request, } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -137,6 +146,10 @@ func (r *ReloadSecureSettings) HttpRequest(ctx context.Context) (*http.Request, } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -152,6 +165,9 @@ func (r *ReloadSecureSettings) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("reload_secure_settings") @@ -167,15 +183,15 @@ func (r *ReloadSecureSettings) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -192,27 +208,66 @@ func (r *ReloadSecureSettings) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ReloadSecureSettings) Perform(ctx context.Context) (*http.Response, error) { +func (r ReloadSecureSettings) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "nodes.reload_secure_settings") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.reload_secure_settings") + if reader := instrument.RecordRequestBody(ctx, "nodes.reload_secure_settings", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.reload_secure_settings") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ReloadSecureSettings query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ReloadSecureSettings query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a reloadsecuresettings.Response -func (r ReloadSecureSettings) Do(ctx context.Context) (*Response, error) { +func (r ReloadSecureSettings) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.reload_secure_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -220,6 +275,9 @@ func (r ReloadSecureSettings) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +287,9 @@ func (r ReloadSecureSettings) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +297,9 @@ func (r ReloadSecureSettings) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/nodes/reloadsecuresettings/request.go b/typedapi/nodes/reloadsecuresettings/request.go index ac654d4fcc..427774a3f2 100644 --- a/typedapi/nodes/reloadsecuresettings/request.go +++ b/typedapi/nodes/reloadsecuresettings/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package reloadsecuresettings @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package reloadsecuresettings // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/reload_secure_settings/ReloadSecureSettingsRequest.ts#L24-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/reload_secure_settings/ReloadSecureSettingsRequest.ts#L24-L50 type Request struct { // SecureSettingsPassword The password for the Elasticsearch keystore. diff --git a/typedapi/nodes/reloadsecuresettings/response.go b/typedapi/nodes/reloadsecuresettings/response.go index c73119ab85..f66ffdb0ab 100644 --- a/typedapi/nodes/reloadsecuresettings/response.go +++ b/typedapi/nodes/reloadsecuresettings/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package reloadsecuresettings @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package reloadsecuresettings // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/reload_secure_settings/ReloadSecureSettingsResponse.ts#L30-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/reload_secure_settings/ReloadSecureSettingsResponse.ts#L30-L32 type Response struct { ClusterName string `json:"cluster_name"` // NodeStats Contains statistics about the number of nodes selected by the request’s node diff --git a/typedapi/nodes/stats/response.go b/typedapi/nodes/stats/response.go index 2f8911c64a..37a9681b18 100644 --- a/typedapi/nodes/stats/response.go +++ b/typedapi/nodes/stats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package stats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/stats/NodesStatsResponse.ts#L30-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/stats/NodesStatsResponse.ts#L30-L32 type Response struct { ClusterName *string `json:"cluster_name,omitempty"` // NodeStats Contains statistics about the number of nodes selected by the request’s node diff --git a/typedapi/nodes/stats/stats.go b/typedapi/nodes/stats/stats.go index b2fbfd87f7..9269127d50 100644 --- a/typedapi/nodes/stats/stats.go +++ b/typedapi/nodes/stats/stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns statistical information about nodes in the cluster. package stats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -57,13 +56,17 @@ type Stats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string metric string indexmetric string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStats type alias for index. @@ -81,13 +84,18 @@ func NewStatsFunc(tp elastictransport.Interface) NewStats { // Returns statistical information about nodes in the cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-nodes-stats.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html func New(tp elastictransport.Interface) *Stats { r := &Stats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -117,6 +125,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("stats") @@ -129,6 +140,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("stats") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) method = http.MethodGet @@ -137,11 +151,17 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("stats") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) method = http.MethodGet @@ -152,9 +172,15 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("stats") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "indexmetric", r.indexmetric) + } path.WriteString(r.indexmetric) method = http.MethodGet @@ -163,14 +189,23 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("stats") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "indexmetric", r.indexmetric) + } path.WriteString(r.indexmetric) method = http.MethodGet @@ -184,9 +219,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -203,27 +238,66 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Stats) Perform(ctx context.Context) (*http.Response, error) { +func (r Stats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "nodes.stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.stats") + if reader := instrument.RecordRequestBody(ctx, "nodes.stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Stats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Stats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stats.Response -func (r Stats) Do(ctx context.Context) (*Response, error) { +func (r Stats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -231,6 +305,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -240,6 +317,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -247,12 +327,25 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Stats) IsSuccess(ctx context.Context) (bool, error) { +func (r Stats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -268,6 +361,14 @@ func (r Stats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Stats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/nodes/usage/response.go b/typedapi/nodes/usage/response.go index 992be64d1e..1d6c2efea4 100644 --- a/typedapi/nodes/usage/response.go +++ b/typedapi/nodes/usage/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package usage @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package usage // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/usage/NodesUsageResponse.ts#L30-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/usage/NodesUsageResponse.ts#L30-L32 type Response struct { ClusterName string `json:"cluster_name"` // NodeStats Contains statistics about the number of nodes selected by the request’s node diff --git a/typedapi/nodes/usage/usage.go b/typedapi/nodes/usage/usage.go index fc2013afd8..7d060eb08c 100644 --- a/typedapi/nodes/usage/usage.go +++ b/typedapi/nodes/usage/usage.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns low-level information about REST actions usage on nodes. package usage import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type Usage struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string metric string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUsage type alias for index. @@ -76,13 +79,18 @@ func NewUsageFunc(tp elastictransport.Interface) NewUsage { // Returns low-level information about REST actions usage on nodes. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-nodes-usage.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-usage.html func New(tp elastictransport.Interface) *Usage { r := &Usage{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,6 +120,9 @@ func (r *Usage) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("usage") @@ -124,6 +135,9 @@ func (r *Usage) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("usage") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) method = http.MethodGet @@ -132,11 +146,17 @@ func (r *Usage) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("usage") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) method = http.MethodGet @@ -150,9 +170,9 @@ func (r *Usage) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -169,27 +189,66 @@ func (r *Usage) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Usage) Perform(ctx context.Context) (*http.Response, error) { +func (r Usage) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "nodes.usage") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "nodes.usage") + if reader := instrument.RecordRequestBody(ctx, "nodes.usage", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "nodes.usage") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Usage query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Usage query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a usage.Response -func (r Usage) Do(ctx context.Context) (*Response, error) { +func (r Usage) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.usage") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -197,6 +256,9 @@ func (r Usage) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -206,6 +268,9 @@ func (r Usage) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -213,12 +278,25 @@ func (r Usage) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Usage) IsSuccess(ctx context.Context) (bool, error) { +func (r Usage) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "nodes.usage") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -234,6 +312,14 @@ func (r Usage) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Usage query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/queryruleset/delete/delete.go b/typedapi/queryruleset/delete/delete.go index 8e91d90875..97d0a0f94f 100644 --- a/typedapi/queryruleset/delete/delete.go +++ b/typedapi/queryruleset/delete/delete.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a query ruleset. package delete import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type Delete struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int rulesetid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDelete type alias for index. @@ -75,13 +78,18 @@ func NewDeleteFunc(tp elastictransport.Interface) NewDelete { // Deletes a query ruleset. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-query-ruleset.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-query-ruleset.html func New(tp elastictransport.Interface) *Delete { r := &Delete{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_query_rules") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "rulesetid", r.rulesetid) + } path.WriteString(r.rulesetid) method = http.MethodDelete @@ -117,9 +128,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Delete) Perform(ctx context.Context) (*http.Response, error) { +func (r Delete) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "query_ruleset.delete") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "query_ruleset.delete") + if reader := instrument.RecordRequestBody(ctx, "query_ruleset.delete", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "query_ruleset.delete") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Delete query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Delete query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a delete.Response -func (r Delete) Do(ctx context.Context) (*Response, error) { +func (r Delete) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Delete) IsSuccess(ctx context.Context) (bool, error) { +func (r Delete) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r Delete) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Delete query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/queryruleset/delete/response.go b/typedapi/queryruleset/delete/response.go index 3f24180f1e..e815407b77 100644 --- a/typedapi/queryruleset/delete/response.go +++ b/typedapi/queryruleset/delete/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package delete // Response holds the response body struct for the package delete // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/delete/QueryRulesetDeleteResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/delete/QueryRulesetDeleteResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/queryruleset/get/get.go b/typedapi/queryruleset/get/get.go index 7e05037acf..18a02071e4 100644 --- a/typedapi/queryruleset/get/get.go +++ b/typedapi/queryruleset/get/get.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the details about a query ruleset. package get import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type Get struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int rulesetid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGet type alias for index. @@ -75,13 +78,18 @@ func NewGetFunc(tp elastictransport.Interface) NewGet { // Returns the details about a query ruleset. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-query-ruleset.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-query-ruleset.html func New(tp elastictransport.Interface) *Get { r := &Get{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_query_rules") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "rulesetid", r.rulesetid) + } path.WriteString(r.rulesetid) method = http.MethodGet @@ -117,9 +128,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Get) Perform(ctx context.Context) (*http.Response, error) { +func (r Get) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "query_ruleset.get") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "query_ruleset.get") + if reader := instrument.RecordRequestBody(ctx, "query_ruleset.get", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "query_ruleset.get") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Get query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Get query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a get.Response -func (r Get) Do(ctx context.Context) (*Response, error) { +func (r Get) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Get) IsSuccess(ctx context.Context) (bool, error) { +func (r Get) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r Get) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Get query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/queryruleset/get/response.go b/typedapi/queryruleset/get/response.go index f6f3939315..25a9aa6182 100644 --- a/typedapi/queryruleset/get/response.go +++ b/typedapi/queryruleset/get/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package get @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package get // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/get/QueryRulesetGetResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/get/QueryRulesetGetResponse.ts#L22-L24 type Response struct { // Rules Rules associated with the query ruleset diff --git a/typedapi/queryruleset/list/list.go b/typedapi/queryruleset/list/list.go index ceed99c516..739fe0e9ab 100644 --- a/typedapi/queryruleset/list/list.go +++ b/typedapi/queryruleset/list/list.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Lists query rulesets. package list import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type List struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewList type alias for index. @@ -68,13 +71,18 @@ func NewListFunc(tp elastictransport.Interface) NewList { // Lists query rulesets. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/list-query-rulesets.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/list-query-rulesets.html func New(tp elastictransport.Interface) *List { r := &List{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,9 +115,9 @@ func (r *List) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -126,27 +134,66 @@ func (r *List) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r List) Perform(ctx context.Context) (*http.Response, error) { +func (r List) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "query_ruleset.list") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "query_ruleset.list") + if reader := instrument.RecordRequestBody(ctx, "query_ruleset.list", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "query_ruleset.list") + } if err != nil { - return nil, fmt.Errorf("an error happened during the List query execution: %w", err) + localErr := fmt.Errorf("an error happened during the List query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a list.Response -func (r List) Do(ctx context.Context) (*Response, error) { +func (r List) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -154,6 +201,9 @@ func (r List) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -163,6 +213,9 @@ func (r List) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -170,12 +223,25 @@ func (r List) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r List) IsSuccess(ctx context.Context) (bool, error) { +func (r List) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -191,6 +257,14 @@ func (r List) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the List query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/queryruleset/list/response.go b/typedapi/queryruleset/list/response.go index 05dbd8a36d..03e1b96891 100644 --- a/typedapi/queryruleset/list/response.go +++ b/typedapi/queryruleset/list/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package list @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package list // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/list/QueryRulesetListResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/list/QueryRulesetListResponse.ts#L23-L28 type Response struct { Count int64 `json:"count"` Results []types.QueryRulesetListItem `json:"results"` diff --git a/typedapi/queryruleset/put/put.go b/typedapi/queryruleset/put/put.go index 4e6d48e8c8..e773849d7b 100644 --- a/typedapi/queryruleset/put/put.go +++ b/typedapi/queryruleset/put/put.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates a query ruleset. package put @@ -50,15 +50,19 @@ type Put struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int rulesetid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPut type alias for index. @@ -78,17 +82,24 @@ func NewPutFunc(tp elastictransport.Interface) NewPut { // Creates or updates a query ruleset. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/put-query-ruleset.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/put-query-ruleset.html func New(tp elastictransport.Interface) *Put { r := &Put{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *Put) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *Put) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -147,6 +160,9 @@ func (r *Put) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_query_rules") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "rulesetid", r.rulesetid) + } path.WriteString(r.rulesetid) method = http.MethodPut @@ -160,15 +176,15 @@ func (r *Put) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -185,27 +201,66 @@ func (r *Put) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Put) Perform(ctx context.Context) (*http.Response, error) { +func (r Put) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "query_ruleset.put") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "query_ruleset.put") + if reader := instrument.RecordRequestBody(ctx, "query_ruleset.put", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "query_ruleset.put") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Put query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Put query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a put.Response -func (r Put) Do(ctx context.Context) (*Response, error) { +func (r Put) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "query_ruleset.put") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -213,6 +268,9 @@ func (r Put) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r Put) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +290,9 @@ func (r Put) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/queryruleset/put/request.go b/typedapi/queryruleset/put/request.go index 523217eec2..173b27c3b6 100644 --- a/typedapi/queryruleset/put/request.go +++ b/typedapi/queryruleset/put/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package put @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package put // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/put/QueryRulesetPutRequest.ts#L23-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/put/QueryRulesetPutRequest.ts#L23-L43 type Request struct { Rules []types.QueryRule `json:"rules"` } diff --git a/typedapi/queryruleset/put/response.go b/typedapi/queryruleset/put/response.go index 5c1a91c041..d48bb6f1e2 100644 --- a/typedapi/queryruleset/put/response.go +++ b/typedapi/queryruleset/put/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package put @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package put // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/put/QueryRulesetPutResponse.ts#L22-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/put/QueryRulesetPutResponse.ts#L22-L26 type Response struct { Result result.Result `json:"result"` } diff --git a/typedapi/rollup/deletejob/delete_job.go b/typedapi/rollup/deletejob/delete_job.go index 8b0647d5f2..220c93784d 100644 --- a/typedapi/rollup/deletejob/delete_job.go +++ b/typedapi/rollup/deletejob/delete_job.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an existing rollup job. package deletejob import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteJob type alias for index. @@ -75,13 +78,18 @@ func NewDeleteJobFunc(tp elastictransport.Interface) NewDeleteJob { // Deletes an existing rollup job. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-delete-job.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-delete-job.html func New(tp elastictransport.Interface) *DeleteJob { r := &DeleteJob{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeleteJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("job") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *DeleteJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *DeleteJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteJob) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "rollup.delete_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.delete_job") + if reader := instrument.RecordRequestBody(ctx, "rollup.delete_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.delete_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletejob.Response -func (r DeleteJob) Do(ctx context.Context) (*Response, error) { +func (r DeleteJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.delete_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r DeleteJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r DeleteJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r DeleteJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteJob) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteJob) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.delete_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r DeleteJob) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteJob query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/rollup/deletejob/response.go b/typedapi/rollup/deletejob/response.go index c1ac4ec47b..2f09603dad 100644 --- a/typedapi/rollup/deletejob/response.go +++ b/typedapi/rollup/deletejob/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletejob @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package deletejob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/delete_job/DeleteRollupJobResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/delete_job/DeleteRollupJobResponse.ts#L22-L27 type Response struct { Acknowledged bool `json:"acknowledged"` TaskFailures []types.TaskFailure `json:"task_failures,omitempty"` diff --git a/typedapi/rollup/getjobs/get_jobs.go b/typedapi/rollup/getjobs/get_jobs.go index 30eae40691..d380435372 100644 --- a/typedapi/rollup/getjobs/get_jobs.go +++ b/typedapi/rollup/getjobs/get_jobs.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves the configuration, stats, and status of rollup jobs. package getjobs import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type GetJobs struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetJobs type alias for index. @@ -73,13 +76,18 @@ func NewGetJobsFunc(tp elastictransport.Interface) NewGetJobs { // Retrieves the configuration, stats, and status of rollup jobs. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-job.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-get-job.html func New(tp elastictransport.Interface) *GetJobs { r := &GetJobs{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *GetJobs) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("job") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -124,9 +135,9 @@ func (r *GetJobs) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -143,27 +154,66 @@ func (r *GetJobs) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetJobs) Perform(ctx context.Context) (*http.Response, error) { +func (r GetJobs) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "rollup.get_jobs") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.get_jobs") + if reader := instrument.RecordRequestBody(ctx, "rollup.get_jobs", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.get_jobs") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetJobs query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetJobs query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getjobs.Response -func (r GetJobs) Do(ctx context.Context) (*Response, error) { +func (r GetJobs) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.get_jobs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -171,6 +221,9 @@ func (r GetJobs) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,6 +233,9 @@ func (r GetJobs) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,12 +243,25 @@ func (r GetJobs) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetJobs) IsSuccess(ctx context.Context) (bool, error) { +func (r GetJobs) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.get_jobs") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -208,6 +277,14 @@ func (r GetJobs) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetJobs query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/rollup/getjobs/response.go b/typedapi/rollup/getjobs/response.go index 0d5b0c3eb2..1f93091a40 100644 --- a/typedapi/rollup/getjobs/response.go +++ b/typedapi/rollup/getjobs/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getjobs @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getjobs // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_jobs/GetRollupJobResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_jobs/GetRollupJobResponse.ts#L22-L24 type Response struct { Jobs []types.RollupJob `json:"jobs"` } diff --git a/typedapi/rollup/getrollupcaps/get_rollup_caps.go b/typedapi/rollup/getrollupcaps/get_rollup_caps.go index fdc4c6ff15..93e44c6b9e 100644 --- a/typedapi/rollup/getrollupcaps/get_rollup_caps.go +++ b/typedapi/rollup/getrollupcaps/get_rollup_caps.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the capabilities of any rollup jobs that have been configured for a // specific index or index pattern. package getrollupcaps import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetRollupCaps struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetRollupCaps type alias for index. @@ -75,13 +78,18 @@ func NewGetRollupCapsFunc(tp elastictransport.Interface) NewGetRollupCaps { // Returns the capabilities of any rollup jobs that have been configured for a // specific index or index pattern. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-caps.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-get-rollup-caps.html func New(tp elastictransport.Interface) *GetRollupCaps { r := &GetRollupCaps{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *GetRollupCaps) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("data") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -126,9 +137,9 @@ func (r *GetRollupCaps) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -145,27 +156,66 @@ func (r *GetRollupCaps) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetRollupCaps) Perform(ctx context.Context) (*http.Response, error) { +func (r GetRollupCaps) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "rollup.get_rollup_caps") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.get_rollup_caps") + if reader := instrument.RecordRequestBody(ctx, "rollup.get_rollup_caps", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.get_rollup_caps") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetRollupCaps query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetRollupCaps query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getrollupcaps.Response -func (r GetRollupCaps) Do(ctx context.Context) (Response, error) { +func (r GetRollupCaps) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.get_rollup_caps") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -173,6 +223,9 @@ func (r GetRollupCaps) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,6 +235,9 @@ func (r GetRollupCaps) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,12 +245,25 @@ func (r GetRollupCaps) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetRollupCaps) IsSuccess(ctx context.Context) (bool, error) { +func (r GetRollupCaps) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.get_rollup_caps") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -210,6 +279,14 @@ func (r GetRollupCaps) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetRollupCaps query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/rollup/getrollupcaps/response.go b/typedapi/rollup/getrollupcaps/response.go index 299c991a40..5ec188c4ee 100644 --- a/typedapi/rollup/getrollupcaps/response.go +++ b/typedapi/rollup/getrollupcaps/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getrollupcaps @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getrollupcaps // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_rollup_caps/GetRollupCapabilitiesResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_rollup_caps/GetRollupCapabilitiesResponse.ts#L24-L26 type Response map[string]types.RollupCapabilities diff --git a/typedapi/rollup/getrollupindexcaps/get_rollup_index_caps.go b/typedapi/rollup/getrollupindexcaps/get_rollup_index_caps.go index 4781bff681..803257a67e 100644 --- a/typedapi/rollup/getrollupindexcaps/get_rollup_index_caps.go +++ b/typedapi/rollup/getrollupindexcaps/get_rollup_index_caps.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the rollup capabilities of all jobs inside of a rollup index (e.g. // the index where rollup data is stored). package getrollupindexcaps import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetRollupIndexCaps struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetRollupIndexCaps type alias for index. @@ -77,13 +80,18 @@ func NewGetRollupIndexCapsFunc(tp elastictransport.Interface) NewGetRollupIndexC // Returns the rollup capabilities of all jobs inside of a rollup index (e.g. // the index where rollup data is stored). // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-index-caps.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-get-rollup-index-caps.html func New(tp elastictransport.Interface) *GetRollupIndexCaps { r := &GetRollupIndexCaps{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *GetRollupIndexCaps) HttpRequest(ctx context.Context) (*http.Request, er case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_rollup") @@ -121,9 +132,9 @@ func (r *GetRollupIndexCaps) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *GetRollupIndexCaps) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetRollupIndexCaps) Perform(ctx context.Context) (*http.Response, error) { +func (r GetRollupIndexCaps) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "rollup.get_rollup_index_caps") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.get_rollup_index_caps") + if reader := instrument.RecordRequestBody(ctx, "rollup.get_rollup_index_caps", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.get_rollup_index_caps") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetRollupIndexCaps query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetRollupIndexCaps query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getrollupindexcaps.Response -func (r GetRollupIndexCaps) Do(ctx context.Context) (Response, error) { +func (r GetRollupIndexCaps) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.get_rollup_index_caps") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r GetRollupIndexCaps) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r GetRollupIndexCaps) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r GetRollupIndexCaps) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetRollupIndexCaps) IsSuccess(ctx context.Context) (bool, error) { +func (r GetRollupIndexCaps) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.get_rollup_index_caps") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r GetRollupIndexCaps) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetRollupIndexCaps query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/rollup/getrollupindexcaps/response.go b/typedapi/rollup/getrollupindexcaps/response.go index 34b24bdbf5..41ec7aab74 100644 --- a/typedapi/rollup/getrollupindexcaps/response.go +++ b/typedapi/rollup/getrollupindexcaps/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getrollupindexcaps @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getrollupindexcaps // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_rollup_index_caps/GetRollupIndexCapabilitiesResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_rollup_index_caps/GetRollupIndexCapabilitiesResponse.ts#L24-L26 type Response map[string]types.IndexCapabilities diff --git a/typedapi/rollup/putjob/put_job.go b/typedapi/rollup/putjob/put_job.go index c84f6854db..23c26bd9c1 100644 --- a/typedapi/rollup/putjob/put_job.go +++ b/typedapi/rollup/putjob/put_job.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a rollup job. package putjob @@ -50,15 +50,19 @@ type PutJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutJob type alias for index. @@ -78,17 +82,24 @@ func NewPutJobFunc(tp elastictransport.Interface) NewPutJob { // Creates a rollup job. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-put-job.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-put-job.html func New(tp elastictransport.Interface) *PutJob { r := &PutJob{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutJob) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutJob) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("job") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPut @@ -162,15 +178,15 @@ func (r *PutJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *PutJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutJob) Perform(ctx context.Context) (*http.Response, error) { +func (r PutJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "rollup.put_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.put_job") + if reader := instrument.RecordRequestBody(ctx, "rollup.put_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.put_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putjob.Response -func (r PutJob) Do(ctx context.Context) (*Response, error) { +func (r PutJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.put_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r PutJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r PutJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r PutJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/rollup/putjob/request.go b/typedapi/rollup/putjob/request.go index 6ac94fe27b..887c8ad4db 100644 --- a/typedapi/rollup/putjob/request.go +++ b/typedapi/rollup/putjob/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putjob @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/put_job/CreateRollupJobRequest.ts#L27-L89 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/put_job/CreateRollupJobRequest.ts#L27-L89 type Request struct { // Cron A cron string which defines the intervals when the rollup job should be diff --git a/typedapi/rollup/putjob/response.go b/typedapi/rollup/putjob/response.go index efb0a41dea..c83cefb1dc 100644 --- a/typedapi/rollup/putjob/response.go +++ b/typedapi/rollup/putjob/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putjob // Response holds the response body struct for the package putjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/put_job/CreateRollupJobResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/put_job/CreateRollupJobResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/rollup/rollupsearch/request.go b/typedapi/rollup/rollupsearch/request.go index f503a25a1d..7d533ea79c 100644 --- a/typedapi/rollup/rollupsearch/request.go +++ b/typedapi/rollup/rollupsearch/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package rollupsearch @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package rollupsearch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/rollup_search/RollupSearchRequest.ts#L27-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/rollup_search/RollupSearchRequest.ts#L27-L57 type Request struct { // Aggregations Specifies aggregations. diff --git a/typedapi/rollup/rollupsearch/response.go b/typedapi/rollup/rollupsearch/response.go index 0dbd6be064..1fa004b889 100644 --- a/typedapi/rollup/rollupsearch/response.go +++ b/typedapi/rollup/rollupsearch/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package rollupsearch @@ -33,8 +33,7 @@ import ( // Response holds the response body struct for the package rollupsearch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/rollup_search/RollupSearchResponse.ts#L27-L36 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/rollup_search/RollupSearchResponse.ts#L27-L36 type Response struct { Aggregations map[string]types.Aggregate `json:"aggregations,omitempty"` Hits types.HitsMetadata `json:"hits"` diff --git a/typedapi/rollup/rollupsearch/rollup_search.go b/typedapi/rollup/rollupsearch/rollup_search.go index f656540a0f..472c3b2eeb 100644 --- a/typedapi/rollup/rollupsearch/rollup_search.go +++ b/typedapi/rollup/rollupsearch/rollup_search.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Enables searching rolled-up data using the standard query DSL. package rollupsearch @@ -51,15 +51,19 @@ type RollupSearch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRollupSearch type alias for index. @@ -79,17 +83,24 @@ func NewRollupSearchFunc(tp elastictransport.Interface) NewRollupSearch { // Enables searching rolled-up data using the standard query DSL. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-search.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-search.html func New(tp elastictransport.Interface) *RollupSearch { r := &RollupSearch{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *RollupSearch) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,12 +149,19 @@ func (r *RollupSearch) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_rollup_search") @@ -161,15 +177,15 @@ func (r *RollupSearch) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -186,22 +202,58 @@ func (r *RollupSearch) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r RollupSearch) Perform(ctx context.Context) (*http.Response, error) { +func (r RollupSearch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "rollup.rollup_search") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.rollup_search") + if reader := instrument.RecordRequestBody(ctx, "rollup.rollup_search", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.rollup_search") + } if err != nil { - return nil, fmt.Errorf("an error happened during the RollupSearch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the RollupSearch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a rollupsearch.Response -func (r RollupSearch) Do(ctx context.Context) (*Response, error) { +func (r RollupSearch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.rollup_search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() @@ -209,6 +261,9 @@ func (r RollupSearch) Do(ctx context.Context) (*Response, error) { res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -216,6 +271,9 @@ func (r RollupSearch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -225,6 +283,9 @@ func (r RollupSearch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +293,9 @@ func (r RollupSearch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/rollup/startjob/response.go b/typedapi/rollup/startjob/response.go index 77fe987ea3..d251c737c0 100644 --- a/typedapi/rollup/startjob/response.go +++ b/typedapi/rollup/startjob/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package startjob // Response holds the response body struct for the package startjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/start_job/StartRollupJobResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/start_job/StartRollupJobResponse.ts#L20-L22 type Response struct { Started bool `json:"started"` } diff --git a/typedapi/rollup/startjob/start_job.go b/typedapi/rollup/startjob/start_job.go index 71a7d1982b..908affd3e1 100644 --- a/typedapi/rollup/startjob/start_job.go +++ b/typedapi/rollup/startjob/start_job.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Starts an existing, stopped rollup job. package startjob import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type StartJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStartJob type alias for index. @@ -75,13 +78,18 @@ func NewStartJobFunc(tp elastictransport.Interface) NewStartJob { // Starts an existing, stopped rollup job. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-start-job.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-start-job.html func New(tp elastictransport.Interface) *StartJob { r := &StartJob{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *StartJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("job") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") path.WriteString("_start") @@ -121,9 +132,9 @@ func (r *StartJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *StartJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r StartJob) Perform(ctx context.Context) (*http.Response, error) { +func (r StartJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "rollup.start_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.start_job") + if reader := instrument.RecordRequestBody(ctx, "rollup.start_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.start_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the StartJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the StartJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a startjob.Response -func (r StartJob) Do(ctx context.Context) (*Response, error) { +func (r StartJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.start_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r StartJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r StartJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r StartJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r StartJob) IsSuccess(ctx context.Context) (bool, error) { +func (r StartJob) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.start_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r StartJob) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the StartJob query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/rollup/stopjob/response.go b/typedapi/rollup/stopjob/response.go index d971638944..b0d7d82302 100644 --- a/typedapi/rollup/stopjob/response.go +++ b/typedapi/rollup/stopjob/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stopjob // Response holds the response body struct for the package stopjob // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/stop_job/StopRollupJobResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/stop_job/StopRollupJobResponse.ts#L20-L22 type Response struct { Stopped bool `json:"stopped"` } diff --git a/typedapi/rollup/stopjob/stop_job.go b/typedapi/rollup/stopjob/stop_job.go index 3d2dcc6f09..7cd116c1ad 100644 --- a/typedapi/rollup/stopjob/stop_job.go +++ b/typedapi/rollup/stopjob/stop_job.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Stops an existing, started rollup job. package stopjob import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type StopJob struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStopJob type alias for index. @@ -76,13 +79,18 @@ func NewStopJobFunc(tp elastictransport.Interface) NewStopJob { // Stops an existing, started rollup job. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-stop-job.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-stop-job.html func New(tp elastictransport.Interface) *StopJob { r := &StopJob{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *StopJob) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("job") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") path.WriteString("_stop") @@ -122,9 +133,9 @@ func (r *StopJob) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *StopJob) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r StopJob) Perform(ctx context.Context) (*http.Response, error) { +func (r StopJob) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "rollup.stop_job") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "rollup.stop_job") + if reader := instrument.RecordRequestBody(ctx, "rollup.stop_job", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "rollup.stop_job") + } if err != nil { - return nil, fmt.Errorf("an error happened during the StopJob query execution: %w", err) + localErr := fmt.Errorf("an error happened during the StopJob query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stopjob.Response -func (r StopJob) Do(ctx context.Context) (*Response, error) { +func (r StopJob) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.stop_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r StopJob) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r StopJob) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r StopJob) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r StopJob) IsSuccess(ctx context.Context) (bool, error) { +func (r StopJob) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "rollup.stop_job") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r StopJob) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the StopJob query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/searchablesnapshots/cachestats/cache_stats.go b/typedapi/searchablesnapshots/cachestats/cache_stats.go index bf6b1bc65b..884b2e363e 100644 --- a/typedapi/searchablesnapshots/cachestats/cache_stats.go +++ b/typedapi/searchablesnapshots/cachestats/cache_stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieve node-level cache statistics about searchable snapshots. package cachestats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type CacheStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCacheStats type alias for index. @@ -73,13 +76,18 @@ func NewCacheStatsFunc(tp elastictransport.Interface) NewCacheStats { // Retrieve node-level cache statistics about searchable snapshots. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-apis.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html func New(tp elastictransport.Interface) *CacheStats { r := &CacheStats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,6 +119,9 @@ func (r *CacheStats) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_searchable_snapshots") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("cache") @@ -128,9 +139,9 @@ func (r *CacheStats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -147,27 +158,66 @@ func (r *CacheStats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r CacheStats) Perform(ctx context.Context) (*http.Response, error) { +func (r CacheStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "searchable_snapshots.cache_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "searchable_snapshots.cache_stats") + if reader := instrument.RecordRequestBody(ctx, "searchable_snapshots.cache_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "searchable_snapshots.cache_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the CacheStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the CacheStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a cachestats.Response -func (r CacheStats) Do(ctx context.Context) (*Response, error) { +func (r CacheStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.cache_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -175,6 +225,9 @@ func (r CacheStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,6 +237,9 @@ func (r CacheStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -191,12 +247,25 @@ func (r CacheStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r CacheStats) IsSuccess(ctx context.Context) (bool, error) { +func (r CacheStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.cache_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -212,6 +281,14 @@ func (r CacheStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the CacheStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/searchablesnapshots/cachestats/response.go b/typedapi/searchablesnapshots/cachestats/response.go index d0ec86c572..74a58e15ad 100644 --- a/typedapi/searchablesnapshots/cachestats/response.go +++ b/typedapi/searchablesnapshots/cachestats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package cachestats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package cachestats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/searchable_snapshots/cache_stats/Response.ts#L24-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/searchable_snapshots/cache_stats/Response.ts#L24-L28 type Response struct { Nodes map[string]types.Node `json:"nodes"` } diff --git a/typedapi/searchablesnapshots/clearcache/clear_cache.go b/typedapi/searchablesnapshots/clearcache/clear_cache.go index ad7ca1011b..38851bff95 100644 --- a/typedapi/searchablesnapshots/clearcache/clear_cache.go +++ b/typedapi/searchablesnapshots/clearcache/clear_cache.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Clear the cache of searchable snapshots. package clearcache import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type ClearCache struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearCache type alias for index. @@ -75,13 +78,18 @@ func NewClearCacheFunc(tp elastictransport.Interface) NewClearCache { // Clear the cache of searchable snapshots. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-apis.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html func New(tp elastictransport.Interface) *ClearCache { r := &ClearCache{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,6 +119,9 @@ func (r *ClearCache) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_searchable_snapshots") @@ -130,9 +141,9 @@ func (r *ClearCache) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -149,27 +160,66 @@ func (r *ClearCache) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearCache) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearCache) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "searchable_snapshots.clear_cache") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "searchable_snapshots.clear_cache") + if reader := instrument.RecordRequestBody(ctx, "searchable_snapshots.clear_cache", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "searchable_snapshots.clear_cache") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearCache query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearCache query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clearcache.Response -func (r ClearCache) Do(ctx context.Context) (Response, error) { +func (r ClearCache) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.clear_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := new(Response) res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -177,6 +227,9 @@ func (r ClearCache) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -186,6 +239,9 @@ func (r ClearCache) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -193,12 +249,25 @@ func (r ClearCache) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ClearCache) IsSuccess(ctx context.Context) (bool, error) { +func (r ClearCache) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.clear_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -214,6 +283,14 @@ func (r ClearCache) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ClearCache query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/searchablesnapshots/clearcache/response.go b/typedapi/searchablesnapshots/clearcache/response.go index 70b246268e..22087c25cf 100644 --- a/typedapi/searchablesnapshots/clearcache/response.go +++ b/typedapi/searchablesnapshots/clearcache/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearcache @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package clearcache // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/searchable_snapshots/clear_cache/SearchableSnapshotsClearCacheResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/searchable_snapshots/clear_cache/SearchableSnapshotsClearCacheResponse.ts#L22-L24 type Response = json.RawMessage diff --git a/typedapi/searchablesnapshots/mount/mount.go b/typedapi/searchablesnapshots/mount/mount.go index 4936f5f73c..1e4ee29f8b 100644 --- a/typedapi/searchablesnapshots/mount/mount.go +++ b/typedapi/searchablesnapshots/mount/mount.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Mount a snapshot as a searchable index. package mount @@ -53,16 +53,20 @@ type Mount struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int repository string snapshot string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewMount type alias for index. @@ -84,17 +88,24 @@ func NewMountFunc(tp elastictransport.Interface) NewMount { // Mount a snapshot as a searchable index. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-mount-snapshot.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-mount-snapshot.html func New(tp elastictransport.Interface) *Mount { r := &Mount{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -131,9 +142,7 @@ func (r *Mount) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -145,6 +154,10 @@ func (r *Mount) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,9 +166,15 @@ func (r *Mount) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.snapshot) + } path.WriteString(r.snapshot) path.WriteString("/") path.WriteString("_mount") @@ -171,15 +190,15 @@ func (r *Mount) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -196,27 +215,66 @@ func (r *Mount) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Mount) Perform(ctx context.Context) (*http.Response, error) { +func (r Mount) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "searchable_snapshots.mount") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "searchable_snapshots.mount") + if reader := instrument.RecordRequestBody(ctx, "searchable_snapshots.mount", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "searchable_snapshots.mount") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Mount query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Mount query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a mount.Response -func (r Mount) Do(ctx context.Context) (*Response, error) { +func (r Mount) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.mount") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -224,6 +282,9 @@ func (r Mount) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r Mount) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -240,6 +304,9 @@ func (r Mount) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/searchablesnapshots/mount/request.go b/typedapi/searchablesnapshots/mount/request.go index 20dad2d945..44217b855c 100644 --- a/typedapi/searchablesnapshots/mount/request.go +++ b/typedapi/searchablesnapshots/mount/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package mount @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package mount // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/searchable_snapshots/mount/SearchableSnapshotsMountRequest.ts#L26-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/searchable_snapshots/mount/SearchableSnapshotsMountRequest.ts#L26-L49 type Request struct { IgnoreIndexSettings []string `json:"ignore_index_settings,omitempty"` Index string `json:"index"` diff --git a/typedapi/searchablesnapshots/mount/response.go b/typedapi/searchablesnapshots/mount/response.go index 2ef31a76ae..fb9b16a2ab 100644 --- a/typedapi/searchablesnapshots/mount/response.go +++ b/typedapi/searchablesnapshots/mount/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package mount @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package mount // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/searchable_snapshots/mount/SearchableSnapshotsMountResponse.ts#L22-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/searchable_snapshots/mount/SearchableSnapshotsMountResponse.ts#L22-L26 type Response struct { Snapshot types.MountedSnapshot `json:"snapshot"` } diff --git a/typedapi/searchablesnapshots/stats/response.go b/typedapi/searchablesnapshots/stats/response.go index 4a3b786f75..b54d8de017 100644 --- a/typedapi/searchablesnapshots/stats/response.go +++ b/typedapi/searchablesnapshots/stats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package stats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/searchable_snapshots/stats/SearchableSnapshotsStatsResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/searchable_snapshots/stats/SearchableSnapshotsStatsResponse.ts#L22-L27 type Response struct { Stats json.RawMessage `json:"stats,omitempty"` Total json.RawMessage `json:"total,omitempty"` diff --git a/typedapi/searchablesnapshots/stats/stats.go b/typedapi/searchablesnapshots/stats/stats.go index aa0e6ee61e..c9fcd9c988 100644 --- a/typedapi/searchablesnapshots/stats/stats.go +++ b/typedapi/searchablesnapshots/stats/stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieve shard-level statistics about searchable snapshots. package stats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Stats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int index string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStats type alias for index. @@ -74,13 +77,18 @@ func NewStatsFunc(tp elastictransport.Interface) NewStats { // Retrieve shard-level statistics about searchable snapshots. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-apis.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html func New(tp elastictransport.Interface) *Stats { r := &Stats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { case r.paramSet == indexMask: path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "index", r.index) + } path.WriteString(r.index) path.WriteString("/") path.WriteString("_searchable_snapshots") @@ -125,9 +136,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Stats) Perform(ctx context.Context) (*http.Response, error) { +func (r Stats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "searchable_snapshots.stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "searchable_snapshots.stats") + if reader := instrument.RecordRequestBody(ctx, "searchable_snapshots.stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "searchable_snapshots.stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Stats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Stats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stats.Response -func (r Stats) Do(ctx context.Context) (*Response, error) { +func (r Stats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Stats) IsSuccess(ctx context.Context) (bool, error) { +func (r Stats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "searchable_snapshots.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r Stats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Stats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/searchapplication/delete/delete.go b/typedapi/searchapplication/delete/delete.go index 0729552e1a..aa99996f6e 100644 --- a/typedapi/searchapplication/delete/delete.go +++ b/typedapi/searchapplication/delete/delete.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a search application. package delete import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type Delete struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDelete type alias for index. @@ -75,13 +78,18 @@ func NewDeleteFunc(tp elastictransport.Interface) NewDelete { // Deletes a search application. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/put-search-application.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-search-application.html func New(tp elastictransport.Interface) *Delete { r := &Delete{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("search_application") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Delete) Perform(ctx context.Context) (*http.Response, error) { +func (r Delete) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_application.delete") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.delete") + if reader := instrument.RecordRequestBody(ctx, "search_application.delete", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.delete") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Delete query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Delete query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a delete.Response -func (r Delete) Do(ctx context.Context) (*Response, error) { +func (r Delete) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Delete) IsSuccess(ctx context.Context) (bool, error) { +func (r Delete) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r Delete) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Delete query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/searchapplication/delete/response.go b/typedapi/searchapplication/delete/response.go index 8af7f6dd40..4794278517 100644 --- a/typedapi/searchapplication/delete/response.go +++ b/typedapi/searchapplication/delete/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package delete // Response holds the response body struct for the package delete // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/delete/SearchApplicationsDeleteResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/delete/SearchApplicationsDeleteResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/searchapplication/deletebehavioralanalytics/delete_behavioral_analytics.go b/typedapi/searchapplication/deletebehavioralanalytics/delete_behavioral_analytics.go index 9632341146..58b8712579 100644 --- a/typedapi/searchapplication/deletebehavioralanalytics/delete_behavioral_analytics.go +++ b/typedapi/searchapplication/deletebehavioralanalytics/delete_behavioral_analytics.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Delete a behavioral analytics collection. package deletebehavioralanalytics import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteBehavioralAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteBehavioralAnalytics type alias for index. @@ -75,13 +78,18 @@ func NewDeleteBehavioralAnalyticsFunc(tp elastictransport.Interface) NewDeleteBe // Delete a behavioral analytics collection. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-analytics-collection.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-analytics-collection.html func New(tp elastictransport.Interface) *DeleteBehavioralAnalytics { r := &DeleteBehavioralAnalytics{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeleteBehavioralAnalytics) HttpRequest(ctx context.Context) (*http.Requ path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *DeleteBehavioralAnalytics) HttpRequest(ctx context.Context) (*http.Requ } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *DeleteBehavioralAnalytics) HttpRequest(ctx context.Context) (*http.Requ } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteBehavioralAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteBehavioralAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_application.delete_behavioral_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.delete_behavioral_analytics") + if reader := instrument.RecordRequestBody(ctx, "search_application.delete_behavioral_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.delete_behavioral_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteBehavioralAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteBehavioralAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletebehavioralanalytics.Response -func (r DeleteBehavioralAnalytics) Do(ctx context.Context) (*Response, error) { +func (r DeleteBehavioralAnalytics) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.delete_behavioral_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r DeleteBehavioralAnalytics) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r DeleteBehavioralAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r DeleteBehavioralAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteBehavioralAnalytics) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteBehavioralAnalytics) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.delete_behavioral_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r DeleteBehavioralAnalytics) IsSuccess(ctx context.Context) (bool, error) return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteBehavioralAnalytics query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/searchapplication/deletebehavioralanalytics/response.go b/typedapi/searchapplication/deletebehavioralanalytics/response.go index 76e5defce5..dfc5ab2177 100644 --- a/typedapi/searchapplication/deletebehavioralanalytics/response.go +++ b/typedapi/searchapplication/deletebehavioralanalytics/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletebehavioralanalytics // Response holds the response body struct for the package deletebehavioralanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/delete_behavioral_analytics/BehavioralAnalyticsDeleteResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/delete_behavioral_analytics/BehavioralAnalyticsDeleteResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/searchapplication/get/get.go b/typedapi/searchapplication/get/get.go index 28761263fa..7decee7ff0 100644 --- a/typedapi/searchapplication/get/get.go +++ b/typedapi/searchapplication/get/get.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the details about a search application. package get import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type Get struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGet type alias for index. @@ -75,13 +78,18 @@ func NewGetFunc(tp elastictransport.Interface) NewGet { // Returns the details about a search application. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-search-application.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-search-application.html func New(tp elastictransport.Interface) *Get { r := &Get{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("search_application") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -119,9 +130,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Get) Perform(ctx context.Context) (*http.Response, error) { +func (r Get) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_application.get") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.get") + if reader := instrument.RecordRequestBody(ctx, "search_application.get", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.get") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Get query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Get query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a get.Response -func (r Get) Do(ctx context.Context) (*Response, error) { +func (r Get) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Get) IsSuccess(ctx context.Context) (bool, error) { +func (r Get) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r Get) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Get query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/searchapplication/get/response.go b/typedapi/searchapplication/get/response.go index d296a041cf..0bbdc5b152 100644 --- a/typedapi/searchapplication/get/response.go +++ b/typedapi/searchapplication/get/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package get @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package get // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/get/SearchApplicationsGetResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/get/SearchApplicationsGetResponse.ts#L22-L24 type Response struct { // AnalyticsCollectionName Analytics collection associated to the Search Application. diff --git a/typedapi/searchapplication/getbehavioralanalytics/get_behavioral_analytics.go b/typedapi/searchapplication/getbehavioralanalytics/get_behavioral_analytics.go index 9794367eb5..f6c1619611 100644 --- a/typedapi/searchapplication/getbehavioralanalytics/get_behavioral_analytics.go +++ b/typedapi/searchapplication/getbehavioralanalytics/get_behavioral_analytics.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the existing behavioral analytics collections. package getbehavioralanalytics import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type GetBehavioralAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetBehavioralAnalytics type alias for index. @@ -73,13 +76,18 @@ func NewGetBehavioralAnalyticsFunc(tp elastictransport.Interface) NewGetBehavior // Returns the existing behavioral analytics collections. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/list-analytics-collection.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/list-analytics-collection.html func New(tp elastictransport.Interface) *GetBehavioralAnalytics { r := &GetBehavioralAnalytics{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,6 +119,9 @@ func (r *GetBehavioralAnalytics) HttpRequest(ctx context.Context) (*http.Request path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -124,9 +135,9 @@ func (r *GetBehavioralAnalytics) HttpRequest(ctx context.Context) (*http.Request } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -143,27 +154,66 @@ func (r *GetBehavioralAnalytics) HttpRequest(ctx context.Context) (*http.Request } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetBehavioralAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r GetBehavioralAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_application.get_behavioral_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.get_behavioral_analytics") + if reader := instrument.RecordRequestBody(ctx, "search_application.get_behavioral_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.get_behavioral_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetBehavioralAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetBehavioralAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getbehavioralanalytics.Response -func (r GetBehavioralAnalytics) Do(ctx context.Context) (Response, error) { +func (r GetBehavioralAnalytics) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.get_behavioral_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -171,6 +221,9 @@ func (r GetBehavioralAnalytics) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,6 +233,9 @@ func (r GetBehavioralAnalytics) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,12 +243,25 @@ func (r GetBehavioralAnalytics) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetBehavioralAnalytics) IsSuccess(ctx context.Context) (bool, error) { +func (r GetBehavioralAnalytics) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.get_behavioral_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -208,6 +277,14 @@ func (r GetBehavioralAnalytics) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetBehavioralAnalytics query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/searchapplication/getbehavioralanalytics/response.go b/typedapi/searchapplication/getbehavioralanalytics/response.go index 92bdd47b8b..daf0f108a2 100644 --- a/typedapi/searchapplication/getbehavioralanalytics/response.go +++ b/typedapi/searchapplication/getbehavioralanalytics/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getbehavioralanalytics @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getbehavioralanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/get_behavioral_analytics/BehavioralAnalyticsGetResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/get_behavioral_analytics/BehavioralAnalyticsGetResponse.ts#L24-L26 type Response map[string]types.AnalyticsCollection diff --git a/typedapi/searchapplication/list/list.go b/typedapi/searchapplication/list/list.go index 56b8ce49a5..310d864d97 100644 --- a/typedapi/searchapplication/list/list.go +++ b/typedapi/searchapplication/list/list.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the existing search applications. package list import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type List struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewList type alias for index. @@ -68,13 +71,18 @@ func NewListFunc(tp elastictransport.Interface) NewList { // Returns the existing search applications. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/list-search-applications.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/list-search-applications.html func New(tp elastictransport.Interface) *List { r := &List{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,9 +117,9 @@ func (r *List) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -128,27 +136,66 @@ func (r *List) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r List) Perform(ctx context.Context) (*http.Response, error) { +func (r List) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_application.list") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.list") + if reader := instrument.RecordRequestBody(ctx, "search_application.list", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.list") + } if err != nil { - return nil, fmt.Errorf("an error happened during the List query execution: %w", err) + localErr := fmt.Errorf("an error happened during the List query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a list.Response -func (r List) Do(ctx context.Context) (*Response, error) { +func (r List) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -156,6 +203,9 @@ func (r List) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -165,6 +215,9 @@ func (r List) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -172,12 +225,25 @@ func (r List) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r List) IsSuccess(ctx context.Context) (bool, error) { +func (r List) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -193,6 +259,14 @@ func (r List) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the List query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/searchapplication/list/response.go b/typedapi/searchapplication/list/response.go index aa409c596c..b8b971d88f 100644 --- a/typedapi/searchapplication/list/response.go +++ b/typedapi/searchapplication/list/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package list @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package list // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/list/SearchApplicationsListResponse.ts#L24-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/list/SearchApplicationsListResponse.ts#L24-L29 type Response struct { Count int64 `json:"count"` Results []types.SearchApplicationListItem `json:"results"` diff --git a/typedapi/searchapplication/put/put.go b/typedapi/searchapplication/put/put.go index a613cbecb1..d1dd493000 100644 --- a/typedapi/searchapplication/put/put.go +++ b/typedapi/searchapplication/put/put.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates a search application. package put @@ -51,15 +51,19 @@ type Put struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPut type alias for index. @@ -79,13 +83,20 @@ func NewPutFunc(tp elastictransport.Interface) NewPut { // Creates or updates a search application. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/put-search-application.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/put-search-application.html func New(tp elastictransport.Interface) *Put { r := &Put{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -124,9 +135,7 @@ func (r *Put) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -138,6 +147,10 @@ func (r *Put) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -148,6 +161,9 @@ func (r *Put) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("search_application") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -161,15 +177,15 @@ func (r *Put) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -186,27 +202,66 @@ func (r *Put) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Put) Perform(ctx context.Context) (*http.Response, error) { +func (r Put) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_application.put") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.put") + if reader := instrument.RecordRequestBody(ctx, "search_application.put", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.put") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Put query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Put query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a put.Response -func (r Put) Do(ctx context.Context) (*Response, error) { +func (r Put) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.put") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -214,6 +269,9 @@ func (r Put) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r Put) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +291,9 @@ func (r Put) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/searchapplication/put/request.go b/typedapi/searchapplication/put/request.go index 6bae430023..6a97541971 100644 --- a/typedapi/searchapplication/put/request.go +++ b/typedapi/searchapplication/put/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package put @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package put // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/put/SearchApplicationsPutRequest.ts#L23-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/put/SearchApplicationsPutRequest.ts#L23-L48 type Request = types.SearchApplication diff --git a/typedapi/searchapplication/put/response.go b/typedapi/searchapplication/put/response.go index 906fba3bbf..964dae9d58 100644 --- a/typedapi/searchapplication/put/response.go +++ b/typedapi/searchapplication/put/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package put @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package put // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/put/SearchApplicationsPutResponse.ts#L22-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/put/SearchApplicationsPutResponse.ts#L22-L26 type Response struct { Result result.Result `json:"result"` } diff --git a/typedapi/searchapplication/putbehavioralanalytics/put_behavioral_analytics.go b/typedapi/searchapplication/putbehavioralanalytics/put_behavioral_analytics.go index a8e437e311..88d8c45ff8 100644 --- a/typedapi/searchapplication/putbehavioralanalytics/put_behavioral_analytics.go +++ b/typedapi/searchapplication/putbehavioralanalytics/put_behavioral_analytics.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a behavioral analytics collection. package putbehavioralanalytics import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type PutBehavioralAnalytics struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutBehavioralAnalytics type alias for index. @@ -75,13 +78,18 @@ func NewPutBehavioralAnalyticsFunc(tp elastictransport.Interface) NewPutBehavior // Creates a behavioral analytics collection. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/put-analytics-collection.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/put-analytics-collection.html func New(tp elastictransport.Interface) *PutBehavioralAnalytics { r := &PutBehavioralAnalytics{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *PutBehavioralAnalytics) HttpRequest(ctx context.Context) (*http.Request path.WriteString("analytics") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -119,9 +130,9 @@ func (r *PutBehavioralAnalytics) HttpRequest(ctx context.Context) (*http.Request } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *PutBehavioralAnalytics) HttpRequest(ctx context.Context) (*http.Request } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutBehavioralAnalytics) Perform(ctx context.Context) (*http.Response, error) { +func (r PutBehavioralAnalytics) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_application.put_behavioral_analytics") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.put_behavioral_analytics") + if reader := instrument.RecordRequestBody(ctx, "search_application.put_behavioral_analytics", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.put_behavioral_analytics") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutBehavioralAnalytics query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutBehavioralAnalytics query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putbehavioralanalytics.Response -func (r PutBehavioralAnalytics) Do(ctx context.Context) (*Response, error) { +func (r PutBehavioralAnalytics) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.put_behavioral_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r PutBehavioralAnalytics) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r PutBehavioralAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r PutBehavioralAnalytics) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r PutBehavioralAnalytics) IsSuccess(ctx context.Context) (bool, error) { +func (r PutBehavioralAnalytics) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.put_behavioral_analytics") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r PutBehavioralAnalytics) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the PutBehavioralAnalytics query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/searchapplication/putbehavioralanalytics/response.go b/typedapi/searchapplication/putbehavioralanalytics/response.go index 1ad63e1ed1..0ff4b9978a 100644 --- a/typedapi/searchapplication/putbehavioralanalytics/response.go +++ b/typedapi/searchapplication/putbehavioralanalytics/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putbehavioralanalytics // Response holds the response body struct for the package putbehavioralanalytics // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/put_behavioral_analytics/BehavioralAnalyticsPutResponse.ts#L24-L26 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/put_behavioral_analytics/BehavioralAnalyticsPutResponse.ts#L24-L26 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/searchapplication/search/request.go b/typedapi/searchapplication/search/request.go index a317fe406b..f1493b39c6 100644 --- a/typedapi/searchapplication/search/request.go +++ b/typedapi/searchapplication/search/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package search @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package search // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/search/SearchApplicationsSearchRequest.ts#L24-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/search/SearchApplicationsSearchRequest.ts#L24-L43 type Request struct { // Params Query parameters specific to this request, which will override any defaults diff --git a/typedapi/searchapplication/search/response.go b/typedapi/searchapplication/search/response.go index c82c64219a..00115a5803 100644 --- a/typedapi/searchapplication/search/response.go +++ b/typedapi/searchapplication/search/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package search @@ -33,8 +33,7 @@ import ( // Response holds the response body struct for the package search // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/search/SearchApplicationsSearchResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/search/SearchApplicationsSearchResponse.ts#L23-L25 type Response struct { Aggregations map[string]types.Aggregate `json:"aggregations,omitempty"` Clusters_ *types.ClusterStatistics `json:"_clusters,omitempty"` diff --git a/typedapi/searchapplication/search/search.go b/typedapi/searchapplication/search/search.go index 351fae0230..088cbe4017 100644 --- a/typedapi/searchapplication/search/search.go +++ b/typedapi/searchapplication/search/search.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Perform a search against a search application package search @@ -50,15 +50,19 @@ type Search struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSearch type alias for index. @@ -78,17 +82,24 @@ func NewSearchFunc(tp elastictransport.Interface) NewSearch { // Perform a search against a search application // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/search-application-search.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-application-search.html func New(tp elastictransport.Interface) *Search { r := &Search{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("search_application") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) path.WriteString("/") path.WriteString("_search") @@ -164,15 +180,15 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Search) Perform(ctx context.Context) (*http.Response, error) { +func (r Search) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "search_application.search") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "search_application.search") + if reader := instrument.RecordRequestBody(ctx, "search_application.search", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "search_application.search") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Search query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Search query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a search.Response -func (r Search) Do(ctx context.Context) (*Response, error) { +func (r Search) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "search_application.search") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r Search) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/activateuserprofile/activate_user_profile.go b/typedapi/security/activateuserprofile/activate_user_profile.go index 389245b8c8..065d40512b 100644 --- a/typedapi/security/activateuserprofile/activate_user_profile.go +++ b/typedapi/security/activateuserprofile/activate_user_profile.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates the user profile on behalf of another user. package activateuserprofile @@ -47,13 +47,17 @@ type ActivateUserProfile struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewActivateUserProfile type alias for index. @@ -77,11 +81,18 @@ func New(tp elastictransport.Interface) *ActivateUserProfile { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -118,9 +129,7 @@ func (r *ActivateUserProfile) HttpRequest(ctx context.Context) (*http.Request, e } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -132,6 +141,10 @@ func (r *ActivateUserProfile) HttpRequest(ctx context.Context) (*http.Request, e } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,15 +167,15 @@ func (r *ActivateUserProfile) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -179,27 +192,66 @@ func (r *ActivateUserProfile) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ActivateUserProfile) Perform(ctx context.Context) (*http.Response, error) { +func (r ActivateUserProfile) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.activate_user_profile") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.activate_user_profile") + if reader := instrument.RecordRequestBody(ctx, "security.activate_user_profile", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.activate_user_profile") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ActivateUserProfile query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ActivateUserProfile query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a activateuserprofile.Response -func (r ActivateUserProfile) Do(ctx context.Context) (*Response, error) { +func (r ActivateUserProfile) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.activate_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -207,6 +259,9 @@ func (r ActivateUserProfile) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -216,6 +271,9 @@ func (r ActivateUserProfile) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r ActivateUserProfile) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/activateuserprofile/request.go b/typedapi/security/activateuserprofile/request.go index 6f80cfccee..94c94e7a7f 100644 --- a/typedapi/security/activateuserprofile/request.go +++ b/typedapi/security/activateuserprofile/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package activateuserprofile @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package activateuserprofile // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/activate_user_profile/Request.ts#L23-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/activate_user_profile/Request.ts#L23-L37 type Request struct { AccessToken *string `json:"access_token,omitempty"` GrantType granttype.GrantType `json:"grant_type"` diff --git a/typedapi/security/activateuserprofile/response.go b/typedapi/security/activateuserprofile/response.go index b54c9e2b56..0f89d9e1cf 100644 --- a/typedapi/security/activateuserprofile/response.go +++ b/typedapi/security/activateuserprofile/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package activateuserprofile @@ -28,8 +28,7 @@ import ( // Response holds the response body struct for the package activateuserprofile // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/activate_user_profile/Response.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/activate_user_profile/Response.ts#L22-L24 type Response struct { Data map[string]json.RawMessage `json:"data"` Doc_ types.UserProfileHitMetadata `json:"_doc"` diff --git a/typedapi/security/authenticate/authenticate.go b/typedapi/security/authenticate/authenticate.go index 8ba66a37de..c822a26f66 100644 --- a/typedapi/security/authenticate/authenticate.go +++ b/typedapi/security/authenticate/authenticate.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Enables authentication as a user and retrieve information about the // authenticated user. package authenticate import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type Authenticate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewAuthenticate type alias for index. @@ -75,7 +78,12 @@ func New(tp elastictransport.Interface) *Authenticate { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *Authenticate) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *Authenticate) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Authenticate) Perform(ctx context.Context) (*http.Response, error) { +func (r Authenticate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.authenticate") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.authenticate") + if reader := instrument.RecordRequestBody(ctx, "security.authenticate", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.authenticate") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Authenticate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Authenticate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a authenticate.Response -func (r Authenticate) Do(ctx context.Context) (*Response, error) { +func (r Authenticate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.authenticate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r Authenticate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r Authenticate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r Authenticate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Authenticate) IsSuccess(ctx context.Context) (bool, error) { +func (r Authenticate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.authenticate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r Authenticate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Authenticate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/authenticate/response.go b/typedapi/security/authenticate/response.go index e015eb04bf..642a89efb3 100644 --- a/typedapi/security/authenticate/response.go +++ b/typedapi/security/authenticate/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package authenticate @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package authenticate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/authenticate/SecurityAuthenticateResponse.ts#L25-L43 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/authenticate/SecurityAuthenticateResponse.ts#L25-L43 type Response struct { ApiKey *types.ApiKey `json:"api_key,omitempty"` AuthenticationRealm types.RealmInfo `json:"authentication_realm"` diff --git a/typedapi/security/bulkupdateapikeys/bulk_update_api_keys.go b/typedapi/security/bulkupdateapikeys/bulk_update_api_keys.go index 2b7498ece6..00d91d772e 100644 --- a/typedapi/security/bulkupdateapikeys/bulk_update_api_keys.go +++ b/typedapi/security/bulkupdateapikeys/bulk_update_api_keys.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates the attributes of multiple existing API keys. package bulkupdateapikeys import ( - gobytes "bytes" "context" "errors" "fmt" @@ -45,9 +44,13 @@ type BulkUpdateApiKeys struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewBulkUpdateApiKeys type alias for index. @@ -71,7 +74,12 @@ func New(tp elastictransport.Interface) *BulkUpdateApiKeys { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,15 +116,15 @@ func (r *BulkUpdateApiKeys) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -133,15 +141,42 @@ func (r *BulkUpdateApiKeys) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r BulkUpdateApiKeys) Perform(ctx context.Context) (*http.Response, error) { +func (r BulkUpdateApiKeys) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.bulk_update_api_keys") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.bulk_update_api_keys") + if reader := instrument.RecordRequestBody(ctx, "security.bulk_update_api_keys", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.bulk_update_api_keys") + } if err != nil { - return nil, fmt.Errorf("an error happened during the BulkUpdateApiKeys query execution: %w", err) + localErr := fmt.Errorf("an error happened during the BulkUpdateApiKeys query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -154,7 +189,17 @@ func (r BulkUpdateApiKeys) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r BulkUpdateApiKeys) IsSuccess(ctx context.Context) (bool, error) { +func (r BulkUpdateApiKeys) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.bulk_update_api_keys") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -170,6 +215,14 @@ func (r BulkUpdateApiKeys) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the BulkUpdateApiKeys query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/changepassword/change_password.go b/typedapi/security/changepassword/change_password.go index 2d2a16c18f..0637d6ced4 100644 --- a/typedapi/security/changepassword/change_password.go +++ b/typedapi/security/changepassword/change_password.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Changes the passwords of users in the native realm and built-in users. package changepassword @@ -51,15 +51,19 @@ type ChangePassword struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int username string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewChangePassword type alias for index. @@ -83,11 +87,18 @@ func New(tp elastictransport.Interface) *ChangePassword { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -124,9 +135,7 @@ func (r *ChangePassword) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -138,6 +147,10 @@ func (r *ChangePassword) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -148,6 +161,9 @@ func (r *ChangePassword) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("user") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.username) + } path.WriteString(r.username) path.WriteString("/") path.WriteString("_password") @@ -172,15 +188,15 @@ func (r *ChangePassword) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -197,27 +213,66 @@ func (r *ChangePassword) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ChangePassword) Perform(ctx context.Context) (*http.Response, error) { +func (r ChangePassword) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.change_password") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.change_password") + if reader := instrument.RecordRequestBody(ctx, "security.change_password", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.change_password") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ChangePassword query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ChangePassword query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a changepassword.Response -func (r ChangePassword) Do(ctx context.Context) (*Response, error) { +func (r ChangePassword) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.change_password") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -225,6 +280,9 @@ func (r ChangePassword) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +292,9 @@ func (r ChangePassword) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -241,6 +302,9 @@ func (r ChangePassword) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/changepassword/request.go b/typedapi/security/changepassword/request.go index a823f2452c..28d5e9294b 100644 --- a/typedapi/security/changepassword/request.go +++ b/typedapi/security/changepassword/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package changepassword @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package changepassword // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/change_password/SecurityChangePasswordRequest.ts#L23-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/change_password/SecurityChangePasswordRequest.ts#L23-L51 type Request struct { // Password The new password value. Passwords must be at least 6 characters long. diff --git a/typedapi/security/changepassword/response.go b/typedapi/security/changepassword/response.go index 44d9832aa2..aa14ab30ff 100644 --- a/typedapi/security/changepassword/response.go +++ b/typedapi/security/changepassword/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package changepassword // Response holds the response body struct for the package changepassword // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/change_password/SecurityChangePasswordResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/change_password/SecurityChangePasswordResponse.ts#L20-L22 type Response struct { } diff --git a/typedapi/security/clearapikeycache/clear_api_key_cache.go b/typedapi/security/clearapikeycache/clear_api_key_cache.go index 0f37304208..d5f6f40905 100644 --- a/typedapi/security/clearapikeycache/clear_api_key_cache.go +++ b/typedapi/security/clearapikeycache/clear_api_key_cache.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Clear a subset or all entries from the API key cache. package clearapikeycache import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type ClearApiKeyCache struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int ids string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearApiKeyCache type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *ClearApiKeyCache { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *ClearApiKeyCache) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("api_key") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "ids", r.ids) + } path.WriteString(r.ids) path.WriteString("/") path.WriteString("_clear_cache") @@ -121,9 +132,9 @@ func (r *ClearApiKeyCache) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *ClearApiKeyCache) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearApiKeyCache) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearApiKeyCache) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.clear_api_key_cache") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.clear_api_key_cache") + if reader := instrument.RecordRequestBody(ctx, "security.clear_api_key_cache", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.clear_api_key_cache") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearApiKeyCache query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearApiKeyCache query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clearapikeycache.Response -func (r ClearApiKeyCache) Do(ctx context.Context) (*Response, error) { +func (r ClearApiKeyCache) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_api_key_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r ClearApiKeyCache) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r ClearApiKeyCache) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r ClearApiKeyCache) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ClearApiKeyCache) IsSuccess(ctx context.Context) (bool, error) { +func (r ClearApiKeyCache) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_api_key_cache") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r ClearApiKeyCache) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ClearApiKeyCache query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/clearapikeycache/response.go b/typedapi/security/clearapikeycache/response.go index 0b52452ea7..c65da7ee65 100644 --- a/typedapi/security/clearapikeycache/response.go +++ b/typedapi/security/clearapikeycache/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearapikeycache @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package clearapikeycache // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/clear_api_key_cache/SecurityClearApiKeyCacheResponse.ts#L25-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/clear_api_key_cache/SecurityClearApiKeyCacheResponse.ts#L25-L32 type Response struct { ClusterName string `json:"cluster_name"` NodeStats types.NodeStatistics `json:"_nodes"` diff --git a/typedapi/security/clearcachedprivileges/clear_cached_privileges.go b/typedapi/security/clearcachedprivileges/clear_cached_privileges.go index 497f172850..f62c19b96a 100644 --- a/typedapi/security/clearcachedprivileges/clear_cached_privileges.go +++ b/typedapi/security/clearcachedprivileges/clear_cached_privileges.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Evicts application privileges from the native application privileges cache. package clearcachedprivileges import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type ClearCachedPrivileges struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int application string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearCachedPrivileges type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *ClearCachedPrivileges { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *ClearCachedPrivileges) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("privilege") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "application", r.application) + } path.WriteString(r.application) path.WriteString("/") path.WriteString("_clear_cache") @@ -121,9 +132,9 @@ func (r *ClearCachedPrivileges) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *ClearCachedPrivileges) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearCachedPrivileges) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearCachedPrivileges) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.clear_cached_privileges") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.clear_cached_privileges") + if reader := instrument.RecordRequestBody(ctx, "security.clear_cached_privileges", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.clear_cached_privileges") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearCachedPrivileges query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearCachedPrivileges query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clearcachedprivileges.Response -func (r ClearCachedPrivileges) Do(ctx context.Context) (*Response, error) { +func (r ClearCachedPrivileges) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r ClearCachedPrivileges) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r ClearCachedPrivileges) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r ClearCachedPrivileges) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ClearCachedPrivileges) IsSuccess(ctx context.Context) (bool, error) { +func (r ClearCachedPrivileges) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r ClearCachedPrivileges) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ClearCachedPrivileges query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/clearcachedprivileges/response.go b/typedapi/security/clearcachedprivileges/response.go index 1c1f1596c3..f89cb80015 100644 --- a/typedapi/security/clearcachedprivileges/response.go +++ b/typedapi/security/clearcachedprivileges/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearcachedprivileges @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package clearcachedprivileges // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/clear_cached_privileges/SecurityClearCachedPrivilegesResponse.ts#L25-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/clear_cached_privileges/SecurityClearCachedPrivilegesResponse.ts#L25-L32 type Response struct { ClusterName string `json:"cluster_name"` NodeStats types.NodeStatistics `json:"_nodes"` diff --git a/typedapi/security/clearcachedrealms/clear_cached_realms.go b/typedapi/security/clearcachedrealms/clear_cached_realms.go index 3db24230ff..475c3a551c 100644 --- a/typedapi/security/clearcachedrealms/clear_cached_realms.go +++ b/typedapi/security/clearcachedrealms/clear_cached_realms.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Evicts users from the user cache. Can completely clear the cache or evict // specific users. package clearcachedrealms import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type ClearCachedRealms struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int realms string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearCachedRealms type alias for index. @@ -83,7 +86,12 @@ func New(tp elastictransport.Interface) *ClearCachedRealms { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *ClearCachedRealms) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("realm") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "realms", r.realms) + } path.WriteString(r.realms) path.WriteString("/") path.WriteString("_clear_cache") @@ -123,9 +134,9 @@ func (r *ClearCachedRealms) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -142,27 +153,66 @@ func (r *ClearCachedRealms) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearCachedRealms) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearCachedRealms) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.clear_cached_realms") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.clear_cached_realms") + if reader := instrument.RecordRequestBody(ctx, "security.clear_cached_realms", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.clear_cached_realms") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearCachedRealms query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearCachedRealms query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clearcachedrealms.Response -func (r ClearCachedRealms) Do(ctx context.Context) (*Response, error) { +func (r ClearCachedRealms) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_realms") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -170,6 +220,9 @@ func (r ClearCachedRealms) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -179,6 +232,9 @@ func (r ClearCachedRealms) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -186,12 +242,25 @@ func (r ClearCachedRealms) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ClearCachedRealms) IsSuccess(ctx context.Context) (bool, error) { +func (r ClearCachedRealms) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_realms") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -207,6 +276,14 @@ func (r ClearCachedRealms) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ClearCachedRealms query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/clearcachedrealms/response.go b/typedapi/security/clearcachedrealms/response.go index 3dfcaf746b..c6117f68c6 100644 --- a/typedapi/security/clearcachedrealms/response.go +++ b/typedapi/security/clearcachedrealms/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearcachedrealms @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package clearcachedrealms // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/clear_cached_realms/SecurityClearCachedRealmsResponse.ts#L25-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/clear_cached_realms/SecurityClearCachedRealmsResponse.ts#L25-L32 type Response struct { ClusterName string `json:"cluster_name"` NodeStats types.NodeStatistics `json:"_nodes"` diff --git a/typedapi/security/clearcachedroles/clear_cached_roles.go b/typedapi/security/clearcachedroles/clear_cached_roles.go index e830f0aa29..6f4b995dad 100644 --- a/typedapi/security/clearcachedroles/clear_cached_roles.go +++ b/typedapi/security/clearcachedroles/clear_cached_roles.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Evicts roles from the native role cache. package clearcachedroles import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type ClearCachedRoles struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearCachedRoles type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *ClearCachedRoles { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *ClearCachedRoles) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("role") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) path.WriteString("/") path.WriteString("_clear_cache") @@ -121,9 +132,9 @@ func (r *ClearCachedRoles) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *ClearCachedRoles) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearCachedRoles) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearCachedRoles) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.clear_cached_roles") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.clear_cached_roles") + if reader := instrument.RecordRequestBody(ctx, "security.clear_cached_roles", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.clear_cached_roles") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearCachedRoles query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearCachedRoles query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clearcachedroles.Response -func (r ClearCachedRoles) Do(ctx context.Context) (*Response, error) { +func (r ClearCachedRoles) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_roles") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r ClearCachedRoles) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r ClearCachedRoles) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r ClearCachedRoles) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ClearCachedRoles) IsSuccess(ctx context.Context) (bool, error) { +func (r ClearCachedRoles) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_roles") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r ClearCachedRoles) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ClearCachedRoles query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/clearcachedroles/response.go b/typedapi/security/clearcachedroles/response.go index b4cd72005d..c798251817 100644 --- a/typedapi/security/clearcachedroles/response.go +++ b/typedapi/security/clearcachedroles/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearcachedroles @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package clearcachedroles // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/clear_cached_roles/ClearCachedRolesResponse.ts#L25-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/clear_cached_roles/ClearCachedRolesResponse.ts#L25-L32 type Response struct { ClusterName string `json:"cluster_name"` NodeStats types.NodeStatistics `json:"_nodes"` diff --git a/typedapi/security/clearcachedservicetokens/clear_cached_service_tokens.go b/typedapi/security/clearcachedservicetokens/clear_cached_service_tokens.go index b266ff91db..9eb51a728e 100644 --- a/typedapi/security/clearcachedservicetokens/clear_cached_service_tokens.go +++ b/typedapi/security/clearcachedservicetokens/clear_cached_service_tokens.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Evicts tokens from the service account token caches. package clearcachedservicetokens import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -55,13 +54,17 @@ type ClearCachedServiceTokens struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int namespace string service string name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearCachedServiceTokens type alias for index. @@ -91,7 +94,12 @@ func New(tp elastictransport.Interface) *ClearCachedServiceTokens { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -116,9 +124,15 @@ func (r *ClearCachedServiceTokens) HttpRequest(ctx context.Context) (*http.Reque path.WriteString("service") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.namespace) + } path.WriteString(r.namespace) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.service) + } path.WriteString(r.service) path.WriteString("/") path.WriteString("credential") @@ -126,6 +140,9 @@ func (r *ClearCachedServiceTokens) HttpRequest(ctx context.Context) (*http.Reque path.WriteString("token") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) path.WriteString("/") path.WriteString("_clear_cache") @@ -141,9 +158,9 @@ func (r *ClearCachedServiceTokens) HttpRequest(ctx context.Context) (*http.Reque } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -160,27 +177,66 @@ func (r *ClearCachedServiceTokens) HttpRequest(ctx context.Context) (*http.Reque } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearCachedServiceTokens) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearCachedServiceTokens) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.clear_cached_service_tokens") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.clear_cached_service_tokens") + if reader := instrument.RecordRequestBody(ctx, "security.clear_cached_service_tokens", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.clear_cached_service_tokens") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearCachedServiceTokens query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearCachedServiceTokens query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clearcachedservicetokens.Response -func (r ClearCachedServiceTokens) Do(ctx context.Context) (*Response, error) { +func (r ClearCachedServiceTokens) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_service_tokens") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -188,6 +244,9 @@ func (r ClearCachedServiceTokens) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -197,6 +256,9 @@ func (r ClearCachedServiceTokens) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -204,12 +266,25 @@ func (r ClearCachedServiceTokens) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ClearCachedServiceTokens) IsSuccess(ctx context.Context) (bool, error) { +func (r ClearCachedServiceTokens) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.clear_cached_service_tokens") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -225,6 +300,14 @@ func (r ClearCachedServiceTokens) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ClearCachedServiceTokens query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/clearcachedservicetokens/response.go b/typedapi/security/clearcachedservicetokens/response.go index 049b75a989..140c88e00c 100644 --- a/typedapi/security/clearcachedservicetokens/response.go +++ b/typedapi/security/clearcachedservicetokens/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearcachedservicetokens @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package clearcachedservicetokens // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/clear_cached_service_tokens/ClearCachedServiceTokensResponse.ts#L25-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/clear_cached_service_tokens/ClearCachedServiceTokensResponse.ts#L25-L32 type Response struct { ClusterName string `json:"cluster_name"` NodeStats types.NodeStatistics `json:"_nodes"` diff --git a/typedapi/security/createapikey/create_api_key.go b/typedapi/security/createapikey/create_api_key.go index 8b8269f5e1..1400afe5a3 100644 --- a/typedapi/security/createapikey/create_api_key.go +++ b/typedapi/security/createapikey/create_api_key.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates an API key for access without requiring basic authentication. package createapikey @@ -47,13 +47,17 @@ type CreateApiKey struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCreateApiKey type alias for index. @@ -77,11 +81,18 @@ func New(tp elastictransport.Interface) *CreateApiKey { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -118,9 +129,7 @@ func (r *CreateApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -132,6 +141,10 @@ func (r *CreateApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -152,15 +165,15 @@ func (r *CreateApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -177,27 +190,66 @@ func (r *CreateApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r CreateApiKey) Perform(ctx context.Context) (*http.Response, error) { +func (r CreateApiKey) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.create_api_key") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.create_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.create_api_key", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.create_api_key") + } if err != nil { - return nil, fmt.Errorf("an error happened during the CreateApiKey query execution: %w", err) + localErr := fmt.Errorf("an error happened during the CreateApiKey query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a createapikey.Response -func (r CreateApiKey) Do(ctx context.Context) (*Response, error) { +func (r CreateApiKey) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.create_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -205,6 +257,9 @@ func (r CreateApiKey) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -214,6 +269,9 @@ func (r CreateApiKey) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -221,6 +279,9 @@ func (r CreateApiKey) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/createapikey/request.go b/typedapi/security/createapikey/request.go index 31659370e1..a88e01032e 100644 --- a/typedapi/security/createapikey/request.go +++ b/typedapi/security/createapikey/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package createapikey @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package createapikey // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/create_api_key/SecurityCreateApiKeyRequest.ts#L26-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/create_api_key/SecurityCreateApiKeyRequest.ts#L26-L58 type Request struct { // Expiration Expiration time for the API key. By default, API keys never expire. diff --git a/typedapi/security/createapikey/response.go b/typedapi/security/createapikey/response.go index 212c5aeeb2..4e711955e9 100644 --- a/typedapi/security/createapikey/response.go +++ b/typedapi/security/createapikey/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package createapikey // Response holds the response body struct for the package createapikey // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/create_api_key/SecurityCreateApiKeyResponse.ts#L23-L50 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/create_api_key/SecurityCreateApiKeyResponse.ts#L23-L50 type Response struct { // ApiKey Generated API key. diff --git a/typedapi/security/createcrossclusterapikey/create_cross_cluster_api_key.go b/typedapi/security/createcrossclusterapikey/create_cross_cluster_api_key.go index 3a532b1a87..6b8ee84bf5 100644 --- a/typedapi/security/createcrossclusterapikey/create_cross_cluster_api_key.go +++ b/typedapi/security/createcrossclusterapikey/create_cross_cluster_api_key.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a cross-cluster API key for API key based remote cluster access. package createcrossclusterapikey import ( - gobytes "bytes" "context" "errors" "fmt" @@ -45,9 +44,13 @@ type CreateCrossClusterApiKey struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCreateCrossClusterApiKey type alias for index. @@ -71,7 +74,12 @@ func New(tp elastictransport.Interface) *CreateCrossClusterApiKey { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,15 +116,15 @@ func (r *CreateCrossClusterApiKey) HttpRequest(ctx context.Context) (*http.Reque } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -133,15 +141,42 @@ func (r *CreateCrossClusterApiKey) HttpRequest(ctx context.Context) (*http.Reque } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r CreateCrossClusterApiKey) Perform(ctx context.Context) (*http.Response, error) { +func (r CreateCrossClusterApiKey) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.create_cross_cluster_api_key") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.create_cross_cluster_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.create_cross_cluster_api_key", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.create_cross_cluster_api_key") + } if err != nil { - return nil, fmt.Errorf("an error happened during the CreateCrossClusterApiKey query execution: %w", err) + localErr := fmt.Errorf("an error happened during the CreateCrossClusterApiKey query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -154,7 +189,17 @@ func (r CreateCrossClusterApiKey) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r CreateCrossClusterApiKey) IsSuccess(ctx context.Context) (bool, error) { +func (r CreateCrossClusterApiKey) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.create_cross_cluster_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -170,6 +215,14 @@ func (r CreateCrossClusterApiKey) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the CreateCrossClusterApiKey query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/createservicetoken/create_service_token.go b/typedapi/security/createservicetoken/create_service_token.go index 831c17f58b..338231d294 100644 --- a/typedapi/security/createservicetoken/create_service_token.go +++ b/typedapi/security/createservicetoken/create_service_token.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a service account token for access without requiring basic // authentication. package createservicetoken import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -57,13 +56,17 @@ type CreateServiceToken struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int namespace string service string name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCreateServiceToken type alias for index. @@ -92,7 +95,12 @@ func New(tp elastictransport.Interface) *CreateServiceToken { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -117,9 +125,15 @@ func (r *CreateServiceToken) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("service") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.namespace) + } path.WriteString(r.namespace) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.service) + } path.WriteString(r.service) path.WriteString("/") path.WriteString("credential") @@ -127,6 +141,9 @@ func (r *CreateServiceToken) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("token") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -137,9 +154,15 @@ func (r *CreateServiceToken) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("service") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.namespace) + } path.WriteString(r.namespace) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.service) + } path.WriteString(r.service) path.WriteString("/") path.WriteString("credential") @@ -157,9 +180,9 @@ func (r *CreateServiceToken) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -176,27 +199,66 @@ func (r *CreateServiceToken) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r CreateServiceToken) Perform(ctx context.Context) (*http.Response, error) { +func (r CreateServiceToken) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.create_service_token") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.create_service_token") + if reader := instrument.RecordRequestBody(ctx, "security.create_service_token", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.create_service_token") + } if err != nil { - return nil, fmt.Errorf("an error happened during the CreateServiceToken query execution: %w", err) + localErr := fmt.Errorf("an error happened during the CreateServiceToken query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a createservicetoken.Response -func (r CreateServiceToken) Do(ctx context.Context) (*Response, error) { +func (r CreateServiceToken) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.create_service_token") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -204,6 +266,9 @@ func (r CreateServiceToken) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -213,6 +278,9 @@ func (r CreateServiceToken) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -220,12 +288,25 @@ func (r CreateServiceToken) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r CreateServiceToken) IsSuccess(ctx context.Context) (bool, error) { +func (r CreateServiceToken) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.create_service_token") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -241,6 +322,14 @@ func (r CreateServiceToken) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the CreateServiceToken query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/createservicetoken/response.go b/typedapi/security/createservicetoken/response.go index 4abedce2b1..f14f809ea1 100644 --- a/typedapi/security/createservicetoken/response.go +++ b/typedapi/security/createservicetoken/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package createservicetoken @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package createservicetoken // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/create_service_token/CreateServiceTokenResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/create_service_token/CreateServiceTokenResponse.ts#L22-L27 type Response struct { Created bool `json:"created"` Token types.ServiceToken `json:"token"` diff --git a/typedapi/security/deleteprivileges/delete_privileges.go b/typedapi/security/deleteprivileges/delete_privileges.go index a94d99cb4d..fbd8487e0b 100644 --- a/typedapi/security/deleteprivileges/delete_privileges.go +++ b/typedapi/security/deleteprivileges/delete_privileges.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Removes application privileges. package deleteprivileges import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,12 +53,16 @@ type DeletePrivileges struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int application string name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeletePrivileges type alias for index. @@ -87,7 +90,12 @@ func New(tp elastictransport.Interface) *DeletePrivileges { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,9 +120,15 @@ func (r *DeletePrivileges) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("privilege") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "application", r.application) + } path.WriteString(r.application) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -128,9 +142,9 @@ func (r *DeletePrivileges) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -147,27 +161,66 @@ func (r *DeletePrivileges) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeletePrivileges) Perform(ctx context.Context) (*http.Response, error) { +func (r DeletePrivileges) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.delete_privileges") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.delete_privileges") + if reader := instrument.RecordRequestBody(ctx, "security.delete_privileges", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.delete_privileges") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeletePrivileges query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeletePrivileges query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleteprivileges.Response -func (r DeletePrivileges) Do(ctx context.Context) (Response, error) { +func (r DeletePrivileges) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -175,6 +228,9 @@ func (r DeletePrivileges) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,6 +240,9 @@ func (r DeletePrivileges) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -191,12 +250,25 @@ func (r DeletePrivileges) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeletePrivileges) IsSuccess(ctx context.Context) (bool, error) { +func (r DeletePrivileges) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -212,6 +284,14 @@ func (r DeletePrivileges) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeletePrivileges query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/deleteprivileges/response.go b/typedapi/security/deleteprivileges/response.go index 19e113c145..7c70c02f25 100644 --- a/typedapi/security/deleteprivileges/response.go +++ b/typedapi/security/deleteprivileges/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleteprivileges @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package deleteprivileges // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/delete_privileges/SecurityDeletePrivilegesResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/delete_privileges/SecurityDeletePrivilegesResponse.ts#L23-L25 type Response map[string]map[string]types.FoundStatus diff --git a/typedapi/security/deleterole/delete_role.go b/typedapi/security/deleterole/delete_role.go index 3bf0cb7185..76e35dc1ff 100644 --- a/typedapi/security/deleterole/delete_role.go +++ b/typedapi/security/deleterole/delete_role.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Removes roles in the native realm. package deleterole import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteRole struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteRole type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *DeleteRole { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *DeleteRole) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("role") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -120,9 +131,9 @@ func (r *DeleteRole) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,27 +150,66 @@ func (r *DeleteRole) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteRole) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteRole) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.delete_role") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.delete_role") + if reader := instrument.RecordRequestBody(ctx, "security.delete_role", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.delete_role") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteRole query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteRole query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleterole.Response -func (r DeleteRole) Do(ctx context.Context) (*Response, error) { +func (r DeleteRole) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_role") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -167,6 +217,9 @@ func (r DeleteRole) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,6 +229,9 @@ func (r DeleteRole) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,12 +239,25 @@ func (r DeleteRole) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteRole) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteRole) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_role") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -204,6 +273,14 @@ func (r DeleteRole) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteRole query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/deleterole/response.go b/typedapi/security/deleterole/response.go index a1d3ea116a..fc68d5ecdb 100644 --- a/typedapi/security/deleterole/response.go +++ b/typedapi/security/deleterole/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleterole // Response holds the response body struct for the package deleterole // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/delete_role/SecurityDeleteRoleResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/delete_role/SecurityDeleteRoleResponse.ts#L20-L22 type Response struct { Found bool `json:"found"` } diff --git a/typedapi/security/deleterolemapping/delete_role_mapping.go b/typedapi/security/deleterolemapping/delete_role_mapping.go index 415a2674d5..d31e97bbd2 100644 --- a/typedapi/security/deleterolemapping/delete_role_mapping.go +++ b/typedapi/security/deleterolemapping/delete_role_mapping.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Removes role mappings. package deleterolemapping import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteRoleMapping struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteRoleMapping type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *DeleteRoleMapping { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *DeleteRoleMapping) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("role_mapping") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -120,9 +131,9 @@ func (r *DeleteRoleMapping) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,27 +150,66 @@ func (r *DeleteRoleMapping) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteRoleMapping) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteRoleMapping) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.delete_role_mapping") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.delete_role_mapping") + if reader := instrument.RecordRequestBody(ctx, "security.delete_role_mapping", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.delete_role_mapping") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteRoleMapping query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteRoleMapping query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleterolemapping.Response -func (r DeleteRoleMapping) Do(ctx context.Context) (*Response, error) { +func (r DeleteRoleMapping) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_role_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -167,6 +217,9 @@ func (r DeleteRoleMapping) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,6 +229,9 @@ func (r DeleteRoleMapping) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,12 +239,25 @@ func (r DeleteRoleMapping) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteRoleMapping) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteRoleMapping) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_role_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -204,6 +273,14 @@ func (r DeleteRoleMapping) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteRoleMapping query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/deleterolemapping/response.go b/typedapi/security/deleterolemapping/response.go index a0870162a6..d09c5f98c3 100644 --- a/typedapi/security/deleterolemapping/response.go +++ b/typedapi/security/deleterolemapping/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleterolemapping // Response holds the response body struct for the package deleterolemapping // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/delete_role_mapping/SecurityDeleteRoleMappingResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/delete_role_mapping/SecurityDeleteRoleMappingResponse.ts#L20-L22 type Response struct { Found bool `json:"found"` } diff --git a/typedapi/security/deleteservicetoken/delete_service_token.go b/typedapi/security/deleteservicetoken/delete_service_token.go index 890a8f5ea7..cc5428612b 100644 --- a/typedapi/security/deleteservicetoken/delete_service_token.go +++ b/typedapi/security/deleteservicetoken/delete_service_token.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a service account token. package deleteservicetoken import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -56,13 +55,17 @@ type DeleteServiceToken struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int namespace string service string name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteServiceToken type alias for index. @@ -92,7 +95,12 @@ func New(tp elastictransport.Interface) *DeleteServiceToken { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -117,9 +125,15 @@ func (r *DeleteServiceToken) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("service") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.namespace) + } path.WriteString(r.namespace) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.service) + } path.WriteString(r.service) path.WriteString("/") path.WriteString("credential") @@ -127,6 +141,9 @@ func (r *DeleteServiceToken) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("token") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodDelete @@ -140,9 +157,9 @@ func (r *DeleteServiceToken) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -159,27 +176,66 @@ func (r *DeleteServiceToken) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteServiceToken) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteServiceToken) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.delete_service_token") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.delete_service_token") + if reader := instrument.RecordRequestBody(ctx, "security.delete_service_token", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.delete_service_token") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteServiceToken query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteServiceToken query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleteservicetoken.Response -func (r DeleteServiceToken) Do(ctx context.Context) (*Response, error) { +func (r DeleteServiceToken) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_service_token") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -187,6 +243,9 @@ func (r DeleteServiceToken) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -196,6 +255,9 @@ func (r DeleteServiceToken) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -203,12 +265,25 @@ func (r DeleteServiceToken) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteServiceToken) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteServiceToken) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_service_token") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -224,6 +299,14 @@ func (r DeleteServiceToken) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteServiceToken query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/deleteservicetoken/response.go b/typedapi/security/deleteservicetoken/response.go index 0bcea3800d..55a3d15138 100644 --- a/typedapi/security/deleteservicetoken/response.go +++ b/typedapi/security/deleteservicetoken/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleteservicetoken // Response holds the response body struct for the package deleteservicetoken // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/delete_service_token/DeleteServiceTokenResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/delete_service_token/DeleteServiceTokenResponse.ts#L20-L22 type Response struct { Found bool `json:"found"` } diff --git a/typedapi/security/deleteuser/delete_user.go b/typedapi/security/deleteuser/delete_user.go index 83bb52e090..b5e49c8da6 100644 --- a/typedapi/security/deleteuser/delete_user.go +++ b/typedapi/security/deleteuser/delete_user.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes users from the native realm. package deleteuser import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteUser struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int username string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteUser type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *DeleteUser { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *DeleteUser) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("user") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.username) + } path.WriteString(r.username) method = http.MethodDelete @@ -120,9 +131,9 @@ func (r *DeleteUser) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,27 +150,66 @@ func (r *DeleteUser) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteUser) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteUser) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.delete_user") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.delete_user") + if reader := instrument.RecordRequestBody(ctx, "security.delete_user", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.delete_user") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteUser query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteUser query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleteuser.Response -func (r DeleteUser) Do(ctx context.Context) (*Response, error) { +func (r DeleteUser) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -167,6 +217,9 @@ func (r DeleteUser) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,6 +229,9 @@ func (r DeleteUser) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,12 +239,25 @@ func (r DeleteUser) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteUser) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteUser) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.delete_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -204,6 +273,14 @@ func (r DeleteUser) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteUser query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/deleteuser/response.go b/typedapi/security/deleteuser/response.go index 21c823efde..8081072bfe 100644 --- a/typedapi/security/deleteuser/response.go +++ b/typedapi/security/deleteuser/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleteuser // Response holds the response body struct for the package deleteuser // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/delete_user/SecurityDeleteUserResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/delete_user/SecurityDeleteUserResponse.ts#L20-L22 type Response struct { Found bool `json:"found"` } diff --git a/typedapi/security/disableuser/disable_user.go b/typedapi/security/disableuser/disable_user.go index 2e11fde2c8..c80f038330 100644 --- a/typedapi/security/disableuser/disable_user.go +++ b/typedapi/security/disableuser/disable_user.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Disables users in the native realm. package disableuser import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DisableUser struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int username string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDisableUser type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *DisableUser { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *DisableUser) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("user") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.username) + } path.WriteString(r.username) path.WriteString("/") path.WriteString("_disable") @@ -122,9 +133,9 @@ func (r *DisableUser) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *DisableUser) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DisableUser) Perform(ctx context.Context) (*http.Response, error) { +func (r DisableUser) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.disable_user") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.disable_user") + if reader := instrument.RecordRequestBody(ctx, "security.disable_user", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.disable_user") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DisableUser query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DisableUser query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a disableuser.Response -func (r DisableUser) Do(ctx context.Context) (*Response, error) { +func (r DisableUser) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.disable_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r DisableUser) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r DisableUser) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r DisableUser) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DisableUser) IsSuccess(ctx context.Context) (bool, error) { +func (r DisableUser) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.disable_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r DisableUser) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DisableUser query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/disableuser/response.go b/typedapi/security/disableuser/response.go index 3f7ab43b61..fdf54f2ac9 100644 --- a/typedapi/security/disableuser/response.go +++ b/typedapi/security/disableuser/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package disableuser // Response holds the response body struct for the package disableuser // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/disable_user/SecurityDisableUserResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/disable_user/SecurityDisableUserResponse.ts#L20-L22 type Response struct { } diff --git a/typedapi/security/disableuserprofile/disable_user_profile.go b/typedapi/security/disableuserprofile/disable_user_profile.go index 167e30558c..862b6a72b2 100644 --- a/typedapi/security/disableuserprofile/disable_user_profile.go +++ b/typedapi/security/disableuserprofile/disable_user_profile.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Disables a user profile so it's not visible in user profile searches. package disableuserprofile import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DisableUserProfile struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int uid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDisableUserProfile type alias for index. @@ -76,13 +79,18 @@ func NewDisableUserProfileFunc(tp elastictransport.Interface) NewDisableUserProf // Disables a user profile so it's not visible in user profile searches. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-disable-user-profile.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user-profile.html func New(tp elastictransport.Interface) *DisableUserProfile { r := &DisableUserProfile{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *DisableUserProfile) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("profile") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "uid", r.uid) + } path.WriteString(r.uid) path.WriteString("/") path.WriteString("_disable") @@ -122,9 +133,9 @@ func (r *DisableUserProfile) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *DisableUserProfile) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DisableUserProfile) Perform(ctx context.Context) (*http.Response, error) { +func (r DisableUserProfile) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.disable_user_profile") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.disable_user_profile") + if reader := instrument.RecordRequestBody(ctx, "security.disable_user_profile", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.disable_user_profile") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DisableUserProfile query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DisableUserProfile query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a disableuserprofile.Response -func (r DisableUserProfile) Do(ctx context.Context) (*Response, error) { +func (r DisableUserProfile) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.disable_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r DisableUserProfile) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r DisableUserProfile) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r DisableUserProfile) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DisableUserProfile) IsSuccess(ctx context.Context) (bool, error) { +func (r DisableUserProfile) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.disable_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r DisableUserProfile) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DisableUserProfile query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/disableuserprofile/response.go b/typedapi/security/disableuserprofile/response.go index 16ac11040b..f383f36f21 100644 --- a/typedapi/security/disableuserprofile/response.go +++ b/typedapi/security/disableuserprofile/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package disableuserprofile // Response holds the response body struct for the package disableuserprofile // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/disable_user_profile/Response.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/disable_user_profile/Response.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/security/enableuser/enable_user.go b/typedapi/security/enableuser/enable_user.go index 9e098ee8f3..a3bc513d93 100644 --- a/typedapi/security/enableuser/enable_user.go +++ b/typedapi/security/enableuser/enable_user.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Enables users in the native realm. package enableuser import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type EnableUser struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int username string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewEnableUser type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *EnableUser { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *EnableUser) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("user") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.username) + } path.WriteString(r.username) path.WriteString("/") path.WriteString("_enable") @@ -122,9 +133,9 @@ func (r *EnableUser) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *EnableUser) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r EnableUser) Perform(ctx context.Context) (*http.Response, error) { +func (r EnableUser) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.enable_user") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.enable_user") + if reader := instrument.RecordRequestBody(ctx, "security.enable_user", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.enable_user") + } if err != nil { - return nil, fmt.Errorf("an error happened during the EnableUser query execution: %w", err) + localErr := fmt.Errorf("an error happened during the EnableUser query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a enableuser.Response -func (r EnableUser) Do(ctx context.Context) (*Response, error) { +func (r EnableUser) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enable_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r EnableUser) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r EnableUser) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r EnableUser) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r EnableUser) IsSuccess(ctx context.Context) (bool, error) { +func (r EnableUser) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enable_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r EnableUser) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the EnableUser query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/enableuser/response.go b/typedapi/security/enableuser/response.go index e9c7e2db02..39df91d50b 100644 --- a/typedapi/security/enableuser/response.go +++ b/typedapi/security/enableuser/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package enableuser // Response holds the response body struct for the package enableuser // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/enable_user/SecurityEnableUserResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/enable_user/SecurityEnableUserResponse.ts#L20-L22 type Response struct { } diff --git a/typedapi/security/enableuserprofile/enable_user_profile.go b/typedapi/security/enableuserprofile/enable_user_profile.go index c14a1fc839..74aef723d2 100644 --- a/typedapi/security/enableuserprofile/enable_user_profile.go +++ b/typedapi/security/enableuserprofile/enable_user_profile.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Enables a user profile so it's visible in user profile searches. package enableuserprofile import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type EnableUserProfile struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int uid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewEnableUserProfile type alias for index. @@ -76,13 +79,18 @@ func NewEnableUserProfileFunc(tp elastictransport.Interface) NewEnableUserProfil // Enables a user profile so it's visible in user profile searches. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-enable-user-profile.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user-profile.html func New(tp elastictransport.Interface) *EnableUserProfile { r := &EnableUserProfile{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *EnableUserProfile) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("profile") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "uid", r.uid) + } path.WriteString(r.uid) path.WriteString("/") path.WriteString("_enable") @@ -122,9 +133,9 @@ func (r *EnableUserProfile) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -141,27 +152,66 @@ func (r *EnableUserProfile) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r EnableUserProfile) Perform(ctx context.Context) (*http.Response, error) { +func (r EnableUserProfile) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.enable_user_profile") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.enable_user_profile") + if reader := instrument.RecordRequestBody(ctx, "security.enable_user_profile", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.enable_user_profile") + } if err != nil { - return nil, fmt.Errorf("an error happened during the EnableUserProfile query execution: %w", err) + localErr := fmt.Errorf("an error happened during the EnableUserProfile query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a enableuserprofile.Response -func (r EnableUserProfile) Do(ctx context.Context) (*Response, error) { +func (r EnableUserProfile) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enable_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -169,6 +219,9 @@ func (r EnableUserProfile) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,6 +231,9 @@ func (r EnableUserProfile) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,12 +241,25 @@ func (r EnableUserProfile) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r EnableUserProfile) IsSuccess(ctx context.Context) (bool, error) { +func (r EnableUserProfile) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enable_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -206,6 +275,14 @@ func (r EnableUserProfile) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the EnableUserProfile query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/enableuserprofile/response.go b/typedapi/security/enableuserprofile/response.go index 1200d8262e..05a7665b53 100644 --- a/typedapi/security/enableuserprofile/response.go +++ b/typedapi/security/enableuserprofile/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package enableuserprofile // Response holds the response body struct for the package enableuserprofile // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/enable_user_profile/Response.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/enable_user_profile/Response.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/security/enrollkibana/enroll_kibana.go b/typedapi/security/enrollkibana/enroll_kibana.go index 476219678f..1eff8c4591 100644 --- a/typedapi/security/enrollkibana/enroll_kibana.go +++ b/typedapi/security/enrollkibana/enroll_kibana.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows a kibana instance to configure itself to communicate with a secured // elasticsearch cluster. package enrollkibana import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type EnrollKibana struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewEnrollKibana type alias for index. @@ -69,13 +72,18 @@ func NewEnrollKibanaFunc(tp elastictransport.Interface) NewEnrollKibana { // Allows a kibana instance to configure itself to communicate with a secured // elasticsearch cluster. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-kibana-enrollment.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-kibana-enrollment.html func New(tp elastictransport.Interface) *EnrollKibana { r := &EnrollKibana{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,15 +120,15 @@ func (r *EnrollKibana) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -137,27 +145,66 @@ func (r *EnrollKibana) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r EnrollKibana) Perform(ctx context.Context) (*http.Response, error) { +func (r EnrollKibana) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.enroll_kibana") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.enroll_kibana") + if reader := instrument.RecordRequestBody(ctx, "security.enroll_kibana", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.enroll_kibana") + } if err != nil { - return nil, fmt.Errorf("an error happened during the EnrollKibana query execution: %w", err) + localErr := fmt.Errorf("an error happened during the EnrollKibana query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a enrollkibana.Response -func (r EnrollKibana) Do(ctx context.Context) (*Response, error) { +func (r EnrollKibana) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enroll_kibana") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -165,6 +212,9 @@ func (r EnrollKibana) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -174,6 +224,9 @@ func (r EnrollKibana) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,12 +234,25 @@ func (r EnrollKibana) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r EnrollKibana) IsSuccess(ctx context.Context) (bool, error) { +func (r EnrollKibana) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enroll_kibana") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -202,6 +268,14 @@ func (r EnrollKibana) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the EnrollKibana query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/enrollkibana/response.go b/typedapi/security/enrollkibana/response.go index 6972364b25..210d9229bd 100644 --- a/typedapi/security/enrollkibana/response.go +++ b/typedapi/security/enrollkibana/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package enrollkibana @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package enrollkibana // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/enroll_kibana/Response.ts#L20-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/enroll_kibana/Response.ts#L20-L25 type Response struct { HttpCa string `json:"http_ca"` Token types.KibanaToken `json:"token"` diff --git a/typedapi/security/enrollnode/enroll_node.go b/typedapi/security/enrollnode/enroll_node.go index d1101850b5..553e424c0d 100644 --- a/typedapi/security/enrollnode/enroll_node.go +++ b/typedapi/security/enrollnode/enroll_node.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Allows a new node to enroll to an existing cluster with security enabled. package enrollnode import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type EnrollNode struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewEnrollNode type alias for index. @@ -67,13 +70,18 @@ func NewEnrollNodeFunc(tp elastictransport.Interface) NewEnrollNode { // Allows a new node to enroll to an existing cluster with security enabled. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-node-enrollment.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-node-enrollment.html func New(tp elastictransport.Interface) *EnrollNode { r := &EnrollNode{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,15 +118,15 @@ func (r *EnrollNode) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -135,27 +143,66 @@ func (r *EnrollNode) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r EnrollNode) Perform(ctx context.Context) (*http.Response, error) { +func (r EnrollNode) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.enroll_node") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.enroll_node") + if reader := instrument.RecordRequestBody(ctx, "security.enroll_node", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.enroll_node") + } if err != nil { - return nil, fmt.Errorf("an error happened during the EnrollNode query execution: %w", err) + localErr := fmt.Errorf("an error happened during the EnrollNode query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a enrollnode.Response -func (r EnrollNode) Do(ctx context.Context) (*Response, error) { +func (r EnrollNode) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enroll_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -163,6 +210,9 @@ func (r EnrollNode) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -172,6 +222,9 @@ func (r EnrollNode) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -179,12 +232,25 @@ func (r EnrollNode) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r EnrollNode) IsSuccess(ctx context.Context) (bool, error) { +func (r EnrollNode) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.enroll_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -200,6 +266,14 @@ func (r EnrollNode) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the EnrollNode query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/enrollnode/response.go b/typedapi/security/enrollnode/response.go index eba0d26d57..6f216779d1 100644 --- a/typedapi/security/enrollnode/response.go +++ b/typedapi/security/enrollnode/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package enrollnode // Response holds the response body struct for the package enrollnode // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/enroll_node/Response.ts#L20-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/enroll_node/Response.ts#L20-L29 type Response struct { HttpCaCert string `json:"http_ca_cert"` HttpCaKey string `json:"http_ca_key"` diff --git a/typedapi/security/getapikey/get_api_key.go b/typedapi/security/getapikey/get_api_key.go index 4aca4c8852..68d91d7228 100644 --- a/typedapi/security/getapikey/get_api_key.go +++ b/typedapi/security/getapikey/get_api_key.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information for one or more API keys. package getapikey import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type GetApiKey struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetApiKey type alias for index. @@ -74,7 +77,12 @@ func New(tp elastictransport.Interface) *GetApiKey { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,9 +117,9 @@ func (r *GetApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -128,27 +136,66 @@ func (r *GetApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetApiKey) Perform(ctx context.Context) (*http.Response, error) { +func (r GetApiKey) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_api_key") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.get_api_key", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_api_key") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetApiKey query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetApiKey query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getapikey.Response -func (r GetApiKey) Do(ctx context.Context) (*Response, error) { +func (r GetApiKey) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -156,6 +203,9 @@ func (r GetApiKey) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -165,6 +215,9 @@ func (r GetApiKey) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -172,12 +225,25 @@ func (r GetApiKey) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetApiKey) IsSuccess(ctx context.Context) (bool, error) { +func (r GetApiKey) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -193,6 +259,14 @@ func (r GetApiKey) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetApiKey query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/getapikey/response.go b/typedapi/security/getapikey/response.go index e62663fcb7..71fd4d9e99 100644 --- a/typedapi/security/getapikey/response.go +++ b/typedapi/security/getapikey/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getapikey @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getapikey // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_api_key/SecurityGetApiKeyResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_api_key/SecurityGetApiKeyResponse.ts#L22-L24 type Response struct { ApiKeys []types.ApiKey `json:"api_keys"` } diff --git a/typedapi/security/getbuiltinprivileges/get_builtin_privileges.go b/typedapi/security/getbuiltinprivileges/get_builtin_privileges.go index aaa4cd6167..0298a4e9ca 100644 --- a/typedapi/security/getbuiltinprivileges/get_builtin_privileges.go +++ b/typedapi/security/getbuiltinprivileges/get_builtin_privileges.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves the list of cluster privileges and index privileges that are // available in this version of Elasticsearch. package getbuiltinprivileges import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type GetBuiltinPrivileges struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetBuiltinPrivileges type alias for index. @@ -75,7 +78,12 @@ func New(tp elastictransport.Interface) *GetBuiltinPrivileges { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,9 +120,9 @@ func (r *GetBuiltinPrivileges) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -131,27 +139,66 @@ func (r *GetBuiltinPrivileges) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetBuiltinPrivileges) Perform(ctx context.Context) (*http.Response, error) { +func (r GetBuiltinPrivileges) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_builtin_privileges") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_builtin_privileges") + if reader := instrument.RecordRequestBody(ctx, "security.get_builtin_privileges", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_builtin_privileges") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetBuiltinPrivileges query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetBuiltinPrivileges query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getbuiltinprivileges.Response -func (r GetBuiltinPrivileges) Do(ctx context.Context) (*Response, error) { +func (r GetBuiltinPrivileges) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_builtin_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -159,6 +206,9 @@ func (r GetBuiltinPrivileges) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -168,6 +218,9 @@ func (r GetBuiltinPrivileges) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,12 +228,25 @@ func (r GetBuiltinPrivileges) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetBuiltinPrivileges) IsSuccess(ctx context.Context) (bool, error) { +func (r GetBuiltinPrivileges) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_builtin_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -196,6 +262,14 @@ func (r GetBuiltinPrivileges) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetBuiltinPrivileges query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/getbuiltinprivileges/response.go b/typedapi/security/getbuiltinprivileges/response.go index 3ef9a78b1e..bc0df7337e 100644 --- a/typedapi/security/getbuiltinprivileges/response.go +++ b/typedapi/security/getbuiltinprivileges/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getbuiltinprivileges @@ -29,8 +29,7 @@ import ( // Response holds the response body struct for the package getbuiltinprivileges // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts#L22-L24 type Response struct { Cluster []string `json:"cluster"` Index []string `json:"index"` diff --git a/typedapi/security/getprivileges/get_privileges.go b/typedapi/security/getprivileges/get_privileges.go index 15905dabaf..7d748ffbd2 100644 --- a/typedapi/security/getprivileges/get_privileges.go +++ b/typedapi/security/getprivileges/get_privileges.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves application privileges. package getprivileges import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type GetPrivileges struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int application string name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetPrivileges type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *GetPrivileges { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,6 +122,9 @@ func (r *GetPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("privilege") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "application", r.application) + } path.WriteString(r.application) method = http.MethodGet @@ -124,9 +135,15 @@ func (r *GetPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("privilege") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "application", r.application) + } path.WriteString(r.application) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -140,9 +157,9 @@ func (r *GetPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -159,27 +176,66 @@ func (r *GetPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetPrivileges) Perform(ctx context.Context) (*http.Response, error) { +func (r GetPrivileges) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_privileges") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_privileges") + if reader := instrument.RecordRequestBody(ctx, "security.get_privileges", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_privileges") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetPrivileges query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetPrivileges query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getprivileges.Response -func (r GetPrivileges) Do(ctx context.Context) (Response, error) { +func (r GetPrivileges) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -187,6 +243,9 @@ func (r GetPrivileges) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -196,6 +255,9 @@ func (r GetPrivileges) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -203,12 +265,25 @@ func (r GetPrivileges) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetPrivileges) IsSuccess(ctx context.Context) (bool, error) { +func (r GetPrivileges) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -224,6 +299,14 @@ func (r GetPrivileges) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetPrivileges query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/getprivileges/response.go b/typedapi/security/getprivileges/response.go index c174c35f9e..25b6caef30 100644 --- a/typedapi/security/getprivileges/response.go +++ b/typedapi/security/getprivileges/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getprivileges @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getprivileges // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_privileges/SecurityGetPrivilegesResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_privileges/SecurityGetPrivilegesResponse.ts#L23-L25 type Response map[string]map[string]types.PrivilegesActions diff --git a/typedapi/security/getrole/get_role.go b/typedapi/security/getrole/get_role.go index 960972fcd7..cf7f143544 100644 --- a/typedapi/security/getrole/get_role.go +++ b/typedapi/security/getrole/get_role.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves roles in the native realm. package getrole import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type GetRole struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetRole type alias for index. @@ -79,7 +82,12 @@ func New(tp elastictransport.Interface) *GetRole { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *GetRole) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("role") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -124,9 +135,9 @@ func (r *GetRole) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -143,27 +154,66 @@ func (r *GetRole) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetRole) Perform(ctx context.Context) (*http.Response, error) { +func (r GetRole) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_role") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_role") + if reader := instrument.RecordRequestBody(ctx, "security.get_role", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_role") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetRole query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetRole query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getrole.Response -func (r GetRole) Do(ctx context.Context) (Response, error) { +func (r GetRole) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_role") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -171,6 +221,9 @@ func (r GetRole) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,6 +233,9 @@ func (r GetRole) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,12 +243,25 @@ func (r GetRole) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetRole) IsSuccess(ctx context.Context) (bool, error) { +func (r GetRole) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_role") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -208,6 +277,14 @@ func (r GetRole) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetRole query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/getrole/response.go b/typedapi/security/getrole/response.go index fe2a44ac3a..211c9282d7 100644 --- a/typedapi/security/getrole/response.go +++ b/typedapi/security/getrole/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getrole @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getrole // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_role/SecurityGetRoleResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_role/SecurityGetRoleResponse.ts#L23-L25 type Response map[string]types.Role diff --git a/typedapi/security/getrolemapping/get_role_mapping.go b/typedapi/security/getrolemapping/get_role_mapping.go index bb7ee21a66..4b585d1b25 100644 --- a/typedapi/security/getrolemapping/get_role_mapping.go +++ b/typedapi/security/getrolemapping/get_role_mapping.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves role mappings. package getrolemapping import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type GetRoleMapping struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetRoleMapping type alias for index. @@ -79,7 +82,12 @@ func New(tp elastictransport.Interface) *GetRoleMapping { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *GetRoleMapping) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("role_mapping") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodGet @@ -124,9 +135,9 @@ func (r *GetRoleMapping) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -143,27 +154,66 @@ func (r *GetRoleMapping) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetRoleMapping) Perform(ctx context.Context) (*http.Response, error) { +func (r GetRoleMapping) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_role_mapping") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_role_mapping") + if reader := instrument.RecordRequestBody(ctx, "security.get_role_mapping", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_role_mapping") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetRoleMapping query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetRoleMapping query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getrolemapping.Response -func (r GetRoleMapping) Do(ctx context.Context) (Response, error) { +func (r GetRoleMapping) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_role_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -171,6 +221,9 @@ func (r GetRoleMapping) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,6 +233,9 @@ func (r GetRoleMapping) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,12 +243,25 @@ func (r GetRoleMapping) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetRoleMapping) IsSuccess(ctx context.Context) (bool, error) { +func (r GetRoleMapping) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_role_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -208,6 +277,14 @@ func (r GetRoleMapping) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetRoleMapping query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/getrolemapping/response.go b/typedapi/security/getrolemapping/response.go index c332779b4a..0c81ee81ec 100644 --- a/typedapi/security/getrolemapping/response.go +++ b/typedapi/security/getrolemapping/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getrolemapping @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getrolemapping // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_role_mapping/SecurityGetRoleMappingResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_role_mapping/SecurityGetRoleMappingResponse.ts#L23-L25 type Response map[string]types.SecurityRoleMapping diff --git a/typedapi/security/getserviceaccounts/get_service_accounts.go b/typedapi/security/getserviceaccounts/get_service_accounts.go index d3dec9cfa6..31ca451d37 100644 --- a/typedapi/security/getserviceaccounts/get_service_accounts.go +++ b/typedapi/security/getserviceaccounts/get_service_accounts.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about service accounts. package getserviceaccounts import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type GetServiceAccounts struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int namespace string service string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetServiceAccounts type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *GetServiceAccounts { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,9 +115,15 @@ func (r *GetServiceAccounts) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("service") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.namespace) + } path.WriteString(r.namespace) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.service) + } path.WriteString(r.service) method = http.MethodGet @@ -120,6 +134,9 @@ func (r *GetServiceAccounts) HttpRequest(ctx context.Context) (*http.Request, er path.WriteString("service") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.namespace) + } path.WriteString(r.namespace) method = http.MethodGet @@ -140,9 +157,9 @@ func (r *GetServiceAccounts) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -159,27 +176,66 @@ func (r *GetServiceAccounts) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetServiceAccounts) Perform(ctx context.Context) (*http.Response, error) { +func (r GetServiceAccounts) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_service_accounts") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_service_accounts") + if reader := instrument.RecordRequestBody(ctx, "security.get_service_accounts", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_service_accounts") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetServiceAccounts query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetServiceAccounts query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getserviceaccounts.Response -func (r GetServiceAccounts) Do(ctx context.Context) (Response, error) { +func (r GetServiceAccounts) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_service_accounts") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -187,6 +243,9 @@ func (r GetServiceAccounts) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -196,6 +255,9 @@ func (r GetServiceAccounts) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -203,12 +265,25 @@ func (r GetServiceAccounts) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetServiceAccounts) IsSuccess(ctx context.Context) (bool, error) { +func (r GetServiceAccounts) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_service_accounts") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -224,6 +299,14 @@ func (r GetServiceAccounts) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetServiceAccounts query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/getserviceaccounts/response.go b/typedapi/security/getserviceaccounts/response.go index 718f875c44..6fcbe21643 100644 --- a/typedapi/security/getserviceaccounts/response.go +++ b/typedapi/security/getserviceaccounts/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getserviceaccounts @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getserviceaccounts // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_service_accounts/GetServiceAccountsResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_service_accounts/GetServiceAccountsResponse.ts#L23-L25 type Response map[string]types.RoleDescriptorWrapper diff --git a/typedapi/security/getservicecredentials/get_service_credentials.go b/typedapi/security/getservicecredentials/get_service_credentials.go index a2b1a1e1eb..d1752b428a 100644 --- a/typedapi/security/getservicecredentials/get_service_credentials.go +++ b/typedapi/security/getservicecredentials/get_service_credentials.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information of all service credentials for a service account. package getservicecredentials import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type GetServiceCredentials struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int namespace string service string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetServiceCredentials type alias for index. @@ -86,7 +89,12 @@ func New(tp elastictransport.Interface) *GetServiceCredentials { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,9 +119,15 @@ func (r *GetServiceCredentials) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("service") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "namespace", r.namespace) + } path.WriteString(r.namespace) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "service", r.service) + } path.WriteString(r.service) path.WriteString("/") path.WriteString("credential") @@ -129,9 +143,9 @@ func (r *GetServiceCredentials) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -148,27 +162,66 @@ func (r *GetServiceCredentials) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetServiceCredentials) Perform(ctx context.Context) (*http.Response, error) { +func (r GetServiceCredentials) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_service_credentials") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_service_credentials") + if reader := instrument.RecordRequestBody(ctx, "security.get_service_credentials", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_service_credentials") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetServiceCredentials query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetServiceCredentials query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getservicecredentials.Response -func (r GetServiceCredentials) Do(ctx context.Context) (*Response, error) { +func (r GetServiceCredentials) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_service_credentials") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -176,6 +229,9 @@ func (r GetServiceCredentials) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -185,6 +241,9 @@ func (r GetServiceCredentials) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -192,12 +251,25 @@ func (r GetServiceCredentials) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetServiceCredentials) IsSuccess(ctx context.Context) (bool, error) { +func (r GetServiceCredentials) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_service_credentials") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -213,6 +285,14 @@ func (r GetServiceCredentials) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetServiceCredentials query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/getservicecredentials/response.go b/typedapi/security/getservicecredentials/response.go index 415bc9ceda..d8ffafc688 100644 --- a/typedapi/security/getservicecredentials/response.go +++ b/typedapi/security/getservicecredentials/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getservicecredentials @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getservicecredentials // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_service_credentials/GetServiceCredentialsResponse.ts#L25-L33 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_service_credentials/GetServiceCredentialsResponse.ts#L25-L33 type Response struct { Count int `json:"count"` // NodesCredentials Contains service account credentials collected from all nodes of the cluster diff --git a/typedapi/security/getsettings/get_settings.go b/typedapi/security/getsettings/get_settings.go new file mode 100644 index 0000000000..609e0e51b0 --- /dev/null +++ b/typedapi/security/getsettings/get_settings.go @@ -0,0 +1,232 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +// Retrieve settings for the security system indices +package getsettings + +import ( + "context" + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/elastic/elastic-transport-go/v8/elastictransport" +) + +// ErrBuildPath is returned in case of missing parameters within the build of the request. +var ErrBuildPath = errors.New("cannot build path, check for missing path parameters") + +type GetSettings struct { + transport elastictransport.Interface + + headers http.Header + values url.Values + path url.URL + + raw io.Reader + + paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation +} + +// NewGetSettings type alias for index. +type NewGetSettings func() *GetSettings + +// NewGetSettingsFunc returns a new instance of GetSettings with the provided transport. +// Used in the index of the library this allows to retrieve every apis in once place. +func NewGetSettingsFunc(tp elastictransport.Interface) NewGetSettings { + return func() *GetSettings { + n := New(tp) + + return n + } +} + +// Retrieve settings for the security system indices +// +// https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-settings.html +func New(tp elastictransport.Interface) *GetSettings { + r := &GetSettings{ + transport: tp, + values: make(url.Values), + headers: make(http.Header), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + + return r +} + +// HttpRequest returns the http.Request object built from the +// given parameters. +func (r *GetSettings) HttpRequest(ctx context.Context) (*http.Request, error) { + var path strings.Builder + var method string + var req *http.Request + + var err error + + r.path.Scheme = "http" + + switch { + case r.paramSet == 0: + path.WriteString("/") + path.WriteString("_security") + path.WriteString("/") + path.WriteString("settings") + + method = http.MethodGet + } + + r.path.Path = path.String() + r.path.RawQuery = r.values.Encode() + + if r.path.Path == "" { + return nil, ErrBuildPath + } + + if ctx != nil { + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) + } else { + req, err = http.NewRequest(method, r.path.String(), r.raw) + } + + req.Header = r.headers.Clone() + + if req.Header.Get("Content-Type") == "" { + if r.raw != nil { + req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") + } + } + + if req.Header.Get("Accept") == "" { + req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=8") + } + + if err != nil { + return req, fmt.Errorf("could not build http.Request: %w", err) + } + + return req, nil +} + +// Perform runs the http.Request through the provided transport and returns an http.Response. +func (r GetSettings) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_settings") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + + req, err := r.HttpRequest(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_settings") + if reader := instrument.RecordRequestBody(ctx, "security.get_settings", r.raw); reader != nil { + req.Body = reader + } + } + res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_settings") + } + if err != nil { + localErr := fmt.Errorf("an error happened during the GetSettings query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr + } + + return res, nil +} + +// Do runs the request through the transport, handle the response and returns a getsettings.Response +func (r GetSettings) Do(ctx context.Context) (bool, error) { + return r.IsSuccess(ctx) +} + +// IsSuccess allows to run a query with a context and retrieve the result as a boolean. +// This only exists for endpoints without a request payload and allows for quick control flow. +func (r GetSettings) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + res, err := r.Perform(ctx) + + if err != nil { + return false, err + } + io.Copy(ioutil.Discard, res.Body) + err = res.Body.Close() + if err != nil { + return false, err + } + + if res.StatusCode >= 200 && res.StatusCode < 300 { + return true, nil + } + + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetSettings query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + + return false, nil +} + +// Header set a key, value pair in the GetSettings headers map. +func (r *GetSettings) Header(key, value string) *GetSettings { + r.headers.Set(key, value) + + return r +} diff --git a/typedapi/security/gettoken/get_token.go b/typedapi/security/gettoken/get_token.go index 26f0a1068a..2c5f8f6738 100644 --- a/typedapi/security/gettoken/get_token.go +++ b/typedapi/security/gettoken/get_token.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a bearer token for access without requiring basic authentication. package gettoken @@ -47,13 +47,17 @@ type GetToken struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetToken type alias for index. @@ -77,11 +81,18 @@ func New(tp elastictransport.Interface) *GetToken { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -118,9 +129,7 @@ func (r *GetToken) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -132,6 +141,10 @@ func (r *GetToken) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,15 +167,15 @@ func (r *GetToken) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -179,27 +192,66 @@ func (r *GetToken) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetToken) Perform(ctx context.Context) (*http.Response, error) { +func (r GetToken) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_token") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_token") + if reader := instrument.RecordRequestBody(ctx, "security.get_token", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_token") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetToken query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetToken query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a gettoken.Response -func (r GetToken) Do(ctx context.Context) (*Response, error) { +func (r GetToken) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_token") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -207,6 +259,9 @@ func (r GetToken) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -216,6 +271,9 @@ func (r GetToken) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r GetToken) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/gettoken/request.go b/typedapi/security/gettoken/request.go index 003be5b2a6..a4dc2cfcfe 100644 --- a/typedapi/security/gettoken/request.go +++ b/typedapi/security/gettoken/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package gettoken @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package gettoken // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_token/GetUserAccessTokenRequest.ts#L25-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_token/GetUserAccessTokenRequest.ts#L25-L39 type Request struct { GrantType *accesstokengranttype.AccessTokenGrantType `json:"grant_type,omitempty"` KerberosTicket *string `json:"kerberos_ticket,omitempty"` diff --git a/typedapi/security/gettoken/response.go b/typedapi/security/gettoken/response.go index 3cd9036530..ec050658ab 100644 --- a/typedapi/security/gettoken/response.go +++ b/typedapi/security/gettoken/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package gettoken @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package gettoken // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_token/GetUserAccessTokenResponse.ts#L23-L33 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_token/GetUserAccessTokenResponse.ts#L23-L33 type Response struct { AccessToken string `json:"access_token"` Authentication types.AuthenticatedUser `json:"authentication"` diff --git a/typedapi/security/getuser/get_user.go b/typedapi/security/getuser/get_user.go index 5cdd6ebce2..086e4a4a49 100644 --- a/typedapi/security/getuser/get_user.go +++ b/typedapi/security/getuser/get_user.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about users in the native realm and built-in users. package getuser import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetUser struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int username string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetUser type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetUser { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *GetUser) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("user") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.username) + } path.WriteString(r.username) method = http.MethodGet @@ -125,9 +136,9 @@ func (r *GetUser) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *GetUser) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetUser) Perform(ctx context.Context) (*http.Response, error) { +func (r GetUser) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_user") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_user") + if reader := instrument.RecordRequestBody(ctx, "security.get_user", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_user") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetUser query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetUser query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getuser.Response -func (r GetUser) Do(ctx context.Context) (Response, error) { +func (r GetUser) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r GetUser) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r GetUser) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r GetUser) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetUser) IsSuccess(ctx context.Context) (bool, error) { +func (r GetUser) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r GetUser) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetUser query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/getuser/response.go b/typedapi/security/getuser/response.go index 394dc34e2e..ade8ad3c81 100644 --- a/typedapi/security/getuser/response.go +++ b/typedapi/security/getuser/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getuser @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getuser // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_user/SecurityGetUserResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_user/SecurityGetUserResponse.ts#L23-L25 type Response map[string]types.User diff --git a/typedapi/security/getuserprivileges/get_user_privileges.go b/typedapi/security/getuserprivileges/get_user_privileges.go index 23b7eafc02..2bb69a827e 100644 --- a/typedapi/security/getuserprivileges/get_user_privileges.go +++ b/typedapi/security/getuserprivileges/get_user_privileges.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves security privileges for the logged in user. package getuserprivileges import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type GetUserPrivileges struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetUserPrivileges type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *GetUserPrivileges { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *GetUserPrivileges) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *GetUserPrivileges) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetUserPrivileges) Perform(ctx context.Context) (*http.Response, error) { +func (r GetUserPrivileges) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_user_privileges") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_user_privileges") + if reader := instrument.RecordRequestBody(ctx, "security.get_user_privileges", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_user_privileges") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetUserPrivileges query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetUserPrivileges query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getuserprivileges.Response -func (r GetUserPrivileges) Do(ctx context.Context) (*Response, error) { +func (r GetUserPrivileges) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_user_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r GetUserPrivileges) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r GetUserPrivileges) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r GetUserPrivileges) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetUserPrivileges) IsSuccess(ctx context.Context) (bool, error) { +func (r GetUserPrivileges) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_user_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r GetUserPrivileges) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetUserPrivileges query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/getuserprivileges/response.go b/typedapi/security/getuserprivileges/response.go index bee8336d04..253a7e4a01 100644 --- a/typedapi/security/getuserprivileges/response.go +++ b/typedapi/security/getuserprivileges/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getuserprivileges @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getuserprivileges // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_user_privileges/SecurityGetUserPrivilegesResponse.ts#L27-L35 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_user_privileges/SecurityGetUserPrivilegesResponse.ts#L27-L35 type Response struct { Applications []types.ApplicationPrivileges `json:"applications"` Cluster []string `json:"cluster"` diff --git a/typedapi/security/getuserprofile/get_user_profile.go b/typedapi/security/getuserprofile/get_user_profile.go index 8e85a71947..d52511ae3a 100644 --- a/typedapi/security/getuserprofile/get_user_profile.go +++ b/typedapi/security/getuserprofile/get_user_profile.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves user profiles for the given unique ID(s). package getuserprofile import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type GetUserProfile struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int uid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetUserProfile type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *GetUserProfile { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *GetUserProfile) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("profile") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "uid", r.uid) + } path.WriteString(r.uid) method = http.MethodGet @@ -119,9 +130,9 @@ func (r *GetUserProfile) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *GetUserProfile) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetUserProfile) Perform(ctx context.Context) (*http.Response, error) { +func (r GetUserProfile) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.get_user_profile") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.get_user_profile") + if reader := instrument.RecordRequestBody(ctx, "security.get_user_profile", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.get_user_profile") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetUserProfile query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetUserProfile query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getuserprofile.Response -func (r GetUserProfile) Do(ctx context.Context) (*Response, error) { +func (r GetUserProfile) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r GetUserProfile) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r GetUserProfile) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r GetUserProfile) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetUserProfile) IsSuccess(ctx context.Context) (bool, error) { +func (r GetUserProfile) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.get_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r GetUserProfile) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetUserProfile query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/getuserprofile/response.go b/typedapi/security/getuserprofile/response.go index 3659c64516..abdf47c8d8 100644 --- a/typedapi/security/getuserprofile/response.go +++ b/typedapi/security/getuserprofile/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getuserprofile @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getuserprofile // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_user_profile/Response.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_user_profile/Response.ts#L23-L28 type Response struct { Errors *types.GetUserProfileErrors `json:"errors,omitempty"` Profiles []types.UserProfileWithMetadata `json:"profiles"` diff --git a/typedapi/security/grantapikey/grant_api_key.go b/typedapi/security/grantapikey/grant_api_key.go index 1f8f792912..b832c19285 100644 --- a/typedapi/security/grantapikey/grant_api_key.go +++ b/typedapi/security/grantapikey/grant_api_key.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates an API key on behalf of another user. package grantapikey @@ -47,13 +47,17 @@ type GrantApiKey struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGrantApiKey type alias for index. @@ -77,11 +81,18 @@ func New(tp elastictransport.Interface) *GrantApiKey { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -118,9 +129,7 @@ func (r *GrantApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -132,6 +141,10 @@ func (r *GrantApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,15 +167,15 @@ func (r *GrantApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -179,27 +192,66 @@ func (r *GrantApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GrantApiKey) Perform(ctx context.Context) (*http.Response, error) { +func (r GrantApiKey) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.grant_api_key") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.grant_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.grant_api_key", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.grant_api_key") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GrantApiKey query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GrantApiKey query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a grantapikey.Response -func (r GrantApiKey) Do(ctx context.Context) (*Response, error) { +func (r GrantApiKey) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.grant_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -207,6 +259,9 @@ func (r GrantApiKey) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -216,6 +271,9 @@ func (r GrantApiKey) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r GrantApiKey) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/grantapikey/request.go b/typedapi/security/grantapikey/request.go index a592ecf351..787adc174b 100644 --- a/typedapi/security/grantapikey/request.go +++ b/typedapi/security/grantapikey/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package grantapikey @@ -30,7 +30,7 @@ import ( // Request holds the request body struct for the package grantapikey // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/grant_api_key/SecurityGrantApiKeyRequest.ts#L24-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/grant_api_key/SecurityGrantApiKeyRequest.ts#L24-L75 type Request struct { // AccessToken The user’s access token. diff --git a/typedapi/security/grantapikey/response.go b/typedapi/security/grantapikey/response.go index ac746ea332..32557b7015 100644 --- a/typedapi/security/grantapikey/response.go +++ b/typedapi/security/grantapikey/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package grantapikey // Response holds the response body struct for the package grantapikey // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/grant_api_key/SecurityGrantApiKeyResponse.ts#L23-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/grant_api_key/SecurityGrantApiKeyResponse.ts#L23-L31 type Response struct { ApiKey string `json:"api_key"` Encoded string `json:"encoded"` diff --git a/typedapi/security/hasprivileges/has_privileges.go b/typedapi/security/hasprivileges/has_privileges.go index 239d2fb746..7f76f62999 100644 --- a/typedapi/security/hasprivileges/has_privileges.go +++ b/typedapi/security/hasprivileges/has_privileges.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Determines whether the specified user has a specified list of privileges. package hasprivileges @@ -51,15 +51,19 @@ type HasPrivileges struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int user string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewHasPrivileges type alias for index. @@ -83,11 +87,18 @@ func New(tp elastictransport.Interface) *HasPrivileges { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -124,9 +135,7 @@ func (r *HasPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -138,6 +147,10 @@ func (r *HasPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -157,6 +170,9 @@ func (r *HasPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("user") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "user", r.user) + } path.WriteString(r.user) path.WriteString("/") path.WriteString("_has_privileges") @@ -172,15 +188,15 @@ func (r *HasPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -197,27 +213,66 @@ func (r *HasPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r HasPrivileges) Perform(ctx context.Context) (*http.Response, error) { +func (r HasPrivileges) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.has_privileges") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.has_privileges") + if reader := instrument.RecordRequestBody(ctx, "security.has_privileges", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.has_privileges") + } if err != nil { - return nil, fmt.Errorf("an error happened during the HasPrivileges query execution: %w", err) + localErr := fmt.Errorf("an error happened during the HasPrivileges query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a hasprivileges.Response -func (r HasPrivileges) Do(ctx context.Context) (*Response, error) { +func (r HasPrivileges) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.has_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -225,6 +280,9 @@ func (r HasPrivileges) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +292,9 @@ func (r HasPrivileges) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -241,6 +302,9 @@ func (r HasPrivileges) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/hasprivileges/request.go b/typedapi/security/hasprivileges/request.go index c641c54b76..59509c4117 100644 --- a/typedapi/security/hasprivileges/request.go +++ b/typedapi/security/hasprivileges/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package hasprivileges @@ -30,7 +30,7 @@ import ( // Request holds the request body struct for the package hasprivileges // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges/SecurityHasPrivilegesRequest.ts#L25-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges/SecurityHasPrivilegesRequest.ts#L25-L42 type Request struct { Application []types.ApplicationPrivilegesCheck `json:"application,omitempty"` // Cluster A list of the cluster privileges that you want to check. diff --git a/typedapi/security/hasprivileges/response.go b/typedapi/security/hasprivileges/response.go index a94e78596e..8787d81d0a 100644 --- a/typedapi/security/hasprivileges/response.go +++ b/typedapi/security/hasprivileges/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package hasprivileges @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package hasprivileges // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges/SecurityHasPrivilegesResponse.ts#L24-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges/SecurityHasPrivilegesResponse.ts#L24-L32 type Response struct { Application types.ApplicationsPrivileges `json:"application"` Cluster map[string]bool `json:"cluster"` diff --git a/typedapi/security/hasprivilegesuserprofile/has_privileges_user_profile.go b/typedapi/security/hasprivilegesuserprofile/has_privileges_user_profile.go index 507ec3500d..0dcc1b1fb0 100644 --- a/typedapi/security/hasprivilegesuserprofile/has_privileges_user_profile.go +++ b/typedapi/security/hasprivilegesuserprofile/has_privileges_user_profile.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Determines whether the users associated with the specified profile IDs have // all the requested privileges. @@ -47,13 +47,17 @@ type HasPrivilegesUserProfile struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewHasPrivilegesUserProfile type alias for index. @@ -78,11 +82,18 @@ func New(tp elastictransport.Interface) *HasPrivilegesUserProfile { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -119,9 +130,7 @@ func (r *HasPrivilegesUserProfile) HttpRequest(ctx context.Context) (*http.Reque } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -133,6 +142,10 @@ func (r *HasPrivilegesUserProfile) HttpRequest(ctx context.Context) (*http.Reque } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -155,15 +168,15 @@ func (r *HasPrivilegesUserProfile) HttpRequest(ctx context.Context) (*http.Reque } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -180,27 +193,66 @@ func (r *HasPrivilegesUserProfile) HttpRequest(ctx context.Context) (*http.Reque } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r HasPrivilegesUserProfile) Perform(ctx context.Context) (*http.Response, error) { +func (r HasPrivilegesUserProfile) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.has_privileges_user_profile") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.has_privileges_user_profile") + if reader := instrument.RecordRequestBody(ctx, "security.has_privileges_user_profile", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.has_privileges_user_profile") + } if err != nil { - return nil, fmt.Errorf("an error happened during the HasPrivilegesUserProfile query execution: %w", err) + localErr := fmt.Errorf("an error happened during the HasPrivilegesUserProfile query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a hasprivilegesuserprofile.Response -func (r HasPrivilegesUserProfile) Do(ctx context.Context) (*Response, error) { +func (r HasPrivilegesUserProfile) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.has_privileges_user_profile") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -208,6 +260,9 @@ func (r HasPrivilegesUserProfile) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -217,6 +272,9 @@ func (r HasPrivilegesUserProfile) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r HasPrivilegesUserProfile) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/hasprivilegesuserprofile/request.go b/typedapi/security/hasprivilegesuserprofile/request.go index e64329f160..de8229c72b 100644 --- a/typedapi/security/hasprivilegesuserprofile/request.go +++ b/typedapi/security/hasprivilegesuserprofile/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package hasprivilegesuserprofile @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package hasprivilegesuserprofile // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges_user_profile/Request.ts#L24-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges_user_profile/Request.ts#L24-L38 type Request struct { Privileges types.PrivilegesCheck `json:"privileges"` // Uids A list of profile IDs. The privileges are checked for associated users of the diff --git a/typedapi/security/hasprivilegesuserprofile/response.go b/typedapi/security/hasprivilegesuserprofile/response.go index d58aff57fb..b96a2bdfb1 100644 --- a/typedapi/security/hasprivilegesuserprofile/response.go +++ b/typedapi/security/hasprivilegesuserprofile/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package hasprivilegesuserprofile @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package hasprivilegesuserprofile // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges_user_profile/Response.ts#L23-L38 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges_user_profile/Response.ts#L23-L38 type Response struct { // Errors The subset of the requested profile IDs for which an error diff --git a/typedapi/security/invalidateapikey/invalidate_api_key.go b/typedapi/security/invalidateapikey/invalidate_api_key.go index f6e6df31c2..320dc7a865 100644 --- a/typedapi/security/invalidateapikey/invalidate_api_key.go +++ b/typedapi/security/invalidateapikey/invalidate_api_key.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Invalidates one or more API keys. package invalidateapikey @@ -46,13 +46,17 @@ type InvalidateApiKey struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewInvalidateApiKey type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *InvalidateApiKey { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *InvalidateApiKey) HttpRequest(ctx context.Context) (*http.Request, erro } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *InvalidateApiKey) HttpRequest(ctx context.Context) (*http.Request, erro } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,15 +164,15 @@ func (r *InvalidateApiKey) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -176,27 +189,66 @@ func (r *InvalidateApiKey) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r InvalidateApiKey) Perform(ctx context.Context) (*http.Response, error) { +func (r InvalidateApiKey) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.invalidate_api_key") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.invalidate_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.invalidate_api_key", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.invalidate_api_key") + } if err != nil { - return nil, fmt.Errorf("an error happened during the InvalidateApiKey query execution: %w", err) + localErr := fmt.Errorf("an error happened during the InvalidateApiKey query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a invalidateapikey.Response -func (r InvalidateApiKey) Do(ctx context.Context) (*Response, error) { +func (r InvalidateApiKey) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.invalidate_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -204,6 +256,9 @@ func (r InvalidateApiKey) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -213,6 +268,9 @@ func (r InvalidateApiKey) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -220,6 +278,9 @@ func (r InvalidateApiKey) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/invalidateapikey/request.go b/typedapi/security/invalidateapikey/request.go index fc4123c903..ed5fad9f13 100644 --- a/typedapi/security/invalidateapikey/request.go +++ b/typedapi/security/invalidateapikey/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package invalidateapikey @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package invalidateapikey // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/invalidate_api_key/SecurityInvalidateApiKeyRequest.ts#L23-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/invalidate_api_key/SecurityInvalidateApiKeyRequest.ts#L23-L66 type Request struct { Id *string `json:"id,omitempty"` // Ids A list of API key ids. diff --git a/typedapi/security/invalidateapikey/response.go b/typedapi/security/invalidateapikey/response.go index 9685ef6d37..0c7e6ced58 100644 --- a/typedapi/security/invalidateapikey/response.go +++ b/typedapi/security/invalidateapikey/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package invalidateapikey @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package invalidateapikey // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/invalidate_api_key/SecurityInvalidateApiKeyResponse.ts#L23-L30 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/invalidate_api_key/SecurityInvalidateApiKeyResponse.ts#L23-L30 type Response struct { ErrorCount int `json:"error_count"` ErrorDetails []types.ErrorCause `json:"error_details,omitempty"` diff --git a/typedapi/security/invalidatetoken/invalidate_token.go b/typedapi/security/invalidatetoken/invalidate_token.go index ce5f49a01d..02c5e6309d 100644 --- a/typedapi/security/invalidatetoken/invalidate_token.go +++ b/typedapi/security/invalidatetoken/invalidate_token.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Invalidates one or more access tokens or refresh tokens. package invalidatetoken @@ -46,13 +46,17 @@ type InvalidateToken struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewInvalidateToken type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *InvalidateToken { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *InvalidateToken) HttpRequest(ctx context.Context) (*http.Request, error } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *InvalidateToken) HttpRequest(ctx context.Context) (*http.Request, error } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,15 +166,15 @@ func (r *InvalidateToken) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -178,27 +191,66 @@ func (r *InvalidateToken) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r InvalidateToken) Perform(ctx context.Context) (*http.Response, error) { +func (r InvalidateToken) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.invalidate_token") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.invalidate_token") + if reader := instrument.RecordRequestBody(ctx, "security.invalidate_token", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.invalidate_token") + } if err != nil { - return nil, fmt.Errorf("an error happened during the InvalidateToken query execution: %w", err) + localErr := fmt.Errorf("an error happened during the InvalidateToken query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a invalidatetoken.Response -func (r InvalidateToken) Do(ctx context.Context) (*Response, error) { +func (r InvalidateToken) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.invalidate_token") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -206,6 +258,9 @@ func (r InvalidateToken) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -215,6 +270,9 @@ func (r InvalidateToken) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r InvalidateToken) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/invalidatetoken/request.go b/typedapi/security/invalidatetoken/request.go index 3d084d955c..021194b9ba 100644 --- a/typedapi/security/invalidatetoken/request.go +++ b/typedapi/security/invalidatetoken/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package invalidatetoken @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package invalidatetoken // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/invalidate_token/SecurityInvalidateTokenRequest.ts#L23-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/invalidate_token/SecurityInvalidateTokenRequest.ts#L23-L35 type Request struct { RealmName *string `json:"realm_name,omitempty"` RefreshToken *string `json:"refresh_token,omitempty"` diff --git a/typedapi/security/invalidatetoken/response.go b/typedapi/security/invalidatetoken/response.go index 54d5fcfb46..7b08f32402 100644 --- a/typedapi/security/invalidatetoken/response.go +++ b/typedapi/security/invalidatetoken/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package invalidatetoken @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package invalidatetoken // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/invalidate_token/SecurityInvalidateTokenResponse.ts#L23-L30 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/invalidate_token/SecurityInvalidateTokenResponse.ts#L23-L30 type Response struct { ErrorCount int64 `json:"error_count"` ErrorDetails []types.ErrorCause `json:"error_details,omitempty"` diff --git a/typedapi/security/oidcauthenticate/oidc_authenticate.go b/typedapi/security/oidcauthenticate/oidc_authenticate.go index cf7d3aee26..fcdca2d064 100644 --- a/typedapi/security/oidcauthenticate/oidc_authenticate.go +++ b/typedapi/security/oidcauthenticate/oidc_authenticate.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Exchanges an OpenID Connection authentication response message for an // Elasticsearch access token and refresh token pair package oidcauthenticate import ( - gobytes "bytes" "context" "errors" "fmt" @@ -46,9 +45,13 @@ type OidcAuthenticate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewOidcAuthenticate type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *OidcAuthenticate { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,15 +118,15 @@ func (r *OidcAuthenticate) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -135,15 +143,42 @@ func (r *OidcAuthenticate) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r OidcAuthenticate) Perform(ctx context.Context) (*http.Response, error) { +func (r OidcAuthenticate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.oidc_authenticate") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.oidc_authenticate") + if reader := instrument.RecordRequestBody(ctx, "security.oidc_authenticate", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.oidc_authenticate") + } if err != nil { - return nil, fmt.Errorf("an error happened during the OidcAuthenticate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the OidcAuthenticate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -156,7 +191,17 @@ func (r OidcAuthenticate) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r OidcAuthenticate) IsSuccess(ctx context.Context) (bool, error) { +func (r OidcAuthenticate) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.oidc_authenticate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -172,6 +217,14 @@ func (r OidcAuthenticate) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the OidcAuthenticate query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/oidclogout/oidc_logout.go b/typedapi/security/oidclogout/oidc_logout.go index 53db490ddb..a0b97c05c5 100644 --- a/typedapi/security/oidclogout/oidc_logout.go +++ b/typedapi/security/oidclogout/oidc_logout.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Invalidates a refresh token and access token that was generated from the // OpenID Connect Authenticate API package oidclogout import ( - gobytes "bytes" "context" "errors" "fmt" @@ -46,9 +45,13 @@ type OidcLogout struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewOidcLogout type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *OidcLogout { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,15 +118,15 @@ func (r *OidcLogout) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -135,15 +143,42 @@ func (r *OidcLogout) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r OidcLogout) Perform(ctx context.Context) (*http.Response, error) { +func (r OidcLogout) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.oidc_logout") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.oidc_logout") + if reader := instrument.RecordRequestBody(ctx, "security.oidc_logout", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.oidc_logout") + } if err != nil { - return nil, fmt.Errorf("an error happened during the OidcLogout query execution: %w", err) + localErr := fmt.Errorf("an error happened during the OidcLogout query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -156,7 +191,17 @@ func (r OidcLogout) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r OidcLogout) IsSuccess(ctx context.Context) (bool, error) { +func (r OidcLogout) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.oidc_logout") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -172,6 +217,14 @@ func (r OidcLogout) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the OidcLogout query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/oidcprepareauthentication/oidc_prepare_authentication.go b/typedapi/security/oidcprepareauthentication/oidc_prepare_authentication.go index 5e655d47ff..8b8518da81 100644 --- a/typedapi/security/oidcprepareauthentication/oidc_prepare_authentication.go +++ b/typedapi/security/oidcprepareauthentication/oidc_prepare_authentication.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates an OAuth 2.0 authentication request as a URL string package oidcprepareauthentication import ( - gobytes "bytes" "context" "errors" "fmt" @@ -45,9 +44,13 @@ type OidcPrepareAuthentication struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewOidcPrepareAuthentication type alias for index. @@ -71,7 +74,12 @@ func New(tp elastictransport.Interface) *OidcPrepareAuthentication { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,15 +116,15 @@ func (r *OidcPrepareAuthentication) HttpRequest(ctx context.Context) (*http.Requ } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -133,15 +141,42 @@ func (r *OidcPrepareAuthentication) HttpRequest(ctx context.Context) (*http.Requ } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r OidcPrepareAuthentication) Perform(ctx context.Context) (*http.Response, error) { +func (r OidcPrepareAuthentication) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.oidc_prepare_authentication") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.oidc_prepare_authentication") + if reader := instrument.RecordRequestBody(ctx, "security.oidc_prepare_authentication", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.oidc_prepare_authentication") + } if err != nil { - return nil, fmt.Errorf("an error happened during the OidcPrepareAuthentication query execution: %w", err) + localErr := fmt.Errorf("an error happened during the OidcPrepareAuthentication query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -154,7 +189,17 @@ func (r OidcPrepareAuthentication) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r OidcPrepareAuthentication) IsSuccess(ctx context.Context) (bool, error) { +func (r OidcPrepareAuthentication) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.oidc_prepare_authentication") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -170,6 +215,14 @@ func (r OidcPrepareAuthentication) IsSuccess(ctx context.Context) (bool, error) return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the OidcPrepareAuthentication query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/putprivileges/put_privileges.go b/typedapi/security/putprivileges/put_privileges.go index 3445a8f6ba..611ea898bb 100644 --- a/typedapi/security/putprivileges/put_privileges.go +++ b/typedapi/security/putprivileges/put_privileges.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Adds or updates application privileges. package putprivileges @@ -47,13 +47,17 @@ type PutPrivileges struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutPrivileges type alias for index. @@ -77,7 +81,14 @@ func New(tp elastictransport.Interface) *PutPrivileges { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -116,9 +127,7 @@ func (r *PutPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -130,6 +139,10 @@ func (r *PutPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,15 +163,15 @@ func (r *PutPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -175,27 +188,66 @@ func (r *PutPrivileges) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutPrivileges) Perform(ctx context.Context) (*http.Response, error) { +func (r PutPrivileges) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.put_privileges") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.put_privileges") + if reader := instrument.RecordRequestBody(ctx, "security.put_privileges", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.put_privileges") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutPrivileges query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutPrivileges query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putprivileges.Response -func (r PutPrivileges) Do(ctx context.Context) (Response, error) { +func (r PutPrivileges) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.put_privileges") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -203,6 +255,9 @@ func (r PutPrivileges) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -212,6 +267,9 @@ func (r PutPrivileges) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -219,6 +277,9 @@ func (r PutPrivileges) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/putprivileges/request.go b/typedapi/security/putprivileges/request.go index 173bb00bcb..aae95a4442 100644 --- a/typedapi/security/putprivileges/request.go +++ b/typedapi/security/putprivileges/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putprivileges @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package putprivileges // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/put_privileges/SecurityPutPrivilegesRequest.ts#L25-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/put_privileges/SecurityPutPrivilegesRequest.ts#L25-L37 type Request = map[string]map[string]types.PrivilegesActions diff --git a/typedapi/security/putprivileges/response.go b/typedapi/security/putprivileges/response.go index 0362761f48..3339124c1b 100644 --- a/typedapi/security/putprivileges/response.go +++ b/typedapi/security/putprivileges/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putprivileges @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package putprivileges // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/put_privileges/SecurityPutPrivilegesResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/put_privileges/SecurityPutPrivilegesResponse.ts#L23-L25 type Response map[string]map[string]types.CreatedStatus diff --git a/typedapi/security/putrole/put_role.go b/typedapi/security/putrole/put_role.go index cb984494f6..842b3195c4 100644 --- a/typedapi/security/putrole/put_role.go +++ b/typedapi/security/putrole/put_role.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Adds and updates roles in the native realm. package putrole @@ -52,15 +52,19 @@ type PutRole struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutRole type alias for index. @@ -86,11 +90,18 @@ func New(tp elastictransport.Interface) *PutRole { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -127,9 +138,7 @@ func (r *PutRole) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -141,6 +150,10 @@ func (r *PutRole) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *PutRole) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("role") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -164,15 +180,15 @@ func (r *PutRole) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -189,27 +205,66 @@ func (r *PutRole) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutRole) Perform(ctx context.Context) (*http.Response, error) { +func (r PutRole) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.put_role") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.put_role") + if reader := instrument.RecordRequestBody(ctx, "security.put_role", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.put_role") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutRole query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutRole query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putrole.Response -func (r PutRole) Do(ctx context.Context) (*Response, error) { +func (r PutRole) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.put_role") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -217,6 +272,9 @@ func (r PutRole) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r PutRole) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r PutRole) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/putrole/request.go b/typedapi/security/putrole/request.go index 281c2e2594..383f4cb93c 100644 --- a/typedapi/security/putrole/request.go +++ b/typedapi/security/putrole/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putrole @@ -30,7 +30,7 @@ import ( // Request holds the request body struct for the package putrole // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/put_role/SecurityPutRoleRequest.ts#L31-L80 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/put_role/SecurityPutRoleRequest.ts#L31-L80 type Request struct { // Applications A list of application privilege entries. diff --git a/typedapi/security/putrole/response.go b/typedapi/security/putrole/response.go index 241a4a949e..0ca4d25154 100644 --- a/typedapi/security/putrole/response.go +++ b/typedapi/security/putrole/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putrole @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package putrole // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/put_role/SecurityPutRoleResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/put_role/SecurityPutRoleResponse.ts#L22-L24 type Response struct { Role types.CreatedStatus `json:"role"` } diff --git a/typedapi/security/putrolemapping/put_role_mapping.go b/typedapi/security/putrolemapping/put_role_mapping.go index 8469719575..d53224b1ed 100644 --- a/typedapi/security/putrolemapping/put_role_mapping.go +++ b/typedapi/security/putrolemapping/put_role_mapping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates and updates role mappings. package putrolemapping @@ -51,15 +51,19 @@ type PutRoleMapping struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int name string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutRoleMapping type alias for index. @@ -85,11 +89,18 @@ func New(tp elastictransport.Interface) *PutRoleMapping { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *PutRoleMapping) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *PutRoleMapping) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,6 +163,9 @@ func (r *PutRoleMapping) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("role_mapping") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "name", r.name) + } path.WriteString(r.name) method = http.MethodPut @@ -163,15 +179,15 @@ func (r *PutRoleMapping) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -188,27 +204,66 @@ func (r *PutRoleMapping) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutRoleMapping) Perform(ctx context.Context) (*http.Response, error) { +func (r PutRoleMapping) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.put_role_mapping") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.put_role_mapping") + if reader := instrument.RecordRequestBody(ctx, "security.put_role_mapping", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.put_role_mapping") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutRoleMapping query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutRoleMapping query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putrolemapping.Response -func (r PutRoleMapping) Do(ctx context.Context) (*Response, error) { +func (r PutRoleMapping) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.put_role_mapping") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -216,6 +271,9 @@ func (r PutRoleMapping) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -225,6 +283,9 @@ func (r PutRoleMapping) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +293,9 @@ func (r PutRoleMapping) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } @@ -275,6 +339,13 @@ func (r *PutRoleMapping) Metadata(metadata types.Metadata) *PutRoleMapping { return r } +// API name: role_templates +func (r *PutRoleMapping) RoleTemplates(roletemplates ...types.RoleTemplate) *PutRoleMapping { + r.req.RoleTemplates = roletemplates + + return r +} + // API name: roles func (r *PutRoleMapping) Roles(roles ...string) *PutRoleMapping { r.req.Roles = roles diff --git a/typedapi/security/putrolemapping/request.go b/typedapi/security/putrolemapping/request.go index 99563e999e..287e72c68b 100644 --- a/typedapi/security/putrolemapping/request.go +++ b/typedapi/security/putrolemapping/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putrolemapping @@ -29,13 +29,14 @@ import ( // Request holds the request body struct for the package putrolemapping // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/put_role_mapping/SecurityPutRoleMappingRequest.ts#L24-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/put_role_mapping/SecurityPutRoleMappingRequest.ts#L25-L45 type Request struct { - Enabled *bool `json:"enabled,omitempty"` - Metadata types.Metadata `json:"metadata,omitempty"` - Roles []string `json:"roles,omitempty"` - Rules *types.RoleMappingRule `json:"rules,omitempty"` - RunAs []string `json:"run_as,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Metadata types.Metadata `json:"metadata,omitempty"` + RoleTemplates []types.RoleTemplate `json:"role_templates,omitempty"` + Roles []string `json:"roles,omitempty"` + Rules *types.RoleMappingRule `json:"rules,omitempty"` + RunAs []string `json:"run_as,omitempty"` } // NewRequest returns a Request diff --git a/typedapi/security/putrolemapping/response.go b/typedapi/security/putrolemapping/response.go index 2fa246274b..9ead3fa2f4 100644 --- a/typedapi/security/putrolemapping/response.go +++ b/typedapi/security/putrolemapping/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putrolemapping @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package putrolemapping // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/put_role_mapping/SecurityPutRoleMappingResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/put_role_mapping/SecurityPutRoleMappingResponse.ts#L22-L24 type Response struct { Created *bool `json:"created,omitempty"` RoleMapping types.CreatedStatus `json:"role_mapping"` diff --git a/typedapi/security/putuser/put_user.go b/typedapi/security/putuser/put_user.go index fac7d37ff0..bddc1a1d27 100644 --- a/typedapi/security/putuser/put_user.go +++ b/typedapi/security/putuser/put_user.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Adds and updates users in the native realm. These users are commonly referred // to as native users. @@ -52,15 +52,19 @@ type PutUser struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int username string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutUser type alias for index. @@ -87,11 +91,18 @@ func New(tp elastictransport.Interface) *PutUser { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -128,9 +139,7 @@ func (r *PutUser) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -142,6 +151,10 @@ func (r *PutUser) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -152,6 +165,9 @@ func (r *PutUser) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("user") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "username", r.username) + } path.WriteString(r.username) method = http.MethodPut @@ -165,15 +181,15 @@ func (r *PutUser) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -190,27 +206,66 @@ func (r *PutUser) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutUser) Perform(ctx context.Context) (*http.Response, error) { +func (r PutUser) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.put_user") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.put_user") + if reader := instrument.RecordRequestBody(ctx, "security.put_user", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.put_user") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutUser query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutUser query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putuser.Response -func (r PutUser) Do(ctx context.Context) (*Response, error) { +func (r PutUser) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.put_user") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -218,6 +273,9 @@ func (r PutUser) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -227,6 +285,9 @@ func (r PutUser) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +295,9 @@ func (r PutUser) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/putuser/request.go b/typedapi/security/putuser/request.go index 520e3d9843..99850aa7a7 100644 --- a/typedapi/security/putuser/request.go +++ b/typedapi/security/putuser/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putuser @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putuser // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/put_user/SecurityPutUserRequest.ts#L23-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/put_user/SecurityPutUserRequest.ts#L23-L44 type Request struct { Email string `json:"email,omitempty"` Enabled *bool `json:"enabled,omitempty"` diff --git a/typedapi/security/putuser/response.go b/typedapi/security/putuser/response.go index b30a0683a2..93c1d53faf 100644 --- a/typedapi/security/putuser/response.go +++ b/typedapi/security/putuser/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putuser // Response holds the response body struct for the package putuser // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/put_user/SecurityPutUserResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/put_user/SecurityPutUserResponse.ts#L20-L22 type Response struct { Created bool `json:"created"` } diff --git a/typedapi/security/queryapikeys/query_api_keys.go b/typedapi/security/queryapikeys/query_api_keys.go index a101f10baa..cff95588aa 100644 --- a/typedapi/security/queryapikeys/query_api_keys.go +++ b/typedapi/security/queryapikeys/query_api_keys.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information for API keys using a subset of query DSL package queryapikeys @@ -47,13 +47,17 @@ type QueryApiKeys struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewQueryApiKeys type alias for index. @@ -77,11 +81,18 @@ func New(tp elastictransport.Interface) *QueryApiKeys { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -118,9 +129,7 @@ func (r *QueryApiKeys) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -132,6 +141,10 @@ func (r *QueryApiKeys) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -154,15 +167,15 @@ func (r *QueryApiKeys) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -179,27 +192,66 @@ func (r *QueryApiKeys) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r QueryApiKeys) Perform(ctx context.Context) (*http.Response, error) { +func (r QueryApiKeys) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.query_api_keys") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.query_api_keys") + if reader := instrument.RecordRequestBody(ctx, "security.query_api_keys", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.query_api_keys") + } if err != nil { - return nil, fmt.Errorf("an error happened during the QueryApiKeys query execution: %w", err) + localErr := fmt.Errorf("an error happened during the QueryApiKeys query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a queryapikeys.Response -func (r QueryApiKeys) Do(ctx context.Context) (*Response, error) { +func (r QueryApiKeys) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.query_api_keys") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -207,6 +259,9 @@ func (r QueryApiKeys) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -216,6 +271,9 @@ func (r QueryApiKeys) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r QueryApiKeys) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/queryapikeys/request.go b/typedapi/security/queryapikeys/request.go index e705ebca51..84ac77cab1 100644 --- a/typedapi/security/queryapikeys/request.go +++ b/typedapi/security/queryapikeys/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package queryapikeys @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package queryapikeys // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/query_api_keys/QueryApiKeysRequest.ts#L25-L74 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/query_api_keys/QueryApiKeysRequest.ts#L25-L74 type Request struct { // From Starting document offset. diff --git a/typedapi/security/queryapikeys/response.go b/typedapi/security/queryapikeys/response.go index 12a7d9fb60..9a2fe477cb 100644 --- a/typedapi/security/queryapikeys/response.go +++ b/typedapi/security/queryapikeys/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package queryapikeys @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package queryapikeys // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/query_api_keys/QueryApiKeysResponse.ts#L23-L38 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/query_api_keys/QueryApiKeysResponse.ts#L23-L38 type Response struct { // ApiKeys A list of API key information. diff --git a/typedapi/security/samlauthenticate/request.go b/typedapi/security/samlauthenticate/request.go index 3c3ff224d8..c69716416b 100644 --- a/typedapi/security/samlauthenticate/request.go +++ b/typedapi/security/samlauthenticate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package samlauthenticate @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package samlauthenticate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/saml_authenticate/Request.ts#L23-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/saml_authenticate/Request.ts#L23-L38 type Request struct { // Content The SAML response as it was sent by the user’s browser, usually a Base64 diff --git a/typedapi/security/samlauthenticate/response.go b/typedapi/security/samlauthenticate/response.go index 521ba4ea57..011cf893ab 100644 --- a/typedapi/security/samlauthenticate/response.go +++ b/typedapi/security/samlauthenticate/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package samlauthenticate // Response holds the response body struct for the package samlauthenticate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/saml_authenticate/Response.ts#L22-L30 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/saml_authenticate/Response.ts#L22-L30 type Response struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` diff --git a/typedapi/security/samlauthenticate/saml_authenticate.go b/typedapi/security/samlauthenticate/saml_authenticate.go index 4a7b97376c..b67b838e11 100644 --- a/typedapi/security/samlauthenticate/saml_authenticate.go +++ b/typedapi/security/samlauthenticate/saml_authenticate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Exchanges a SAML Response message for an Elasticsearch access token and // refresh token pair @@ -47,13 +47,17 @@ type SamlAuthenticate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSamlAuthenticate type alias for index. @@ -78,11 +82,18 @@ func New(tp elastictransport.Interface) *SamlAuthenticate { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -119,9 +130,7 @@ func (r *SamlAuthenticate) HttpRequest(ctx context.Context) (*http.Request, erro } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -133,6 +142,10 @@ func (r *SamlAuthenticate) HttpRequest(ctx context.Context) (*http.Request, erro } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -155,15 +168,15 @@ func (r *SamlAuthenticate) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -180,27 +193,66 @@ func (r *SamlAuthenticate) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SamlAuthenticate) Perform(ctx context.Context) (*http.Response, error) { +func (r SamlAuthenticate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.saml_authenticate") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_authenticate") + if reader := instrument.RecordRequestBody(ctx, "security.saml_authenticate", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_authenticate") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SamlAuthenticate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SamlAuthenticate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a samlauthenticate.Response -func (r SamlAuthenticate) Do(ctx context.Context) (*Response, error) { +func (r SamlAuthenticate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_authenticate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -208,6 +260,9 @@ func (r SamlAuthenticate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -217,6 +272,9 @@ func (r SamlAuthenticate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r SamlAuthenticate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/samlcompletelogout/request.go b/typedapi/security/samlcompletelogout/request.go index c802c1de2a..1266893480 100644 --- a/typedapi/security/samlcompletelogout/request.go +++ b/typedapi/security/samlcompletelogout/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package samlcompletelogout @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package samlcompletelogout // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/saml_complete_logout/Request.ts#L23-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/saml_complete_logout/Request.ts#L23-L40 type Request struct { // Content If the SAML IdP sends the logout response with the HTTP-Post binding, this diff --git a/typedapi/security/samlcompletelogout/saml_complete_logout.go b/typedapi/security/samlcompletelogout/saml_complete_logout.go index 74165329e2..7b27168107 100644 --- a/typedapi/security/samlcompletelogout/saml_complete_logout.go +++ b/typedapi/security/samlcompletelogout/saml_complete_logout.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Verifies the logout response sent from the SAML IdP package samlcompletelogout @@ -45,13 +45,17 @@ type SamlCompleteLogout struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSamlCompleteLogout type alias for index. @@ -75,11 +79,18 @@ func New(tp elastictransport.Interface) *SamlCompleteLogout { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -116,9 +127,7 @@ func (r *SamlCompleteLogout) HttpRequest(ctx context.Context) (*http.Request, er } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -130,6 +139,10 @@ func (r *SamlCompleteLogout) HttpRequest(ctx context.Context) (*http.Request, er } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -152,15 +165,15 @@ func (r *SamlCompleteLogout) HttpRequest(ctx context.Context) (*http.Request, er } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -177,15 +190,42 @@ func (r *SamlCompleteLogout) HttpRequest(ctx context.Context) (*http.Request, er } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SamlCompleteLogout) Perform(ctx context.Context) (*http.Response, error) { +func (r SamlCompleteLogout) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.saml_complete_logout") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_complete_logout") + if reader := instrument.RecordRequestBody(ctx, "security.saml_complete_logout", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_complete_logout") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SamlCompleteLogout query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SamlCompleteLogout query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil diff --git a/typedapi/security/samlinvalidate/request.go b/typedapi/security/samlinvalidate/request.go index 7f0687d499..c2ebc417ae 100644 --- a/typedapi/security/samlinvalidate/request.go +++ b/typedapi/security/samlinvalidate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package samlinvalidate @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package samlinvalidate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/saml_invalidate/Request.ts#L22-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/saml_invalidate/Request.ts#L22-L43 type Request struct { // Acs The Assertion Consumer Service URL that matches the one of the SAML realm in diff --git a/typedapi/security/samlinvalidate/response.go b/typedapi/security/samlinvalidate/response.go index 02573420c5..d8a439b0d9 100644 --- a/typedapi/security/samlinvalidate/response.go +++ b/typedapi/security/samlinvalidate/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package samlinvalidate // Response holds the response body struct for the package samlinvalidate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/saml_invalidate/Response.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/saml_invalidate/Response.ts#L22-L28 type Response struct { Invalidated int `json:"invalidated"` Realm string `json:"realm"` diff --git a/typedapi/security/samlinvalidate/saml_invalidate.go b/typedapi/security/samlinvalidate/saml_invalidate.go index d53214f824..ebf705fe6b 100644 --- a/typedapi/security/samlinvalidate/saml_invalidate.go +++ b/typedapi/security/samlinvalidate/saml_invalidate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Consumes a SAML LogoutRequest package samlinvalidate @@ -46,13 +46,17 @@ type SamlInvalidate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSamlInvalidate type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *SamlInvalidate { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *SamlInvalidate) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *SamlInvalidate) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,15 +166,15 @@ func (r *SamlInvalidate) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -178,27 +191,66 @@ func (r *SamlInvalidate) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SamlInvalidate) Perform(ctx context.Context) (*http.Response, error) { +func (r SamlInvalidate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.saml_invalidate") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_invalidate") + if reader := instrument.RecordRequestBody(ctx, "security.saml_invalidate", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_invalidate") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SamlInvalidate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SamlInvalidate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a samlinvalidate.Response -func (r SamlInvalidate) Do(ctx context.Context) (*Response, error) { +func (r SamlInvalidate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_invalidate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -206,6 +258,9 @@ func (r SamlInvalidate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -215,6 +270,9 @@ func (r SamlInvalidate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r SamlInvalidate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/samllogout/request.go b/typedapi/security/samllogout/request.go index 4fb144821a..f381d27d64 100644 --- a/typedapi/security/samllogout/request.go +++ b/typedapi/security/samllogout/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package samllogout @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package samllogout // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/saml_logout/Request.ts#L22-L41 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/saml_logout/Request.ts#L22-L41 type Request struct { // RefreshToken The refresh token that was returned as a response to calling the SAML diff --git a/typedapi/security/samllogout/response.go b/typedapi/security/samllogout/response.go index 955d2943f9..298cc7dfbe 100644 --- a/typedapi/security/samllogout/response.go +++ b/typedapi/security/samllogout/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package samllogout // Response holds the response body struct for the package samllogout // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/saml_logout/Response.ts#L20-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/saml_logout/Response.ts#L20-L24 type Response struct { Redirect string `json:"redirect"` } diff --git a/typedapi/security/samllogout/saml_logout.go b/typedapi/security/samllogout/saml_logout.go index f319e51ac6..ec8e6518d0 100644 --- a/typedapi/security/samllogout/saml_logout.go +++ b/typedapi/security/samllogout/saml_logout.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Invalidates an access token and a refresh token that were generated via the // SAML Authenticate API @@ -47,13 +47,17 @@ type SamlLogout struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSamlLogout type alias for index. @@ -78,11 +82,18 @@ func New(tp elastictransport.Interface) *SamlLogout { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -119,9 +130,7 @@ func (r *SamlLogout) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -133,6 +142,10 @@ func (r *SamlLogout) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -155,15 +168,15 @@ func (r *SamlLogout) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -180,27 +193,66 @@ func (r *SamlLogout) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SamlLogout) Perform(ctx context.Context) (*http.Response, error) { +func (r SamlLogout) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.saml_logout") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_logout") + if reader := instrument.RecordRequestBody(ctx, "security.saml_logout", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_logout") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SamlLogout query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SamlLogout query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a samllogout.Response -func (r SamlLogout) Do(ctx context.Context) (*Response, error) { +func (r SamlLogout) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_logout") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -208,6 +260,9 @@ func (r SamlLogout) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -217,6 +272,9 @@ func (r SamlLogout) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r SamlLogout) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/samlprepareauthentication/request.go b/typedapi/security/samlprepareauthentication/request.go index d5bdf73f9b..6611039e68 100644 --- a/typedapi/security/samlprepareauthentication/request.go +++ b/typedapi/security/samlprepareauthentication/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package samlprepareauthentication @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package samlprepareauthentication // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/saml_prepare_authentication/Request.ts#L22-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/saml_prepare_authentication/Request.ts#L22-L46 type Request struct { // Acs The Assertion Consumer Service URL that matches the one of the SAML realms in diff --git a/typedapi/security/samlprepareauthentication/response.go b/typedapi/security/samlprepareauthentication/response.go index 0d77e263d0..be0461c241 100644 --- a/typedapi/security/samlprepareauthentication/response.go +++ b/typedapi/security/samlprepareauthentication/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package samlprepareauthentication // Response holds the response body struct for the package samlprepareauthentication // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/saml_prepare_authentication/Response.ts#L22-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/saml_prepare_authentication/Response.ts#L22-L28 type Response struct { Id string `json:"id"` Realm string `json:"realm"` diff --git a/typedapi/security/samlprepareauthentication/saml_prepare_authentication.go b/typedapi/security/samlprepareauthentication/saml_prepare_authentication.go index a20d64ee3e..8cfd2d8f6a 100644 --- a/typedapi/security/samlprepareauthentication/saml_prepare_authentication.go +++ b/typedapi/security/samlprepareauthentication/saml_prepare_authentication.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a SAML authentication request package samlprepareauthentication @@ -46,13 +46,17 @@ type SamlPrepareAuthentication struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSamlPrepareAuthentication type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *SamlPrepareAuthentication { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *SamlPrepareAuthentication) HttpRequest(ctx context.Context) (*http.Requ } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *SamlPrepareAuthentication) HttpRequest(ctx context.Context) (*http.Requ } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,15 +166,15 @@ func (r *SamlPrepareAuthentication) HttpRequest(ctx context.Context) (*http.Requ } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -178,27 +191,66 @@ func (r *SamlPrepareAuthentication) HttpRequest(ctx context.Context) (*http.Requ } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SamlPrepareAuthentication) Perform(ctx context.Context) (*http.Response, error) { +func (r SamlPrepareAuthentication) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.saml_prepare_authentication") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_prepare_authentication") + if reader := instrument.RecordRequestBody(ctx, "security.saml_prepare_authentication", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_prepare_authentication") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SamlPrepareAuthentication query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SamlPrepareAuthentication query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a samlprepareauthentication.Response -func (r SamlPrepareAuthentication) Do(ctx context.Context) (*Response, error) { +func (r SamlPrepareAuthentication) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_prepare_authentication") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -206,6 +258,9 @@ func (r SamlPrepareAuthentication) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -215,6 +270,9 @@ func (r SamlPrepareAuthentication) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r SamlPrepareAuthentication) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/samlserviceprovidermetadata/response.go b/typedapi/security/samlserviceprovidermetadata/response.go index a3e6ba9577..077692955a 100644 --- a/typedapi/security/samlserviceprovidermetadata/response.go +++ b/typedapi/security/samlserviceprovidermetadata/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package samlserviceprovidermetadata // Response holds the response body struct for the package samlserviceprovidermetadata // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/saml_service_provider_metadata/Response.ts#L20-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/saml_service_provider_metadata/Response.ts#L20-L24 type Response struct { Metadata string `json:"metadata"` } diff --git a/typedapi/security/samlserviceprovidermetadata/saml_service_provider_metadata.go b/typedapi/security/samlserviceprovidermetadata/saml_service_provider_metadata.go index 236d6d5c5f..518272f7a2 100644 --- a/typedapi/security/samlserviceprovidermetadata/saml_service_provider_metadata.go +++ b/typedapi/security/samlserviceprovidermetadata/saml_service_provider_metadata.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Generates SAML metadata for the Elastic stack SAML 2.0 Service Provider package samlserviceprovidermetadata import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type SamlServiceProviderMetadata struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int realmname string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSamlServiceProviderMetadata type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *SamlServiceProviderMetadata { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *SamlServiceProviderMetadata) HttpRequest(ctx context.Context) (*http.Re path.WriteString("metadata") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "realmname", r.realmname) + } path.WriteString(r.realmname) method = http.MethodGet @@ -121,15 +132,15 @@ func (r *SamlServiceProviderMetadata) HttpRequest(ctx context.Context) (*http.Re } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -146,27 +157,66 @@ func (r *SamlServiceProviderMetadata) HttpRequest(ctx context.Context) (*http.Re } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SamlServiceProviderMetadata) Perform(ctx context.Context) (*http.Response, error) { +func (r SamlServiceProviderMetadata) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.saml_service_provider_metadata") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.saml_service_provider_metadata") + if reader := instrument.RecordRequestBody(ctx, "security.saml_service_provider_metadata", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.saml_service_provider_metadata") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SamlServiceProviderMetadata query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SamlServiceProviderMetadata query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a samlserviceprovidermetadata.Response -func (r SamlServiceProviderMetadata) Do(ctx context.Context) (*Response, error) { +func (r SamlServiceProviderMetadata) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_service_provider_metadata") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -174,6 +224,9 @@ func (r SamlServiceProviderMetadata) Do(ctx context.Context) (*Response, error) if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,6 +236,9 @@ func (r SamlServiceProviderMetadata) Do(ctx context.Context) (*Response, error) errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -190,12 +246,25 @@ func (r SamlServiceProviderMetadata) Do(ctx context.Context) (*Response, error) errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r SamlServiceProviderMetadata) IsSuccess(ctx context.Context) (bool, error) { +func (r SamlServiceProviderMetadata) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.saml_service_provider_metadata") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -211,6 +280,14 @@ func (r SamlServiceProviderMetadata) IsSuccess(ctx context.Context) (bool, error return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the SamlServiceProviderMetadata query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/security/suggestuserprofiles/request.go b/typedapi/security/suggestuserprofiles/request.go index e0f6b73ad4..14e4e8749f 100644 --- a/typedapi/security/suggestuserprofiles/request.go +++ b/typedapi/security/suggestuserprofiles/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package suggestuserprofiles @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package suggestuserprofiles // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/suggest_user_profiles/Request.ts#L24-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/suggest_user_profiles/Request.ts#L24-L66 type Request struct { // Data List of filters for the `data` field of the profile document. diff --git a/typedapi/security/suggestuserprofiles/response.go b/typedapi/security/suggestuserprofiles/response.go index be3ebdd613..0d7670f9eb 100644 --- a/typedapi/security/suggestuserprofiles/response.go +++ b/typedapi/security/suggestuserprofiles/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package suggestuserprofiles @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package suggestuserprofiles // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/suggest_user_profiles/Response.ts#L29-L35 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/suggest_user_profiles/Response.ts#L29-L35 type Response struct { Profiles []types.UserProfile `json:"profiles"` Took int64 `json:"took"` diff --git a/typedapi/security/suggestuserprofiles/suggest_user_profiles.go b/typedapi/security/suggestuserprofiles/suggest_user_profiles.go index 368672cd6e..eaa4cffa6c 100644 --- a/typedapi/security/suggestuserprofiles/suggest_user_profiles.go +++ b/typedapi/security/suggestuserprofiles/suggest_user_profiles.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Get suggestions for user profiles that match specified search criteria. package suggestuserprofiles @@ -46,13 +46,17 @@ type SuggestUserProfiles struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewSuggestUserProfiles type alias for index. @@ -70,17 +74,24 @@ func NewSuggestUserProfilesFunc(tp elastictransport.Interface) NewSuggestUserPro // Get suggestions for user profiles that match specified search criteria. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-suggest-user-profile.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-suggest-user-profile.html func New(tp elastictransport.Interface) *SuggestUserProfiles { r := &SuggestUserProfiles{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *SuggestUserProfiles) HttpRequest(ctx context.Context) (*http.Request, e } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *SuggestUserProfiles) HttpRequest(ctx context.Context) (*http.Request, e } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,15 +166,15 @@ func (r *SuggestUserProfiles) HttpRequest(ctx context.Context) (*http.Request, e } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -178,27 +191,66 @@ func (r *SuggestUserProfiles) HttpRequest(ctx context.Context) (*http.Request, e } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r SuggestUserProfiles) Perform(ctx context.Context) (*http.Response, error) { +func (r SuggestUserProfiles) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.suggest_user_profiles") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.suggest_user_profiles") + if reader := instrument.RecordRequestBody(ctx, "security.suggest_user_profiles", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.suggest_user_profiles") + } if err != nil { - return nil, fmt.Errorf("an error happened during the SuggestUserProfiles query execution: %w", err) + localErr := fmt.Errorf("an error happened during the SuggestUserProfiles query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a suggestuserprofiles.Response -func (r SuggestUserProfiles) Do(ctx context.Context) (*Response, error) { +func (r SuggestUserProfiles) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.suggest_user_profiles") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -206,6 +258,9 @@ func (r SuggestUserProfiles) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -215,6 +270,9 @@ func (r SuggestUserProfiles) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r SuggestUserProfiles) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/updateapikey/request.go b/typedapi/security/updateapikey/request.go index eed83429d0..54f9f5525c 100644 --- a/typedapi/security/updateapikey/request.go +++ b/typedapi/security/updateapikey/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updateapikey @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package updateapikey // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/update_api_key/Request.ts#L25-L62 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/update_api_key/Request.ts#L25-L62 type Request struct { // Metadata Arbitrary metadata that you want to associate with the API key. It supports diff --git a/typedapi/security/updateapikey/response.go b/typedapi/security/updateapikey/response.go index 304e3383d2..62569424e8 100644 --- a/typedapi/security/updateapikey/response.go +++ b/typedapi/security/updateapikey/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updateapikey // Response holds the response body struct for the package updateapikey // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/update_api_key/Response.ts#L20-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/update_api_key/Response.ts#L20-L28 type Response struct { // Updated If `true`, the API key was updated. diff --git a/typedapi/security/updateapikey/update_api_key.go b/typedapi/security/updateapikey/update_api_key.go index cc1d07c5ce..d971bf4d2f 100644 --- a/typedapi/security/updateapikey/update_api_key.go +++ b/typedapi/security/updateapikey/update_api_key.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates attributes of an existing API key. package updateapikey @@ -50,15 +50,19 @@ type UpdateApiKey struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateApiKey type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *UpdateApiKey { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *UpdateApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *UpdateApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *UpdateApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("api_key") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPut @@ -162,15 +178,15 @@ func (r *UpdateApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *UpdateApiKey) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateApiKey) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateApiKey) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.update_api_key") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.update_api_key") + if reader := instrument.RecordRequestBody(ctx, "security.update_api_key", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.update_api_key") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateApiKey query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateApiKey query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updateapikey.Response -func (r UpdateApiKey) Do(ctx context.Context) (*Response, error) { +func (r UpdateApiKey) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.update_api_key") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r UpdateApiKey) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r UpdateApiKey) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r UpdateApiKey) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/security/updatesettings/update_settings.go b/typedapi/security/updatesettings/update_settings.go new file mode 100644 index 0000000000..3154c038da --- /dev/null +++ b/typedapi/security/updatesettings/update_settings.go @@ -0,0 +1,232 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +// Update settings for the security system index +package updatesettings + +import ( + "context" + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/elastic/elastic-transport-go/v8/elastictransport" +) + +// ErrBuildPath is returned in case of missing parameters within the build of the request. +var ErrBuildPath = errors.New("cannot build path, check for missing path parameters") + +type UpdateSettings struct { + transport elastictransport.Interface + + headers http.Header + values url.Values + path url.URL + + raw io.Reader + + paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation +} + +// NewUpdateSettings type alias for index. +type NewUpdateSettings func() *UpdateSettings + +// NewUpdateSettingsFunc returns a new instance of UpdateSettings with the provided transport. +// Used in the index of the library this allows to retrieve every apis in once place. +func NewUpdateSettingsFunc(tp elastictransport.Interface) NewUpdateSettings { + return func() *UpdateSettings { + n := New(tp) + + return n + } +} + +// Update settings for the security system index +// +// https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-settings.html +func New(tp elastictransport.Interface) *UpdateSettings { + r := &UpdateSettings{ + transport: tp, + values: make(url.Values), + headers: make(http.Header), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + + return r +} + +// HttpRequest returns the http.Request object built from the +// given parameters. +func (r *UpdateSettings) HttpRequest(ctx context.Context) (*http.Request, error) { + var path strings.Builder + var method string + var req *http.Request + + var err error + + r.path.Scheme = "http" + + switch { + case r.paramSet == 0: + path.WriteString("/") + path.WriteString("_security") + path.WriteString("/") + path.WriteString("settings") + + method = http.MethodPut + } + + r.path.Path = path.String() + r.path.RawQuery = r.values.Encode() + + if r.path.Path == "" { + return nil, ErrBuildPath + } + + if ctx != nil { + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) + } else { + req, err = http.NewRequest(method, r.path.String(), r.raw) + } + + req.Header = r.headers.Clone() + + if req.Header.Get("Content-Type") == "" { + if r.raw != nil { + req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") + } + } + + if req.Header.Get("Accept") == "" { + req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=8") + } + + if err != nil { + return req, fmt.Errorf("could not build http.Request: %w", err) + } + + return req, nil +} + +// Perform runs the http.Request through the provided transport and returns an http.Response. +func (r UpdateSettings) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.update_settings") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + + req, err := r.HttpRequest(ctx) + if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return nil, err + } + + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.update_settings") + if reader := instrument.RecordRequestBody(ctx, "security.update_settings", r.raw); reader != nil { + req.Body = reader + } + } + res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.update_settings") + } + if err != nil { + localErr := fmt.Errorf("an error happened during the UpdateSettings query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr + } + + return res, nil +} + +// Do runs the request through the transport, handle the response and returns a updatesettings.Response +func (r UpdateSettings) Do(ctx context.Context) (bool, error) { + return r.IsSuccess(ctx) +} + +// IsSuccess allows to run a query with a context and retrieve the result as a boolean. +// This only exists for endpoints without a request payload and allows for quick control flow. +func (r UpdateSettings) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.update_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + + res, err := r.Perform(ctx) + + if err != nil { + return false, err + } + io.Copy(ioutil.Discard, res.Body) + err = res.Body.Close() + if err != nil { + return false, err + } + + if res.StatusCode >= 200 && res.StatusCode < 300 { + return true, nil + } + + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the UpdateSettings query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + + return false, nil +} + +// Header set a key, value pair in the UpdateSettings headers map. +func (r *UpdateSettings) Header(key, value string) *UpdateSettings { + r.headers.Set(key, value) + + return r +} diff --git a/typedapi/security/updateuserprofiledata/request.go b/typedapi/security/updateuserprofiledata/request.go index bd63cbc3ae..1f10325248 100644 --- a/typedapi/security/updateuserprofiledata/request.go +++ b/typedapi/security/updateuserprofiledata/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updateuserprofiledata @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package updateuserprofiledata // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/update_user_profile_data/Request.ts#L27-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/update_user_profile_data/Request.ts#L27-L70 type Request struct { // Data Non-searchable data that you want to associate with the user profile. diff --git a/typedapi/security/updateuserprofiledata/response.go b/typedapi/security/updateuserprofiledata/response.go index cb2de65a7f..8fffd4df5b 100644 --- a/typedapi/security/updateuserprofiledata/response.go +++ b/typedapi/security/updateuserprofiledata/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updateuserprofiledata // Response holds the response body struct for the package updateuserprofiledata // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/update_user_profile_data/Response.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/update_user_profile_data/Response.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/security/updateuserprofiledata/update_user_profile_data.go b/typedapi/security/updateuserprofiledata/update_user_profile_data.go index cb3fbe8b41..b05a87684f 100644 --- a/typedapi/security/updateuserprofiledata/update_user_profile_data.go +++ b/typedapi/security/updateuserprofiledata/update_user_profile_data.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Update application specific data for the user profile of the given unique ID. package updateuserprofiledata @@ -51,15 +51,19 @@ type UpdateUserProfileData struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int uid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateUserProfileData type alias for index. @@ -85,11 +89,18 @@ func New(tp elastictransport.Interface) *UpdateUserProfileData { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *UpdateUserProfileData) HttpRequest(ctx context.Context) (*http.Request, } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *UpdateUserProfileData) HttpRequest(ctx context.Context) (*http.Request, } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,6 +163,9 @@ func (r *UpdateUserProfileData) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("profile") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "uid", r.uid) + } path.WriteString(r.uid) path.WriteString("/") path.WriteString("_data") @@ -165,15 +181,15 @@ func (r *UpdateUserProfileData) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -190,27 +206,66 @@ func (r *UpdateUserProfileData) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateUserProfileData) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateUserProfileData) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "security.update_user_profile_data") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "security.update_user_profile_data") + if reader := instrument.RecordRequestBody(ctx, "security.update_user_profile_data", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "security.update_user_profile_data") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateUserProfileData query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateUserProfileData query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updateuserprofiledata.Response -func (r UpdateUserProfileData) Do(ctx context.Context) (*Response, error) { +func (r UpdateUserProfileData) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "security.update_user_profile_data") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -218,6 +273,9 @@ func (r UpdateUserProfileData) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -227,6 +285,9 @@ func (r UpdateUserProfileData) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -234,6 +295,9 @@ func (r UpdateUserProfileData) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/shutdown/deletenode/delete_node.go b/typedapi/shutdown/deletenode/delete_node.go index 0739efc2f0..3cef393a93 100644 --- a/typedapi/shutdown/deletenode/delete_node.go +++ b/typedapi/shutdown/deletenode/delete_node.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Removes a node from the shutdown list. Designed for indirect use by ECE/ESS // and ECK. Direct use is not supported. package deletenode import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,11 +52,15 @@ type DeleteNode struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteNode type alias for index. @@ -84,7 +87,12 @@ func New(tp elastictransport.Interface) *DeleteNode { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,6 +115,9 @@ func (r *DeleteNode) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("shutdown") @@ -122,15 +133,15 @@ func (r *DeleteNode) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -147,27 +158,66 @@ func (r *DeleteNode) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteNode) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteNode) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "shutdown.delete_node") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "shutdown.delete_node") + if reader := instrument.RecordRequestBody(ctx, "shutdown.delete_node", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "shutdown.delete_node") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteNode query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteNode query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletenode.Response -func (r DeleteNode) Do(ctx context.Context) (*Response, error) { +func (r DeleteNode) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "shutdown.delete_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -175,6 +225,9 @@ func (r DeleteNode) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,6 +237,9 @@ func (r DeleteNode) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -191,12 +247,25 @@ func (r DeleteNode) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteNode) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteNode) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "shutdown.delete_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -212,6 +281,14 @@ func (r DeleteNode) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteNode query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/shutdown/deletenode/response.go b/typedapi/shutdown/deletenode/response.go index 6cf19d0031..6b79f51495 100644 --- a/typedapi/shutdown/deletenode/response.go +++ b/typedapi/shutdown/deletenode/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletenode // Response holds the response body struct for the package deletenode // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/delete_node/ShutdownDeleteNodeResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/delete_node/ShutdownDeleteNodeResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/shutdown/getnode/get_node.go b/typedapi/shutdown/getnode/get_node.go index 6180a4aeb7..239d8cb16c 100644 --- a/typedapi/shutdown/getnode/get_node.go +++ b/typedapi/shutdown/getnode/get_node.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieve status of a node or nodes that are currently marked as shutting // down. Designed for indirect use by ECE/ESS and ECK. Direct use is not @@ -24,7 +24,6 @@ package getnode import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,11 +53,15 @@ type GetNode struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int nodeid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetNode type alias for index. @@ -84,7 +87,12 @@ func New(tp elastictransport.Interface) *GetNode { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -114,6 +122,9 @@ func (r *GetNode) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("shutdown") @@ -129,15 +140,15 @@ func (r *GetNode) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -154,27 +165,66 @@ func (r *GetNode) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetNode) Perform(ctx context.Context) (*http.Response, error) { +func (r GetNode) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "shutdown.get_node") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "shutdown.get_node") + if reader := instrument.RecordRequestBody(ctx, "shutdown.get_node", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "shutdown.get_node") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetNode query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetNode query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getnode.Response -func (r GetNode) Do(ctx context.Context) (*Response, error) { +func (r GetNode) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "shutdown.get_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -182,6 +232,9 @@ func (r GetNode) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -191,6 +244,9 @@ func (r GetNode) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -198,12 +254,25 @@ func (r GetNode) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetNode) IsSuccess(ctx context.Context) (bool, error) { +func (r GetNode) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "shutdown.get_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -219,6 +288,14 @@ func (r GetNode) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetNode query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/shutdown/getnode/response.go b/typedapi/shutdown/getnode/response.go index e4f40ccfee..c1447f8d78 100644 --- a/typedapi/shutdown/getnode/response.go +++ b/typedapi/shutdown/getnode/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getnode @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getnode // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L23-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L23-L27 type Response struct { Nodes []types.NodeShutdownStatus `json:"nodes"` } diff --git a/typedapi/shutdown/putnode/put_node.go b/typedapi/shutdown/putnode/put_node.go index 7a50cd42dd..44b5854ee7 100644 --- a/typedapi/shutdown/putnode/put_node.go +++ b/typedapi/shutdown/putnode/put_node.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Adds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. // Direct use is not supported. @@ -53,15 +53,19 @@ type PutNode struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int nodeid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutNode type alias for index. @@ -88,11 +92,18 @@ func New(tp elastictransport.Interface) *PutNode { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -129,9 +140,7 @@ func (r *PutNode) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -143,6 +152,10 @@ func (r *PutNode) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,6 +164,9 @@ func (r *PutNode) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_nodes") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "nodeid", r.nodeid) + } path.WriteString(r.nodeid) path.WriteString("/") path.WriteString("shutdown") @@ -166,15 +182,15 @@ func (r *PutNode) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -191,27 +207,66 @@ func (r *PutNode) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutNode) Perform(ctx context.Context) (*http.Response, error) { +func (r PutNode) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "shutdown.put_node") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "shutdown.put_node") + if reader := instrument.RecordRequestBody(ctx, "shutdown.put_node", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "shutdown.put_node") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutNode query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutNode query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putnode.Response -func (r PutNode) Do(ctx context.Context) (*Response, error) { +func (r PutNode) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "shutdown.put_node") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -219,6 +274,9 @@ func (r PutNode) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -228,6 +286,9 @@ func (r PutNode) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +296,9 @@ func (r PutNode) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/shutdown/putnode/request.go b/typedapi/shutdown/putnode/request.go index 096caedf73..88718ce30c 100644 --- a/typedapi/shutdown/putnode/request.go +++ b/typedapi/shutdown/putnode/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putnode @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putnode // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/put_node/ShutdownPutNodeRequest.ts#L25-L76 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/put_node/ShutdownPutNodeRequest.ts#L25-L76 type Request struct { // AllocationDelay Only valid if type is restart. diff --git a/typedapi/shutdown/putnode/response.go b/typedapi/shutdown/putnode/response.go index 63b6f9996c..fb85ee775f 100644 --- a/typedapi/shutdown/putnode/response.go +++ b/typedapi/shutdown/putnode/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putnode // Response holds the response body struct for the package putnode // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/put_node/ShutdownPutNodeResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/put_node/ShutdownPutNodeResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/slm/deletelifecycle/delete_lifecycle.go b/typedapi/slm/deletelifecycle/delete_lifecycle.go index 3211448773..61dbfd9ffe 100644 --- a/typedapi/slm/deletelifecycle/delete_lifecycle.go +++ b/typedapi/slm/deletelifecycle/delete_lifecycle.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an existing snapshot lifecycle policy. package deletelifecycle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int policyid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteLifecycle type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *DeleteLifecycle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeleteLifecycle) HttpRequest(ctx context.Context) (*http.Request, error path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "policyid", r.policyid) + } path.WriteString(r.policyid) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *DeleteLifecycle) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *DeleteLifecycle) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "slm.delete_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "slm.delete_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "slm.delete_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.delete_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletelifecycle.Response -func (r DeleteLifecycle) Do(ctx context.Context) (*Response, error) { +func (r DeleteLifecycle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.delete_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r DeleteLifecycle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r DeleteLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r DeleteLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteLifecycle) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteLifecycle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.delete_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r DeleteLifecycle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteLifecycle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/slm/deletelifecycle/response.go b/typedapi/slm/deletelifecycle/response.go index ebcf654eca..14be660f2a 100644 --- a/typedapi/slm/deletelifecycle/response.go +++ b/typedapi/slm/deletelifecycle/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletelifecycle // Response holds the response body struct for the package deletelifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/delete_lifecycle/DeleteSnapshotLifecycleResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/delete_lifecycle/DeleteSnapshotLifecycleResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/slm/executelifecycle/execute_lifecycle.go b/typedapi/slm/executelifecycle/execute_lifecycle.go index 9ff4525bb8..624620431e 100644 --- a/typedapi/slm/executelifecycle/execute_lifecycle.go +++ b/typedapi/slm/executelifecycle/execute_lifecycle.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Immediately creates a snapshot according to the lifecycle policy, without // waiting for the scheduled time. package executelifecycle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type ExecuteLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int policyid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExecuteLifecycle type alias for index. @@ -83,7 +86,12 @@ func New(tp elastictransport.Interface) *ExecuteLifecycle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *ExecuteLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "policyid", r.policyid) + } path.WriteString(r.policyid) path.WriteString("/") path.WriteString("_execute") @@ -123,9 +134,9 @@ func (r *ExecuteLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -142,27 +153,66 @@ func (r *ExecuteLifecycle) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExecuteLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r ExecuteLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "slm.execute_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "slm.execute_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "slm.execute_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.execute_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExecuteLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExecuteLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a executelifecycle.Response -func (r ExecuteLifecycle) Do(ctx context.Context) (*Response, error) { +func (r ExecuteLifecycle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.execute_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -170,6 +220,9 @@ func (r ExecuteLifecycle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -179,6 +232,9 @@ func (r ExecuteLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -186,12 +242,25 @@ func (r ExecuteLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ExecuteLifecycle) IsSuccess(ctx context.Context) (bool, error) { +func (r ExecuteLifecycle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.execute_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -207,6 +276,14 @@ func (r ExecuteLifecycle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ExecuteLifecycle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/slm/executelifecycle/response.go b/typedapi/slm/executelifecycle/response.go index 2eb1aabeb2..a5f1078d37 100644 --- a/typedapi/slm/executelifecycle/response.go +++ b/typedapi/slm/executelifecycle/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package executelifecycle // Response holds the response body struct for the package executelifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/execute_lifecycle/ExecuteSnapshotLifecycleResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/execute_lifecycle/ExecuteSnapshotLifecycleResponse.ts#L22-L24 type Response struct { SnapshotName string `json:"snapshot_name"` } diff --git a/typedapi/slm/executeretention/execute_retention.go b/typedapi/slm/executeretention/execute_retention.go index 7928bb2e67..d557f83f89 100644 --- a/typedapi/slm/executeretention/execute_retention.go +++ b/typedapi/slm/executeretention/execute_retention.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes any snapshots that are expired according to the policy's retention // rules. package executeretention import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type ExecuteRetention struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExecuteRetention type alias for index. @@ -75,7 +78,12 @@ func New(tp elastictransport.Interface) *ExecuteRetention { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *ExecuteRetention) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *ExecuteRetention) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExecuteRetention) Perform(ctx context.Context) (*http.Response, error) { +func (r ExecuteRetention) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "slm.execute_retention") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "slm.execute_retention") + if reader := instrument.RecordRequestBody(ctx, "slm.execute_retention", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.execute_retention") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExecuteRetention query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExecuteRetention query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a executeretention.Response -func (r ExecuteRetention) Do(ctx context.Context) (*Response, error) { +func (r ExecuteRetention) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.execute_retention") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r ExecuteRetention) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r ExecuteRetention) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r ExecuteRetention) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ExecuteRetention) IsSuccess(ctx context.Context) (bool, error) { +func (r ExecuteRetention) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.execute_retention") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r ExecuteRetention) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ExecuteRetention query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/slm/executeretention/response.go b/typedapi/slm/executeretention/response.go index 2afe6e62df..219b9c794c 100644 --- a/typedapi/slm/executeretention/response.go +++ b/typedapi/slm/executeretention/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package executeretention // Response holds the response body struct for the package executeretention // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/execute_retention/ExecuteRetentionResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/execute_retention/ExecuteRetentionResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/slm/getlifecycle/get_lifecycle.go b/typedapi/slm/getlifecycle/get_lifecycle.go index 252f3136e2..26641180f0 100644 --- a/typedapi/slm/getlifecycle/get_lifecycle.go +++ b/typedapi/slm/getlifecycle/get_lifecycle.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves one or more snapshot lifecycle policy definitions and information // about the latest snapshot attempts. package getlifecycle import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int policyid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetLifecycle type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *GetLifecycle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *GetLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "policyid", r.policyid) + } path.WriteString(r.policyid) method = http.MethodGet @@ -126,9 +137,9 @@ func (r *GetLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -145,27 +156,66 @@ func (r *GetLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r GetLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "slm.get_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "slm.get_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "slm.get_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.get_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getlifecycle.Response -func (r GetLifecycle) Do(ctx context.Context) (Response, error) { +func (r GetLifecycle) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.get_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -173,6 +223,9 @@ func (r GetLifecycle) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,6 +235,9 @@ func (r GetLifecycle) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -189,12 +245,25 @@ func (r GetLifecycle) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetLifecycle) IsSuccess(ctx context.Context) (bool, error) { +func (r GetLifecycle) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.get_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -210,6 +279,14 @@ func (r GetLifecycle) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetLifecycle query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/slm/getlifecycle/response.go b/typedapi/slm/getlifecycle/response.go index 6fe7d45495..aed6507f7f 100644 --- a/typedapi/slm/getlifecycle/response.go +++ b/typedapi/slm/getlifecycle/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getlifecycle @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getlifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/get_lifecycle/GetSnapshotLifecycleResponse.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/get_lifecycle/GetSnapshotLifecycleResponse.ts#L24-L26 type Response map[string]types.SnapshotLifecycle diff --git a/typedapi/slm/getstats/get_stats.go b/typedapi/slm/getstats/get_stats.go index 788350615c..87c84a6e3d 100644 --- a/typedapi/slm/getstats/get_stats.go +++ b/typedapi/slm/getstats/get_stats.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns global and policy-level statistics about actions taken by snapshot // lifecycle management. package getstats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type GetStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetStats type alias for index. @@ -69,13 +72,18 @@ func NewGetStatsFunc(tp elastictransport.Interface) NewGetStats { // Returns global and policy-level statistics about actions taken by snapshot // lifecycle management. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-stats.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get-stats.html func New(tp elastictransport.Interface) *GetStats { r := &GetStats{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *GetStats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *GetStats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetStats) Perform(ctx context.Context) (*http.Response, error) { +func (r GetStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "slm.get_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "slm.get_stats") + if reader := instrument.RecordRequestBody(ctx, "slm.get_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.get_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getstats.Response -func (r GetStats) Do(ctx context.Context) (*Response, error) { +func (r GetStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.get_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r GetStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r GetStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r GetStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetStats) IsSuccess(ctx context.Context) (bool, error) { +func (r GetStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.get_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r GetStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/slm/getstats/response.go b/typedapi/slm/getstats/response.go index 55cdd4429c..f5c85f44e9 100644 --- a/typedapi/slm/getstats/response.go +++ b/typedapi/slm/getstats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getstats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getstats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/get_stats/GetSnapshotLifecycleStatsResponse.ts#L23-L36 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/get_stats/GetSnapshotLifecycleStatsResponse.ts#L23-L36 type Response struct { PolicyStats []string `json:"policy_stats"` RetentionDeletionTime types.Duration `json:"retention_deletion_time"` diff --git a/typedapi/slm/getstatus/get_status.go b/typedapi/slm/getstatus/get_status.go index efc3b6be95..cf6dd0d501 100644 --- a/typedapi/slm/getstatus/get_status.go +++ b/typedapi/slm/getstatus/get_status.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves the status of snapshot lifecycle management (SLM). package getstatus import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type GetStatus struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetStatus type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *GetStatus { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *GetStatus) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *GetStatus) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetStatus) Perform(ctx context.Context) (*http.Response, error) { +func (r GetStatus) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "slm.get_status") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "slm.get_status") + if reader := instrument.RecordRequestBody(ctx, "slm.get_status", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.get_status") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetStatus query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetStatus query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getstatus.Response -func (r GetStatus) Do(ctx context.Context) (*Response, error) { +func (r GetStatus) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.get_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r GetStatus) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r GetStatus) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r GetStatus) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetStatus) IsSuccess(ctx context.Context) (bool, error) { +func (r GetStatus) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.get_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r GetStatus) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetStatus query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/slm/getstatus/response.go b/typedapi/slm/getstatus/response.go index a4a082da53..ec7d3cb9b2 100644 --- a/typedapi/slm/getstatus/response.go +++ b/typedapi/slm/getstatus/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getstatus @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getstatus // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/get_status/GetSnapshotLifecycleManagementStatusResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/get_status/GetSnapshotLifecycleManagementStatusResponse.ts#L22-L24 type Response struct { OperationMode lifecycleoperationmode.LifecycleOperationMode `json:"operation_mode"` } diff --git a/typedapi/slm/putlifecycle/put_lifecycle.go b/typedapi/slm/putlifecycle/put_lifecycle.go index f3b1367461..899c244ffc 100644 --- a/typedapi/slm/putlifecycle/put_lifecycle.go +++ b/typedapi/slm/putlifecycle/put_lifecycle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates a snapshot lifecycle policy. package putlifecycle @@ -50,15 +50,19 @@ type PutLifecycle struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int policyid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutLifecycle type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *PutLifecycle { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *PutLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("policy") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "policyid", r.policyid) + } path.WriteString(r.policyid) method = http.MethodPut @@ -162,15 +178,15 @@ func (r *PutLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -187,27 +203,66 @@ func (r *PutLifecycle) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutLifecycle) Perform(ctx context.Context) (*http.Response, error) { +func (r PutLifecycle) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "slm.put_lifecycle") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "slm.put_lifecycle") + if reader := instrument.RecordRequestBody(ctx, "slm.put_lifecycle", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.put_lifecycle") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutLifecycle query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutLifecycle query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putlifecycle.Response -func (r PutLifecycle) Do(ctx context.Context) (*Response, error) { +func (r PutLifecycle) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.put_lifecycle") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -215,6 +270,9 @@ func (r PutLifecycle) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -224,6 +282,9 @@ func (r PutLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r PutLifecycle) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/slm/putlifecycle/request.go b/typedapi/slm/putlifecycle/request.go index 14581f1025..5d1e54c1ed 100644 --- a/typedapi/slm/putlifecycle/request.go +++ b/typedapi/slm/putlifecycle/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putlifecycle @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putlifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/put_lifecycle/PutSnapshotLifecycleRequest.ts#L26-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/put_lifecycle/PutSnapshotLifecycleRequest.ts#L26-L72 type Request struct { // Config Configuration for each snapshot created by the policy. diff --git a/typedapi/slm/putlifecycle/response.go b/typedapi/slm/putlifecycle/response.go index e36b90180a..4c55a011ac 100644 --- a/typedapi/slm/putlifecycle/response.go +++ b/typedapi/slm/putlifecycle/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putlifecycle // Response holds the response body struct for the package putlifecycle // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/put_lifecycle/PutSnapshotLifecycleResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/put_lifecycle/PutSnapshotLifecycleResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/slm/start/response.go b/typedapi/slm/start/response.go index aa0b75783b..bba1d6527e 100644 --- a/typedapi/slm/start/response.go +++ b/typedapi/slm/start/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package start // Response holds the response body struct for the package start // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/start/StartSnapshotLifecycleManagementResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/start/StartSnapshotLifecycleManagementResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/slm/start/start.go b/typedapi/slm/start/start.go index 7b38700d1b..7b6b38f455 100644 --- a/typedapi/slm/start/start.go +++ b/typedapi/slm/start/start.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Turns on snapshot lifecycle management (SLM). package start import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Start struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStart type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *Start { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Start) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Start) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Start) Perform(ctx context.Context) (*http.Response, error) { +func (r Start) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "slm.start") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "slm.start") + if reader := instrument.RecordRequestBody(ctx, "slm.start", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.start") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Start query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Start query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a start.Response -func (r Start) Do(ctx context.Context) (*Response, error) { +func (r Start) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.start") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Start) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Start) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Start) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Start) IsSuccess(ctx context.Context) (bool, error) { +func (r Start) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.start") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Start) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Start query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/slm/stop/response.go b/typedapi/slm/stop/response.go index e715c076c0..b0cdb833f0 100644 --- a/typedapi/slm/stop/response.go +++ b/typedapi/slm/stop/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stop // Response holds the response body struct for the package stop // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/stop/StopSnapshotLifecycleManagementResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/stop/StopSnapshotLifecycleManagementResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/slm/stop/stop.go b/typedapi/slm/stop/stop.go index 4995619377..d461824846 100644 --- a/typedapi/slm/stop/stop.go +++ b/typedapi/slm/stop/stop.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Turns off snapshot lifecycle management (SLM). package stop import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Stop struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStop type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *Stop { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Stop) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Stop) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Stop) Perform(ctx context.Context) (*http.Response, error) { +func (r Stop) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "slm.stop") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "slm.stop") + if reader := instrument.RecordRequestBody(ctx, "slm.stop", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "slm.stop") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Stop query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Stop query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stop.Response -func (r Stop) Do(ctx context.Context) (*Response, error) { +func (r Stop) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.stop") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Stop) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Stop) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Stop) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Stop) IsSuccess(ctx context.Context) (bool, error) { +func (r Stop) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "slm.stop") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Stop) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Stop query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/snapshot/cleanuprepository/cleanup_repository.go b/typedapi/snapshot/cleanuprepository/cleanup_repository.go index c0cab6db54..77a3f2789b 100644 --- a/typedapi/snapshot/cleanuprepository/cleanup_repository.go +++ b/typedapi/snapshot/cleanuprepository/cleanup_repository.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Removes stale data from repository. package cleanuprepository import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type CleanupRepository struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int repository string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCleanupRepository type alias for index. @@ -75,13 +78,18 @@ func NewCleanupRepositoryFunc(tp elastictransport.Interface) NewCleanupRepositor // Removes stale data from repository. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/clean-up-snapshot-repo-api.html func New(tp elastictransport.Interface) *CleanupRepository { r := &CleanupRepository{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *CleanupRepository) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) path.WriteString("/") path.WriteString("_cleanup") @@ -119,9 +130,9 @@ func (r *CleanupRepository) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *CleanupRepository) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r CleanupRepository) Perform(ctx context.Context) (*http.Response, error) { +func (r CleanupRepository) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.cleanup_repository") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.cleanup_repository") + if reader := instrument.RecordRequestBody(ctx, "snapshot.cleanup_repository", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.cleanup_repository") + } if err != nil { - return nil, fmt.Errorf("an error happened during the CleanupRepository query execution: %w", err) + localErr := fmt.Errorf("an error happened during the CleanupRepository query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a cleanuprepository.Response -func (r CleanupRepository) Do(ctx context.Context) (*Response, error) { +func (r CleanupRepository) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.cleanup_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r CleanupRepository) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r CleanupRepository) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r CleanupRepository) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r CleanupRepository) IsSuccess(ctx context.Context) (bool, error) { +func (r CleanupRepository) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.cleanup_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r CleanupRepository) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the CleanupRepository query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/snapshot/cleanuprepository/response.go b/typedapi/snapshot/cleanuprepository/response.go index 4bf209d8af..c3cccb53c2 100644 --- a/typedapi/snapshot/cleanuprepository/response.go +++ b/typedapi/snapshot/cleanuprepository/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package cleanuprepository @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package cleanuprepository // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/cleanup_repository/SnapshotCleanupRepositoryResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/cleanup_repository/SnapshotCleanupRepositoryResponse.ts#L22-L27 type Response struct { // Results Statistics for cleanup operations. diff --git a/typedapi/snapshot/clone/clone.go b/typedapi/snapshot/clone/clone.go index 6b7ad2d677..79c49205c3 100644 --- a/typedapi/snapshot/clone/clone.go +++ b/typedapi/snapshot/clone/clone.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Clones indices from one snapshot into another snapshot in the same // repository. @@ -55,17 +55,21 @@ type Clone struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int repository string snapshot string targetsnapshot string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClone type alias for index. @@ -90,17 +94,24 @@ func NewCloneFunc(tp elastictransport.Interface) NewClone { // Clones indices from one snapshot into another snapshot in the same // repository. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *Clone { r := &Clone{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -137,9 +148,7 @@ func (r *Clone) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -151,6 +160,10 @@ func (r *Clone) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -159,14 +172,23 @@ func (r *Clone) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.snapshot) + } path.WriteString(r.snapshot) path.WriteString("/") path.WriteString("_clone") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "targetsnapshot", r.targetsnapshot) + } path.WriteString(r.targetsnapshot) method = http.MethodPut @@ -180,15 +202,15 @@ func (r *Clone) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -205,27 +227,66 @@ func (r *Clone) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Clone) Perform(ctx context.Context) (*http.Response, error) { +func (r Clone) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.clone") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.clone") + if reader := instrument.RecordRequestBody(ctx, "snapshot.clone", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.clone") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Clone query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Clone query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clone.Response -func (r Clone) Do(ctx context.Context) (*Response, error) { +func (r Clone) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.clone") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -233,6 +294,9 @@ func (r Clone) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -242,6 +306,9 @@ func (r Clone) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -249,6 +316,9 @@ func (r Clone) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/snapshot/clone/request.go b/typedapi/snapshot/clone/request.go index c0ac3b4d74..e9d976f9b6 100644 --- a/typedapi/snapshot/clone/request.go +++ b/typedapi/snapshot/clone/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clone @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package clone // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/clone/SnapshotCloneRequest.ts#L24-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/clone/SnapshotCloneRequest.ts#L24-L42 type Request struct { Indices string `json:"indices"` } diff --git a/typedapi/snapshot/clone/response.go b/typedapi/snapshot/clone/response.go index b5258cc553..2078c8ac62 100644 --- a/typedapi/snapshot/clone/response.go +++ b/typedapi/snapshot/clone/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clone // Response holds the response body struct for the package clone // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/clone/SnapshotCloneResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/clone/SnapshotCloneResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/snapshot/create/create.go b/typedapi/snapshot/create/create.go index b35ed6e98f..550af9cb52 100644 --- a/typedapi/snapshot/create/create.go +++ b/typedapi/snapshot/create/create.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a snapshot in a repository. package create @@ -53,16 +53,20 @@ type Create struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int repository string snapshot string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCreate type alias for index. @@ -84,17 +88,24 @@ func NewCreateFunc(tp elastictransport.Interface) NewCreate { // Creates a snapshot in a repository. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *Create { r := &Create{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -131,9 +142,7 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -145,6 +154,10 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,9 +166,15 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.snapshot) + } path.WriteString(r.snapshot) method = http.MethodPut @@ -169,15 +188,15 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -194,27 +213,66 @@ func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Create) Perform(ctx context.Context) (*http.Response, error) { +func (r Create) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.create") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.create") + if reader := instrument.RecordRequestBody(ctx, "snapshot.create", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.create") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Create query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Create query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a create.Response -func (r Create) Do(ctx context.Context) (*Response, error) { +func (r Create) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.create") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -222,6 +280,9 @@ func (r Create) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -231,6 +292,9 @@ func (r Create) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -238,6 +302,9 @@ func (r Create) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/snapshot/create/request.go b/typedapi/snapshot/create/request.go index 7ed0ed7d9c..72359b7018 100644 --- a/typedapi/snapshot/create/request.go +++ b/typedapi/snapshot/create/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package create @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package create // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/create/SnapshotCreateRequest.ts#L24-L81 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/create/SnapshotCreateRequest.ts#L24-L81 type Request struct { // FeatureStates Feature states to include in the snapshot. Each feature state includes one or diff --git a/typedapi/snapshot/create/response.go b/typedapi/snapshot/create/response.go index db99a1d45a..8f276c19fe 100644 --- a/typedapi/snapshot/create/response.go +++ b/typedapi/snapshot/create/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package create @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package create // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/create/SnapshotCreateResponse.ts#L22-L35 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/create/SnapshotCreateResponse.ts#L22-L35 type Response struct { // Accepted Equals `true` if the snapshot was accepted. Present when the request had diff --git a/typedapi/snapshot/createrepository/create_repository.go b/typedapi/snapshot/createrepository/create_repository.go index adb7d61e12..51fffe7046 100644 --- a/typedapi/snapshot/createrepository/create_repository.go +++ b/typedapi/snapshot/createrepository/create_repository.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a repository. package createrepository @@ -51,15 +51,19 @@ type CreateRepository struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int repository string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCreateRepository type alias for index. @@ -79,17 +83,24 @@ func NewCreateRepositoryFunc(tp elastictransport.Interface) NewCreateRepository // Creates a repository. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *CreateRepository { r := &CreateRepository{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *CreateRepository) HttpRequest(ctx context.Context) (*http.Request, erro } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *CreateRepository) HttpRequest(ctx context.Context) (*http.Request, erro } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -148,6 +161,9 @@ func (r *CreateRepository) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) method = http.MethodPut @@ -161,15 +177,15 @@ func (r *CreateRepository) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -186,27 +202,66 @@ func (r *CreateRepository) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r CreateRepository) Perform(ctx context.Context) (*http.Response, error) { +func (r CreateRepository) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.create_repository") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.create_repository") + if reader := instrument.RecordRequestBody(ctx, "snapshot.create_repository", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.create_repository") + } if err != nil { - return nil, fmt.Errorf("an error happened during the CreateRepository query execution: %w", err) + localErr := fmt.Errorf("an error happened during the CreateRepository query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a createrepository.Response -func (r CreateRepository) Do(ctx context.Context) (*Response, error) { +func (r CreateRepository) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.create_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -214,6 +269,9 @@ func (r CreateRepository) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r CreateRepository) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +291,9 @@ func (r CreateRepository) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/snapshot/createrepository/request.go b/typedapi/snapshot/createrepository/request.go index c712b48dfa..ba0fcb53ce 100644 --- a/typedapi/snapshot/createrepository/request.go +++ b/typedapi/snapshot/createrepository/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package createrepository @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package createrepository // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/create_repository/SnapshotCreateRepositoryRequest.ts#L28-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/create_repository/SnapshotCreateRepositoryRequest.ts#L28-L48 type Request struct { Repository *types.Repository `json:"repository,omitempty"` Settings types.RepositorySettings `json:"settings"` diff --git a/typedapi/snapshot/createrepository/response.go b/typedapi/snapshot/createrepository/response.go index 0147791018..3219469068 100644 --- a/typedapi/snapshot/createrepository/response.go +++ b/typedapi/snapshot/createrepository/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package createrepository // Response holds the response body struct for the package createrepository // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/create_repository/SnapshotCreateRepositoryResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/create_repository/SnapshotCreateRepositoryResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/snapshot/delete/delete.go b/typedapi/snapshot/delete/delete.go index a95345abe4..00a8d0cdb9 100644 --- a/typedapi/snapshot/delete/delete.go +++ b/typedapi/snapshot/delete/delete.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes one or more snapshots. package delete import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type Delete struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int repository string snapshot string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDelete type alias for index. @@ -80,13 +83,18 @@ func NewDeleteFunc(tp elastictransport.Interface) NewDelete { // Deletes one or more snapshots. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *Delete { r := &Delete{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,9 +117,15 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.snapshot) + } path.WriteString(r.snapshot) method = http.MethodDelete @@ -125,9 +139,9 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +158,66 @@ func (r *Delete) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Delete) Perform(ctx context.Context) (*http.Response, error) { +func (r Delete) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.delete") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.delete") + if reader := instrument.RecordRequestBody(ctx, "snapshot.delete", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.delete") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Delete query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Delete query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a delete.Response -func (r Delete) Do(ctx context.Context) (*Response, error) { +func (r Delete) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +225,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +237,9 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +247,25 @@ func (r Delete) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Delete) IsSuccess(ctx context.Context) (bool, error) { +func (r Delete) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.delete") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +281,14 @@ func (r Delete) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Delete query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/snapshot/delete/response.go b/typedapi/snapshot/delete/response.go index 0e56f2cc9d..8068fef363 100644 --- a/typedapi/snapshot/delete/response.go +++ b/typedapi/snapshot/delete/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package delete // Response holds the response body struct for the package delete // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/delete/SnapshotDeleteResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/delete/SnapshotDeleteResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/snapshot/deleterepository/delete_repository.go b/typedapi/snapshot/deleterepository/delete_repository.go index 1965a2ee8c..76d8dad3c5 100644 --- a/typedapi/snapshot/deleterepository/delete_repository.go +++ b/typedapi/snapshot/deleterepository/delete_repository.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a repository. package deleterepository import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteRepository struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int repository string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteRepository type alias for index. @@ -75,13 +78,18 @@ func NewDeleteRepositoryFunc(tp elastictransport.Interface) NewDeleteRepository // Deletes a repository. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *DeleteRepository { r := &DeleteRepository{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *DeleteRepository) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) method = http.MethodDelete @@ -117,9 +128,9 @@ func (r *DeleteRepository) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *DeleteRepository) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteRepository) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteRepository) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.delete_repository") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.delete_repository") + if reader := instrument.RecordRequestBody(ctx, "snapshot.delete_repository", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.delete_repository") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteRepository query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteRepository query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleterepository.Response -func (r DeleteRepository) Do(ctx context.Context) (*Response, error) { +func (r DeleteRepository) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.delete_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r DeleteRepository) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r DeleteRepository) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r DeleteRepository) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteRepository) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteRepository) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.delete_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r DeleteRepository) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteRepository query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/snapshot/deleterepository/response.go b/typedapi/snapshot/deleterepository/response.go index 8c78171d65..80a5c8abc3 100644 --- a/typedapi/snapshot/deleterepository/response.go +++ b/typedapi/snapshot/deleterepository/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleterepository // Response holds the response body struct for the package deleterepository // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/delete_repository/SnapshotDeleteRepositoryResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/delete_repository/SnapshotDeleteRepositoryResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/snapshot/get/get.go b/typedapi/snapshot/get/get.go index bf0c729e5e..5337d5344e 100644 --- a/typedapi/snapshot/get/get.go +++ b/typedapi/snapshot/get/get.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about a snapshot. package get import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -56,12 +55,16 @@ type Get struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int repository string snapshot string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGet type alias for index. @@ -83,13 +86,18 @@ func NewGetFunc(tp elastictransport.Interface) NewGet { // Returns information about a snapshot. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *Get { r := &Get{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,9 +120,15 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.snapshot) + } path.WriteString(r.snapshot) method = http.MethodGet @@ -128,9 +142,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -147,27 +161,66 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Get) Perform(ctx context.Context) (*http.Response, error) { +func (r Get) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.get") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.get") + if reader := instrument.RecordRequestBody(ctx, "snapshot.get", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.get") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Get query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Get query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a get.Response -func (r Get) Do(ctx context.Context) (*Response, error) { +func (r Get) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -175,6 +228,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,6 +240,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -191,12 +250,25 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Get) IsSuccess(ctx context.Context) (bool, error) { +func (r Get) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -212,6 +284,14 @@ func (r Get) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Get query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/snapshot/get/response.go b/typedapi/snapshot/get/response.go index dcc8ecfc6e..02576d3dfe 100644 --- a/typedapi/snapshot/get/response.go +++ b/typedapi/snapshot/get/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package get @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package get // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/get/SnapshotGetResponse.ts#L25-L42 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/get/SnapshotGetResponse.ts#L25-L42 type Response struct { // Remaining The number of remaining snapshots that were not returned due to size limits diff --git a/typedapi/snapshot/getrepository/get_repository.go b/typedapi/snapshot/getrepository/get_repository.go index 545455d62b..7e88857ae5 100644 --- a/typedapi/snapshot/getrepository/get_repository.go +++ b/typedapi/snapshot/getrepository/get_repository.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about a repository. package getrepository import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetRepository struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int repository string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetRepository type alias for index. @@ -74,13 +77,18 @@ func NewGetRepositoryFunc(tp elastictransport.Interface) NewGetRepository { // Returns information about a repository. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *GetRepository { r := &GetRepository{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *GetRepository) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) method = http.MethodGet @@ -121,9 +132,9 @@ func (r *GetRepository) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *GetRepository) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetRepository) Perform(ctx context.Context) (*http.Response, error) { +func (r GetRepository) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.get_repository") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.get_repository") + if reader := instrument.RecordRequestBody(ctx, "snapshot.get_repository", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.get_repository") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetRepository query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetRepository query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getrepository.Response -func (r GetRepository) Do(ctx context.Context) (Response, error) { +func (r GetRepository) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.get_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r GetRepository) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r GetRepository) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r GetRepository) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetRepository) IsSuccess(ctx context.Context) (bool, error) { +func (r GetRepository) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.get_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r GetRepository) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetRepository query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/snapshot/getrepository/response.go b/typedapi/snapshot/getrepository/response.go index 8bb9479396..bf1827ef5a 100644 --- a/typedapi/snapshot/getrepository/response.go +++ b/typedapi/snapshot/getrepository/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getrepository @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package getrepository // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/get_repository/SnapshotGetRepositoryResponse.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/get_repository/SnapshotGetRepositoryResponse.ts#L23-L25 type Response map[string]types.Repository diff --git a/typedapi/snapshot/restore/request.go b/typedapi/snapshot/restore/request.go index c5e45bd550..d0dfea0eac 100644 --- a/typedapi/snapshot/restore/request.go +++ b/typedapi/snapshot/restore/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package restore @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package restore // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/restore/SnapshotRestoreRequest.ts#L25-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/restore/SnapshotRestoreRequest.ts#L25-L51 type Request struct { FeatureStates []string `json:"feature_states,omitempty"` IgnoreIndexSettings []string `json:"ignore_index_settings,omitempty"` diff --git a/typedapi/snapshot/restore/response.go b/typedapi/snapshot/restore/response.go index 46fa31a59d..3099c92aa6 100644 --- a/typedapi/snapshot/restore/response.go +++ b/typedapi/snapshot/restore/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package restore @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package restore // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/restore/SnapshotRestoreResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/restore/SnapshotRestoreResponse.ts#L23-L25 type Response struct { Snapshot types.SnapshotRestore `json:"snapshot"` } diff --git a/typedapi/snapshot/restore/restore.go b/typedapi/snapshot/restore/restore.go index aa96790256..54a0dd44e9 100644 --- a/typedapi/snapshot/restore/restore.go +++ b/typedapi/snapshot/restore/restore.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Restores a snapshot. package restore @@ -53,16 +53,20 @@ type Restore struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int repository string snapshot string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewRestore type alias for index. @@ -84,17 +88,24 @@ func NewRestoreFunc(tp elastictransport.Interface) NewRestore { // Restores a snapshot. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *Restore { r := &Restore{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -131,9 +142,7 @@ func (r *Restore) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -145,6 +154,10 @@ func (r *Restore) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,9 +166,15 @@ func (r *Restore) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.snapshot) + } path.WriteString(r.snapshot) path.WriteString("/") path.WriteString("_restore") @@ -171,15 +190,15 @@ func (r *Restore) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -196,27 +215,66 @@ func (r *Restore) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Restore) Perform(ctx context.Context) (*http.Response, error) { +func (r Restore) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.restore") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.restore") + if reader := instrument.RecordRequestBody(ctx, "snapshot.restore", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.restore") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Restore query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Restore query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a restore.Response -func (r Restore) Do(ctx context.Context) (*Response, error) { +func (r Restore) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.restore") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -224,6 +282,9 @@ func (r Restore) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -233,6 +294,9 @@ func (r Restore) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -240,6 +304,9 @@ func (r Restore) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/snapshot/status/response.go b/typedapi/snapshot/status/response.go index 7d18127f5c..7d230288de 100644 --- a/typedapi/snapshot/status/response.go +++ b/typedapi/snapshot/status/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package status @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package status // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/status/SnapshotStatusResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/status/SnapshotStatusResponse.ts#L22-L24 type Response struct { Snapshots []types.Status `json:"snapshots"` } diff --git a/typedapi/snapshot/status/status.go b/typedapi/snapshot/status/status.go index 3907f5f262..4ee66a0a6d 100644 --- a/typedapi/snapshot/status/status.go +++ b/typedapi/snapshot/status/status.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about the status of a snapshot. package status import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,12 +53,16 @@ type Status struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int repository string snapshot string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStatus type alias for index. @@ -77,13 +80,18 @@ func NewStatusFunc(tp elastictransport.Interface) NewStatus { // Returns information about the status of a snapshot. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *Status { r := &Status{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -113,6 +121,9 @@ func (r *Status) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) path.WriteString("/") path.WriteString("_status") @@ -123,9 +134,15 @@ func (r *Status) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "snapshot", r.snapshot) + } path.WriteString(r.snapshot) path.WriteString("/") path.WriteString("_status") @@ -141,9 +158,9 @@ func (r *Status) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -160,27 +177,66 @@ func (r *Status) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Status) Perform(ctx context.Context) (*http.Response, error) { +func (r Status) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.status") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.status") + if reader := instrument.RecordRequestBody(ctx, "snapshot.status", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.status") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Status query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Status query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a status.Response -func (r Status) Do(ctx context.Context) (*Response, error) { +func (r Status) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -188,6 +244,9 @@ func (r Status) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -197,6 +256,9 @@ func (r Status) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -204,12 +266,25 @@ func (r Status) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Status) IsSuccess(ctx context.Context) (bool, error) { +func (r Status) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -225,6 +300,14 @@ func (r Status) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Status query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/snapshot/verifyrepository/response.go b/typedapi/snapshot/verifyrepository/response.go index b394918230..c98c8e4b34 100644 --- a/typedapi/snapshot/verifyrepository/response.go +++ b/typedapi/snapshot/verifyrepository/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package verifyrepository @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package verifyrepository // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/verify_repository/SnapshotVerifyRepositoryResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/verify_repository/SnapshotVerifyRepositoryResponse.ts#L23-L25 type Response struct { Nodes map[string]types.CompactNodeInfo `json:"nodes"` } diff --git a/typedapi/snapshot/verifyrepository/verify_repository.go b/typedapi/snapshot/verifyrepository/verify_repository.go index 7cbfb3a201..d3697daddd 100644 --- a/typedapi/snapshot/verifyrepository/verify_repository.go +++ b/typedapi/snapshot/verifyrepository/verify_repository.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Verifies a repository. package verifyrepository import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type VerifyRepository struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int repository string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewVerifyRepository type alias for index. @@ -75,13 +78,18 @@ func NewVerifyRepositoryFunc(tp elastictransport.Interface) NewVerifyRepository // Verifies a repository. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html func New(tp elastictransport.Interface) *VerifyRepository { r := &VerifyRepository{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *VerifyRepository) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_snapshot") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "repository", r.repository) + } path.WriteString(r.repository) path.WriteString("/") path.WriteString("_verify") @@ -119,9 +130,9 @@ func (r *VerifyRepository) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *VerifyRepository) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r VerifyRepository) Perform(ctx context.Context) (*http.Response, error) { +func (r VerifyRepository) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "snapshot.verify_repository") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "snapshot.verify_repository") + if reader := instrument.RecordRequestBody(ctx, "snapshot.verify_repository", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "snapshot.verify_repository") + } if err != nil { - return nil, fmt.Errorf("an error happened during the VerifyRepository query execution: %w", err) + localErr := fmt.Errorf("an error happened during the VerifyRepository query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a verifyrepository.Response -func (r VerifyRepository) Do(ctx context.Context) (*Response, error) { +func (r VerifyRepository) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.verify_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r VerifyRepository) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r VerifyRepository) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r VerifyRepository) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r VerifyRepository) IsSuccess(ctx context.Context) (bool, error) { +func (r VerifyRepository) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "snapshot.verify_repository") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r VerifyRepository) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the VerifyRepository query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/sql/clearcursor/clear_cursor.go b/typedapi/sql/clearcursor/clear_cursor.go index fc31f28d1d..bc89bc6e33 100644 --- a/typedapi/sql/clearcursor/clear_cursor.go +++ b/typedapi/sql/clearcursor/clear_cursor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Clears the SQL cursor package clearcursor @@ -46,13 +46,17 @@ type ClearCursor struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewClearCursor type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *ClearCursor { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *ClearCursor) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *ClearCursor) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,15 +164,15 @@ func (r *ClearCursor) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -176,27 +189,66 @@ func (r *ClearCursor) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ClearCursor) Perform(ctx context.Context) (*http.Response, error) { +func (r ClearCursor) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "sql.clear_cursor") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "sql.clear_cursor") + if reader := instrument.RecordRequestBody(ctx, "sql.clear_cursor", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.clear_cursor") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ClearCursor query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ClearCursor query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a clearcursor.Response -func (r ClearCursor) Do(ctx context.Context) (*Response, error) { +func (r ClearCursor) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.clear_cursor") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -204,6 +256,9 @@ func (r ClearCursor) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -213,6 +268,9 @@ func (r ClearCursor) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -220,6 +278,9 @@ func (r ClearCursor) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/sql/clearcursor/request.go b/typedapi/sql/clearcursor/request.go index 53cb502cb4..1bc75eae6a 100644 --- a/typedapi/sql/clearcursor/request.go +++ b/typedapi/sql/clearcursor/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearcursor @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package clearcursor // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/sql/clear_cursor/ClearSqlCursorRequest.ts#L22-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/sql/clear_cursor/ClearSqlCursorRequest.ts#L22-L34 type Request struct { // Cursor Cursor to clear. diff --git a/typedapi/sql/clearcursor/response.go b/typedapi/sql/clearcursor/response.go index e31ec06e90..fc01b60fa2 100644 --- a/typedapi/sql/clearcursor/response.go +++ b/typedapi/sql/clearcursor/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package clearcursor // Response holds the response body struct for the package clearcursor // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/sql/clear_cursor/ClearSqlCursorResponse.ts#L20-L22 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/sql/clear_cursor/ClearSqlCursorResponse.ts#L20-L22 type Response struct { Succeeded bool `json:"succeeded"` } diff --git a/typedapi/sql/deleteasync/delete_async.go b/typedapi/sql/deleteasync/delete_async.go index f179ec6cfd..df46e59eb7 100644 --- a/typedapi/sql/deleteasync/delete_async.go +++ b/typedapi/sql/deleteasync/delete_async.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an async SQL search or a stored synchronous SQL search. If the search // is still running, the API cancels it. package deleteasync import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteAsync struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteAsync type alias for index. @@ -77,13 +80,18 @@ func NewDeleteAsyncFunc(tp elastictransport.Interface) NewDeleteAsync { // Deletes an async SQL search or a stored synchronous SQL search. If the search // is still running, the API cancels it. // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-async-sql-search-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-async-sql-search-api.html func New(tp elastictransport.Interface) *DeleteAsync { r := &DeleteAsync{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,6 +118,9 @@ func (r *DeleteAsync) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("delete") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -123,9 +134,9 @@ func (r *DeleteAsync) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -142,27 +153,66 @@ func (r *DeleteAsync) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteAsync) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteAsync) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "sql.delete_async") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "sql.delete_async") + if reader := instrument.RecordRequestBody(ctx, "sql.delete_async", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.delete_async") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteAsync query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteAsync query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deleteasync.Response -func (r DeleteAsync) Do(ctx context.Context) (*Response, error) { +func (r DeleteAsync) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.delete_async") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -170,6 +220,9 @@ func (r DeleteAsync) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -179,6 +232,9 @@ func (r DeleteAsync) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -186,12 +242,25 @@ func (r DeleteAsync) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteAsync) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteAsync) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.delete_async") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -207,6 +276,14 @@ func (r DeleteAsync) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteAsync query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/sql/deleteasync/response.go b/typedapi/sql/deleteasync/response.go index 296c9d7394..dc1101bdea 100644 --- a/typedapi/sql/deleteasync/response.go +++ b/typedapi/sql/deleteasync/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deleteasync // Response holds the response body struct for the package deleteasync // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/sql/delete_async/SqlDeleteAsyncResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/sql/delete_async/SqlDeleteAsyncResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/sql/getasync/get_async.go b/typedapi/sql/getasync/get_async.go index c3f1df3d16..4f109e3ca5 100644 --- a/typedapi/sql/getasync/get_async.go +++ b/typedapi/sql/getasync/get_async.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the current status and available results for an async SQL search or // stored synchronous SQL search package getasync import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetAsync struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetAsync type alias for index. @@ -77,13 +80,18 @@ func NewGetAsyncFunc(tp elastictransport.Interface) NewGetAsync { // Returns the current status and available results for an async SQL search or // stored synchronous SQL search // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-sql-search-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-async-sql-search-api.html func New(tp elastictransport.Interface) *GetAsync { r := &GetAsync{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,6 +116,9 @@ func (r *GetAsync) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("async") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -121,9 +132,9 @@ func (r *GetAsync) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *GetAsync) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetAsync) Perform(ctx context.Context) (*http.Response, error) { +func (r GetAsync) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "sql.get_async") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "sql.get_async") + if reader := instrument.RecordRequestBody(ctx, "sql.get_async", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.get_async") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetAsync query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetAsync query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getasync.Response -func (r GetAsync) Do(ctx context.Context) (*Response, error) { +func (r GetAsync) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.get_async") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r GetAsync) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r GetAsync) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r GetAsync) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetAsync) IsSuccess(ctx context.Context) (bool, error) { +func (r GetAsync) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.get_async") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r GetAsync) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetAsync query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/sql/getasync/response.go b/typedapi/sql/getasync/response.go index 84c0e71b85..69d7dea591 100644 --- a/typedapi/sql/getasync/response.go +++ b/typedapi/sql/getasync/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getasync @@ -28,8 +28,7 @@ import ( // Response holds the response body struct for the package getasync // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/sql/get_async/SqlGetAsyncResponse.ts#L23-L60 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/sql/get_async/SqlGetAsyncResponse.ts#L23-L60 type Response struct { // Columns Column headings for the search results. Each object is a column. diff --git a/typedapi/sql/getasyncstatus/get_async_status.go b/typedapi/sql/getasyncstatus/get_async_status.go index bea9c3466c..087a55cdda 100644 --- a/typedapi/sql/getasyncstatus/get_async_status.go +++ b/typedapi/sql/getasyncstatus/get_async_status.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns the current status of an async SQL search or a stored synchronous SQL // search package getasyncstatus import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetAsyncStatus struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetAsyncStatus type alias for index. @@ -77,13 +80,18 @@ func NewGetAsyncStatusFunc(tp elastictransport.Interface) NewGetAsyncStatus { // Returns the current status of an async SQL search or a stored synchronous SQL // search // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-sql-search-status-api.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-async-sql-search-status-api.html func New(tp elastictransport.Interface) *GetAsyncStatus { r := &GetAsyncStatus{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,6 +118,9 @@ func (r *GetAsyncStatus) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("status") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -123,9 +134,9 @@ func (r *GetAsyncStatus) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -142,27 +153,66 @@ func (r *GetAsyncStatus) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetAsyncStatus) Perform(ctx context.Context) (*http.Response, error) { +func (r GetAsyncStatus) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "sql.get_async_status") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "sql.get_async_status") + if reader := instrument.RecordRequestBody(ctx, "sql.get_async_status", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.get_async_status") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetAsyncStatus query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetAsyncStatus query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getasyncstatus.Response -func (r GetAsyncStatus) Do(ctx context.Context) (*Response, error) { +func (r GetAsyncStatus) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.get_async_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -170,6 +220,9 @@ func (r GetAsyncStatus) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -179,6 +232,9 @@ func (r GetAsyncStatus) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -186,12 +242,25 @@ func (r GetAsyncStatus) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetAsyncStatus) IsSuccess(ctx context.Context) (bool, error) { +func (r GetAsyncStatus) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.get_async_status") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -207,6 +276,14 @@ func (r GetAsyncStatus) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetAsyncStatus query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/sql/getasyncstatus/response.go b/typedapi/sql/getasyncstatus/response.go index 338c18c9c2..ae208b500e 100644 --- a/typedapi/sql/getasyncstatus/response.go +++ b/typedapi/sql/getasyncstatus/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getasyncstatus // Response holds the response body struct for the package getasyncstatus // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/sql/get_async_status/SqlGetAsyncStatusResponse.ts#L23-L55 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/sql/get_async_status/SqlGetAsyncStatusResponse.ts#L23-L55 type Response struct { // CompletionStatus HTTP status code for the search. The API only returns this property for diff --git a/typedapi/sql/query/query.go b/typedapi/sql/query/query.go index 9efaa13122..99bb4b1ac4 100644 --- a/typedapi/sql/query/query.go +++ b/typedapi/sql/query/query.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Executes a SQL request package query @@ -46,13 +46,17 @@ type Query struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewQuery type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *Query { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *Query) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *Query) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,15 +162,15 @@ func (r *Query) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -174,27 +187,66 @@ func (r *Query) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Query) Perform(ctx context.Context) (*http.Response, error) { +func (r Query) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "sql.query") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "sql.query") + if reader := instrument.RecordRequestBody(ctx, "sql.query", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.query") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Query query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Query query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a query.Response -func (r Query) Do(ctx context.Context) (*Response, error) { +func (r Query) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.query") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -202,6 +254,9 @@ func (r Query) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -211,6 +266,9 @@ func (r Query) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -218,6 +276,9 @@ func (r Query) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/sql/query/request.go b/typedapi/sql/query/request.go index 847d7a4ed6..98fe72bf7e 100644 --- a/typedapi/sql/query/request.go +++ b/typedapi/sql/query/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package query @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package query // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/sql/query/QuerySqlRequest.ts#L28-L122 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/sql/query/QuerySqlRequest.ts#L28-L122 type Request struct { // Catalog Default catalog (cluster) for queries. If unspecified, the queries execute on diff --git a/typedapi/sql/query/response.go b/typedapi/sql/query/response.go index 6517276fb8..e0c9ae9090 100644 --- a/typedapi/sql/query/response.go +++ b/typedapi/sql/query/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package query @@ -28,8 +28,7 @@ import ( // Response holds the response body struct for the package query // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/sql/query/QuerySqlResponse.ts#L23-L60 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/sql/query/QuerySqlResponse.ts#L23-L60 type Response struct { // Columns Column headings for the search results. Each object is a column. diff --git a/typedapi/sql/translate/request.go b/typedapi/sql/translate/request.go index 51b718c3b2..1214458396 100644 --- a/typedapi/sql/translate/request.go +++ b/typedapi/sql/translate/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package translate @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package translate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/sql/translate/TranslateSqlRequest.ts#L25-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/sql/translate/TranslateSqlRequest.ts#L25-L54 type Request struct { // FetchSize The maximum number of rows (or entries) to return in one response. diff --git a/typedapi/sql/translate/response.go b/typedapi/sql/translate/response.go index 41f34aa309..259ba169a9 100644 --- a/typedapi/sql/translate/response.go +++ b/typedapi/sql/translate/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package translate @@ -32,8 +32,7 @@ import ( // Response holds the response body struct for the package translate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/sql/translate/TranslateSqlResponse.ts#L28-L38 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/sql/translate/TranslateSqlResponse.ts#L28-L38 type Response struct { Aggregations map[string]types.Aggregations `json:"aggregations,omitempty"` Fields []types.FieldAndFormat `json:"fields,omitempty"` diff --git a/typedapi/sql/translate/translate.go b/typedapi/sql/translate/translate.go index 78150ad400..1b2a95323c 100644 --- a/typedapi/sql/translate/translate.go +++ b/typedapi/sql/translate/translate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Translates SQL into Elasticsearch queries package translate @@ -46,13 +46,17 @@ type Translate struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewTranslate type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *Translate { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *Translate) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *Translate) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -151,15 +164,15 @@ func (r *Translate) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -176,27 +189,66 @@ func (r *Translate) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Translate) Perform(ctx context.Context) (*http.Response, error) { +func (r Translate) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "sql.translate") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "sql.translate") + if reader := instrument.RecordRequestBody(ctx, "sql.translate", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "sql.translate") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Translate query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Translate query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a translate.Response -func (r Translate) Do(ctx context.Context) (*Response, error) { +func (r Translate) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "sql.translate") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -204,6 +256,9 @@ func (r Translate) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -213,6 +268,9 @@ func (r Translate) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -220,6 +278,9 @@ func (r Translate) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/ssl/certificates/certificates.go b/typedapi/ssl/certificates/certificates.go index 45cf64c390..2ba8489219 100644 --- a/typedapi/ssl/certificates/certificates.go +++ b/typedapi/ssl/certificates/certificates.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about the X.509 certificates used to encrypt // communications in the cluster. package certificates import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type Certificates struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCertificates type alias for index. @@ -75,7 +78,12 @@ func New(tp elastictransport.Interface) *Certificates { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,9 +118,9 @@ func (r *Certificates) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -129,27 +137,66 @@ func (r *Certificates) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Certificates) Perform(ctx context.Context) (*http.Response, error) { +func (r Certificates) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "ssl.certificates") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "ssl.certificates") + if reader := instrument.RecordRequestBody(ctx, "ssl.certificates", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "ssl.certificates") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Certificates query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Certificates query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a certificates.Response -func (r Certificates) Do(ctx context.Context) (Response, error) { +func (r Certificates) Do(providedCtx context.Context) (Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ssl.certificates") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -157,6 +204,9 @@ func (r Certificates) Do(ctx context.Context) (Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(&response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -166,6 +216,9 @@ func (r Certificates) Do(ctx context.Context) (Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,12 +226,25 @@ func (r Certificates) Do(ctx context.Context) (Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Certificates) IsSuccess(ctx context.Context) (bool, error) { +func (r Certificates) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "ssl.certificates") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -194,6 +260,14 @@ func (r Certificates) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Certificates query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/ssl/certificates/response.go b/typedapi/ssl/certificates/response.go index a6789b2dba..53330b4c6c 100644 --- a/typedapi/ssl/certificates/response.go +++ b/typedapi/ssl/certificates/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package certificates @@ -26,7 +26,7 @@ import ( // Response holds the response body struct for the package certificates // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ssl/certificates/GetCertificatesResponse.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ssl/certificates/GetCertificatesResponse.ts#L22-L24 type Response []types.CertificateInformation diff --git a/typedapi/synonyms/deletesynonym/delete_synonym.go b/typedapi/synonyms/deletesynonym/delete_synonym.go index 82c1acf6ea..36ae244789 100644 --- a/typedapi/synonyms/deletesynonym/delete_synonym.go +++ b/typedapi/synonyms/deletesynonym/delete_synonym.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a synonym set package deletesynonym import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteSynonym struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteSynonym type alias for index. @@ -75,13 +78,18 @@ func NewDeleteSynonymFunc(tp elastictransport.Interface) NewDeleteSynonym { // Deletes a synonym set // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-synonyms-set.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-synonyms-set.html func New(tp elastictransport.Interface) *DeleteSynonym { r := &DeleteSynonym{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *DeleteSynonym) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("_synonyms") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -117,9 +128,9 @@ func (r *DeleteSynonym) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -136,27 +147,66 @@ func (r *DeleteSynonym) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteSynonym) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteSynonym) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "synonyms.delete_synonym") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.delete_synonym") + if reader := instrument.RecordRequestBody(ctx, "synonyms.delete_synonym", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.delete_synonym") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteSynonym query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteSynonym query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletesynonym.Response -func (r DeleteSynonym) Do(ctx context.Context) (*Response, error) { +func (r DeleteSynonym) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.delete_synonym") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -164,6 +214,9 @@ func (r DeleteSynonym) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -173,6 +226,9 @@ func (r DeleteSynonym) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -180,12 +236,25 @@ func (r DeleteSynonym) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteSynonym) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteSynonym) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.delete_synonym") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -201,6 +270,14 @@ func (r DeleteSynonym) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteSynonym query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/synonyms/deletesynonym/response.go b/typedapi/synonyms/deletesynonym/response.go index f305db7c87..25b0758066 100644 --- a/typedapi/synonyms/deletesynonym/response.go +++ b/typedapi/synonyms/deletesynonym/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletesynonym // Response holds the response body struct for the package deletesynonym // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/delete_synonym/SynonymsDeleteResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/delete_synonym/SynonymsDeleteResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/synonyms/deletesynonymrule/delete_synonym_rule.go b/typedapi/synonyms/deletesynonymrule/delete_synonym_rule.go index 22f8619ce3..02251b8a78 100644 --- a/typedapi/synonyms/deletesynonymrule/delete_synonym_rule.go +++ b/typedapi/synonyms/deletesynonymrule/delete_synonym_rule.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes a synonym rule in a synonym set package deletesynonymrule import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type DeleteSynonymRule struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int setid string ruleid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteSynonymRule type alias for index. @@ -80,13 +83,18 @@ func NewDeleteSynonymRuleFunc(tp elastictransport.Interface) NewDeleteSynonymRul // Deletes a synonym rule in a synonym set // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-synonym-rule.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-synonym-rule.html func New(tp elastictransport.Interface) *DeleteSynonymRule { r := &DeleteSynonymRule{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,9 +117,15 @@ func (r *DeleteSynonymRule) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("_synonyms") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "setid", r.setid) + } path.WriteString(r.setid) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "ruleid", r.ruleid) + } path.WriteString(r.ruleid) method = http.MethodDelete @@ -125,15 +139,15 @@ func (r *DeleteSynonymRule) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -150,27 +164,66 @@ func (r *DeleteSynonymRule) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteSynonymRule) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteSynonymRule) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "synonyms.delete_synonym_rule") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.delete_synonym_rule") + if reader := instrument.RecordRequestBody(ctx, "synonyms.delete_synonym_rule", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.delete_synonym_rule") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteSynonymRule query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteSynonymRule query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletesynonymrule.Response -func (r DeleteSynonymRule) Do(ctx context.Context) (*Response, error) { +func (r DeleteSynonymRule) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.delete_synonym_rule") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -178,6 +231,9 @@ func (r DeleteSynonymRule) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,6 +243,9 @@ func (r DeleteSynonymRule) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -194,12 +253,25 @@ func (r DeleteSynonymRule) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteSynonymRule) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteSynonymRule) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.delete_synonym_rule") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -215,6 +287,14 @@ func (r DeleteSynonymRule) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteSynonymRule query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/synonyms/deletesynonymrule/response.go b/typedapi/synonyms/deletesynonymrule/response.go index a705c61609..49d828f484 100644 --- a/typedapi/synonyms/deletesynonymrule/response.go +++ b/typedapi/synonyms/deletesynonymrule/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletesynonymrule @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package deletesynonymrule // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/delete_synonym_rule/SynonymRuleDeleteResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/delete_synonym_rule/SynonymRuleDeleteResponse.ts#L22-L24 type Response struct { // ReloadAnalyzersDetails Updating synonyms in a synonym set reloads the associated analyzers. diff --git a/typedapi/synonyms/getsynonym/get_synonym.go b/typedapi/synonyms/getsynonym/get_synonym.go index 132ca30bdd..b4b67c8ce3 100644 --- a/typedapi/synonyms/getsynonym/get_synonym.go +++ b/typedapi/synonyms/getsynonym/get_synonym.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves a synonym set package getsynonym import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetSynonym struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetSynonym type alias for index. @@ -76,13 +79,18 @@ func NewGetSynonymFunc(tp elastictransport.Interface) NewGetSynonym { // Retrieves a synonym set // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-synonyms-set.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-synonyms-set.html func New(tp elastictransport.Interface) *GetSynonym { r := &GetSynonym{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *GetSynonym) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_synonyms") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -118,9 +129,9 @@ func (r *GetSynonym) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -137,27 +148,66 @@ func (r *GetSynonym) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetSynonym) Perform(ctx context.Context) (*http.Response, error) { +func (r GetSynonym) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "synonyms.get_synonym") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.get_synonym") + if reader := instrument.RecordRequestBody(ctx, "synonyms.get_synonym", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.get_synonym") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetSynonym query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetSynonym query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getsynonym.Response -func (r GetSynonym) Do(ctx context.Context) (*Response, error) { +func (r GetSynonym) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.get_synonym") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -165,6 +215,9 @@ func (r GetSynonym) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -174,6 +227,9 @@ func (r GetSynonym) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,12 +237,25 @@ func (r GetSynonym) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetSynonym) IsSuccess(ctx context.Context) (bool, error) { +func (r GetSynonym) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.get_synonym") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -202,6 +271,14 @@ func (r GetSynonym) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetSynonym query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/synonyms/getsynonym/response.go b/typedapi/synonyms/getsynonym/response.go index 6a0b14c8ad..3713deb6e6 100644 --- a/typedapi/synonyms/getsynonym/response.go +++ b/typedapi/synonyms/getsynonym/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getsynonym @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getsynonym // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/get_synonym/SynonymsGetResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/get_synonym/SynonymsGetResponse.ts#L23-L28 type Response struct { Count int `json:"count"` SynonymsSet []types.SynonymRuleRead `json:"synonyms_set"` diff --git a/typedapi/synonyms/getsynonymrule/get_synonym_rule.go b/typedapi/synonyms/getsynonymrule/get_synonym_rule.go index 0e65c7b688..b383a0e7be 100644 --- a/typedapi/synonyms/getsynonymrule/get_synonym_rule.go +++ b/typedapi/synonyms/getsynonymrule/get_synonym_rule.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves a synonym rule from a synonym set package getsynonymrule import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -53,12 +52,16 @@ type GetSynonymRule struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int setid string ruleid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetSynonymRule type alias for index. @@ -80,13 +83,18 @@ func NewGetSynonymRuleFunc(tp elastictransport.Interface) NewGetSynonymRule { // Retrieves a synonym rule from a synonym set // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/get-synonym-rule.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/get-synonym-rule.html func New(tp elastictransport.Interface) *GetSynonymRule { r := &GetSynonymRule{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,9 +117,15 @@ func (r *GetSynonymRule) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("_synonyms") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "setid", r.setid) + } path.WriteString(r.setid) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "ruleid", r.ruleid) + } path.WriteString(r.ruleid) method = http.MethodGet @@ -125,15 +139,15 @@ func (r *GetSynonymRule) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -150,27 +164,66 @@ func (r *GetSynonymRule) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetSynonymRule) Perform(ctx context.Context) (*http.Response, error) { +func (r GetSynonymRule) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "synonyms.get_synonym_rule") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.get_synonym_rule") + if reader := instrument.RecordRequestBody(ctx, "synonyms.get_synonym_rule", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.get_synonym_rule") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetSynonymRule query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetSynonymRule query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getsynonymrule.Response -func (r GetSynonymRule) Do(ctx context.Context) (*Response, error) { +func (r GetSynonymRule) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.get_synonym_rule") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -178,6 +231,9 @@ func (r GetSynonymRule) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -187,6 +243,9 @@ func (r GetSynonymRule) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -194,12 +253,25 @@ func (r GetSynonymRule) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetSynonymRule) IsSuccess(ctx context.Context) (bool, error) { +func (r GetSynonymRule) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.get_synonym_rule") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -215,6 +287,14 @@ func (r GetSynonymRule) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetSynonymRule query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/synonyms/getsynonymrule/response.go b/typedapi/synonyms/getsynonymrule/response.go index 798c51e120..dabf3edd85 100644 --- a/typedapi/synonyms/getsynonymrule/response.go +++ b/typedapi/synonyms/getsynonymrule/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getsynonymrule // Response holds the response body struct for the package getsynonymrule // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/get_synonym_rule/SynonymRuleGetResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/get_synonym_rule/SynonymRuleGetResponse.ts#L22-L24 type Response struct { // Id Synonym Rule identifier diff --git a/typedapi/synonyms/getsynonymssets/get_synonyms_sets.go b/typedapi/synonyms/getsynonymssets/get_synonyms_sets.go index f648253125..e1a2df73c7 100644 --- a/typedapi/synonyms/getsynonymssets/get_synonyms_sets.go +++ b/typedapi/synonyms/getsynonymssets/get_synonyms_sets.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves a summary of all defined synonym sets package getsynonymssets import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type GetSynonymsSets struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetSynonymsSets type alias for index. @@ -68,13 +71,18 @@ func NewGetSynonymsSetsFunc(tp elastictransport.Interface) NewGetSynonymsSets { // Retrieves a summary of all defined synonym sets // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/list-synonyms-sets.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/list-synonyms-sets.html func New(tp elastictransport.Interface) *GetSynonymsSets { r := &GetSynonymsSets{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,9 +115,9 @@ func (r *GetSynonymsSets) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -126,27 +134,66 @@ func (r *GetSynonymsSets) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetSynonymsSets) Perform(ctx context.Context) (*http.Response, error) { +func (r GetSynonymsSets) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "synonyms.get_synonyms_sets") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.get_synonyms_sets") + if reader := instrument.RecordRequestBody(ctx, "synonyms.get_synonyms_sets", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.get_synonyms_sets") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetSynonymsSets query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetSynonymsSets query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getsynonymssets.Response -func (r GetSynonymsSets) Do(ctx context.Context) (*Response, error) { +func (r GetSynonymsSets) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.get_synonyms_sets") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -154,6 +201,9 @@ func (r GetSynonymsSets) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -163,6 +213,9 @@ func (r GetSynonymsSets) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -170,12 +223,25 @@ func (r GetSynonymsSets) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetSynonymsSets) IsSuccess(ctx context.Context) (bool, error) { +func (r GetSynonymsSets) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.get_synonyms_sets") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -191,6 +257,14 @@ func (r GetSynonymsSets) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetSynonymsSets query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/synonyms/getsynonymssets/response.go b/typedapi/synonyms/getsynonymssets/response.go index ec7fc037de..898f57e53b 100644 --- a/typedapi/synonyms/getsynonymssets/response.go +++ b/typedapi/synonyms/getsynonymssets/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getsynonymssets @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getsynonymssets // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/get_synonyms_sets/SynonymsSetsGetResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/get_synonyms_sets/SynonymsSetsGetResponse.ts#L23-L28 type Response struct { Count int `json:"count"` Results []types.SynonymsSetItem `json:"results"` diff --git a/typedapi/synonyms/putsynonym/put_synonym.go b/typedapi/synonyms/putsynonym/put_synonym.go index ebbdba1fa6..2381a0674d 100644 --- a/typedapi/synonyms/putsynonym/put_synonym.go +++ b/typedapi/synonyms/putsynonym/put_synonym.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates a synonyms set package putsynonym @@ -50,15 +50,19 @@ type PutSynonym struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutSynonym type alias for index. @@ -78,17 +82,24 @@ func NewPutSynonymFunc(tp elastictransport.Interface) NewPutSynonym { // Creates or updates a synonyms set // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/put-synonyms-set.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/put-synonyms-set.html func New(tp elastictransport.Interface) *PutSynonym { r := &PutSynonym{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *PutSynonym) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *PutSynonym) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -147,6 +160,9 @@ func (r *PutSynonym) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_synonyms") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPut @@ -160,15 +176,15 @@ func (r *PutSynonym) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -185,27 +201,66 @@ func (r *PutSynonym) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutSynonym) Perform(ctx context.Context) (*http.Response, error) { +func (r PutSynonym) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "synonyms.put_synonym") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.put_synonym") + if reader := instrument.RecordRequestBody(ctx, "synonyms.put_synonym", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.put_synonym") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutSynonym query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutSynonym query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putsynonym.Response -func (r PutSynonym) Do(ctx context.Context) (*Response, error) { +func (r PutSynonym) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.put_synonym") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -213,6 +268,9 @@ func (r PutSynonym) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r PutSynonym) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +290,9 @@ func (r PutSynonym) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/synonyms/putsynonym/request.go b/typedapi/synonyms/putsynonym/request.go index 5c1ca99790..63afbc27fd 100644 --- a/typedapi/synonyms/putsynonym/request.go +++ b/typedapi/synonyms/putsynonym/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putsynonym @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putsynonym // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/put_synonym/SynonymsPutRequest.ts#L23-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/put_synonym/SynonymsPutRequest.ts#L23-L42 type Request struct { // SynonymsSet The synonym set information to update diff --git a/typedapi/synonyms/putsynonym/response.go b/typedapi/synonyms/putsynonym/response.go index 03226779d0..4e3101a9a1 100644 --- a/typedapi/synonyms/putsynonym/response.go +++ b/typedapi/synonyms/putsynonym/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putsynonym @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package putsynonym // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/put_synonym/SynonymsPutResponse.ts#L24-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/put_synonym/SynonymsPutResponse.ts#L24-L29 type Response struct { ReloadAnalyzersDetails types.ReloadDetails `json:"reload_analyzers_details"` Result result.Result `json:"result"` diff --git a/typedapi/synonyms/putsynonymrule/put_synonym_rule.go b/typedapi/synonyms/putsynonymrule/put_synonym_rule.go index 2de5ea2f16..606bd21d70 100644 --- a/typedapi/synonyms/putsynonymrule/put_synonym_rule.go +++ b/typedapi/synonyms/putsynonymrule/put_synonym_rule.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates or updates a synonym rule in a synonym set package putsynonymrule @@ -52,16 +52,20 @@ type PutSynonymRule struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int setid string ruleid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutSynonymRule type alias for index. @@ -83,17 +87,24 @@ func NewPutSynonymRuleFunc(tp elastictransport.Interface) NewPutSynonymRule { // Creates or updates a synonym rule in a synonym set // -// https://www.elastic.co/guide/en/elasticsearch/reference/master/put-synonym-rule.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/put-synonym-rule.html func New(tp elastictransport.Interface) *PutSynonymRule { r := &PutSynonymRule{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -130,9 +141,7 @@ func (r *PutSynonymRule) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -144,6 +153,10 @@ func (r *PutSynonymRule) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -152,9 +165,15 @@ func (r *PutSynonymRule) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("_synonyms") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "setid", r.setid) + } path.WriteString(r.setid) path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "ruleid", r.ruleid) + } path.WriteString(r.ruleid) method = http.MethodPut @@ -168,15 +187,15 @@ func (r *PutSynonymRule) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -193,27 +212,66 @@ func (r *PutSynonymRule) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutSynonymRule) Perform(ctx context.Context) (*http.Response, error) { +func (r PutSynonymRule) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "synonyms.put_synonym_rule") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "synonyms.put_synonym_rule") + if reader := instrument.RecordRequestBody(ctx, "synonyms.put_synonym_rule", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "synonyms.put_synonym_rule") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutSynonymRule query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutSynonymRule query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putsynonymrule.Response -func (r PutSynonymRule) Do(ctx context.Context) (*Response, error) { +func (r PutSynonymRule) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "synonyms.put_synonym_rule") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -221,6 +279,9 @@ func (r PutSynonymRule) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +291,9 @@ func (r PutSynonymRule) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -237,6 +301,9 @@ func (r PutSynonymRule) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/synonyms/putsynonymrule/request.go b/typedapi/synonyms/putsynonymrule/request.go index a251c27213..1fe045addb 100644 --- a/typedapi/synonyms/putsynonymrule/request.go +++ b/typedapi/synonyms/putsynonymrule/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putsynonymrule @@ -27,7 +27,7 @@ import ( // Request holds the request body struct for the package putsynonymrule // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/put_synonym_rule/SynonymRulePutRequest.ts#L23-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/put_synonym_rule/SynonymRulePutRequest.ts#L23-L47 type Request struct { Synonyms []string `json:"synonyms"` } diff --git a/typedapi/synonyms/putsynonymrule/response.go b/typedapi/synonyms/putsynonymrule/response.go index a8d46d1508..4a00b6f593 100644 --- a/typedapi/synonyms/putsynonymrule/response.go +++ b/typedapi/synonyms/putsynonymrule/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putsynonymrule @@ -27,8 +27,7 @@ import ( // Response holds the response body struct for the package putsynonymrule // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/put_synonym_rule/SynonymRulePutResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/put_synonym_rule/SynonymRulePutResponse.ts#L22-L24 type Response struct { // ReloadAnalyzersDetails Updating synonyms in a synonym set reloads the associated analyzers. diff --git a/typedapi/tasks/cancel/cancel.go b/typedapi/tasks/cancel/cancel.go index e6f507a486..88819e332b 100644 --- a/typedapi/tasks/cancel/cancel.go +++ b/typedapi/tasks/cancel/cancel.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Cancels a task, if it can be cancelled through an API. package cancel import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Cancel struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int taskid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewCancel type alias for index. @@ -74,13 +77,18 @@ func NewCancelFunc(tp elastictransport.Interface) NewCancel { // Cancels a task, if it can be cancelled through an API. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/tasks.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html func New(tp elastictransport.Interface) *Cancel { r := &Cancel{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -110,6 +118,9 @@ func (r *Cancel) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_tasks") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "taskid", r.taskid) + } path.WriteString(r.taskid) path.WriteString("/") path.WriteString("_cancel") @@ -125,9 +136,9 @@ func (r *Cancel) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *Cancel) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Cancel) Perform(ctx context.Context) (*http.Response, error) { +func (r Cancel) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "tasks.cancel") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "tasks.cancel") + if reader := instrument.RecordRequestBody(ctx, "tasks.cancel", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "tasks.cancel") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Cancel query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Cancel query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a cancel.Response -func (r Cancel) Do(ctx context.Context) (*Response, error) { +func (r Cancel) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "tasks.cancel") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r Cancel) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r Cancel) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r Cancel) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Cancel) IsSuccess(ctx context.Context) (bool, error) { +func (r Cancel) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "tasks.cancel") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r Cancel) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Cancel query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/tasks/cancel/response.go b/typedapi/tasks/cancel/response.go index 9f27d6ef5c..47aceaa651 100644 --- a/typedapi/tasks/cancel/response.go +++ b/typedapi/tasks/cancel/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package cancel @@ -31,8 +31,7 @@ import ( // Response holds the response body struct for the package cancel // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/tasks/cancel/CancelTasksResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/tasks/cancel/CancelTasksResponse.ts#L22-L24 type Response struct { NodeFailures []types.ErrorCause `json:"node_failures,omitempty"` // Nodes Task information grouped by node, if `group_by` was set to `node` (the diff --git a/typedapi/tasks/get/get.go b/typedapi/tasks/get/get.go index 978c50c84c..a53e337d8b 100644 --- a/typedapi/tasks/get/get.go +++ b/typedapi/tasks/get/get.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns information about a task. package get import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Get struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int taskid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGet type alias for index. @@ -76,13 +79,18 @@ func NewGetFunc(tp elastictransport.Interface) NewGet { // Returns information about a task. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/tasks.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html func New(tp elastictransport.Interface) *Get { r := &Get{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_tasks") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "taskid", r.taskid) + } path.WriteString(r.taskid) method = http.MethodGet @@ -118,9 +129,9 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -137,27 +148,66 @@ func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Get) Perform(ctx context.Context) (*http.Response, error) { +func (r Get) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "tasks.get") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "tasks.get") + if reader := instrument.RecordRequestBody(ctx, "tasks.get", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "tasks.get") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Get query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Get query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a get.Response -func (r Get) Do(ctx context.Context) (*Response, error) { +func (r Get) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "tasks.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -165,6 +215,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -174,6 +227,9 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,12 +237,25 @@ func (r Get) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Get) IsSuccess(ctx context.Context) (bool, error) { +func (r Get) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "tasks.get") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -202,6 +271,14 @@ func (r Get) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Get query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/tasks/get/response.go b/typedapi/tasks/get/response.go index 5fdf8f9ed7..44cc655d7a 100644 --- a/typedapi/tasks/get/response.go +++ b/typedapi/tasks/get/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package get @@ -28,8 +28,7 @@ import ( // Response holds the response body struct for the package get // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/tasks/get/GetTaskResponse.ts#L24-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/tasks/get/GetTaskResponse.ts#L24-L31 type Response struct { Completed bool `json:"completed"` Error *types.ErrorCause `json:"error,omitempty"` diff --git a/typedapi/tasks/list/list.go b/typedapi/tasks/list/list.go index c670d702b8..83ad5569cc 100644 --- a/typedapi/tasks/list/list.go +++ b/typedapi/tasks/list/list.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Returns a list of tasks. package list import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -49,9 +48,13 @@ type List struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewList type alias for index. @@ -69,13 +72,18 @@ func NewListFunc(tp elastictransport.Interface) NewList { // Returns a list of tasks. // -// https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/tasks.html +// https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html func New(tp elastictransport.Interface) *List { r := &List{ transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *List) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *List) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r List) Perform(ctx context.Context) (*http.Response, error) { +func (r List) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "tasks.list") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "tasks.list") + if reader := instrument.RecordRequestBody(ctx, "tasks.list", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "tasks.list") + } if err != nil { - return nil, fmt.Errorf("an error happened during the List query execution: %w", err) + localErr := fmt.Errorf("an error happened during the List query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a list.Response -func (r List) Do(ctx context.Context) (*Response, error) { +func (r List) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "tasks.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r List) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r List) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r List) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r List) IsSuccess(ctx context.Context) (bool, error) { +func (r List) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "tasks.list") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r List) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the List query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/tasks/list/response.go b/typedapi/tasks/list/response.go index e03d35c556..817adb0b6a 100644 --- a/typedapi/tasks/list/response.go +++ b/typedapi/tasks/list/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package list @@ -31,8 +31,7 @@ import ( // Response holds the response body struct for the package list // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/tasks/list/ListTasksResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/tasks/list/ListTasksResponse.ts#L22-L24 type Response struct { NodeFailures []types.ErrorCause `json:"node_failures,omitempty"` // Nodes Task information grouped by node, if `group_by` was set to `node` (the diff --git a/typedapi/textstructure/findstructure/find_structure.go b/typedapi/textstructure/findstructure/find_structure.go index 56b620ef99..5feadcb2a2 100644 --- a/typedapi/textstructure/findstructure/find_structure.go +++ b/typedapi/textstructure/findstructure/find_structure.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Finds the structure of a text file. The text file must contain data that is // suitable to be ingested into Elasticsearch. @@ -48,13 +48,17 @@ type FindStructure struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewFindStructure type alias for index. @@ -79,7 +83,14 @@ func New(tp elastictransport.Interface) *FindStructure { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -118,9 +129,7 @@ func (r *FindStructure) HttpRequest(ctx context.Context) (*http.Request, error) } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { for _, elem := range *r.req { data, err := json.Marshal(elem) @@ -137,6 +146,10 @@ func (r *FindStructure) HttpRequest(ctx context.Context) (*http.Request, error) } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -157,15 +170,15 @@ func (r *FindStructure) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+x-ndjson;compatible-with=8") } } @@ -182,27 +195,66 @@ func (r *FindStructure) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r FindStructure) Perform(ctx context.Context) (*http.Response, error) { +func (r FindStructure) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "text_structure.find_structure") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "text_structure.find_structure") + if reader := instrument.RecordRequestBody(ctx, "text_structure.find_structure", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "text_structure.find_structure") + } if err != nil { - return nil, fmt.Errorf("an error happened during the FindStructure query execution: %w", err) + localErr := fmt.Errorf("an error happened during the FindStructure query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a findstructure.Response -func (r FindStructure) Do(ctx context.Context) (*Response, error) { +func (r FindStructure) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "text_structure.find_structure") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -210,6 +262,9 @@ func (r FindStructure) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -219,6 +274,9 @@ func (r FindStructure) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -226,6 +284,9 @@ func (r FindStructure) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/textstructure/findstructure/request.go b/typedapi/textstructure/findstructure/request.go index 1a63e06ed6..dd02e40e44 100644 --- a/typedapi/textstructure/findstructure/request.go +++ b/typedapi/textstructure/findstructure/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package findstructure @@ -26,5 +26,5 @@ import ( // Request holds the request body struct for the package findstructure // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/text_structure/find_structure/FindStructureRequest.ts#L24-L73 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/text_structure/find_structure/FindStructureRequest.ts#L24-L73 type Request = []json.RawMessage diff --git a/typedapi/textstructure/findstructure/response.go b/typedapi/textstructure/findstructure/response.go index ddcf2a9d4e..66ba59ff15 100644 --- a/typedapi/textstructure/findstructure/response.go +++ b/typedapi/textstructure/findstructure/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package findstructure @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package findstructure // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/text_structure/find_structure/FindStructureResponse.ts#L27-L52 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/text_structure/find_structure/FindStructureResponse.ts#L27-L52 type Response struct { Charset string `json:"charset"` ColumnNames []string `json:"column_names,omitempty"` diff --git a/typedapi/transform/deletetransform/delete_transform.go b/typedapi/transform/deletetransform/delete_transform.go index 7ad99b2824..cebee70fee 100644 --- a/typedapi/transform/deletetransform/delete_transform.go +++ b/typedapi/transform/deletetransform/delete_transform.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deletes an existing transform. package deletetransform import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type DeleteTransform struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteTransform type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *DeleteTransform { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *DeleteTransform) HttpRequest(ctx context.Context) (*http.Request, error path.WriteString("_transform") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) method = http.MethodDelete @@ -118,9 +129,9 @@ func (r *DeleteTransform) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -137,27 +148,66 @@ func (r *DeleteTransform) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteTransform) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteTransform) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.delete_transform") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.delete_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.delete_transform", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.delete_transform") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteTransform query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteTransform query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletetransform.Response -func (r DeleteTransform) Do(ctx context.Context) (*Response, error) { +func (r DeleteTransform) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.delete_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -165,6 +215,9 @@ func (r DeleteTransform) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -174,6 +227,9 @@ func (r DeleteTransform) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,12 +237,25 @@ func (r DeleteTransform) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteTransform) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteTransform) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.delete_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -202,6 +271,14 @@ func (r DeleteTransform) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteTransform query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } @@ -231,6 +308,16 @@ func (r *DeleteTransform) Force(force bool) *DeleteTransform { return r } +// DeleteDestIndex If this value is true, the destination index is deleted together with the +// transform. If false, the destination +// index will not be deleted +// API name: delete_dest_index +func (r *DeleteTransform) DeleteDestIndex(deletedestindex bool) *DeleteTransform { + r.values.Set("delete_dest_index", strconv.FormatBool(deletedestindex)) + + return r +} + // Timeout Period to wait for a response. If no response is received before the timeout // expires, the request fails and returns an error. // API name: timeout diff --git a/typedapi/transform/deletetransform/response.go b/typedapi/transform/deletetransform/response.go index 1e12394d00..4f81ea543d 100644 --- a/typedapi/transform/deletetransform/response.go +++ b/typedapi/transform/deletetransform/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletetransform // Response holds the response body struct for the package deletetransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/delete_transform/DeleteTransformResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/delete_transform/DeleteTransformResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/transform/gettransform/get_transform.go b/typedapi/transform/gettransform/get_transform.go index 98c720672b..7c029674d6 100644 --- a/typedapi/transform/gettransform/get_transform.go +++ b/typedapi/transform/gettransform/get_transform.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves configuration information for transforms. package gettransform import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetTransform struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetTransform type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *GetTransform { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -103,6 +111,9 @@ func (r *GetTransform) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_transform") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) method = http.MethodGet @@ -121,9 +132,9 @@ func (r *GetTransform) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *GetTransform) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetTransform) Perform(ctx context.Context) (*http.Response, error) { +func (r GetTransform) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.get_transform") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.get_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.get_transform", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.get_transform") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetTransform query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetTransform query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a gettransform.Response -func (r GetTransform) Do(ctx context.Context) (*Response, error) { +func (r GetTransform) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.get_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r GetTransform) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r GetTransform) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r GetTransform) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetTransform) IsSuccess(ctx context.Context) (bool, error) { +func (r GetTransform) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.get_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r GetTransform) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetTransform query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/transform/gettransform/response.go b/typedapi/transform/gettransform/response.go index 9b090437d1..b7598272e2 100644 --- a/typedapi/transform/gettransform/response.go +++ b/typedapi/transform/gettransform/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package gettransform @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package gettransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/get_transform/GetTransformResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/get_transform/GetTransformResponse.ts#L23-L25 type Response struct { Count int64 `json:"count"` Transforms []types.TransformSummary `json:"transforms"` diff --git a/typedapi/transform/gettransformstats/get_transform_stats.go b/typedapi/transform/gettransformstats/get_transform_stats.go index 91b057fa37..d96938c245 100644 --- a/typedapi/transform/gettransformstats/get_transform_stats.go +++ b/typedapi/transform/gettransformstats/get_transform_stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves usage information for transforms. package gettransformstats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type GetTransformStats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetTransformStats type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *GetTransformStats { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *GetTransformStats) HttpRequest(ctx context.Context) (*http.Request, err path.WriteString("_transform") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) path.WriteString("/") path.WriteString("_stats") @@ -120,9 +131,9 @@ func (r *GetTransformStats) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,27 +150,66 @@ func (r *GetTransformStats) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetTransformStats) Perform(ctx context.Context) (*http.Response, error) { +func (r GetTransformStats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.get_transform_stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.get_transform_stats") + if reader := instrument.RecordRequestBody(ctx, "transform.get_transform_stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.get_transform_stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetTransformStats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetTransformStats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a gettransformstats.Response -func (r GetTransformStats) Do(ctx context.Context) (*Response, error) { +func (r GetTransformStats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.get_transform_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -167,6 +217,9 @@ func (r GetTransformStats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,6 +229,9 @@ func (r GetTransformStats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,12 +239,25 @@ func (r GetTransformStats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetTransformStats) IsSuccess(ctx context.Context) (bool, error) { +func (r GetTransformStats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.get_transform_stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -204,6 +273,14 @@ func (r GetTransformStats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetTransformStats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/transform/gettransformstats/response.go b/typedapi/transform/gettransformstats/response.go index 33f3c92f9a..34a5ff0d29 100644 --- a/typedapi/transform/gettransformstats/response.go +++ b/typedapi/transform/gettransformstats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package gettransformstats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package gettransformstats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/get_transform_stats/GetTransformStatsResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/get_transform_stats/GetTransformStatsResponse.ts#L23-L25 type Response struct { Count int64 `json:"count"` Transforms []types.TransformStats `json:"transforms"` diff --git a/typedapi/transform/previewtransform/preview_transform.go b/typedapi/transform/previewtransform/preview_transform.go index 233f2f1bca..069302fd52 100644 --- a/typedapi/transform/previewtransform/preview_transform.go +++ b/typedapi/transform/previewtransform/preview_transform.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Previews a transform. package previewtransform @@ -50,15 +50,19 @@ type PreviewTransform struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPreviewTransform type alias for index. @@ -82,11 +86,18 @@ func New(tp elastictransport.Interface) *PreviewTransform { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -123,9 +134,7 @@ func (r *PreviewTransform) HttpRequest(ctx context.Context) (*http.Request, erro } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -137,6 +146,10 @@ func (r *PreviewTransform) HttpRequest(ctx context.Context) (*http.Request, erro } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -145,6 +158,9 @@ func (r *PreviewTransform) HttpRequest(ctx context.Context) (*http.Request, erro path.WriteString("_transform") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) path.WriteString("/") path.WriteString("_preview") @@ -167,15 +183,15 @@ func (r *PreviewTransform) HttpRequest(ctx context.Context) (*http.Request, erro } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -192,27 +208,66 @@ func (r *PreviewTransform) HttpRequest(ctx context.Context) (*http.Request, erro } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PreviewTransform) Perform(ctx context.Context) (*http.Response, error) { +func (r PreviewTransform) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.preview_transform") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.preview_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.preview_transform", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.preview_transform") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PreviewTransform query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PreviewTransform query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a previewtransform.Response -func (r PreviewTransform) Do(ctx context.Context) (*Response, error) { +func (r PreviewTransform) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.preview_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -220,6 +275,9 @@ func (r PreviewTransform) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -229,6 +287,9 @@ func (r PreviewTransform) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -236,6 +297,9 @@ func (r PreviewTransform) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/transform/previewtransform/request.go b/typedapi/transform/previewtransform/request.go index 20398d2848..537ff1067d 100644 --- a/typedapi/transform/previewtransform/request.go +++ b/typedapi/transform/previewtransform/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package previewtransform @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package previewtransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/preview_transform/PreviewTransformRequest.ts#L33-L107 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/preview_transform/PreviewTransformRequest.ts#L33-L107 type Request struct { // Description Free text description of the transform. diff --git a/typedapi/transform/previewtransform/response.go b/typedapi/transform/previewtransform/response.go index 7d664185ff..427e626616 100644 --- a/typedapi/transform/previewtransform/response.go +++ b/typedapi/transform/previewtransform/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package previewtransform @@ -28,8 +28,7 @@ import ( // Response holds the response body struct for the package previewtransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/preview_transform/PreviewTransformResponse.ts#L22-L27 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/preview_transform/PreviewTransformResponse.ts#L22-L27 type Response struct { GeneratedDestIndex types.IndexState `json:"generated_dest_index"` Preview []json.RawMessage `json:"preview"` diff --git a/typedapi/transform/puttransform/put_transform.go b/typedapi/transform/puttransform/put_transform.go index ceb2f6c855..9a0574317f 100644 --- a/typedapi/transform/puttransform/put_transform.go +++ b/typedapi/transform/puttransform/put_transform.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Instantiates a transform. package puttransform @@ -51,15 +51,19 @@ type PutTransform struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutTransform type alias for index. @@ -85,11 +89,18 @@ func New(tp elastictransport.Interface) *PutTransform { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *PutTransform) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *PutTransform) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -148,6 +161,9 @@ func (r *PutTransform) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("_transform") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) method = http.MethodPut @@ -161,15 +177,15 @@ func (r *PutTransform) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -186,27 +202,66 @@ func (r *PutTransform) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutTransform) Perform(ctx context.Context) (*http.Response, error) { +func (r PutTransform) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.put_transform") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.put_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.put_transform", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.put_transform") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutTransform query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutTransform query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a puttransform.Response -func (r PutTransform) Do(ctx context.Context) (*Response, error) { +func (r PutTransform) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.put_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -214,6 +269,9 @@ func (r PutTransform) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -223,6 +281,9 @@ func (r PutTransform) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -230,6 +291,9 @@ func (r PutTransform) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/transform/puttransform/request.go b/typedapi/transform/puttransform/request.go index 8b24eec518..33e6d32d43 100644 --- a/typedapi/transform/puttransform/request.go +++ b/typedapi/transform/puttransform/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttransform @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package puttransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/put_transform/PutTransformRequest.ts#L33-L122 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/put_transform/PutTransformRequest.ts#L33-L122 type Request struct { // Description Free text description of the transform. diff --git a/typedapi/transform/puttransform/response.go b/typedapi/transform/puttransform/response.go index 1606b9253b..71db98f473 100644 --- a/typedapi/transform/puttransform/response.go +++ b/typedapi/transform/puttransform/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package puttransform // Response holds the response body struct for the package puttransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/put_transform/PutTransformResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/put_transform/PutTransformResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/transform/resettransform/reset_transform.go b/typedapi/transform/resettransform/reset_transform.go index 57381ac65e..203532b0c1 100644 --- a/typedapi/transform/resettransform/reset_transform.go +++ b/typedapi/transform/resettransform/reset_transform.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Resets an existing transform. package resettransform import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type ResetTransform struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewResetTransform type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *ResetTransform { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *ResetTransform) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("_transform") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) path.WriteString("/") path.WriteString("_reset") @@ -120,9 +131,9 @@ func (r *ResetTransform) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,27 +150,66 @@ func (r *ResetTransform) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ResetTransform) Perform(ctx context.Context) (*http.Response, error) { +func (r ResetTransform) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.reset_transform") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.reset_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.reset_transform", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.reset_transform") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ResetTransform query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ResetTransform query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a resettransform.Response -func (r ResetTransform) Do(ctx context.Context) (*Response, error) { +func (r ResetTransform) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.reset_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -167,6 +217,9 @@ func (r ResetTransform) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,6 +229,9 @@ func (r ResetTransform) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,12 +239,25 @@ func (r ResetTransform) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ResetTransform) IsSuccess(ctx context.Context) (bool, error) { +func (r ResetTransform) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.reset_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -204,6 +273,14 @@ func (r ResetTransform) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ResetTransform query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/transform/resettransform/response.go b/typedapi/transform/resettransform/response.go index ce5a138cda..9f076bc151 100644 --- a/typedapi/transform/resettransform/response.go +++ b/typedapi/transform/resettransform/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package resettransform // Response holds the response body struct for the package resettransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/reset_transform/ResetTransformResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/reset_transform/ResetTransformResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/transform/schedulenowtransform/response.go b/typedapi/transform/schedulenowtransform/response.go index 4c1a027630..2522de7eed 100644 --- a/typedapi/transform/schedulenowtransform/response.go +++ b/typedapi/transform/schedulenowtransform/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package schedulenowtransform // Response holds the response body struct for the package schedulenowtransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/schedule_now_transform/ScheduleNowTransformResponse.ts#L21-L23 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/schedule_now_transform/ScheduleNowTransformResponse.ts#L21-L23 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/transform/schedulenowtransform/schedule_now_transform.go b/typedapi/transform/schedulenowtransform/schedule_now_transform.go index 134dac127a..734f6977fa 100644 --- a/typedapi/transform/schedulenowtransform/schedule_now_transform.go +++ b/typedapi/transform/schedulenowtransform/schedule_now_transform.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Schedules now a transform. package schedulenowtransform import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type ScheduleNowTransform struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewScheduleNowTransform type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *ScheduleNowTransform { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *ScheduleNowTransform) HttpRequest(ctx context.Context) (*http.Request, path.WriteString("_transform") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) path.WriteString("/") path.WriteString("_schedule_now") @@ -119,15 +130,15 @@ func (r *ScheduleNowTransform) HttpRequest(ctx context.Context) (*http.Request, } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -144,27 +155,66 @@ func (r *ScheduleNowTransform) HttpRequest(ctx context.Context) (*http.Request, } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ScheduleNowTransform) Perform(ctx context.Context) (*http.Response, error) { +func (r ScheduleNowTransform) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.schedule_now_transform") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.schedule_now_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.schedule_now_transform", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.schedule_now_transform") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ScheduleNowTransform query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ScheduleNowTransform query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a schedulenowtransform.Response -func (r ScheduleNowTransform) Do(ctx context.Context) (*Response, error) { +func (r ScheduleNowTransform) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.schedule_now_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r ScheduleNowTransform) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r ScheduleNowTransform) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r ScheduleNowTransform) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ScheduleNowTransform) IsSuccess(ctx context.Context) (bool, error) { +func (r ScheduleNowTransform) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.schedule_now_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r ScheduleNowTransform) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ScheduleNowTransform query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/transform/starttransform/response.go b/typedapi/transform/starttransform/response.go index 29837b57a2..0530bb0222 100644 --- a/typedapi/transform/starttransform/response.go +++ b/typedapi/transform/starttransform/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package starttransform // Response holds the response body struct for the package starttransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/start_transform/StartTransformResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/start_transform/StartTransformResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/transform/starttransform/start_transform.go b/typedapi/transform/starttransform/start_transform.go index 7c34f0314a..b80e694ecc 100644 --- a/typedapi/transform/starttransform/start_transform.go +++ b/typedapi/transform/starttransform/start_transform.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Starts one or more transforms. package starttransform import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type StartTransform struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStartTransform type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *StartTransform { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -104,6 +112,9 @@ func (r *StartTransform) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("_transform") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) path.WriteString("/") path.WriteString("_start") @@ -119,9 +130,9 @@ func (r *StartTransform) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *StartTransform) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r StartTransform) Perform(ctx context.Context) (*http.Response, error) { +func (r StartTransform) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.start_transform") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.start_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.start_transform", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.start_transform") + } if err != nil { - return nil, fmt.Errorf("an error happened during the StartTransform query execution: %w", err) + localErr := fmt.Errorf("an error happened during the StartTransform query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a starttransform.Response -func (r StartTransform) Do(ctx context.Context) (*Response, error) { +func (r StartTransform) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.start_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r StartTransform) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r StartTransform) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r StartTransform) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r StartTransform) IsSuccess(ctx context.Context) (bool, error) { +func (r StartTransform) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.start_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r StartTransform) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the StartTransform query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/transform/stoptransform/response.go b/typedapi/transform/stoptransform/response.go index abdd2ee378..aa98a9afc6 100644 --- a/typedapi/transform/stoptransform/response.go +++ b/typedapi/transform/stoptransform/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stoptransform // Response holds the response body struct for the package stoptransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/stop_transform/StopTransformResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/stop_transform/StopTransformResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/transform/stoptransform/stop_transform.go b/typedapi/transform/stoptransform/stop_transform.go index 1719c9d6d9..ee77b8ee44 100644 --- a/typedapi/transform/stoptransform/stop_transform.go +++ b/typedapi/transform/stoptransform/stop_transform.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Stops one or more transforms. package stoptransform import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type StopTransform struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStopTransform type alias for index. @@ -82,7 +85,12 @@ func New(tp elastictransport.Interface) *StopTransform { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -105,6 +113,9 @@ func (r *StopTransform) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("_transform") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) path.WriteString("/") path.WriteString("_stop") @@ -120,9 +131,9 @@ func (r *StopTransform) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -139,27 +150,66 @@ func (r *StopTransform) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r StopTransform) Perform(ctx context.Context) (*http.Response, error) { +func (r StopTransform) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.stop_transform") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.stop_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.stop_transform", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.stop_transform") + } if err != nil { - return nil, fmt.Errorf("an error happened during the StopTransform query execution: %w", err) + localErr := fmt.Errorf("an error happened during the StopTransform query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stoptransform.Response -func (r StopTransform) Do(ctx context.Context) (*Response, error) { +func (r StopTransform) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.stop_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -167,6 +217,9 @@ func (r StopTransform) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -176,6 +229,9 @@ func (r StopTransform) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -183,12 +239,25 @@ func (r StopTransform) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r StopTransform) IsSuccess(ctx context.Context) (bool, error) { +func (r StopTransform) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.stop_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -204,6 +273,14 @@ func (r StopTransform) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the StopTransform query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/transform/updatetransform/request.go b/typedapi/transform/updatetransform/request.go index 8907e79219..ba1f4d2e09 100644 --- a/typedapi/transform/updatetransform/request.go +++ b/typedapi/transform/updatetransform/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatetransform @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package updatetransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/update_transform/UpdateTransformRequest.ts#L31-L105 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/update_transform/UpdateTransformRequest.ts#L31-L105 type Request struct { // Description Free text description of the transform. diff --git a/typedapi/transform/updatetransform/response.go b/typedapi/transform/updatetransform/response.go index 4a4f622cf3..3594313a2e 100644 --- a/typedapi/transform/updatetransform/response.go +++ b/typedapi/transform/updatetransform/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package updatetransform @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package updatetransform // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/update_transform/UpdateTransformResponse.ts#L33-L51 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/update_transform/UpdateTransformResponse.ts#L33-L51 type Response struct { Authorization *types.TransformAuthorization `json:"authorization,omitempty"` CreateTime int64 `json:"create_time"` diff --git a/typedapi/transform/updatetransform/update_transform.go b/typedapi/transform/updatetransform/update_transform.go index a71c6760c2..c037a418c1 100644 --- a/typedapi/transform/updatetransform/update_transform.go +++ b/typedapi/transform/updatetransform/update_transform.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Updates certain properties of a transform. package updatetransform @@ -51,15 +51,19 @@ type UpdateTransform struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int transformid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateTransform type alias for index. @@ -85,11 +89,18 @@ func New(tp elastictransport.Interface) *UpdateTransform { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *UpdateTransform) HttpRequest(ctx context.Context) (*http.Request, error } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *UpdateTransform) HttpRequest(ctx context.Context) (*http.Request, error } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -148,6 +161,9 @@ func (r *UpdateTransform) HttpRequest(ctx context.Context) (*http.Request, error path.WriteString("_transform") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "transformid", r.transformid) + } path.WriteString(r.transformid) path.WriteString("/") path.WriteString("_update") @@ -163,15 +179,15 @@ func (r *UpdateTransform) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -188,27 +204,66 @@ func (r *UpdateTransform) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateTransform) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateTransform) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.update_transform") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.update_transform") + if reader := instrument.RecordRequestBody(ctx, "transform.update_transform", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.update_transform") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateTransform query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateTransform query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a updatetransform.Response -func (r UpdateTransform) Do(ctx context.Context) (*Response, error) { +func (r UpdateTransform) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.update_transform") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -216,6 +271,9 @@ func (r UpdateTransform) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -225,6 +283,9 @@ func (r UpdateTransform) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +293,9 @@ func (r UpdateTransform) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/transform/upgradetransforms/response.go b/typedapi/transform/upgradetransforms/response.go index 79e4943778..1f689c7f9c 100644 --- a/typedapi/transform/upgradetransforms/response.go +++ b/typedapi/transform/upgradetransforms/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package upgradetransforms // Response holds the response body struct for the package upgradetransforms // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/upgrade_transforms/UpgradeTransformsResponse.ts#L25-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/upgrade_transforms/UpgradeTransformsResponse.ts#L25-L34 type Response struct { // NeedsUpdate The number of transforms that need to be upgraded. diff --git a/typedapi/transform/upgradetransforms/upgrade_transforms.go b/typedapi/transform/upgradetransforms/upgrade_transforms.go index eee54e4914..7e75e24dd6 100644 --- a/typedapi/transform/upgradetransforms/upgrade_transforms.go +++ b/typedapi/transform/upgradetransforms/upgrade_transforms.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Upgrades all transforms. package upgradetransforms import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type UpgradeTransforms struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpgradeTransforms type alias for index. @@ -74,7 +77,12 @@ func New(tp elastictransport.Interface) *UpgradeTransforms { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -109,15 +117,15 @@ func (r *UpgradeTransforms) HttpRequest(ctx context.Context) (*http.Request, err } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -134,27 +142,66 @@ func (r *UpgradeTransforms) HttpRequest(ctx context.Context) (*http.Request, err } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpgradeTransforms) Perform(ctx context.Context) (*http.Response, error) { +func (r UpgradeTransforms) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "transform.upgrade_transforms") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "transform.upgrade_transforms") + if reader := instrument.RecordRequestBody(ctx, "transform.upgrade_transforms", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "transform.upgrade_transforms") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpgradeTransforms query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpgradeTransforms query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a upgradetransforms.Response -func (r UpgradeTransforms) Do(ctx context.Context) (*Response, error) { +func (r UpgradeTransforms) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.upgrade_transforms") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -162,6 +209,9 @@ func (r UpgradeTransforms) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,6 +221,9 @@ func (r UpgradeTransforms) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -178,12 +231,25 @@ func (r UpgradeTransforms) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r UpgradeTransforms) IsSuccess(ctx context.Context) (bool, error) { +func (r UpgradeTransforms) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "transform.upgrade_transforms") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -199,6 +265,14 @@ func (r UpgradeTransforms) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the UpgradeTransforms query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/types/acknowledgement.go b/typedapi/types/acknowledgement.go index 375257f400..502b2348bd 100644 --- a/typedapi/types/acknowledgement.go +++ b/typedapi/types/acknowledgement.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Acknowledgement type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/post/types.ts#L20-L23 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/post/types.ts#L20-L23 type Acknowledgement struct { License []string `json:"license"` Message string `json:"message"` diff --git a/typedapi/types/acknowledgestate.go b/typedapi/types/acknowledgestate.go index d5cf1a7add..72fa1cb482 100644 --- a/typedapi/types/acknowledgestate.go +++ b/typedapi/types/acknowledgestate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // AcknowledgeState type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L115-L118 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L115-L118 type AcknowledgeState struct { State acknowledgementoptions.AcknowledgementOptions `json:"state"` Timestamp DateTime `json:"timestamp"` diff --git a/typedapi/types/actionstatus.go b/typedapi/types/actionstatus.go index 4f0d6ac7dc..d79014c68c 100644 --- a/typedapi/types/actionstatus.go +++ b/typedapi/types/actionstatus.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ActionStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L131-L136 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L131-L136 type ActionStatus struct { Ack AcknowledgeState `json:"ack"` LastExecution *ExecutionState `json:"last_execution,omitempty"` diff --git a/typedapi/types/activationstate.go b/typedapi/types/activationstate.go index 3b3ae1117e..381f15090b 100644 --- a/typedapi/types/activationstate.go +++ b/typedapi/types/activationstate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ActivationState type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Activation.ts#L24-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Activation.ts#L24-L27 type ActivationState struct { Active bool `json:"active"` Timestamp DateTime `json:"timestamp"` diff --git a/typedapi/types/activationstatus.go b/typedapi/types/activationstatus.go index a6af49cadc..61578aae0c 100644 --- a/typedapi/types/activationstatus.go +++ b/typedapi/types/activationstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ActivationStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Activation.ts#L29-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Activation.ts#L29-L33 type ActivationStatus struct { Actions WatcherStatusActions `json:"actions"` State ActivationState `json:"state"` diff --git a/typedapi/types/adaptiveselection.go b/typedapi/types/adaptiveselection.go index b90db96650..432549be86 100644 --- a/typedapi/types/adaptiveselection.go +++ b/typedapi/types/adaptiveselection.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AdaptiveSelection type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L403-L432 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L403-L432 type AdaptiveSelection struct { // AvgQueueSize The exponentially weighted moving average queue size of search requests on // the keyed node. diff --git a/typedapi/types/addaction.go b/typedapi/types/addaction.go index 8ebcd1d2b5..49ac5d92df 100644 --- a/typedapi/types/addaction.go +++ b/typedapi/types/addaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AddAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/update_aliases/types.ts#L41-L95 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/update_aliases/types.ts#L41-L95 type AddAction struct { // Alias Alias for the action. // Index alias names support date math. diff --git a/typedapi/types/adjacencymatrixaggregate.go b/typedapi/types/adjacencymatrixaggregate.go index d917198456..670e83527e 100644 --- a/typedapi/types/adjacencymatrixaggregate.go +++ b/typedapi/types/adjacencymatrixaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // AdjacencyMatrixAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L573-L575 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L573-L575 type AdjacencyMatrixAggregate struct { Buckets BucketsAdjacencyMatrixBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/adjacencymatrixaggregation.go b/typedapi/types/adjacencymatrixaggregation.go index 32ea1c94a4..3960cd25b5 100644 --- a/typedapi/types/adjacencymatrixaggregation.go +++ b/typedapi/types/adjacencymatrixaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AdjacencyMatrixAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L57-L63 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L57-L63 type AdjacencyMatrixAggregation struct { // Filters Filters used to create buckets. // At least one filter is required. diff --git a/typedapi/types/adjacencymatrixbucket.go b/typedapi/types/adjacencymatrixbucket.go index 6739847971..791b3de2e2 100644 --- a/typedapi/types/adjacencymatrixbucket.go +++ b/typedapi/types/adjacencymatrixbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // AdjacencyMatrixBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L577-L579 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L577-L579 type AdjacencyMatrixBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/aggregate.go b/typedapi/types/aggregate.go index 294e896027..e4664eb7c2 100644 --- a/typedapi/types/aggregate.go +++ b/typedapi/types/aggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -92,5 +92,5 @@ package types // MatrixStatsAggregate // GeoLineAggregate // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L38-L123 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L38-L123 type Aggregate interface{} diff --git a/typedapi/types/aggregatemetricdoubleproperty.go b/typedapi/types/aggregatemetricdoubleproperty.go index 73194dbd2d..a8fdc0f2d9 100644 --- a/typedapi/types/aggregatemetricdoubleproperty.go +++ b/typedapi/types/aggregatemetricdoubleproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // AggregateMetricDoubleProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/complex.ts#L59-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/complex.ts#L59-L64 type AggregateMetricDoubleProperty struct { DefaultMetric string `json:"default_metric"` Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` @@ -197,6 +197,12 @@ func (s *AggregateMetricDoubleProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -527,6 +533,12 @@ func (s *AggregateMetricDoubleProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/aggregateorder.go b/typedapi/types/aggregateorder.go index d6df21de0c..dae65298a0 100644 --- a/typedapi/types/aggregateorder.go +++ b/typedapi/types/aggregateorder.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]sortorder.SortOrder // []map[string]sortorder.SortOrder // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L976-L978 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L976-L978 type AggregateOrder interface{} diff --git a/typedapi/types/aggregateoutput.go b/typedapi/types/aggregateoutput.go index 67f8d25423..7d4a9f6bff 100644 --- a/typedapi/types/aggregateoutput.go +++ b/typedapi/types/aggregateoutput.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // AggregateOutput type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L101-L106 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L101-L106 type AggregateOutput struct { Exponent *Weights `json:"exponent,omitempty"` LogisticRegression *Weights `json:"logistic_regression,omitempty"` diff --git a/typedapi/types/aggregation.go b/typedapi/types/aggregation.go index 881589243a..30f5f2cf22 100644 --- a/typedapi/types/aggregation.go +++ b/typedapi/types/aggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Aggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregation.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregation.ts#L22-L25 type Aggregation struct { Meta Metadata `json:"meta,omitempty"` Name *string `json:"name,omitempty"` diff --git a/typedapi/types/aggregationbreakdown.go b/typedapi/types/aggregationbreakdown.go index 982313b72f..d1a3db3aa3 100644 --- a/typedapi/types/aggregationbreakdown.go +++ b/typedapi/types/aggregationbreakdown.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AggregationBreakdown type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L23-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L23-L36 type AggregationBreakdown struct { BuildAggregation int64 `json:"build_aggregation"` BuildAggregationCount int64 `json:"build_aggregation_count"` diff --git a/typedapi/types/aggregationprofile.go b/typedapi/types/aggregationprofile.go index b44699e605..873d0c897d 100644 --- a/typedapi/types/aggregationprofile.go +++ b/typedapi/types/aggregationprofile.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AggregationProfile type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L77-L84 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L77-L84 type AggregationProfile struct { Breakdown AggregationBreakdown `json:"breakdown"` Children []AggregationProfile `json:"children,omitempty"` diff --git a/typedapi/types/aggregationprofiledebug.go b/typedapi/types/aggregationprofiledebug.go index 6d2048ba1c..13f41838f9 100644 --- a/typedapi/types/aggregationprofiledebug.go +++ b/typedapi/types/aggregationprofiledebug.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AggregationProfileDebug type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L39-L68 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L39-L68 type AggregationProfileDebug struct { BuiltBuckets *int `json:"built_buckets,omitempty"` CharsFetched *int `json:"chars_fetched,omitempty"` diff --git a/typedapi/types/aggregationprofiledelegatedebugfilter.go b/typedapi/types/aggregationprofiledelegatedebugfilter.go index 4b59fb2ccf..5318ce8bd3 100644 --- a/typedapi/types/aggregationprofiledelegatedebugfilter.go +++ b/typedapi/types/aggregationprofiledelegatedebugfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AggregationProfileDelegateDebugFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L70-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L70-L75 type AggregationProfileDelegateDebugFilter struct { Query *string `json:"query,omitempty"` ResultsFromMetadata *int `json:"results_from_metadata,omitempty"` diff --git a/typedapi/types/aggregationrange.go b/typedapi/types/aggregationrange.go index f0a790f958..be4e476416 100644 --- a/typedapi/types/aggregationrange.go +++ b/typedapi/types/aggregationrange.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AggregationRange type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L672-L685 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L672-L685 type AggregationRange struct { // From Start of the range (inclusive). From string `json:"from,omitempty"` diff --git a/typedapi/types/aggregations.go b/typedapi/types/aggregations.go index a2dce7047e..ba836345f2 100644 --- a/typedapi/types/aggregations.go +++ b/typedapi/types/aggregations.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Aggregations type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/AggregationContainer.ts#L106-L515 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/AggregationContainer.ts#L106-L515 type Aggregations struct { // AdjacencyMatrix A bucket aggregation returning a form of adjacency matrix. // The request provides a collection of named filter expressions, similar to the diff --git a/typedapi/types/alias.go b/typedapi/types/alias.go index b89bc5a7e0..1acda12740 100644 --- a/typedapi/types/alias.go +++ b/typedapi/types/alias.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Alias type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/Alias.ts#L23-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/Alias.ts#L23-L53 type Alias struct { // Filter Query used to limit documents the alias can access. Filter *Query `json:"filter,omitempty"` diff --git a/typedapi/types/aliasdefinition.go b/typedapi/types/aliasdefinition.go index 84cbf7808c..8a2b16d1ee 100644 --- a/typedapi/types/aliasdefinition.go +++ b/typedapi/types/aliasdefinition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AliasDefinition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/AliasDefinition.ts#L22-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/AliasDefinition.ts#L22-L54 type AliasDefinition struct { // Filter Query used to limit documents the alias can access. Filter *Query `json:"filter,omitempty"` diff --git a/typedapi/types/aliasesrecord.go b/typedapi/types/aliasesrecord.go index b1dff28cea..1b3c4d8a38 100644 --- a/typedapi/types/aliasesrecord.go +++ b/typedapi/types/aliasesrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AliasesRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/aliases/types.ts#L22-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/aliases/types.ts#L22-L53 type AliasesRecord struct { // Alias alias name Alias *string `json:"alias,omitempty"` diff --git a/typedapi/types/allfield.go b/typedapi/types/allfield.go index 728302df4d..716a20d980 100644 --- a/typedapi/types/allfield.go +++ b/typedapi/types/allfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AllField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/meta-fields.ts#L29-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/meta-fields.ts#L29-L40 type AllField struct { Analyzer string `json:"analyzer"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/allocationdecision.go b/typedapi/types/allocationdecision.go index df0efe2e23..e27b3d2564 100644 --- a/typedapi/types/allocationdecision.go +++ b/typedapi/types/allocationdecision.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // AllocationDecision type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L26-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L26-L30 type AllocationDecision struct { Decider string `json:"decider"` Decision allocationexplaindecision.AllocationExplainDecision `json:"decision"` diff --git a/typedapi/types/allocationrecord.go b/typedapi/types/allocationrecord.go index d53e893a93..8e644875da 100644 --- a/typedapi/types/allocationrecord.go +++ b/typedapi/types/allocationrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AllocationRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/allocation/types.ts#L24-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/allocation/types.ts#L24-L75 type AllocationRecord struct { // DiskAvail Free disk space available to Elasticsearch. // Elasticsearch retrieves this metric from the node’s operating system. diff --git a/typedapi/types/allocationstore.go b/typedapi/types/allocationstore.go index 1b543c8107..d7b00e45c5 100644 --- a/typedapi/types/allocationstore.go +++ b/typedapi/types/allocationstore.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AllocationStore type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L39-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L39-L46 type AllocationStore struct { AllocationId string `json:"allocation_id"` Found bool `json:"found"` diff --git a/typedapi/types/alwayscondition.go b/typedapi/types/alwayscondition.go index 238ef054dd..9bf005abc2 100644 --- a/typedapi/types/alwayscondition.go +++ b/typedapi/types/alwayscondition.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // AlwaysCondition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Conditions.ts#L25-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Conditions.ts#L25-L25 type AlwaysCondition struct { } diff --git a/typedapi/types/analysisconfig.go b/typedapi/types/analysisconfig.go index 23c3a1a727..8183176bb2 100644 --- a/typedapi/types/analysisconfig.go +++ b/typedapi/types/analysisconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnalysisConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Analysis.ts#L29-L77 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Analysis.ts#L29-L77 type AnalysisConfig struct { // BucketSpan The size of the interval that the analysis is aggregated into, typically // between `5m` and `1h`. This value should be either a whole number of days or diff --git a/typedapi/types/analysisconfigread.go b/typedapi/types/analysisconfigread.go index 3a20a9126c..3b8e159b92 100644 --- a/typedapi/types/analysisconfigread.go +++ b/typedapi/types/analysisconfigread.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnalysisConfigRead type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Analysis.ts#L79-L148 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Analysis.ts#L79-L148 type AnalysisConfigRead struct { // BucketSpan The size of the interval that the analysis is aggregated into, typically // between `5m` and `1h`. diff --git a/typedapi/types/analysislimits.go b/typedapi/types/analysislimits.go index 58cfd36cbe..5cd6f7f730 100644 --- a/typedapi/types/analysislimits.go +++ b/typedapi/types/analysislimits.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnalysisLimits type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Analysis.ts#L161-L172 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Analysis.ts#L161-L172 type AnalysisLimits struct { // CategorizationExamplesLimit The maximum number of examples stored per category in memory and in the // results data store. If you increase this value, more examples are available, diff --git a/typedapi/types/analysismemorylimit.go b/typedapi/types/analysismemorylimit.go index fcf40d5836..570af34129 100644 --- a/typedapi/types/analysismemorylimit.go +++ b/typedapi/types/analysismemorylimit.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnalysisMemoryLimit type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Analysis.ts#L174-L179 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Analysis.ts#L174-L179 type AnalysisMemoryLimit struct { // ModelMemoryLimit Limits can be applied for the resources required to hold the mathematical // models in memory. These limits are approximate and can be set per job. They diff --git a/typedapi/types/analytics.go b/typedapi/types/analytics.go index 5c78c65b42..4593b37eb4 100644 --- a/typedapi/types/analytics.go +++ b/typedapi/types/analytics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Analytics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L330-L332 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L330-L332 type Analytics struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/analyticscollection.go b/typedapi/types/analyticscollection.go index 60db754517..8a13dbdff0 100644 --- a/typedapi/types/analyticscollection.go +++ b/typedapi/types/analyticscollection.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // AnalyticsCollection type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/_types/BehavioralAnalytics.ts#L22-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/_types/BehavioralAnalytics.ts#L22-L27 type AnalyticsCollection struct { // EventDataStream Data stream for the collection. EventDataStream EventDataStream `json:"event_data_stream"` diff --git a/typedapi/types/analyticsstatistics.go b/typedapi/types/analyticsstatistics.go index c41d84cb60..564b7e3f84 100644 --- a/typedapi/types/analyticsstatistics.go +++ b/typedapi/types/analyticsstatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnalyticsStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L61-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L61-L71 type AnalyticsStatistics struct { BoxplotUsage int64 `json:"boxplot_usage"` CumulativeCardinalityUsage int64 `json:"cumulative_cardinality_usage"` diff --git a/typedapi/types/analyzedetail.go b/typedapi/types/analyzedetail.go index 84f82c1b53..e0f945974a 100644 --- a/typedapi/types/analyzedetail.go +++ b/typedapi/types/analyzedetail.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnalyzeDetail type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/analyze/types.ts#L24-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/analyze/types.ts#L24-L30 type AnalyzeDetail struct { Analyzer *AnalyzerDetail `json:"analyzer,omitempty"` Charfilters []CharFilterDetail `json:"charfilters,omitempty"` diff --git a/typedapi/types/analyzer.go b/typedapi/types/analyzer.go index 0622ead565..c7176366f7 100644 --- a/typedapi/types/analyzer.go +++ b/typedapi/types/analyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -37,5 +37,5 @@ package types // SnowballAnalyzer // DutchAnalyzer // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L113-L131 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L113-L131 type Analyzer interface{} diff --git a/typedapi/types/analyzerdetail.go b/typedapi/types/analyzerdetail.go index d61743f46c..1ab1992193 100644 --- a/typedapi/types/analyzerdetail.go +++ b/typedapi/types/analyzerdetail.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnalyzerDetail type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/analyze/types.ts#L32-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/analyze/types.ts#L32-L35 type AnalyzerDetail struct { Name string `json:"name"` Tokens []ExplainAnalyzeToken `json:"tokens"` diff --git a/typedapi/types/analyzetoken.go b/typedapi/types/analyzetoken.go index dd672ea254..7ae77c6576 100644 --- a/typedapi/types/analyzetoken.go +++ b/typedapi/types/analyzetoken.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnalyzeToken type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/analyze/types.ts#L37-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/analyze/types.ts#L37-L44 type AnalyzeToken struct { EndOffset int64 `json:"end_offset"` Position int64 `json:"position"` diff --git a/typedapi/types/anomaly.go b/typedapi/types/anomaly.go index 8e6c212f0e..3b0c828908 100644 --- a/typedapi/types/anomaly.go +++ b/typedapi/types/anomaly.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Anomaly type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Anomaly.ts#L24-L121 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Anomaly.ts#L24-L121 type Anomaly struct { // Actual The actual value for the bucket. Actual []Float64 `json:"actual,omitempty"` diff --git a/typedapi/types/anomalycause.go b/typedapi/types/anomalycause.go index 8204fd70e7..c055e17eb9 100644 --- a/typedapi/types/anomalycause.go +++ b/typedapi/types/anomalycause.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnomalyCause type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Anomaly.ts#L123-L138 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Anomaly.ts#L123-L138 type AnomalyCause struct { Actual []Float64 `json:"actual"` ByFieldName string `json:"by_field_name"` diff --git a/typedapi/types/anomalydetectors.go b/typedapi/types/anomalydetectors.go index 42869272d8..e578b04d50 100644 --- a/typedapi/types/anomalydetectors.go +++ b/typedapi/types/anomalydetectors.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnomalyDetectors type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/info/types.ts#L44-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/info/types.ts#L44-L50 type AnomalyDetectors struct { CategorizationAnalyzer CategorizationAnalyzer `json:"categorization_analyzer"` CategorizationExamplesLimit int `json:"categorization_examples_limit"` diff --git a/typedapi/types/anomalyexplanation.go b/typedapi/types/anomalyexplanation.go index e82de6a7ea..390230d569 100644 --- a/typedapi/types/anomalyexplanation.go +++ b/typedapi/types/anomalyexplanation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AnomalyExplanation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Anomaly.ts#L156-L197 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Anomaly.ts#L156-L197 type AnomalyExplanation struct { // AnomalyCharacteristicsImpact Impact from the duration and magnitude of the detected anomaly relative to // the historical average. diff --git a/typedapi/types/apikey.go b/typedapi/types/apikey.go index 9beed30ced..28b1c1e443 100644 --- a/typedapi/types/apikey.go +++ b/typedapi/types/apikey.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ApiKey type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/ApiKey.ts#L27-L77 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/ApiKey.ts#L27-L77 type ApiKey struct { // Creation Creation time for the API key in milliseconds. Creation *int64 `json:"creation,omitempty"` diff --git a/typedapi/types/apikeyauthorization.go b/typedapi/types/apikeyauthorization.go index a11305d4d9..6c950e9541 100644 --- a/typedapi/types/apikeyauthorization.go +++ b/typedapi/types/apikeyauthorization.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ApiKeyAuthorization type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Authorization.ts#L20-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Authorization.ts#L20-L29 type ApiKeyAuthorization struct { // Id The identifier for the API key. Id string `json:"id"` diff --git a/typedapi/types/appendprocessor.go b/typedapi/types/appendprocessor.go index c45c9d4f74..44bc75247a 100644 --- a/typedapi/types/appendprocessor.go +++ b/typedapi/types/appendprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AppendProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L273-L288 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L273-L288 type AppendProcessor struct { // AllowDuplicates If `false`, the processor does not append values already present in the // field. diff --git a/typedapi/types/applicationglobaluserprivileges.go b/typedapi/types/applicationglobaluserprivileges.go index 67f7dd4a61..77f01aeb7a 100644 --- a/typedapi/types/applicationglobaluserprivileges.go +++ b/typedapi/types/applicationglobaluserprivileges.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ApplicationGlobalUserPrivileges type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L193-L195 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L193-L195 type ApplicationGlobalUserPrivileges struct { Manage ManageUserPrivileges `json:"manage"` } diff --git a/typedapi/types/applicationprivileges.go b/typedapi/types/applicationprivileges.go index 478e739e8c..38cfb46ee9 100644 --- a/typedapi/types/applicationprivileges.go +++ b/typedapi/types/applicationprivileges.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ApplicationPrivileges type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L26-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L26-L39 type ApplicationPrivileges struct { // Application The name of the application to which this entry applies. Application string `json:"application"` diff --git a/typedapi/types/applicationprivilegescheck.go b/typedapi/types/applicationprivilegescheck.go index e2220fdec7..7e31fa2e98 100644 --- a/typedapi/types/applicationprivilegescheck.go +++ b/typedapi/types/applicationprivilegescheck.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ApplicationPrivilegesCheck type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges/types.ts#L24-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges/types.ts#L24-L31 type ApplicationPrivilegesCheck struct { // Application The name of the application. Application string `json:"application"` diff --git a/typedapi/types/applicationsprivileges.go b/typedapi/types/applicationsprivileges.go index 8c06bc4d73..bebecf89d1 100644 --- a/typedapi/types/applicationsprivileges.go +++ b/typedapi/types/applicationsprivileges.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ApplicationsPrivileges type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges/types.ts#L46-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges/types.ts#L46-L46 type ApplicationsPrivileges map[string]ResourcePrivileges diff --git a/typedapi/types/archive.go b/typedapi/types/archive.go index 1542dd83ca..8182bf0b5a 100644 --- a/typedapi/types/archive.go +++ b/typedapi/types/archive.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Archive type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L48-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L48-L50 type Archive struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/arraycomparecondition.go b/typedapi/types/arraycomparecondition.go index 01084d7456..d2e01fb5a3 100644 --- a/typedapi/types/arraycomparecondition.go +++ b/typedapi/types/arraycomparecondition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // ArrayCompareCondition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Conditions.ts#L32-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Conditions.ts#L32-L36 type ArrayCompareCondition struct { ArrayCompareCondition map[conditionop.ConditionOp]ArrayCompareOpParams `json:"ArrayCompareCondition,omitempty"` Path string `json:"path"` diff --git a/typedapi/types/arraycompareopparams.go b/typedapi/types/arraycompareopparams.go index 01e21fe38e..606f2ae81a 100644 --- a/typedapi/types/arraycompareopparams.go +++ b/typedapi/types/arraycompareopparams.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // ArrayCompareOpParams type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Conditions.ts#L27-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Conditions.ts#L27-L30 type ArrayCompareOpParams struct { Quantifier quantifier.Quantifier `json:"quantifier"` Value FieldValue `json:"value"` diff --git a/typedapi/types/arraypercentilesitem.go b/typedapi/types/arraypercentilesitem.go index 55122a53fb..cb3d02efc6 100644 --- a/typedapi/types/arraypercentilesitem.go +++ b/typedapi/types/arraypercentilesitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ArrayPercentilesItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L160-L164 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L160-L164 type ArrayPercentilesItem struct { Key string `json:"key"` Value Float64 `json:"value,omitempty"` diff --git a/typedapi/types/asciifoldingtokenfilter.go b/typedapi/types/asciifoldingtokenfilter.go index e699105001..27423f4d7e 100644 --- a/typedapi/types/asciifoldingtokenfilter.go +++ b/typedapi/types/asciifoldingtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // AsciiFoldingTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L168-L171 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L168-L171 type AsciiFoldingTokenFilter struct { PreserveOriginal Stringifiedboolean `json:"preserve_original,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/asyncsearch.go b/typedapi/types/asyncsearch.go index a7a0be466f..d884b49805 100644 --- a/typedapi/types/asyncsearch.go +++ b/typedapi/types/asyncsearch.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // AsyncSearch type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/async_search/_types/AsyncSearch.ts#L30-L56 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/async_search/_types/AsyncSearch.ts#L30-L56 type AsyncSearch struct { // Aggregations Partial aggregations results, coming from the shards that have already // completed the execution of the query. diff --git a/typedapi/types/attachmentprocessor.go b/typedapi/types/attachmentprocessor.go index 2e19427750..5770ac8ca1 100644 --- a/typedapi/types/attachmentprocessor.go +++ b/typedapi/types/attachmentprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AttachmentProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L290-L326 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L290-L326 type AttachmentProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/audit.go b/typedapi/types/audit.go index 80fb419148..b3fd8cdb95 100644 --- a/typedapi/types/audit.go +++ b/typedapi/types/audit.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Audit type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L73-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L73-L75 type Audit struct { Enabled bool `json:"enabled"` Outputs []string `json:"outputs,omitempty"` diff --git a/typedapi/types/authenticateduser.go b/typedapi/types/authenticateduser.go index 1eae9241ae..322de20a2c 100644 --- a/typedapi/types/authenticateduser.go +++ b/typedapi/types/authenticateduser.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AuthenticatedUser type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_token/types.ts#L40-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_token/types.ts#L40-L45 type AuthenticatedUser struct { AuthenticationProvider *AuthenticationProvider `json:"authentication_provider,omitempty"` AuthenticationRealm UserRealm `json:"authentication_realm"` diff --git a/typedapi/types/authenticatetoken.go b/typedapi/types/authenticatetoken.go index 5b38766196..af579b5252 100644 --- a/typedapi/types/authenticatetoken.go +++ b/typedapi/types/authenticatetoken.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AuthenticateToken type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/authenticate/types.ts#L22-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/authenticate/types.ts#L22-L29 type AuthenticateToken struct { Name string `json:"name"` Type *string `json:"type,omitempty"` diff --git a/typedapi/types/authenticationprovider.go b/typedapi/types/authenticationprovider.go index f996393691..f38e0fef30 100644 --- a/typedapi/types/authenticationprovider.go +++ b/typedapi/types/authenticationprovider.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AuthenticationProvider type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_token/types.ts#L35-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_token/types.ts#L35-L38 type AuthenticationProvider struct { Name string `json:"name"` Type string `json:"type"` diff --git a/typedapi/types/autodatehistogramaggregate.go b/typedapi/types/autodatehistogramaggregate.go index 3ee96badc9..dc4034005d 100644 --- a/typedapi/types/autodatehistogramaggregate.go +++ b/typedapi/types/autodatehistogramaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // AutoDateHistogramAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L356-L360 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L356-L360 type AutoDateHistogramAggregate struct { Buckets BucketsDateHistogramBucket `json:"buckets"` Interval string `json:"interval"` diff --git a/typedapi/types/autodatehistogramaggregation.go b/typedapi/types/autodatehistogramaggregation.go index a0ee4ba096..5a8178aa83 100644 --- a/typedapi/types/autodatehistogramaggregation.go +++ b/typedapi/types/autodatehistogramaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // AutoDateHistogramAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L65-L100 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L65-L100 type AutoDateHistogramAggregation struct { // Buckets The target number of buckets. Buckets *int `json:"buckets,omitempty"` diff --git a/typedapi/types/autofollowedcluster.go b/typedapi/types/autofollowedcluster.go index 230ad693ca..c5059d3ae2 100644 --- a/typedapi/types/autofollowedcluster.go +++ b/typedapi/types/autofollowedcluster.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // AutoFollowedCluster type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/stats/types.ts.ts#L27-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/stats/types.ts.ts#L27-L31 type AutoFollowedCluster struct { ClusterName string `json:"cluster_name"` LastSeenMetadataVersion int64 `json:"last_seen_metadata_version"` diff --git a/typedapi/types/autofollowpattern.go b/typedapi/types/autofollowpattern.go index 2d26df5cb3..fc4f6c95cc 100644 --- a/typedapi/types/autofollowpattern.go +++ b/typedapi/types/autofollowpattern.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // AutoFollowPattern type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/get_auto_follow_pattern/types.ts#L23-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/get_auto_follow_pattern/types.ts#L23-L26 type AutoFollowPattern struct { Name string `json:"name"` Pattern AutoFollowPatternSummary `json:"pattern"` diff --git a/typedapi/types/autofollowpatternsummary.go b/typedapi/types/autofollowpatternsummary.go index 94932e64d6..40b961dd5e 100644 --- a/typedapi/types/autofollowpatternsummary.go +++ b/typedapi/types/autofollowpatternsummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AutoFollowPatternSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/get_auto_follow_pattern/types.ts#L28-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/get_auto_follow_pattern/types.ts#L28-L52 type AutoFollowPatternSummary struct { Active bool `json:"active"` // FollowIndexPattern The name of follower index. diff --git a/typedapi/types/autofollowstats.go b/typedapi/types/autofollowstats.go index 0c5b8574c1..4a2c7555f6 100644 --- a/typedapi/types/autofollowstats.go +++ b/typedapi/types/autofollowstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AutoFollowStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/stats/types.ts.ts#L33-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/stats/types.ts.ts#L33-L39 type AutoFollowStats struct { AutoFollowedClusters []AutoFollowedCluster `json:"auto_followed_clusters"` NumberOfFailedFollowIndices int64 `json:"number_of_failed_follow_indices"` diff --git a/typedapi/types/autoscalingcapacity.go b/typedapi/types/autoscalingcapacity.go index 2b9876359c..b7c2add767 100644 --- a/typedapi/types/autoscalingcapacity.go +++ b/typedapi/types/autoscalingcapacity.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // AutoscalingCapacity type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L38-L41 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L38-L41 type AutoscalingCapacity struct { Node AutoscalingResources `json:"node"` Total AutoscalingResources `json:"total"` diff --git a/typedapi/types/autoscalingdecider.go b/typedapi/types/autoscalingdecider.go index e39f90de31..935cc7adff 100644 --- a/typedapi/types/autoscalingdecider.go +++ b/typedapi/types/autoscalingdecider.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AutoscalingDecider type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L52-L56 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L52-L56 type AutoscalingDecider struct { ReasonDetails json.RawMessage `json:"reason_details,omitempty"` ReasonSummary *string `json:"reason_summary,omitempty"` diff --git a/typedapi/types/autoscalingdeciders.go b/typedapi/types/autoscalingdeciders.go index a582edb2e4..1011074746 100644 --- a/typedapi/types/autoscalingdeciders.go +++ b/typedapi/types/autoscalingdeciders.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // AutoscalingDeciders type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L31-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L31-L36 type AutoscalingDeciders struct { CurrentCapacity AutoscalingCapacity `json:"current_capacity"` CurrentNodes []AutoscalingNode `json:"current_nodes"` diff --git a/typedapi/types/autoscalingnode.go b/typedapi/types/autoscalingnode.go index 782c6b74fc..b8f488c1d9 100644 --- a/typedapi/types/autoscalingnode.go +++ b/typedapi/types/autoscalingnode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // AutoscalingNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L48-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L48-L50 type AutoscalingNode struct { Name string `json:"name"` } diff --git a/typedapi/types/autoscalingpolicy.go b/typedapi/types/autoscalingpolicy.go index 75e3da592b..e4fe755be4 100644 --- a/typedapi/types/autoscalingpolicy.go +++ b/typedapi/types/autoscalingpolicy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // AutoscalingPolicy type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/_types/AutoscalingPolicy.ts#L23-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/_types/AutoscalingPolicy.ts#L23-L27 type AutoscalingPolicy struct { // Deciders Decider settings Deciders map[string]json.RawMessage `json:"deciders"` diff --git a/typedapi/types/autoscalingresources.go b/typedapi/types/autoscalingresources.go index adb53d9484..58f9c163bf 100644 --- a/typedapi/types/autoscalingresources.go +++ b/typedapi/types/autoscalingresources.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AutoscalingResources type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L43-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L43-L46 type AutoscalingResources struct { Memory int `json:"memory"` Storage int `json:"storage"` diff --git a/typedapi/types/averageaggregation.go b/typedapi/types/averageaggregation.go index 1d7836aaac..8cf37974ab 100644 --- a/typedapi/types/averageaggregation.go +++ b/typedapi/types/averageaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AverageAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L55-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L55-L55 type AverageAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/averagebucketaggregation.go b/typedapi/types/averagebucketaggregation.go index 4f0fc11d91..50b4881777 100644 --- a/typedapi/types/averagebucketaggregation.go +++ b/typedapi/types/averagebucketaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // AverageBucketAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L78-L78 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L78-L78 type AverageBucketAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/avgaggregate.go b/typedapi/types/avgaggregate.go index c9f0fc7995..3960ecdd3d 100644 --- a/typedapi/types/avgaggregate.go +++ b/typedapi/types/avgaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // AvgAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L209-L210 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L209-L210 type AvgAggregate struct { Meta Metadata `json:"meta,omitempty"` // Value The metric value. A missing value generally means that there was no data to diff --git a/typedapi/types/base.go b/typedapi/types/base.go index 830a875ca2..1e9c640e94 100644 --- a/typedapi/types/base.go +++ b/typedapi/types/base.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Base type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L30-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L30-L33 type Base struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/baseindicator.go b/typedapi/types/baseindicator.go index 8b77ad132d..7a37a58a09 100644 --- a/typedapi/types/baseindicator.go +++ b/typedapi/types/baseindicator.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // BaseIndicator type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L42-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L42-L47 type BaseIndicator struct { Diagnosis []Diagnosis `json:"diagnosis,omitempty"` Impacts []Impact `json:"impacts,omitempty"` diff --git a/typedapi/types/basenode.go b/typedapi/types/basenode.go index faea4fb03a..7d9d57e1e9 100644 --- a/typedapi/types/basenode.go +++ b/typedapi/types/basenode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // BaseNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_spec_utils/BaseNode.ts#L25-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_spec_utils/BaseNode.ts#L25-L32 type BaseNode struct { Attributes map[string]string `json:"attributes"` Host string `json:"host"` diff --git a/typedapi/types/binaryproperty.go b/typedapi/types/binaryproperty.go index 61827d9335..43dda1ec79 100644 --- a/typedapi/types/binaryproperty.go +++ b/typedapi/types/binaryproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // BinaryProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L49-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L49-L51 type BinaryProperty struct { CopyTo []string `json:"copy_to,omitempty"` DocValues *bool `json:"doc_values,omitempty"` @@ -215,6 +215,12 @@ func (s *BinaryProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -540,6 +546,12 @@ func (s *BinaryProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/booleanproperty.go b/typedapi/types/booleanproperty.go index c9925f7728..5840768c42 100644 --- a/typedapi/types/booleanproperty.go +++ b/typedapi/types/booleanproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // BooleanProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L53-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L53-L59 type BooleanProperty struct { Boost *Float64 `json:"boost,omitempty"` CopyTo []string `json:"copy_to,omitempty"` @@ -240,6 +240,12 @@ func (s *BooleanProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -593,6 +599,12 @@ func (s *BooleanProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/boolquery.go b/typedapi/types/boolquery.go index d6f96cf94e..aea363c176 100644 --- a/typedapi/types/boolquery.go +++ b/typedapi/types/boolquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BoolQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L28-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L28-L52 type BoolQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/boostingquery.go b/typedapi/types/boostingquery.go index fd3597687c..2311300f54 100644 --- a/typedapi/types/boostingquery.go +++ b/typedapi/types/boostingquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BoostingQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L54-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L54-L67 type BoostingQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/boxplotaggregate.go b/typedapi/types/boxplotaggregate.go index d54b36dfed..b38b085bed 100644 --- a/typedapi/types/boxplotaggregate.go +++ b/typedapi/types/boxplotaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BoxPlotAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L706-L722 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L706-L722 type BoxPlotAggregate struct { Lower Float64 `json:"lower"` LowerAsString *string `json:"lower_as_string,omitempty"` diff --git a/typedapi/types/boxplotaggregation.go b/typedapi/types/boxplotaggregation.go index 38dfd6b0b8..7e7fcf7ade 100644 --- a/typedapi/types/boxplotaggregation.go +++ b/typedapi/types/boxplotaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BoxplotAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L57-L62 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L57-L62 type BoxplotAggregation struct { // Compression Limits the maximum number of nodes used by the underlying TDigest algorithm // to `20 * compression`, enabling control of memory usage and approximation diff --git a/typedapi/types/breaker.go b/typedapi/types/breaker.go index a4d58034b7..aa631e9bb1 100644 --- a/typedapi/types/breaker.go +++ b/typedapi/types/breaker.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Breaker type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L434-L459 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L434-L459 type Breaker struct { // EstimatedSize Estimated memory used for the operation. EstimatedSize *string `json:"estimated_size,omitempty"` diff --git a/typedapi/types/bucketcorrelationaggregation.go b/typedapi/types/bucketcorrelationaggregation.go index d9bdc7ebcb..676910d4bb 100644 --- a/typedapi/types/bucketcorrelationaggregation.go +++ b/typedapi/types/bucketcorrelationaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BucketCorrelationAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L129-L135 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L129-L135 type BucketCorrelationAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/bucketcorrelationfunction.go b/typedapi/types/bucketcorrelationfunction.go index 594ec2fe60..4fe758e6c7 100644 --- a/typedapi/types/bucketcorrelationfunction.go +++ b/typedapi/types/bucketcorrelationfunction.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // BucketCorrelationFunction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L137-L142 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L137-L142 type BucketCorrelationFunction struct { // CountCorrelation The configuration to calculate a count correlation. This function is designed // for determining the correlation of a term value and a given metric. diff --git a/typedapi/types/bucketcorrelationfunctioncountcorrelation.go b/typedapi/types/bucketcorrelationfunctioncountcorrelation.go index 99ab2ac0ee..f8ccef210d 100644 --- a/typedapi/types/bucketcorrelationfunctioncountcorrelation.go +++ b/typedapi/types/bucketcorrelationfunctioncountcorrelation.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // BucketCorrelationFunctionCountCorrelation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L144-L147 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L144-L147 type BucketCorrelationFunctionCountCorrelation struct { // Indicator The indicator with which to correlate the configured `bucket_path` values. Indicator BucketCorrelationFunctionCountCorrelationIndicator `json:"indicator"` diff --git a/typedapi/types/bucketcorrelationfunctioncountcorrelationindicator.go b/typedapi/types/bucketcorrelationfunctioncountcorrelationindicator.go index 9319707356..bc09b21268 100644 --- a/typedapi/types/bucketcorrelationfunctioncountcorrelationindicator.go +++ b/typedapi/types/bucketcorrelationfunctioncountcorrelationindicator.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BucketCorrelationFunctionCountCorrelationIndicator type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L149-L167 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L149-L167 type BucketCorrelationFunctionCountCorrelationIndicator struct { // DocCount The total number of documents that initially created the expectations. It’s // required to be greater diff --git a/typedapi/types/bucketinfluencer.go b/typedapi/types/bucketinfluencer.go index e7d2eb7497..c8749e2c4b 100644 --- a/typedapi/types/bucketinfluencer.go +++ b/typedapi/types/bucketinfluencer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BucketInfluencer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Bucket.ts#L80-L128 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Bucket.ts#L80-L128 type BucketInfluencer struct { // AnomalyScore A normalized score between 0-100, which is calculated for each bucket // influencer. This score might be updated as diff --git a/typedapi/types/bucketksaggregation.go b/typedapi/types/bucketksaggregation.go index 36322ea247..c19d803412 100644 --- a/typedapi/types/bucketksaggregation.go +++ b/typedapi/types/bucketksaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BucketKsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L94-L127 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L94-L127 type BucketKsAggregation struct { // Alternative A list of string values indicating which K-S test alternative to calculate. // The valid values diff --git a/typedapi/types/bucketmetricvalueaggregate.go b/typedapi/types/bucketmetricvalueaggregate.go index 2c79b17001..b773a589a2 100644 --- a/typedapi/types/bucketmetricvalueaggregate.go +++ b/typedapi/types/bucketmetricvalueaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BucketMetricValueAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L233-L236 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L233-L236 type BucketMetricValueAggregate struct { Keys []string `json:"keys"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/bucketpathaggregation.go b/typedapi/types/bucketpathaggregation.go index 9788990e21..c4e32bff55 100644 --- a/typedapi/types/bucketpathaggregation.go +++ b/typedapi/types/bucketpathaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BucketPathAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L31-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L31-L37 type BucketPathAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/bucketsadjacencymatrixbucket.go b/typedapi/types/bucketsadjacencymatrixbucket.go index 2c86aa170c..1757582496 100644 --- a/typedapi/types/bucketsadjacencymatrixbucket.go +++ b/typedapi/types/bucketsadjacencymatrixbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]AdjacencyMatrixBucket // []AdjacencyMatrixBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsAdjacencyMatrixBucket interface{} diff --git a/typedapi/types/bucketscompositebucket.go b/typedapi/types/bucketscompositebucket.go index c9cad87bcd..471263e64b 100644 --- a/typedapi/types/bucketscompositebucket.go +++ b/typedapi/types/bucketscompositebucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]CompositeBucket // []CompositeBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsCompositeBucket interface{} diff --git a/typedapi/types/bucketscriptaggregation.go b/typedapi/types/bucketscriptaggregation.go index 0e22ed3b95..de4f9bddaa 100644 --- a/typedapi/types/bucketscriptaggregation.go +++ b/typedapi/types/bucketscriptaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // BucketScriptAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L80-L85 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L80-L85 type BucketScriptAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/bucketsdatehistogrambucket.go b/typedapi/types/bucketsdatehistogrambucket.go index a9261436ce..06ddaca2f0 100644 --- a/typedapi/types/bucketsdatehistogrambucket.go +++ b/typedapi/types/bucketsdatehistogrambucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]DateHistogramBucket // []DateHistogramBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsDateHistogramBucket interface{} diff --git a/typedapi/types/bucketsdoubletermsbucket.go b/typedapi/types/bucketsdoubletermsbucket.go index a83705817a..f5a6dd1d05 100644 --- a/typedapi/types/bucketsdoubletermsbucket.go +++ b/typedapi/types/bucketsdoubletermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]DoubleTermsBucket // []DoubleTermsBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsDoubleTermsBucket interface{} diff --git a/typedapi/types/bucketselectoraggregation.go b/typedapi/types/bucketselectoraggregation.go index 60fb9aeba9..4000a599ae 100644 --- a/typedapi/types/bucketselectoraggregation.go +++ b/typedapi/types/bucketselectoraggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // BucketSelectorAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L87-L92 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L87-L92 type BucketSelectorAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/bucketsfiltersbucket.go b/typedapi/types/bucketsfiltersbucket.go index a246117636..96388faf5c 100644 --- a/typedapi/types/bucketsfiltersbucket.go +++ b/typedapi/types/bucketsfiltersbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]FiltersBucket // []FiltersBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsFiltersBucket interface{} diff --git a/typedapi/types/bucketsfrequentitemsetsbucket.go b/typedapi/types/bucketsfrequentitemsetsbucket.go index b981ece8e9..ee9e9b0da5 100644 --- a/typedapi/types/bucketsfrequentitemsetsbucket.go +++ b/typedapi/types/bucketsfrequentitemsetsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]FrequentItemSetsBucket // []FrequentItemSetsBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsFrequentItemSetsBucket interface{} diff --git a/typedapi/types/bucketsgeohashgridbucket.go b/typedapi/types/bucketsgeohashgridbucket.go index 3be14a0e6b..8009191141 100644 --- a/typedapi/types/bucketsgeohashgridbucket.go +++ b/typedapi/types/bucketsgeohashgridbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]GeoHashGridBucket // []GeoHashGridBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsGeoHashGridBucket interface{} diff --git a/typedapi/types/bucketsgeohexgridbucket.go b/typedapi/types/bucketsgeohexgridbucket.go index ab2da2aef0..c1c819cf2c 100644 --- a/typedapi/types/bucketsgeohexgridbucket.go +++ b/typedapi/types/bucketsgeohexgridbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]GeoHexGridBucket // []GeoHexGridBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsGeoHexGridBucket interface{} diff --git a/typedapi/types/bucketsgeotilegridbucket.go b/typedapi/types/bucketsgeotilegridbucket.go index 26ca029294..a13cec062a 100644 --- a/typedapi/types/bucketsgeotilegridbucket.go +++ b/typedapi/types/bucketsgeotilegridbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]GeoTileGridBucket // []GeoTileGridBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsGeoTileGridBucket interface{} diff --git a/typedapi/types/bucketshistogrambucket.go b/typedapi/types/bucketshistogrambucket.go index ac9c428c05..e5e31d6ee0 100644 --- a/typedapi/types/bucketshistogrambucket.go +++ b/typedapi/types/bucketshistogrambucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]HistogramBucket // []HistogramBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsHistogramBucket interface{} diff --git a/typedapi/types/bucketsipprefixbucket.go b/typedapi/types/bucketsipprefixbucket.go index 623cf33f4f..5c1d54483c 100644 --- a/typedapi/types/bucketsipprefixbucket.go +++ b/typedapi/types/bucketsipprefixbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]IpPrefixBucket // []IpPrefixBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsIpPrefixBucket interface{} diff --git a/typedapi/types/bucketsiprangebucket.go b/typedapi/types/bucketsiprangebucket.go index 2be7f7f80b..76afb817df 100644 --- a/typedapi/types/bucketsiprangebucket.go +++ b/typedapi/types/bucketsiprangebucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]IpRangeBucket // []IpRangeBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsIpRangeBucket interface{} diff --git a/typedapi/types/bucketslongraretermsbucket.go b/typedapi/types/bucketslongraretermsbucket.go index c4fd23f280..1c08480c5a 100644 --- a/typedapi/types/bucketslongraretermsbucket.go +++ b/typedapi/types/bucketslongraretermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]LongRareTermsBucket // []LongRareTermsBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsLongRareTermsBucket interface{} diff --git a/typedapi/types/bucketslongtermsbucket.go b/typedapi/types/bucketslongtermsbucket.go index b726d80fc7..af61f19cdc 100644 --- a/typedapi/types/bucketslongtermsbucket.go +++ b/typedapi/types/bucketslongtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]LongTermsBucket // []LongTermsBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsLongTermsBucket interface{} diff --git a/typedapi/types/bucketsmultitermsbucket.go b/typedapi/types/bucketsmultitermsbucket.go index dc32828c6e..62423bef93 100644 --- a/typedapi/types/bucketsmultitermsbucket.go +++ b/typedapi/types/bucketsmultitermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]MultiTermsBucket // []MultiTermsBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsMultiTermsBucket interface{} diff --git a/typedapi/types/bucketsortaggregation.go b/typedapi/types/bucketsortaggregation.go index a9acc39ef7..1132f2db72 100644 --- a/typedapi/types/bucketsortaggregation.go +++ b/typedapi/types/bucketsortaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // BucketSortAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L169-L190 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L169-L190 type BucketSortAggregation struct { // From Buckets in positions prior to `from` will be truncated. From *int `json:"from,omitempty"` diff --git a/typedapi/types/bucketspath.go b/typedapi/types/bucketspath.go index 570e498c59..cd16169d22 100644 --- a/typedapi/types/bucketspath.go +++ b/typedapi/types/bucketspath.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ package types // []string // map[string]string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L53-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L53-L59 type BucketsPath interface{} diff --git a/typedapi/types/bucketsquery.go b/typedapi/types/bucketsquery.go index 2e70f24261..a1b1b6b927 100644 --- a/typedapi/types/bucketsquery.go +++ b/typedapi/types/bucketsquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]Query // []Query // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsQuery interface{} diff --git a/typedapi/types/bucketsrangebucket.go b/typedapi/types/bucketsrangebucket.go index b9a76f0353..18d90ce38e 100644 --- a/typedapi/types/bucketsrangebucket.go +++ b/typedapi/types/bucketsrangebucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]RangeBucket // []RangeBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsRangeBucket interface{} diff --git a/typedapi/types/bucketssignificantlongtermsbucket.go b/typedapi/types/bucketssignificantlongtermsbucket.go index 1fa006e88c..f711de6250 100644 --- a/typedapi/types/bucketssignificantlongtermsbucket.go +++ b/typedapi/types/bucketssignificantlongtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]SignificantLongTermsBucket // []SignificantLongTermsBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsSignificantLongTermsBucket interface{} diff --git a/typedapi/types/bucketssignificantstringtermsbucket.go b/typedapi/types/bucketssignificantstringtermsbucket.go index ab0d4fdde8..592dd9ade6 100644 --- a/typedapi/types/bucketssignificantstringtermsbucket.go +++ b/typedapi/types/bucketssignificantstringtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]SignificantStringTermsBucket // []SignificantStringTermsBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsSignificantStringTermsBucket interface{} diff --git a/typedapi/types/bucketsstringraretermsbucket.go b/typedapi/types/bucketsstringraretermsbucket.go index 3478230296..482e9b5b4c 100644 --- a/typedapi/types/bucketsstringraretermsbucket.go +++ b/typedapi/types/bucketsstringraretermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]StringRareTermsBucket // []StringRareTermsBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsStringRareTermsBucket interface{} diff --git a/typedapi/types/bucketsstringtermsbucket.go b/typedapi/types/bucketsstringtermsbucket.go index 3399fffa4e..584af6d472 100644 --- a/typedapi/types/bucketsstringtermsbucket.go +++ b/typedapi/types/bucketsstringtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]StringTermsBucket // []StringTermsBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsStringTermsBucket interface{} diff --git a/typedapi/types/bucketsummary.go b/typedapi/types/bucketsummary.go index 5f1fe52f0b..cc74418b55 100644 --- a/typedapi/types/bucketsummary.go +++ b/typedapi/types/bucketsummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BucketSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Bucket.ts#L31-L78 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Bucket.ts#L31-L78 type BucketSummary struct { // AnomalyScore The maximum anomaly score, between 0-100, for any of the bucket influencers. // This is an overall, rate-limited diff --git a/typedapi/types/bucketsvariablewidthhistogrambucket.go b/typedapi/types/bucketsvariablewidthhistogrambucket.go index 3b6d67391e..4328a0070f 100644 --- a/typedapi/types/bucketsvariablewidthhistogrambucket.go +++ b/typedapi/types/bucketsvariablewidthhistogrambucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]VariableWidthHistogramBucket // []VariableWidthHistogramBucket // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsVariableWidthHistogramBucket interface{} diff --git a/typedapi/types/bucketsvoid.go b/typedapi/types/bucketsvoid.go index cbd9df9a38..1c9f1e378a 100644 --- a/typedapi/types/bucketsvoid.go +++ b/typedapi/types/bucketsvoid.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // map[string]interface{} // []interface{} // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L316-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L316-L325 type BucketsVoid interface{} diff --git a/typedapi/types/buildinformation.go b/typedapi/types/buildinformation.go index 1ad33e260b..de601a5f02 100644 --- a/typedapi/types/buildinformation.go +++ b/typedapi/types/buildinformation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BuildInformation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/info/types.ts#L24-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/info/types.ts#L24-L27 type BuildInformation struct { Date DateTime `json:"date"` Hash string `json:"hash"` diff --git a/typedapi/types/bulkindexbyscrollfailure.go b/typedapi/types/bulkindexbyscrollfailure.go index 74b6bc6b23..253d9f5b54 100644 --- a/typedapi/types/bulkindexbyscrollfailure.go +++ b/typedapi/types/bulkindexbyscrollfailure.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BulkIndexByScrollFailure type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Errors.ts#L58-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Errors.ts#L58-L64 type BulkIndexByScrollFailure struct { Cause ErrorCause `json:"cause"` Id string `json:"id"` diff --git a/typedapi/types/bulkstats.go b/typedapi/types/bulkstats.go index c893da3b62..6967a51234 100644 --- a/typedapi/types/bulkstats.go +++ b/typedapi/types/bulkstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BulkStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L68-L78 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L68-L78 type BulkStats struct { AvgSize ByteSize `json:"avg_size,omitempty"` AvgSizeInBytes int64 `json:"avg_size_in_bytes"` diff --git a/typedapi/types/bytenumberproperty.go b/typedapi/types/bytenumberproperty.go index c5b17a1ca4..48c0fb1b86 100644 --- a/typedapi/types/bytenumberproperty.go +++ b/typedapi/types/bytenumberproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // ByteNumberProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L164-L167 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L164-L167 type ByteNumberProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -260,6 +260,12 @@ func (s *ByteNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -623,6 +629,12 @@ func (s *ByteNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/bytesize.go b/typedapi/types/bytesize.go index c6141b20f7..3fe6794baf 100644 --- a/typedapi/types/bytesize.go +++ b/typedapi/types/bytesize.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // int64 // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L95-L96 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L96-L97 type ByteSize interface{} diff --git a/typedapi/types/bytesprocessor.go b/typedapi/types/bytesprocessor.go index 571a96bb78..6ee92f4d85 100644 --- a/typedapi/types/bytesprocessor.go +++ b/typedapi/types/bytesprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // BytesProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L381-L397 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L381-L397 type BytesProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/cachequeries.go b/typedapi/types/cachequeries.go index 3d6500beb8..e45eec1d89 100644 --- a/typedapi/types/cachequeries.go +++ b/typedapi/types/cachequeries.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CacheQueries type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L398-L400 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L398-L400 type CacheQueries struct { Enabled bool `json:"enabled"` } diff --git a/typedapi/types/cachestats.go b/typedapi/types/cachestats.go index 80e77a8b96..b7e9672ea7 100644 --- a/typedapi/types/cachestats.go +++ b/typedapi/types/cachestats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CacheStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/stats/types.ts#L37-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/stats/types.ts#L37-L43 type CacheStats struct { Count int `json:"count"` Evictions int `json:"evictions"` diff --git a/typedapi/types/calendar.go b/typedapi/types/calendar.go index 50bdf39fb0..5c1c2cedef 100644 --- a/typedapi/types/calendar.go +++ b/typedapi/types/calendar.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Calendar type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_calendars/types.ts#L22-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_calendars/types.ts#L22-L29 type Calendar struct { // CalendarId A string that uniquely identifies a calendar. CalendarId string `json:"calendar_id"` diff --git a/typedapi/types/calendarevent.go b/typedapi/types/calendarevent.go index 9fbb44727c..5bbbef31ca 100644 --- a/typedapi/types/calendarevent.go +++ b/typedapi/types/calendarevent.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CalendarEvent type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/CalendarEvent.ts#L23-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/CalendarEvent.ts#L23-L33 type CalendarEvent struct { // CalendarId A string that uniquely identifies a calendar. CalendarId *string `json:"calendar_id,omitempty"` diff --git a/typedapi/types/cardinalityaggregate.go b/typedapi/types/cardinalityaggregate.go index 62bcfaf830..796779cdfd 100644 --- a/typedapi/types/cardinalityaggregate.go +++ b/typedapi/types/cardinalityaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CardinalityAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L138-L141 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L138-L141 type CardinalityAggregate struct { Meta Metadata `json:"meta,omitempty"` Value int64 `json:"value"` diff --git a/typedapi/types/cardinalityaggregation.go b/typedapi/types/cardinalityaggregation.go index 52f35e7791..963a95f190 100644 --- a/typedapi/types/cardinalityaggregation.go +++ b/typedapi/types/cardinalityaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // CardinalityAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L87-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L87-L99 type CardinalityAggregation struct { // ExecutionHint Mechanism by which cardinality aggregations is run. ExecutionHint *cardinalityexecutionmode.CardinalityExecutionMode `json:"execution_hint,omitempty"` diff --git a/typedapi/types/catanonalydetectorcolumns.go b/typedapi/types/catanonalydetectorcolumns.go index 994ecb4094..bf43ccef3f 100644 --- a/typedapi/types/catanonalydetectorcolumns.go +++ b/typedapi/types/catanonalydetectorcolumns.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ import ( // CatAnonalyDetectorColumns type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/_types/CatBase.ts#L402-L404 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/_types/CatBase.ts#L402-L404 type CatAnonalyDetectorColumns []catanomalydetectorcolumn.CatAnomalyDetectorColumn diff --git a/typedapi/types/catcomponenttemplate.go b/typedapi/types/catcomponenttemplate.go index 0a1f70846f..302252046c 100644 --- a/typedapi/types/catcomponenttemplate.go +++ b/typedapi/types/catcomponenttemplate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CatComponentTemplate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/component_templates/types.ts#L20-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/component_templates/types.ts#L20-L28 type CatComponentTemplate struct { AliasCount string `json:"alias_count"` IncludedIn string `json:"included_in"` diff --git a/typedapi/types/catdatafeedcolumns.go b/typedapi/types/catdatafeedcolumns.go index e6eae8da52..5feb8565ee 100644 --- a/typedapi/types/catdatafeedcolumns.go +++ b/typedapi/types/catdatafeedcolumns.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ import ( // CatDatafeedColumns type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/_types/CatBase.ts#L559-L559 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/_types/CatBase.ts#L559-L559 type CatDatafeedColumns []catdatafeedcolumn.CatDatafeedColumn diff --git a/typedapi/types/catdfacolumns.go b/typedapi/types/catdfacolumns.go index 8e4c59bacc..3bc2e43ae1 100644 --- a/typedapi/types/catdfacolumns.go +++ b/typedapi/types/catdfacolumns.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ import ( // CatDfaColumns type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/_types/CatBase.ts#L558-L558 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/_types/CatBase.ts#L558-L558 type CatDfaColumns []catdfacolumn.CatDfaColumn diff --git a/typedapi/types/categorizationanalyzer.go b/typedapi/types/categorizationanalyzer.go index fce15f0956..f3c2256152 100644 --- a/typedapi/types/categorizationanalyzer.go +++ b/typedapi/types/categorizationanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // CategorizationAnalyzerDefinition // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Analysis.ts#L181-L182 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Analysis.ts#L181-L182 type CategorizationAnalyzer interface{} diff --git a/typedapi/types/categorizationanalyzerdefinition.go b/typedapi/types/categorizationanalyzerdefinition.go index 0c75161702..7a6928341c 100644 --- a/typedapi/types/categorizationanalyzerdefinition.go +++ b/typedapi/types/categorizationanalyzerdefinition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // CategorizationAnalyzerDefinition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Analysis.ts#L184-L197 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Analysis.ts#L184-L197 type CategorizationAnalyzerDefinition struct { // CharFilter One or more character filters. In addition to the built-in character filters, // other plugins can provide more character filters. If this property is not diff --git a/typedapi/types/categorizetextaggregation.go b/typedapi/types/categorizetextaggregation.go index bb7c9188fa..44a1e4878a 100644 --- a/typedapi/types/categorizetextaggregation.go +++ b/typedapi/types/categorizetextaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CategorizeTextAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L1037-L1101 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L1037-L1101 type CategorizeTextAggregation struct { // CategorizationAnalyzer The categorization analyzer specifies how the text is analyzed and tokenized // before being categorized. diff --git a/typedapi/types/categorizetextanalyzer.go b/typedapi/types/categorizetextanalyzer.go index 5cd5d590d6..da9d796c29 100644 --- a/typedapi/types/categorizetextanalyzer.go +++ b/typedapi/types/categorizetextanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // CustomCategorizeTextAnalyzer // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L1103-L1106 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L1103-L1106 type CategorizeTextAnalyzer interface{} diff --git a/typedapi/types/category.go b/typedapi/types/category.go index ed66251356..58f37cd657 100644 --- a/typedapi/types/category.go +++ b/typedapi/types/category.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Category type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Category.ts#L23-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Category.ts#L23-L49 type Category struct { // CategoryId A unique identifier for the category. category_id is unique at the job level, // even when per-partition categorization is enabled. diff --git a/typedapi/types/cattrainedmodelscolumns.go b/typedapi/types/cattrainedmodelscolumns.go index 5d52be765d..da1b28b450 100644 --- a/typedapi/types/cattrainedmodelscolumns.go +++ b/typedapi/types/cattrainedmodelscolumns.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ import ( // CatTrainedModelsColumns type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/_types/CatBase.ts#L636-L638 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/_types/CatBase.ts#L636-L638 type CatTrainedModelsColumns []cattrainedmodelscolumn.CatTrainedModelsColumn diff --git a/typedapi/types/cattransformcolumns.go b/typedapi/types/cattransformcolumns.go index 3a1e607d39..b4be35a618 100644 --- a/typedapi/types/cattransformcolumns.go +++ b/typedapi/types/cattransformcolumns.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ import ( // CatTransformColumns type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/_types/CatBase.ts#L845-L845 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/_types/CatBase.ts#L845-L845 type CatTransformColumns []cattransformcolumn.CatTransformColumn diff --git a/typedapi/types/ccr.go b/typedapi/types/ccr.go index 663667b0d7..eaf9b2659b 100644 --- a/typedapi/types/ccr.go +++ b/typedapi/types/ccr.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Ccr type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L334-L337 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L334-L337 type Ccr struct { AutoFollowPatternsCount int `json:"auto_follow_patterns_count"` Available bool `json:"available"` diff --git a/typedapi/types/ccrshardstats.go b/typedapi/types/ccrshardstats.go index 03c8bb88a4..f5730b5f37 100644 --- a/typedapi/types/ccrshardstats.go +++ b/typedapi/types/ccrshardstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CcrShardStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/_types/FollowIndexStats.ts#L35-L69 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/_types/FollowIndexStats.ts#L35-L69 type CcrShardStats struct { BytesRead int64 `json:"bytes_read"` FailedReadRequests int64 `json:"failed_read_requests"` diff --git a/typedapi/types/certificateinformation.go b/typedapi/types/certificateinformation.go index ac584a69d6..0282e713d2 100644 --- a/typedapi/types/certificateinformation.go +++ b/typedapi/types/certificateinformation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CertificateInformation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ssl/certificates/types.ts#L22-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ssl/certificates/types.ts#L22-L31 type CertificateInformation struct { Alias string `json:"alias,omitempty"` Expiry DateTime `json:"expiry"` diff --git a/typedapi/types/cgroup.go b/typedapi/types/cgroup.go index a2eee3c755..a562b71a64 100644 --- a/typedapi/types/cgroup.go +++ b/typedapi/types/cgroup.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Cgroup type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L461-L474 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L461-L474 type Cgroup struct { // Cpu Contains statistics about `cpu` control group for the node. Cpu *CgroupCpu `json:"cpu,omitempty"` diff --git a/typedapi/types/cgroupcpu.go b/typedapi/types/cgroupcpu.go index 9148c49415..132cb98355 100644 --- a/typedapi/types/cgroupcpu.go +++ b/typedapi/types/cgroupcpu.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CgroupCpu type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L487-L504 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L487-L504 type CgroupCpu struct { // CfsPeriodMicros The period of time, in microseconds, for how regularly all tasks in the same // cgroup as the Elasticsearch process should have their access to CPU resources diff --git a/typedapi/types/cgroupcpustat.go b/typedapi/types/cgroupcpustat.go index 23218f7ca0..6887a26e98 100644 --- a/typedapi/types/cgroupcpustat.go +++ b/typedapi/types/cgroupcpustat.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CgroupCpuStat type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L506-L519 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L506-L519 type CgroupCpuStat struct { // NumberOfElapsedPeriods The number of reporting periods (as specified by `cfs_period_micros`) that // have elapsed. diff --git a/typedapi/types/cgroupmemory.go b/typedapi/types/cgroupmemory.go index d15f1619d3..116b471c81 100644 --- a/typedapi/types/cgroupmemory.go +++ b/typedapi/types/cgroupmemory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CgroupMemory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L521-L537 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L521-L537 type CgroupMemory struct { // ControlGroup The `memory` control group to which the Elasticsearch process belongs. ControlGroup *string `json:"control_group,omitempty"` diff --git a/typedapi/types/chaininput.go b/typedapi/types/chaininput.go index c25a4cedd3..d921014b90 100644 --- a/typedapi/types/chaininput.go +++ b/typedapi/types/chaininput.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ChainInput type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L35-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L35-L37 type ChainInput struct { Inputs []map[string]WatcherInput `json:"inputs"` } diff --git a/typedapi/types/charfilter.go b/typedapi/types/charfilter.go index 3d52cf8f86..2f91781ce5 100644 --- a/typedapi/types/charfilter.go +++ b/typedapi/types/charfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // CharFilterDefinition // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/char_filters.ts#L28-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/char_filters.ts#L28-L30 type CharFilter interface{} diff --git a/typedapi/types/charfilterdefinition.go b/typedapi/types/charfilterdefinition.go index 9c9e70bb73..5cc710984c 100644 --- a/typedapi/types/charfilterdefinition.go +++ b/typedapi/types/charfilterdefinition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -28,5 +28,5 @@ package types // IcuNormalizationCharFilter // KuromojiIterationMarkCharFilter // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/char_filters.ts#L32-L41 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/char_filters.ts#L32-L41 type CharFilterDefinition interface{} diff --git a/typedapi/types/charfilterdetail.go b/typedapi/types/charfilterdetail.go index bc3367134a..15f80fdff1 100644 --- a/typedapi/types/charfilterdetail.go +++ b/typedapi/types/charfilterdetail.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CharFilterDetail type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/analyze/types.ts#L46-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/analyze/types.ts#L46-L49 type CharFilterDetail struct { FilteredText []string `json:"filtered_text"` Name string `json:"name"` diff --git a/typedapi/types/charfiltertypes.go b/typedapi/types/charfiltertypes.go index 9af5a22104..bcb3b2b249 100644 --- a/typedapi/types/charfiltertypes.go +++ b/typedapi/types/charfiltertypes.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // CharFilterTypes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L228-L261 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L228-L261 type CharFilterTypes struct { // AnalyzerTypes Contains statistics about analyzer types used in selected nodes. AnalyzerTypes []FieldTypes `json:"analyzer_types"` diff --git a/typedapi/types/chargrouptokenizer.go b/typedapi/types/chargrouptokenizer.go index 452f67b213..07ce1a4d75 100644 --- a/typedapi/types/chargrouptokenizer.go +++ b/typedapi/types/chargrouptokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CharGroupTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L56-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L56-L60 type CharGroupTokenizer struct { MaxTokenLength *int `json:"max_token_length,omitempty"` TokenizeOnChars []string `json:"tokenize_on_chars"` diff --git a/typedapi/types/checkpointing.go b/typedapi/types/checkpointing.go index 1ecb75d15f..78e5aa8b0a 100644 --- a/typedapi/types/checkpointing.go +++ b/typedapi/types/checkpointing.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Checkpointing type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/get_transform_stats/types.ts#L85-L92 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/get_transform_stats/types.ts#L85-L92 type Checkpointing struct { ChangesLastDetectedAt *int64 `json:"changes_last_detected_at,omitempty"` ChangesLastDetectedAtDateTime DateTime `json:"changes_last_detected_at_date_time,omitempty"` diff --git a/typedapi/types/checkpointstats.go b/typedapi/types/checkpointstats.go index 3272b83217..4ab10c30cb 100644 --- a/typedapi/types/checkpointstats.go +++ b/typedapi/types/checkpointstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CheckpointStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/get_transform_stats/types.ts#L76-L83 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/get_transform_stats/types.ts#L76-L83 type CheckpointStats struct { Checkpoint int64 `json:"checkpoint"` CheckpointProgress *TransformProgress `json:"checkpoint_progress,omitempty"` diff --git a/typedapi/types/childrenaggregate.go b/typedapi/types/childrenaggregate.go index 2b28c97371..ae67fd7b72 100644 --- a/typedapi/types/childrenaggregate.go +++ b/typedapi/types/childrenaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ChildrenAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L776-L777 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L776-L777 type ChildrenAggregate struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/childrenaggregation.go b/typedapi/types/childrenaggregation.go index 259791d4fe..ec47dc7ece 100644 --- a/typedapi/types/childrenaggregation.go +++ b/typedapi/types/childrenaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ChildrenAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L111-L116 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L111-L116 type ChildrenAggregation struct { Meta Metadata `json:"meta,omitempty"` Name *string `json:"name,omitempty"` diff --git a/typedapi/types/chisquareheuristic.go b/typedapi/types/chisquareheuristic.go index d2290cd7dc..5b777cc394 100644 --- a/typedapi/types/chisquareheuristic.go +++ b/typedapi/types/chisquareheuristic.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ChiSquareHeuristic type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L735-L744 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L735-L744 type ChiSquareHeuristic struct { // BackgroundIsSuperset Set to `false` if you defined a custom background filter that represents a // different set of documents that you want to compare to. diff --git a/typedapi/types/chunkingconfig.go b/typedapi/types/chunkingconfig.go index 38587ebd10..3ce080dd8b 100644 --- a/typedapi/types/chunkingconfig.go +++ b/typedapi/types/chunkingconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // ChunkingConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Datafeed.ts#L239-L252 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Datafeed.ts#L239-L252 type ChunkingConfig struct { // Mode If the mode is `auto`, the chunk size is dynamically calculated; // this is the recommended value when the datafeed does not use aggregations. diff --git a/typedapi/types/circleprocessor.go b/typedapi/types/circleprocessor.go index 7a20c91b68..0b690d7da2 100644 --- a/typedapi/types/circleprocessor.go +++ b/typedapi/types/circleprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // CircleProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L399-L422 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L399-L422 type CircleProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/classificationinferenceoptions.go b/typedapi/types/classificationinferenceoptions.go index a46abde90f..16c0e86a5b 100644 --- a/typedapi/types/classificationinferenceoptions.go +++ b/typedapi/types/classificationinferenceoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClassificationInferenceOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L93-L108 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L93-L108 type ClassificationInferenceOptions struct { // NumTopClasses Specifies the number of top class predictions to return. Defaults to 0. NumTopClasses *int `json:"num_top_classes,omitempty"` diff --git a/typedapi/types/cleanuprepositoryresults.go b/typedapi/types/cleanuprepositoryresults.go index 4ed8a41823..63ad8fc2e8 100644 --- a/typedapi/types/cleanuprepositoryresults.go +++ b/typedapi/types/cleanuprepositoryresults.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CleanupRepositoryResults type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/cleanup_repository/SnapshotCleanupRepositoryResponse.ts#L29-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/cleanup_repository/SnapshotCleanupRepositoryResponse.ts#L29-L34 type CleanupRepositoryResults struct { // DeletedBlobs Number of binary large objects (blobs) removed during cleanup. DeletedBlobs int64 `json:"deleted_blobs"` diff --git a/typedapi/types/client.go b/typedapi/types/client.go index f52a3e98d0..c4db5a0846 100644 --- a/typedapi/types/client.go +++ b/typedapi/types/client.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Client type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L649-L696 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L649-L696 type Client struct { // Agent Reported agent for the HTTP client. // If unavailable, this property is not included in the response. diff --git a/typedapi/types/closeindexresult.go b/typedapi/types/closeindexresult.go index 455809c95e..1a213bd307 100644 --- a/typedapi/types/closeindexresult.go +++ b/typedapi/types/closeindexresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CloseIndexResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/close/CloseIndexResponse.ts#L32-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/close/CloseIndexResponse.ts#L32-L35 type CloseIndexResult struct { Closed bool `json:"closed"` Shards map[string]CloseShardResult `json:"shards,omitempty"` diff --git a/typedapi/types/closeshardresult.go b/typedapi/types/closeshardresult.go index 79da50b80b..663ed3c11d 100644 --- a/typedapi/types/closeshardresult.go +++ b/typedapi/types/closeshardresult.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // CloseShardResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/close/CloseIndexResponse.ts#L37-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/close/CloseIndexResponse.ts#L37-L39 type CloseShardResult struct { Failures []ShardFailure `json:"failures"` } diff --git a/typedapi/types/clusterappliedstats.go b/typedapi/types/clusterappliedstats.go index fb0f797b04..a229969426 100644 --- a/typedapi/types/clusterappliedstats.go +++ b/typedapi/types/clusterappliedstats.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ClusterAppliedStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L221-L223 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L221-L223 type ClusterAppliedStats struct { Recordings []Recording `json:"recordings,omitempty"` } diff --git a/typedapi/types/clustercomponenttemplate.go b/typedapi/types/clustercomponenttemplate.go index 8ace76a731..6207aae2cf 100644 --- a/typedapi/types/clustercomponenttemplate.go +++ b/typedapi/types/clustercomponenttemplate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ClusterComponentTemplate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/_types/ComponentTemplate.ts#L30-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/_types/ComponentTemplate.ts#L30-L33 type ClusterComponentTemplate struct { ComponentTemplate ComponentTemplateNode `json:"component_template"` Name string `json:"name"` diff --git a/typedapi/types/clusterdetails.go b/typedapi/types/clusterdetails.go index fc38a463ac..d78b3aa0c5 100644 --- a/typedapi/types/clusterdetails.go +++ b/typedapi/types/clusterdetails.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ClusterDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L45-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L45-L52 type ClusterDetails struct { Failures []ShardFailure `json:"failures,omitempty"` Indices string `json:"indices"` diff --git a/typedapi/types/clusterfilesystem.go b/typedapi/types/clusterfilesystem.go index 9bdfe13f12..3155cf46a8 100644 --- a/typedapi/types/clusterfilesystem.go +++ b/typedapi/types/clusterfilesystem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterFileSystem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L34-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L34-L49 type ClusterFileSystem struct { // AvailableInBytes Total number of bytes available to JVM in file stores across all selected // nodes. diff --git a/typedapi/types/clusterindexingpressure.go b/typedapi/types/clusterindexingpressure.go index b339e0d63c..2c98514597 100644 --- a/typedapi/types/clusterindexingpressure.go +++ b/typedapi/types/clusterindexingpressure.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ClusterIndexingPressure type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L570-L572 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L570-L572 type ClusterIndexingPressure struct { Memory ClusterPressureMemory `json:"memory"` } diff --git a/typedapi/types/clusterindices.go b/typedapi/types/clusterindices.go index 3bf9bcca0f..12cabab25e 100644 --- a/typedapi/types/clusterindices.go +++ b/typedapi/types/clusterindices.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterIndices type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L74-L107 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L74-L107 type ClusterIndices struct { // Analysis Contains statistics about analyzers and analyzer components used in selected // nodes. diff --git a/typedapi/types/clusterindicesshards.go b/typedapi/types/clusterindicesshards.go index 49eabf4dde..a53e52e4a4 100644 --- a/typedapi/types/clusterindicesshards.go +++ b/typedapi/types/clusterindicesshards.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterIndicesShards type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L60-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L60-L72 type ClusterIndicesShards struct { // Index Contains statistics about shards assigned to selected nodes. Index *ClusterIndicesShardsIndex `json:"index,omitempty"` diff --git a/typedapi/types/clusterindicesshardsindex.go b/typedapi/types/clusterindicesshardsindex.go index 30f1344b55..2fb3196bc1 100644 --- a/typedapi/types/clusterindicesshardsindex.go +++ b/typedapi/types/clusterindicesshardsindex.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ClusterIndicesShardsIndex type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L51-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L51-L58 type ClusterIndicesShardsIndex struct { // Primaries Contains statistics about the number of primary shards assigned to selected // nodes. diff --git a/typedapi/types/clusterinfo.go b/typedapi/types/clusterinfo.go index a04aca2185..d9b3c33257 100644 --- a/typedapi/types/clusterinfo.go +++ b/typedapi/types/clusterinfo.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ClusterInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L48-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L48-L54 type ClusterInfo struct { Nodes map[string]NodeDiskUsage `json:"nodes"` ReservedSizes []ReservedSize `json:"reserved_sizes"` diff --git a/typedapi/types/clusterinfotargets.go b/typedapi/types/clusterinfotargets.go index 46dd2d1695..aa74bac362 100644 --- a/typedapi/types/clusterinfotargets.go +++ b/typedapi/types/clusterinfotargets.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ import ( // ClusterInfoTargets type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L391-L391 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L392-L392 type ClusterInfoTargets []clusterinfotarget.ClusterInfoTarget diff --git a/typedapi/types/clusteringest.go b/typedapi/types/clusteringest.go index 5f7b6f76d7..eb7cca9838 100644 --- a/typedapi/types/clusteringest.go +++ b/typedapi/types/clusteringest.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterIngest type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L270-L273 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L270-L273 type ClusterIngest struct { NumberOfPipelines int `json:"number_of_pipelines"` ProcessorStats map[string]ClusterProcessor `json:"processor_stats"` diff --git a/typedapi/types/clusterjvm.go b/typedapi/types/clusterjvm.go index d51d325e96..947eecdf92 100644 --- a/typedapi/types/clusterjvm.go +++ b/typedapi/types/clusterjvm.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterJvm type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L275-L292 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L275-L292 type ClusterJvm struct { // MaxUptimeInMillis Uptime duration, in milliseconds, since JVM last started. MaxUptimeInMillis int64 `json:"max_uptime_in_millis"` diff --git a/typedapi/types/clusterjvmmemory.go b/typedapi/types/clusterjvmmemory.go index ee069effeb..21c543b36a 100644 --- a/typedapi/types/clusterjvmmemory.go +++ b/typedapi/types/clusterjvmmemory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterJvmMemory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L294-L303 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L294-L303 type ClusterJvmMemory struct { // HeapMaxInBytes Maximum amount of memory, in bytes, available for use by the heap across all // selected nodes. diff --git a/typedapi/types/clusterjvmversion.go b/typedapi/types/clusterjvmversion.go index 8f1a02117c..fb4a06e4bf 100644 --- a/typedapi/types/clusterjvmversion.go +++ b/typedapi/types/clusterjvmversion.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterJvmVersion type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L305-L335 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L305-L335 type ClusterJvmVersion struct { // BundledJdk Always `true`. All distributions come with a bundled Java Development Kit // (JDK). diff --git a/typedapi/types/clusternetworktypes.go b/typedapi/types/clusternetworktypes.go index e352c8bd97..cf5cc19986 100644 --- a/typedapi/types/clusternetworktypes.go +++ b/typedapi/types/clusternetworktypes.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ClusterNetworkTypes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L337-L346 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L337-L346 type ClusterNetworkTypes struct { // HttpTypes Contains statistics about the HTTP network types used by selected nodes. HttpTypes map[string]int `json:"http_types"` diff --git a/typedapi/types/clusternode.go b/typedapi/types/clusternode.go index 2443de1947..9bf4c93da4 100644 --- a/typedapi/types/clusternode.go +++ b/typedapi/types/clusternode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ClusterNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/ClusterNode.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/ClusterNode.ts#L22-L24 type ClusterNode struct { Name string `json:"name"` } diff --git a/typedapi/types/clusternodecount.go b/typedapi/types/clusternodecount.go index 6f8ff1b637..195a0a8d90 100644 --- a/typedapi/types/clusternodecount.go +++ b/typedapi/types/clusternodecount.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterNodeCount type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L348-L367 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L348-L367 type ClusterNodeCount struct { CoordinatingOnly int `json:"coordinating_only"` Data int `json:"data"` diff --git a/typedapi/types/clusternodes.go b/typedapi/types/clusternodes.go index dc56f8c587..c92d77fe7d 100644 --- a/typedapi/types/clusternodes.go +++ b/typedapi/types/clusternodes.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ClusterNodes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L369-L402 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L369-L402 type ClusterNodes struct { // Count Contains counts for nodes selected by the request’s node filters. Count ClusterNodeCount `json:"count"` diff --git a/typedapi/types/clusteroperatingsystem.go b/typedapi/types/clusteroperatingsystem.go index b783d48b5f..2f59e4d005 100644 --- a/typedapi/types/clusteroperatingsystem.go +++ b/typedapi/types/clusteroperatingsystem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterOperatingSystem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L415-L442 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L415-L442 type ClusterOperatingSystem struct { // AllocatedProcessors Number of processors used to calculate thread pool size across all selected // nodes. diff --git a/typedapi/types/clusteroperatingsystemarchitecture.go b/typedapi/types/clusteroperatingsystemarchitecture.go index 6dd05f170c..c070496784 100644 --- a/typedapi/types/clusteroperatingsystemarchitecture.go +++ b/typedapi/types/clusteroperatingsystemarchitecture.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterOperatingSystemArchitecture type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L404-L413 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L404-L413 type ClusterOperatingSystemArchitecture struct { // Arch Name of an architecture used by one or more selected nodes. Arch string `json:"arch"` diff --git a/typedapi/types/clusteroperatingsystemname.go b/typedapi/types/clusteroperatingsystemname.go index ec882c5feb..4cf673cb1a 100644 --- a/typedapi/types/clusteroperatingsystemname.go +++ b/typedapi/types/clusteroperatingsystemname.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterOperatingSystemName type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L444-L453 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L444-L453 type ClusterOperatingSystemName struct { // Count Number of selected nodes using the operating system. Count int `json:"count"` diff --git a/typedapi/types/clusteroperatingsystemprettyname.go b/typedapi/types/clusteroperatingsystemprettyname.go index b4c05e67d4..e5538e4966 100644 --- a/typedapi/types/clusteroperatingsystemprettyname.go +++ b/typedapi/types/clusteroperatingsystemprettyname.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterOperatingSystemPrettyName type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L455-L464 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L455-L464 type ClusterOperatingSystemPrettyName struct { // Count Number of selected nodes using the operating system. Count int `json:"count"` diff --git a/typedapi/types/clusterpressurememory.go b/typedapi/types/clusterpressurememory.go index 9546b6318f..36b7f2d3ac 100644 --- a/typedapi/types/clusterpressurememory.go +++ b/typedapi/types/clusterpressurememory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterPressureMemory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L574-L578 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L574-L578 type ClusterPressureMemory struct { Current IndexingPressureMemorySummary `json:"current"` LimitInBytes int64 `json:"limit_in_bytes"` diff --git a/typedapi/types/clusterprocess.go b/typedapi/types/clusterprocess.go index 7dbd4211fa..c93c9dec4c 100644 --- a/typedapi/types/clusterprocess.go +++ b/typedapi/types/clusterprocess.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ClusterProcess type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L466-L475 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L466-L475 type ClusterProcess struct { // Cpu Contains statistics about CPU used by selected nodes. Cpu ClusterProcessCpu `json:"cpu"` diff --git a/typedapi/types/clusterprocesscpu.go b/typedapi/types/clusterprocesscpu.go index fb6c3af301..d942b74b27 100644 --- a/typedapi/types/clusterprocesscpu.go +++ b/typedapi/types/clusterprocesscpu.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterProcessCpu type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L477-L483 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L477-L483 type ClusterProcessCpu struct { // Percent Percentage of CPU used across all selected nodes. // Returns `-1` if not supported. diff --git a/typedapi/types/clusterprocessopenfiledescriptors.go b/typedapi/types/clusterprocessopenfiledescriptors.go index 578191f296..97624fc52c 100644 --- a/typedapi/types/clusterprocessopenfiledescriptors.go +++ b/typedapi/types/clusterprocessopenfiledescriptors.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterProcessOpenFileDescriptors type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L485-L501 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L485-L501 type ClusterProcessOpenFileDescriptors struct { // Avg Average number of concurrently open file descriptors. // Returns `-1` if not supported. diff --git a/typedapi/types/clusterprocessor.go b/typedapi/types/clusterprocessor.go index 5c18aff40e..9cb34ad5d5 100644 --- a/typedapi/types/clusterprocessor.go +++ b/typedapi/types/clusterprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L503-L509 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L503-L509 type ClusterProcessor struct { Count int64 `json:"count"` Current int64 `json:"current"` diff --git a/typedapi/types/clusterremoteinfo.go b/typedapi/types/clusterremoteinfo.go index aa3225aa53..ceadbdb2f0 100644 --- a/typedapi/types/clusterremoteinfo.go +++ b/typedapi/types/clusterremoteinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // ClusterRemoteSniffInfo // ClusterRemoteProxyInfo // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/remote_info/ClusterRemoteInfoResponse.ts#L28-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/remote_info/ClusterRemoteInfoResponse.ts#L28-L29 type ClusterRemoteInfo interface{} diff --git a/typedapi/types/clusterremoteproxyinfo.go b/typedapi/types/clusterremoteproxyinfo.go index 5a58aee0ca..d09f4c4b54 100644 --- a/typedapi/types/clusterremoteproxyinfo.go +++ b/typedapi/types/clusterremoteproxyinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterRemoteProxyInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/remote_info/ClusterRemoteInfoResponse.ts#L41-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/remote_info/ClusterRemoteInfoResponse.ts#L41-L50 type ClusterRemoteProxyInfo struct { Connected bool `json:"connected"` InitialConnectTimeout Duration `json:"initial_connect_timeout"` diff --git a/typedapi/types/clusterremotesniffinfo.go b/typedapi/types/clusterremotesniffinfo.go index f71bbf9e74..b734b0a99b 100644 --- a/typedapi/types/clusterremotesniffinfo.go +++ b/typedapi/types/clusterremotesniffinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterRemoteSniffInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/remote_info/ClusterRemoteInfoResponse.ts#L31-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/remote_info/ClusterRemoteInfoResponse.ts#L31-L39 type ClusterRemoteSniffInfo struct { Connected bool `json:"connected"` InitialConnectTimeout Duration `json:"initial_connect_timeout"` diff --git a/typedapi/types/clusterruntimefieldtypes.go b/typedapi/types/clusterruntimefieldtypes.go index a055171690..b9d41508f0 100644 --- a/typedapi/types/clusterruntimefieldtypes.go +++ b/typedapi/types/clusterruntimefieldtypes.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterRuntimeFieldTypes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L169-L226 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L169-L226 type ClusterRuntimeFieldTypes struct { // CharsMax Maximum number of characters for a single runtime field script. CharsMax int `json:"chars_max"` diff --git a/typedapi/types/clustershardmetrics.go b/typedapi/types/clustershardmetrics.go index 0f02b4665a..36f212f06b 100644 --- a/typedapi/types/clustershardmetrics.go +++ b/typedapi/types/clustershardmetrics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterShardMetrics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L511-L524 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L511-L524 type ClusterShardMetrics struct { // Avg Mean number of shards in an index, counting only shards assigned to selected // nodes. diff --git a/typedapi/types/clusterstatequeue.go b/typedapi/types/clusterstatequeue.go index e0eacba98d..0df7175779 100644 --- a/typedapi/types/clusterstatequeue.go +++ b/typedapi/types/clusterstatequeue.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterStateQueue type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L248-L261 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L248-L261 type ClusterStateQueue struct { // Committed Number of committed cluster states in queue. Committed *int64 `json:"committed,omitempty"` diff --git a/typedapi/types/clusterstateupdate.go b/typedapi/types/clusterstateupdate.go index 110319a652..543291e279 100644 --- a/typedapi/types/clusterstateupdate.go +++ b/typedapi/types/clusterstateupdate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterStateUpdate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L278-L343 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L278-L343 type ClusterStateUpdate struct { // CommitTime The cumulative amount of time spent waiting for a successful cluster state // update to commit, which measures the time from the start of each publication diff --git a/typedapi/types/clusterstatistics.go b/typedapi/types/clusterstatistics.go index e5c7f153d2..e3e2e6d8b1 100644 --- a/typedapi/types/clusterstatistics.go +++ b/typedapi/types/clusterstatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ClusterStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L27-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L27-L35 type ClusterStatistics struct { Details map[string]ClusterDetails `json:"details,omitempty"` Failed int `json:"failed"` diff --git a/typedapi/types/collector.go b/typedapi/types/collector.go index 99f6570771..477c7ed047 100644 --- a/typedapi/types/collector.go +++ b/typedapi/types/collector.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Collector type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L86-L91 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L86-L91 type Collector struct { Children []Collector `json:"children,omitempty"` Name string `json:"name"` diff --git a/typedapi/types/column.go b/typedapi/types/column.go index 81cdcad213..1ed8e2a9f4 100644 --- a/typedapi/types/column.go +++ b/typedapi/types/column.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Column type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/sql/types.ts#L23-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/sql/types.ts#L23-L26 type Column struct { Name string `json:"name"` Type string `json:"type"` diff --git a/typedapi/types/combinedfieldsquery.go b/typedapi/types/combinedfieldsquery.go index a20fdcb742..a08aa290fd 100644 --- a/typedapi/types/combinedfieldsquery.go +++ b/typedapi/types/combinedfieldsquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // CombinedFieldsQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/abstractions.ts#L429-L463 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/abstractions.ts#L429-L463 type CombinedFieldsQuery struct { // AutoGenerateSynonymsPhraseQuery If true, match phrase queries are automatically created for multi-term // synonyms. diff --git a/typedapi/types/command.go b/typedapi/types/command.go index e8b3d93ce9..eb2bb00db1 100644 --- a/typedapi/types/command.go +++ b/typedapi/types/command.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Command type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/reroute/types.ts#L22-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/reroute/types.ts#L22-L43 type Command struct { // AllocateEmptyPrimary Allocate an empty primary shard to a node. Accepts the index and shard for // index name and shard number, and node to allocate the shard to. Using this diff --git a/typedapi/types/commandallocateprimaryaction.go b/typedapi/types/commandallocateprimaryaction.go index aa99b181c8..a8da8528ce 100644 --- a/typedapi/types/commandallocateprimaryaction.go +++ b/typedapi/types/commandallocateprimaryaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CommandAllocatePrimaryAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/reroute/types.ts#L78-L84 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/reroute/types.ts#L78-L84 type CommandAllocatePrimaryAction struct { // AcceptDataLoss If a node which has a copy of the data rejoins the cluster later on, that // data will be deleted. To ensure that these implications are well-understood, diff --git a/typedapi/types/commandallocatereplicaaction.go b/typedapi/types/commandallocatereplicaaction.go index a2bab57422..8b3f7bb28d 100644 --- a/typedapi/types/commandallocatereplicaaction.go +++ b/typedapi/types/commandallocatereplicaaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CommandAllocateReplicaAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/reroute/types.ts#L69-L76 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/reroute/types.ts#L69-L76 type CommandAllocateReplicaAction struct { Index string `json:"index"` Node string `json:"node"` diff --git a/typedapi/types/commandcancelaction.go b/typedapi/types/commandcancelaction.go index 4e41101261..9fdc74eacf 100644 --- a/typedapi/types/commandcancelaction.go +++ b/typedapi/types/commandcancelaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CommandCancelAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/reroute/types.ts#L45-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/reroute/types.ts#L45-L50 type CommandCancelAction struct { AllowPrimary *bool `json:"allow_primary,omitempty"` Index string `json:"index"` diff --git a/typedapi/types/commandmoveaction.go b/typedapi/types/commandmoveaction.go index 064647af0c..82fd430612 100644 --- a/typedapi/types/commandmoveaction.go +++ b/typedapi/types/commandmoveaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CommandMoveAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/reroute/types.ts#L60-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/reroute/types.ts#L60-L67 type CommandMoveAction struct { // FromNode The node to move the shard from FromNode string `json:"from_node"` diff --git a/typedapi/types/commongramstokenfilter.go b/typedapi/types/commongramstokenfilter.go index a1dc175e41..e5f77d1290 100644 --- a/typedapi/types/commongramstokenfilter.go +++ b/typedapi/types/commongramstokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CommonGramsTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L173-L179 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L173-L179 type CommonGramsTokenFilter struct { CommonWords []string `json:"common_words,omitempty"` CommonWordsPath *string `json:"common_words_path,omitempty"` diff --git a/typedapi/types/commontermsquery.go b/typedapi/types/commontermsquery.go index 0da6ac97ce..12b0c9ae01 100644 --- a/typedapi/types/commontermsquery.go +++ b/typedapi/types/commontermsquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // CommonTermsQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L34-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L34-L44 type CommonTermsQuery struct { Analyzer *string `json:"analyzer,omitempty"` // Boost Floating point number used to decrease or increase the relevance scores of diff --git a/typedapi/types/compactnodeinfo.go b/typedapi/types/compactnodeinfo.go index 5407180321..c3a9d48f9a 100644 --- a/typedapi/types/compactnodeinfo.go +++ b/typedapi/types/compactnodeinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // CompactNodeInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/verify_repository/SnapshotVerifyRepositoryResponse.ts#L27-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/verify_repository/SnapshotVerifyRepositoryResponse.ts#L27-L29 type CompactNodeInfo struct { Name string `json:"name"` } diff --git a/typedapi/types/completioncontext.go b/typedapi/types/completioncontext.go index b754563d4a..d61d3195f4 100644 --- a/typedapi/types/completioncontext.go +++ b/typedapi/types/completioncontext.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CompletionContext type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L232-L261 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L232-L261 type CompletionContext struct { // Boost The factor by which the score of the suggestion should be boosted. // The score is computed by multiplying the boost with the suggestion weight. diff --git a/typedapi/types/completionproperty.go b/typedapi/types/completionproperty.go index a7a3877f74..c3911ed205 100644 --- a/typedapi/types/completionproperty.go +++ b/typedapi/types/completionproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // CompletionProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/specialized.ts#L27-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/specialized.ts#L27-L35 type CompletionProperty struct { Analyzer *string `json:"analyzer,omitempty"` Contexts []SuggestContext `json:"contexts,omitempty"` @@ -238,6 +238,12 @@ func (s *CompletionProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -607,6 +613,12 @@ func (s *CompletionProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/completionstats.go b/typedapi/types/completionstats.go index e04f4917ed..00b5220d60 100644 --- a/typedapi/types/completionstats.go +++ b/typedapi/types/completionstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CompletionStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L80-L90 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L80-L90 type CompletionStats struct { Fields map[string]FieldSizeUsage `json:"fields,omitempty"` // Size Total amount of memory used for completion across all shards assigned to diff --git a/typedapi/types/completionsuggest.go b/typedapi/types/completionsuggest.go index daebe7df68..1a0933dd15 100644 --- a/typedapi/types/completionsuggest.go +++ b/typedapi/types/completionsuggest.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CompletionSuggest type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L48-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L48-L55 type CompletionSuggest struct { Length int `json:"length"` Offset int `json:"offset"` diff --git a/typedapi/types/completionsuggester.go b/typedapi/types/completionsuggester.go index 2d18170fe6..e418214b60 100644 --- a/typedapi/types/completionsuggester.go +++ b/typedapi/types/completionsuggester.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CompletionSuggester type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L160-L178 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L160-L178 type CompletionSuggester struct { // Analyzer The analyzer to analyze the suggest text with. // Defaults to the search analyzer of the suggest field. diff --git a/typedapi/types/completionsuggestoption.go b/typedapi/types/completionsuggestoption.go index 0de2534e2e..6adbb80a77 100644 --- a/typedapi/types/completionsuggestoption.go +++ b/typedapi/types/completionsuggestoption.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CompletionSuggestOption type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L73-L84 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L73-L84 type CompletionSuggestOption struct { CollateMatch *bool `json:"collate_match,omitempty"` Contexts map[string][]Context `json:"contexts,omitempty"` diff --git a/typedapi/types/componenttemplatenode.go b/typedapi/types/componenttemplatenode.go index 7867877eab..a537762d5a 100644 --- a/typedapi/types/componenttemplatenode.go +++ b/typedapi/types/componenttemplatenode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ComponentTemplateNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/_types/ComponentTemplate.ts#L35-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/_types/ComponentTemplate.ts#L35-L40 type ComponentTemplateNode struct { Meta_ Metadata `json:"_meta,omitempty"` Template ComponentTemplateSummary `json:"template"` diff --git a/typedapi/types/componenttemplatesummary.go b/typedapi/types/componenttemplatesummary.go index 024292ebf2..906e5edf80 100644 --- a/typedapi/types/componenttemplatesummary.go +++ b/typedapi/types/componenttemplatesummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ComponentTemplateSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/_types/ComponentTemplate.ts#L42-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/_types/ComponentTemplate.ts#L42-L54 type ComponentTemplateSummary struct { Aliases map[string]AliasDefinition `json:"aliases,omitempty"` Lifecycle *DataStreamLifecycleWithRollover `json:"lifecycle,omitempty"` diff --git a/typedapi/types/compositeaggregate.go b/typedapi/types/compositeaggregate.go index 5efa5f8ac2..e2dee88e3d 100644 --- a/typedapi/types/compositeaggregate.go +++ b/typedapi/types/compositeaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // CompositeAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L618-L623 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L618-L623 type CompositeAggregate struct { AfterKey CompositeAggregateKey `json:"after_key,omitempty"` Buckets BucketsCompositeBucket `json:"buckets"` diff --git a/typedapi/types/compositeaggregatekey.go b/typedapi/types/compositeaggregatekey.go index b32b603754..88fde7d0ba 100644 --- a/typedapi/types/compositeaggregatekey.go +++ b/typedapi/types/compositeaggregatekey.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // CompositeAggregateKey type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L118-L118 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L118-L118 type CompositeAggregateKey map[string]FieldValue diff --git a/typedapi/types/compositeaggregation.go b/typedapi/types/compositeaggregation.go index c0442d879b..0372cfd47e 100644 --- a/typedapi/types/compositeaggregation.go +++ b/typedapi/types/compositeaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CompositeAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L120-L136 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L120-L136 type CompositeAggregation struct { // After When paginating, use the `after_key` value returned in the previous response // to retrieve the next page. diff --git a/typedapi/types/compositeaggregationsource.go b/typedapi/types/compositeaggregationsource.go index ad91857741..92072a972e 100644 --- a/typedapi/types/compositeaggregationsource.go +++ b/typedapi/types/compositeaggregationsource.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // CompositeAggregationSource type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L138-L155 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L138-L155 type CompositeAggregationSource struct { // DateHistogram A date histogram aggregation. DateHistogram *CompositeDateHistogramAggregation `json:"date_histogram,omitempty"` diff --git a/typedapi/types/compositebucket.go b/typedapi/types/compositebucket.go index 5b91d3d2cd..572f75e436 100644 --- a/typedapi/types/compositebucket.go +++ b/typedapi/types/compositebucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // CompositeBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L625-L627 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L625-L627 type CompositeBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/compositedatehistogramaggregation.go b/typedapi/types/compositedatehistogramaggregation.go index 493fc491ec..ffbe284fd7 100644 --- a/typedapi/types/compositedatehistogramaggregation.go +++ b/typedapi/types/compositedatehistogramaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // CompositeDateHistogramAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L174-L182 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L174-L182 type CompositeDateHistogramAggregation struct { // CalendarInterval Either `calendar_interval` or `fixed_interval` must be present CalendarInterval *string `json:"calendar_interval,omitempty"` diff --git a/typedapi/types/compositegeotilegridaggregation.go b/typedapi/types/compositegeotilegridaggregation.go index ac7a853cd9..0b462922e9 100644 --- a/typedapi/types/compositegeotilegridaggregation.go +++ b/typedapi/types/compositegeotilegridaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // CompositeGeoTileGridAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L184-L187 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L184-L187 type CompositeGeoTileGridAggregation struct { Bounds GeoBounds `json:"bounds,omitempty"` // Field Either `field` or `script` must be present diff --git a/typedapi/types/compositehistogramaggregation.go b/typedapi/types/compositehistogramaggregation.go index ad621d685a..11db70ba01 100644 --- a/typedapi/types/compositehistogramaggregation.go +++ b/typedapi/types/compositehistogramaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // CompositeHistogramAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L170-L172 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L170-L172 type CompositeHistogramAggregation struct { // Field Either `field` or `script` must be present Field *string `json:"field,omitempty"` diff --git a/typedapi/types/compositetermsaggregation.go b/typedapi/types/compositetermsaggregation.go index ae04302821..42b53883f3 100644 --- a/typedapi/types/compositetermsaggregation.go +++ b/typedapi/types/compositetermsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // CompositeTermsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L168-L168 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L168-L168 type CompositeTermsAggregation struct { // Field Either `field` or `script` must be present Field *string `json:"field,omitempty"` diff --git a/typedapi/types/conditiontokenfilter.go b/typedapi/types/conditiontokenfilter.go index b1c7a0a58f..dc612c302b 100644 --- a/typedapi/types/conditiontokenfilter.go +++ b/typedapi/types/conditiontokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ConditionTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L181-L185 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L181-L185 type ConditionTokenFilter struct { Filter []string `json:"filter"` Script Script `json:"script"` diff --git a/typedapi/types/configuration.go b/typedapi/types/configuration.go index 61e3fa355e..e06503f855 100644 --- a/typedapi/types/configuration.go +++ b/typedapi/types/configuration.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Configuration type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/_types/SnapshotLifecycle.ts#L99-L129 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/_types/SnapshotLifecycle.ts#L99-L129 type Configuration struct { // FeatureStates A list of feature states to be included in this snapshot. A list of features // available for inclusion in the snapshot and their descriptions be can be diff --git a/typedapi/types/configurations.go b/typedapi/types/configurations.go index 2dbc9a1138..8571cdaaa7 100644 --- a/typedapi/types/configurations.go +++ b/typedapi/types/configurations.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Configurations type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/_types/Phase.ts#L50-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/_types/Phase.ts#L50-L54 type Configurations struct { Forcemerge *ForceMergeConfiguration `json:"forcemerge,omitempty"` Rollover *RolloverConditions `json:"rollover,omitempty"` diff --git a/typedapi/types/confusionmatrixitem.go b/typedapi/types/confusionmatrixitem.go index ff1cf6724e..f3bfacf8a8 100644 --- a/typedapi/types/confusionmatrixitem.go +++ b/typedapi/types/confusionmatrixitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ConfusionMatrixItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L125-L130 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L125-L130 type ConfusionMatrixItem struct { ActualClass string `json:"actual_class"` ActualClassDocCount int `json:"actual_class_doc_count"` diff --git a/typedapi/types/confusionmatrixprediction.go b/typedapi/types/confusionmatrixprediction.go index 1b1b097770..25b3346a53 100644 --- a/typedapi/types/confusionmatrixprediction.go +++ b/typedapi/types/confusionmatrixprediction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ConfusionMatrixPrediction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L132-L135 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L132-L135 type ConfusionMatrixPrediction struct { Count int `json:"count"` PredictedClass string `json:"predicted_class"` diff --git a/typedapi/types/confusionmatrixthreshold.go b/typedapi/types/confusionmatrixthreshold.go index b4138a7624..a72b84e618 100644 --- a/typedapi/types/confusionmatrixthreshold.go +++ b/typedapi/types/confusionmatrixthreshold.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ConfusionMatrixThreshold type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L137-L158 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L137-L158 type ConfusionMatrixThreshold struct { // FalseNegative False Negative FalseNegative int `json:"fn"` diff --git a/typedapi/types/connection.go b/typedapi/types/connection.go index d37be1ec24..d491bd8f3d 100644 --- a/typedapi/types/connection.go +++ b/typedapi/types/connection.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Connection type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/graph/_types/Connection.ts#L22-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/graph/_types/Connection.ts#L22-L27 type Connection struct { DocCount int64 `json:"doc_count"` Source int64 `json:"source"` diff --git a/typedapi/types/constantkeywordproperty.go b/typedapi/types/constantkeywordproperty.go index b9c296dc40..afc146dc2e 100644 --- a/typedapi/types/constantkeywordproperty.go +++ b/typedapi/types/constantkeywordproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ConstantKeywordProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/specialized.ts#L44-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/specialized.ts#L44-L47 type ConstantKeywordProperty struct { Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` Fields map[string]Property `json:"fields,omitempty"` @@ -182,6 +182,12 @@ func (s *ConstantKeywordProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -507,6 +513,12 @@ func (s *ConstantKeywordProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/constantscorequery.go b/typedapi/types/constantscorequery.go index bfb0c8f52d..a91a162b78 100644 --- a/typedapi/types/constantscorequery.go +++ b/typedapi/types/constantscorequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ConstantScoreQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L69-L76 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L69-L76 type ConstantScoreQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/context.go b/typedapi/types/context.go index 2e7beaaaa6..83605e1211 100644 --- a/typedapi/types/context.go +++ b/typedapi/types/context.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // GeoLocation // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L225-L230 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L225-L230 type Context interface{} diff --git a/typedapi/types/contextmethod.go b/typedapi/types/contextmethod.go index df72974019..6305b7bbe3 100644 --- a/typedapi/types/contextmethod.go +++ b/typedapi/types/contextmethod.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ContextMethod type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/get_script_context/types.ts#L27-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/get_script_context/types.ts#L27-L31 type ContextMethod struct { Name string `json:"name"` Params []ContextMethodParam `json:"params"` diff --git a/typedapi/types/contextmethodparam.go b/typedapi/types/contextmethodparam.go index 0b26175827..5b0895ef11 100644 --- a/typedapi/types/contextmethodparam.go +++ b/typedapi/types/contextmethodparam.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ContextMethodParam type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/get_script_context/types.ts#L33-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/get_script_context/types.ts#L33-L36 type ContextMethodParam struct { Name string `json:"name"` Type string `json:"type"` diff --git a/typedapi/types/convertprocessor.go b/typedapi/types/convertprocessor.go index a7acbff23a..6cbbd244d1 100644 --- a/typedapi/types/convertprocessor.go +++ b/typedapi/types/convertprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ConvertProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L434-L454 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L434-L454 type ConvertProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/coordinatorstats.go b/typedapi/types/coordinatorstats.go index 7ef803ad1f..82d4983abb 100644 --- a/typedapi/types/coordinatorstats.go +++ b/typedapi/types/coordinatorstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CoordinatorStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/stats/types.ts#L29-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/stats/types.ts#L29-L35 type CoordinatorStats struct { ExecutedSearchesTotal int64 `json:"executed_searches_total"` NodeId string `json:"node_id"` diff --git a/typedapi/types/coordsgeobounds.go b/typedapi/types/coordsgeobounds.go index fbd2e1c833..c34b576d76 100644 --- a/typedapi/types/coordsgeobounds.go +++ b/typedapi/types/coordsgeobounds.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CoordsGeoBounds type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L163-L168 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L163-L168 type CoordsGeoBounds struct { Bottom Float64 `json:"bottom"` Left Float64 `json:"left"` diff --git a/typedapi/types/coreknnquery.go b/typedapi/types/coreknnquery.go index dc68089479..60e12f1d08 100644 --- a/typedapi/types/coreknnquery.go +++ b/typedapi/types/coreknnquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CoreKnnQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/knn_search/_types/Knn.ts#L24-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/knn_search/_types/Knn.ts#L24-L33 type CoreKnnQuery struct { // Field The name of the vector field to search against Field string `json:"field"` diff --git a/typedapi/types/counter.go b/typedapi/types/counter.go index 6918d44aa0..2758d6e97a 100644 --- a/typedapi/types/counter.go +++ b/typedapi/types/counter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Counter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L35-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L35-L38 type Counter struct { Active int64 `json:"active"` Total int64 `json:"total"` diff --git a/typedapi/types/countrecord.go b/typedapi/types/countrecord.go index 01353f861f..18f926270e 100644 --- a/typedapi/types/countrecord.go +++ b/typedapi/types/countrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CountRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/count/types.ts#L23-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/count/types.ts#L23-L39 type CountRecord struct { // Count the document count Count *string `json:"count,omitempty"` diff --git a/typedapi/types/cpu.go b/typedapi/types/cpu.go index 673f960063..b0a98a91ee 100644 --- a/typedapi/types/cpu.go +++ b/typedapi/types/cpu.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Cpu type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L539-L548 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L539-L548 type Cpu struct { LoadAverage map[string]Float64 `json:"load_average,omitempty"` Percent *int `json:"percent,omitempty"` diff --git a/typedapi/types/cpuacct.go b/typedapi/types/cpuacct.go index bb1a5dc255..fa64dd9030 100644 --- a/typedapi/types/cpuacct.go +++ b/typedapi/types/cpuacct.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CpuAcct type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L476-L485 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L476-L485 type CpuAcct struct { // ControlGroup The `cpuacct` control group to which the Elasticsearch process belongs. ControlGroup *string `json:"control_group,omitempty"` diff --git a/typedapi/types/createdstatus.go b/typedapi/types/createdstatus.go index 83bba68ae4..c883ffa777 100644 --- a/typedapi/types/createdstatus.go +++ b/typedapi/types/createdstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CreatedStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/CreatedStatus.ts#L20-L22 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/CreatedStatus.ts#L20-L22 type CreatedStatus struct { Created bool `json:"created"` } diff --git a/typedapi/types/createoperation.go b/typedapi/types/createoperation.go index 7edb2449ee..f7e5c86189 100644 --- a/typedapi/types/createoperation.go +++ b/typedapi/types/createoperation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // CreateOperation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/types.ts#L130-L130 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/types.ts#L130-L130 type CreateOperation struct { // DynamicTemplates A map from the full name of fields to the name of dynamic templates. // Defaults to an empty map. diff --git a/typedapi/types/csvprocessor.go b/typedapi/types/csvprocessor.go index e28a9cb38c..fc0de9edad 100644 --- a/typedapi/types/csvprocessor.go +++ b/typedapi/types/csvprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CsvProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L456-L489 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L456-L489 type CsvProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/cumulativecardinalityaggregate.go b/typedapi/types/cumulativecardinalityaggregate.go index a583bb150c..729e94957e 100644 --- a/typedapi/types/cumulativecardinalityaggregate.go +++ b/typedapi/types/cumulativecardinalityaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CumulativeCardinalityAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L747-L755 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L747-L755 type CumulativeCardinalityAggregate struct { Meta Metadata `json:"meta,omitempty"` Value int64 `json:"value"` diff --git a/typedapi/types/cumulativecardinalityaggregation.go b/typedapi/types/cumulativecardinalityaggregation.go index c86f75ad54..cb618a778f 100644 --- a/typedapi/types/cumulativecardinalityaggregation.go +++ b/typedapi/types/cumulativecardinalityaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // CumulativeCardinalityAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L192-L192 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L192-L192 type CumulativeCardinalityAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/cumulativesumaggregation.go b/typedapi/types/cumulativesumaggregation.go index 16b10b65e7..46d064eb91 100644 --- a/typedapi/types/cumulativesumaggregation.go +++ b/typedapi/types/cumulativesumaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // CumulativeSumAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L194-L194 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L194-L194 type CumulativeSumAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/currentnode.go b/typedapi/types/currentnode.go index 4ba0d907ba..26ff4e9fd4 100644 --- a/typedapi/types/currentnode.go +++ b/typedapi/types/currentnode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CurrentNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L78-L84 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L78-L84 type CurrentNode struct { Attributes map[string]string `json:"attributes"` Id string `json:"id"` diff --git a/typedapi/types/customanalyzer.go b/typedapi/types/customanalyzer.go index 8261c499e3..93f40441bd 100644 --- a/typedapi/types/customanalyzer.go +++ b/typedapi/types/customanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CustomAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L28-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L28-L35 type CustomAnalyzer struct { CharFilter []string `json:"char_filter,omitempty"` Filter []string `json:"filter,omitempty"` diff --git a/typedapi/types/customcategorizetextanalyzer.go b/typedapi/types/customcategorizetextanalyzer.go index d31b6564fe..9891878b7a 100644 --- a/typedapi/types/customcategorizetextanalyzer.go +++ b/typedapi/types/customcategorizetextanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // CustomCategorizeTextAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L1108-L1112 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L1108-L1112 type CustomCategorizeTextAnalyzer struct { CharFilter []string `json:"char_filter,omitempty"` Filter []string `json:"filter,omitempty"` diff --git a/typedapi/types/customnormalizer.go b/typedapi/types/customnormalizer.go index 2be01e6a7e..118a1d5794 100644 --- a/typedapi/types/customnormalizer.go +++ b/typedapi/types/customnormalizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // CustomNormalizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/normalizers.ts#L30-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/normalizers.ts#L30-L34 type CustomNormalizer struct { CharFilter []string `json:"char_filter,omitempty"` Filter []string `json:"filter,omitempty"` diff --git a/typedapi/types/dailyschedule.go b/typedapi/types/dailyschedule.go index d8c893a35e..6772b85071 100644 --- a/typedapi/types/dailyschedule.go +++ b/typedapi/types/dailyschedule.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DailySchedule type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L33-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L33-L35 type DailySchedule struct { At []ScheduleTimeOfDay `json:"at"` } diff --git a/typedapi/types/danglingindex.go b/typedapi/types/danglingindex.go index ea12413ca9..1fbf082da2 100644 --- a/typedapi/types/danglingindex.go +++ b/typedapi/types/danglingindex.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DanglingIndex type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/dangling_indices/list_dangling_indices/ListDanglingIndicesResponse.ts#L29-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/dangling_indices/list_dangling_indices/ListDanglingIndicesResponse.ts#L29-L34 type DanglingIndex struct { CreationDateMillis int64 `json:"creation_date_millis"` IndexName string `json:"index_name"` diff --git a/typedapi/types/datacounts.go b/typedapi/types/datacounts.go index 8089d3591a..8bf14eec3b 100644 --- a/typedapi/types/datacounts.go +++ b/typedapi/types/datacounts.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataCounts type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L352-L372 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L352-L372 type DataCounts struct { BucketCount int64 `json:"bucket_count"` EarliestRecordTimestamp *int64 `json:"earliest_record_timestamp,omitempty"` diff --git a/typedapi/types/datadescription.go b/typedapi/types/datadescription.go index ea7a89604f..3cbd7eed35 100644 --- a/typedapi/types/datadescription.go +++ b/typedapi/types/datadescription.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataDescription type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L374-L390 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L374-L390 type DataDescription struct { FieldDelimiter *string `json:"field_delimiter,omitempty"` // Format Only JSON format is supported at this time. diff --git a/typedapi/types/dataemailattachment.go b/typedapi/types/dataemailattachment.go index c31a3c260b..005cdb721c 100644 --- a/typedapi/types/dataemailattachment.go +++ b/typedapi/types/dataemailattachment.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // DataEmailAttachment type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L234-L236 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L234-L236 type DataEmailAttachment struct { Format *dataattachmentformat.DataAttachmentFormat `json:"format,omitempty"` } diff --git a/typedapi/types/datafeedauthorization.go b/typedapi/types/datafeedauthorization.go index b10c13d294..6fddbcb552 100644 --- a/typedapi/types/datafeedauthorization.go +++ b/typedapi/types/datafeedauthorization.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DatafeedAuthorization type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Authorization.ts#L31-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Authorization.ts#L31-L43 type DatafeedAuthorization struct { // ApiKey If an API key was used for the most recent update to the datafeed, its name // and identifier are listed in the response. diff --git a/typedapi/types/datafeedconfig.go b/typedapi/types/datafeedconfig.go index 94f4b018d1..90cb8c65af 100644 --- a/typedapi/types/datafeedconfig.go +++ b/typedapi/types/datafeedconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DatafeedConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Datafeed.ts#L60-L117 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Datafeed.ts#L60-L117 type DatafeedConfig struct { // Aggregations If set, the datafeed performs aggregation searches. Support for aggregations // is limited and should be used only with low cardinality data. diff --git a/typedapi/types/datafeedrunningstate.go b/typedapi/types/datafeedrunningstate.go index c83a70c6be..a7281c1ffa 100644 --- a/typedapi/types/datafeedrunningstate.go +++ b/typedapi/types/datafeedrunningstate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DatafeedRunningState type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Datafeed.ts#L198-L212 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Datafeed.ts#L198-L212 type DatafeedRunningState struct { // RealTimeConfigured Indicates if the datafeed is "real-time"; meaning that the datafeed has no // configured `end` time. diff --git a/typedapi/types/datafeeds.go b/typedapi/types/datafeeds.go index 64931b1ef5..9ec36cfe95 100644 --- a/typedapi/types/datafeeds.go +++ b/typedapi/types/datafeeds.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Datafeeds type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/info/types.ts#L40-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/info/types.ts#L40-L42 type Datafeeds struct { ScrollSize int `json:"scroll_size"` } diff --git a/typedapi/types/datafeedsrecord.go b/typedapi/types/datafeedsrecord.go index cac6b5db09..15a3831060 100644 --- a/typedapi/types/datafeedsrecord.go +++ b/typedapi/types/datafeedsrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DatafeedsRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/ml_datafeeds/types.ts#L22-L87 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/ml_datafeeds/types.ts#L22-L87 type DatafeedsRecord struct { // AssignmentExplanation For started datafeeds only, contains messages relating to the selection of a // node. diff --git a/typedapi/types/datafeedstats.go b/typedapi/types/datafeedstats.go index c96863e30d..96dfd4720c 100644 --- a/typedapi/types/datafeedstats.go +++ b/typedapi/types/datafeedstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DatafeedStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Datafeed.ts#L140-L169 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Datafeed.ts#L140-L169 type DatafeedStats struct { // AssignmentExplanation For started datafeeds only, contains messages relating to the selection of a // node. diff --git a/typedapi/types/datafeedtimingstats.go b/typedapi/types/datafeedtimingstats.go index 396e0786fb..82e5a8ea92 100644 --- a/typedapi/types/datafeedtimingstats.go +++ b/typedapi/types/datafeedtimingstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DatafeedTimingStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Datafeed.ts#L171-L196 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Datafeed.ts#L171-L196 type DatafeedTimingStats struct { // AverageSearchTimePerBucketMs The average search time per bucket, in milliseconds. AverageSearchTimePerBucketMs Float64 `json:"average_search_time_per_bucket_ms,omitempty"` diff --git a/typedapi/types/dataframeanalysis.go b/typedapi/types/dataframeanalysis.go index 37c90186ec..f69d3df58f 100644 --- a/typedapi/types/dataframeanalysis.go +++ b/typedapi/types/dataframeanalysis.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalysis type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L134-L213 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L134-L213 type DataframeAnalysis struct { // Alpha Advanced configuration option. Machine learning uses loss guided tree // growing, which means that the decision trees grow where the regularized loss diff --git a/typedapi/types/dataframeanalysisanalyzedfields.go b/typedapi/types/dataframeanalysisanalyzedfields.go index 3cea77dfec..bffc12538b 100644 --- a/typedapi/types/dataframeanalysisanalyzedfields.go +++ b/typedapi/types/dataframeanalysisanalyzedfields.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataframeAnalysisAnalyzedFields type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L238-L244 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L238-L244 type DataframeAnalysisAnalyzedFields struct { // Excludes An array of strings that defines the fields that will be included in the // analysis. diff --git a/typedapi/types/dataframeanalysisclassification.go b/typedapi/types/dataframeanalysisclassification.go index f3aa9632d1..761f8d2651 100644 --- a/typedapi/types/dataframeanalysisclassification.go +++ b/typedapi/types/dataframeanalysisclassification.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalysisClassification type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L227-L236 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L227-L236 type DataframeAnalysisClassification struct { // Alpha Advanced configuration option. Machine learning uses loss guided tree // growing, which means that the decision trees grow where the regularized loss diff --git a/typedapi/types/dataframeanalysiscontainer.go b/typedapi/types/dataframeanalysiscontainer.go index e73bf32e7d..dcaae3c0cc 100644 --- a/typedapi/types/dataframeanalysiscontainer.go +++ b/typedapi/types/dataframeanalysiscontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DataframeAnalysisContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L84-L101 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L84-L101 type DataframeAnalysisContainer struct { // Classification The configuration information necessary to perform classification. Classification *DataframeAnalysisClassification `json:"classification,omitempty"` diff --git a/typedapi/types/dataframeanalysisfeatureprocessor.go b/typedapi/types/dataframeanalysisfeatureprocessor.go index b66460d943..1ffd00336a 100644 --- a/typedapi/types/dataframeanalysisfeatureprocessor.go +++ b/typedapi/types/dataframeanalysisfeatureprocessor.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DataframeAnalysisFeatureProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L246-L258 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L246-L258 type DataframeAnalysisFeatureProcessor struct { // FrequencyEncoding The configuration information necessary to perform frequency encoding. FrequencyEncoding *DataframeAnalysisFeatureProcessorFrequencyEncoding `json:"frequency_encoding,omitempty"` diff --git a/typedapi/types/dataframeanalysisfeatureprocessorfrequencyencoding.go b/typedapi/types/dataframeanalysisfeatureprocessorfrequencyencoding.go index f5e1a40d52..210652568c 100644 --- a/typedapi/types/dataframeanalysisfeatureprocessorfrequencyencoding.go +++ b/typedapi/types/dataframeanalysisfeatureprocessorfrequencyencoding.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataframeAnalysisFeatureProcessorFrequencyEncoding type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L260-L267 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L260-L267 type DataframeAnalysisFeatureProcessorFrequencyEncoding struct { // FeatureName The resulting feature name. FeatureName string `json:"feature_name"` diff --git a/typedapi/types/dataframeanalysisfeatureprocessormultiencoding.go b/typedapi/types/dataframeanalysisfeatureprocessormultiencoding.go index 147b4487a7..e74e4c7614 100644 --- a/typedapi/types/dataframeanalysisfeatureprocessormultiencoding.go +++ b/typedapi/types/dataframeanalysisfeatureprocessormultiencoding.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DataframeAnalysisFeatureProcessorMultiEncoding type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L269-L272 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L269-L272 type DataframeAnalysisFeatureProcessorMultiEncoding struct { // Processors The ordered array of custom processors to execute. Must be more than 1. Processors []int `json:"processors"` diff --git a/typedapi/types/dataframeanalysisfeatureprocessorngramencoding.go b/typedapi/types/dataframeanalysisfeatureprocessorngramencoding.go index cf3ea8ab3c..362a4b3fc3 100644 --- a/typedapi/types/dataframeanalysisfeatureprocessorngramencoding.go +++ b/typedapi/types/dataframeanalysisfeatureprocessorngramencoding.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalysisFeatureProcessorNGramEncoding type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L274-L286 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L274-L286 type DataframeAnalysisFeatureProcessorNGramEncoding struct { Custom *bool `json:"custom,omitempty"` // FeaturePrefix The feature name prefix. Defaults to ngram__. diff --git a/typedapi/types/dataframeanalysisfeatureprocessoronehotencoding.go b/typedapi/types/dataframeanalysisfeatureprocessoronehotencoding.go index e1786c9711..a385cf40ff 100644 --- a/typedapi/types/dataframeanalysisfeatureprocessoronehotencoding.go +++ b/typedapi/types/dataframeanalysisfeatureprocessoronehotencoding.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalysisFeatureProcessorOneHotEncoding type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L288-L293 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L288-L293 type DataframeAnalysisFeatureProcessorOneHotEncoding struct { // Field The name of the field to encode. Field string `json:"field"` diff --git a/typedapi/types/dataframeanalysisfeatureprocessortargetmeanencoding.go b/typedapi/types/dataframeanalysisfeatureprocessortargetmeanencoding.go index 793d2ec3cc..2e8fda65a3 100644 --- a/typedapi/types/dataframeanalysisfeatureprocessortargetmeanencoding.go +++ b/typedapi/types/dataframeanalysisfeatureprocessortargetmeanencoding.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalysisFeatureProcessorTargetMeanEncoding type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L295-L304 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L295-L304 type DataframeAnalysisFeatureProcessorTargetMeanEncoding struct { // DefaultValue The default value if field value is not found in the target_map. DefaultValue int `json:"default_value"` diff --git a/typedapi/types/dataframeanalysisoutlierdetection.go b/typedapi/types/dataframeanalysisoutlierdetection.go index bde6906e9e..923612e2b1 100644 --- a/typedapi/types/dataframeanalysisoutlierdetection.go +++ b/typedapi/types/dataframeanalysisoutlierdetection.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalysisOutlierDetection type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L103-L132 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L103-L132 type DataframeAnalysisOutlierDetection struct { // ComputeFeatureInfluence Specifies whether the feature influence calculation is enabled. ComputeFeatureInfluence *bool `json:"compute_feature_influence,omitempty"` diff --git a/typedapi/types/dataframeanalysisregression.go b/typedapi/types/dataframeanalysisregression.go index ee2d083813..b1c5542d52 100644 --- a/typedapi/types/dataframeanalysisregression.go +++ b/typedapi/types/dataframeanalysisregression.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalysisRegression type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L215-L225 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L215-L225 type DataframeAnalysisRegression struct { // Alpha Advanced configuration option. Machine learning uses loss guided tree // growing, which means that the decision trees grow where the regularized loss diff --git a/typedapi/types/dataframeanalytics.go b/typedapi/types/dataframeanalytics.go index 975603b6d2..d58055d823 100644 --- a/typedapi/types/dataframeanalytics.go +++ b/typedapi/types/dataframeanalytics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DataframeAnalytics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L324-L344 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L324-L344 type DataframeAnalytics struct { // AnalysisStats An object containing information about the analysis job. AnalysisStats *DataframeAnalyticsStatsContainer `json:"analysis_stats,omitempty"` diff --git a/typedapi/types/dataframeanalyticsauthorization.go b/typedapi/types/dataframeanalyticsauthorization.go index cc48f8ac67..f20281f83d 100644 --- a/typedapi/types/dataframeanalyticsauthorization.go +++ b/typedapi/types/dataframeanalyticsauthorization.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalyticsAuthorization type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Authorization.ts#L45-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Authorization.ts#L45-L57 type DataframeAnalyticsAuthorization struct { // ApiKey If an API key was used for the most recent update to the job, its name and // identifier are listed in the response. diff --git a/typedapi/types/dataframeanalyticsdestination.go b/typedapi/types/dataframeanalyticsdestination.go index a89b350f84..4d39ed918a 100644 --- a/typedapi/types/dataframeanalyticsdestination.go +++ b/typedapi/types/dataframeanalyticsdestination.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataframeAnalyticsDestination type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L77-L82 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L77-L82 type DataframeAnalyticsDestination struct { // Index Defines the destination index to store the results of the data frame // analytics job. diff --git a/typedapi/types/dataframeanalyticsfieldselection.go b/typedapi/types/dataframeanalyticsfieldselection.go index 71b48c2196..66b0be2acd 100644 --- a/typedapi/types/dataframeanalyticsfieldselection.go +++ b/typedapi/types/dataframeanalyticsfieldselection.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalyticsFieldSelection type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L55-L68 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L55-L68 type DataframeAnalyticsFieldSelection struct { // FeatureType The feature type of this field for the analysis. May be categorical or // numerical. diff --git a/typedapi/types/dataframeanalyticsmemoryestimation.go b/typedapi/types/dataframeanalyticsmemoryestimation.go index 4b671e9de5..93cea56d02 100644 --- a/typedapi/types/dataframeanalyticsmemoryestimation.go +++ b/typedapi/types/dataframeanalyticsmemoryestimation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalyticsMemoryEstimation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L70-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L70-L75 type DataframeAnalyticsMemoryEstimation struct { // ExpectedMemoryWithDisk Estimated memory usage under the assumption that overflowing to disk is // allowed during data frame analytics. expected_memory_with_disk is usually diff --git a/typedapi/types/dataframeanalyticsrecord.go b/typedapi/types/dataframeanalyticsrecord.go index 3a782a41ed..0e128cd686 100644 --- a/typedapi/types/dataframeanalyticsrecord.go +++ b/typedapi/types/dataframeanalyticsrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataFrameAnalyticsRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/ml_data_frame_analytics/types.ts#L22-L102 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/ml_data_frame_analytics/types.ts#L22-L102 type DataFrameAnalyticsRecord struct { // AssignmentExplanation Messages related to the selection of a node. AssignmentExplanation *string `json:"assignment_explanation,omitempty"` diff --git a/typedapi/types/dataframeanalyticssource.go b/typedapi/types/dataframeanalyticssource.go index 9b4d530a2c..df703eed88 100644 --- a/typedapi/types/dataframeanalyticssource.go +++ b/typedapi/types/dataframeanalyticssource.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataframeAnalyticsSource type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L39-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L39-L53 type DataframeAnalyticsSource struct { // Index Index or indices on which to perform the analysis. It can be a single index // or index pattern as well as an array of indices or patterns. NOTE: If your diff --git a/typedapi/types/dataframeanalyticsstatscontainer.go b/typedapi/types/dataframeanalyticsstatscontainer.go index 401bd5f293..61fe04212d 100644 --- a/typedapi/types/dataframeanalyticsstatscontainer.go +++ b/typedapi/types/dataframeanalyticsstatscontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DataframeAnalyticsStatsContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L373-L381 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L373-L381 type DataframeAnalyticsStatsContainer struct { // ClassificationStats An object containing information about the classification analysis job. ClassificationStats *DataframeAnalyticsStatsHyperparameters `json:"classification_stats,omitempty"` diff --git a/typedapi/types/dataframeanalyticsstatsdatacounts.go b/typedapi/types/dataframeanalyticsstatsdatacounts.go index cce0d5ade5..036402e8fc 100644 --- a/typedapi/types/dataframeanalyticsstatsdatacounts.go +++ b/typedapi/types/dataframeanalyticsstatsdatacounts.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalyticsStatsDataCounts type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L364-L371 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L364-L371 type DataframeAnalyticsStatsDataCounts struct { // SkippedDocsCount The number of documents that are skipped during the analysis because they // contained values that are not supported by the analysis. For example, outlier diff --git a/typedapi/types/dataframeanalyticsstatshyperparameters.go b/typedapi/types/dataframeanalyticsstatshyperparameters.go index 873c406f89..021ed016cf 100644 --- a/typedapi/types/dataframeanalyticsstatshyperparameters.go +++ b/typedapi/types/dataframeanalyticsstatshyperparameters.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalyticsStatsHyperparameters type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L383-L402 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L383-L402 type DataframeAnalyticsStatsHyperparameters struct { // Hyperparameters An object containing the parameters of the classification analysis job. Hyperparameters Hyperparameters `json:"hyperparameters"` diff --git a/typedapi/types/dataframeanalyticsstatsmemoryusage.go b/typedapi/types/dataframeanalyticsstatsmemoryusage.go index bf575a8e93..d73505ff28 100644 --- a/typedapi/types/dataframeanalyticsstatsmemoryusage.go +++ b/typedapi/types/dataframeanalyticsstatsmemoryusage.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalyticsStatsMemoryUsage type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L353-L362 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L353-L362 type DataframeAnalyticsStatsMemoryUsage struct { // MemoryReestimateBytes This value is present when the status is hard_limit and it is a new estimate // of how much memory the job needs. diff --git a/typedapi/types/dataframeanalyticsstatsoutlierdetection.go b/typedapi/types/dataframeanalyticsstatsoutlierdetection.go index 7276f9c599..be4a89aad4 100644 --- a/typedapi/types/dataframeanalyticsstatsoutlierdetection.go +++ b/typedapi/types/dataframeanalyticsstatsoutlierdetection.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataframeAnalyticsStatsOutlierDetection type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L404-L417 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L404-L417 type DataframeAnalyticsStatsOutlierDetection struct { // Parameters The list of job parameters specified by the user or determined by algorithmic // heuristics. diff --git a/typedapi/types/dataframeanalyticsstatsprogress.go b/typedapi/types/dataframeanalyticsstatsprogress.go index e54aee6b4a..ad7e8f465e 100644 --- a/typedapi/types/dataframeanalyticsstatsprogress.go +++ b/typedapi/types/dataframeanalyticsstatsprogress.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalyticsStatsProgress type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L346-L351 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L346-L351 type DataframeAnalyticsStatsProgress struct { // Phase Defines the phase of the data frame analytics job. Phase string `json:"phase"` diff --git a/typedapi/types/dataframeanalyticssummary.go b/typedapi/types/dataframeanalyticssummary.go index 174da729ad..4e5815bb33 100644 --- a/typedapi/types/dataframeanalyticssummary.go +++ b/typedapi/types/dataframeanalyticssummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeAnalyticsSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L306-L322 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L306-L322 type DataframeAnalyticsSummary struct { AllowLazyStart *bool `json:"allow_lazy_start,omitempty"` Analysis DataframeAnalysisContainer `json:"analysis"` diff --git a/typedapi/types/dataframeclassificationsummary.go b/typedapi/types/dataframeclassificationsummary.go index ca3b8377d6..a68d0a0493 100644 --- a/typedapi/types/dataframeclassificationsummary.go +++ b/typedapi/types/dataframeclassificationsummary.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DataframeClassificationSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L44-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L44-L66 type DataframeClassificationSummary struct { // Accuracy Accuracy of predictions (per-class and overall). Accuracy *DataframeClassificationSummaryAccuracy `json:"accuracy,omitempty"` diff --git a/typedapi/types/dataframeclassificationsummaryaccuracy.go b/typedapi/types/dataframeclassificationsummaryaccuracy.go index cce77fbaf8..d3c1afba51 100644 --- a/typedapi/types/dataframeclassificationsummaryaccuracy.go +++ b/typedapi/types/dataframeclassificationsummaryaccuracy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeClassificationSummaryAccuracy type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L111-L114 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L111-L114 type DataframeClassificationSummaryAccuracy struct { Classes []DataframeEvaluationClass `json:"classes"` OverallAccuracy Float64 `json:"overall_accuracy"` diff --git a/typedapi/types/dataframeclassificationsummarymulticlassconfusionmatrix.go b/typedapi/types/dataframeclassificationsummarymulticlassconfusionmatrix.go index 1f05e697ed..e667bf184e 100644 --- a/typedapi/types/dataframeclassificationsummarymulticlassconfusionmatrix.go +++ b/typedapi/types/dataframeclassificationsummarymulticlassconfusionmatrix.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeClassificationSummaryMulticlassConfusionMatrix type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L120-L123 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L120-L123 type DataframeClassificationSummaryMulticlassConfusionMatrix struct { ConfusionMatrix []ConfusionMatrixItem `json:"confusion_matrix"` OtherActualClassCount int `json:"other_actual_class_count"` diff --git a/typedapi/types/dataframeclassificationsummaryprecision.go b/typedapi/types/dataframeclassificationsummaryprecision.go index f673acbc6e..0282aa3c72 100644 --- a/typedapi/types/dataframeclassificationsummaryprecision.go +++ b/typedapi/types/dataframeclassificationsummaryprecision.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeClassificationSummaryPrecision type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L101-L104 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L101-L104 type DataframeClassificationSummaryPrecision struct { AvgPrecision Float64 `json:"avg_precision"` Classes []DataframeEvaluationClass `json:"classes"` diff --git a/typedapi/types/dataframeclassificationsummaryrecall.go b/typedapi/types/dataframeclassificationsummaryrecall.go index 27f0eb44b6..00a483816e 100644 --- a/typedapi/types/dataframeclassificationsummaryrecall.go +++ b/typedapi/types/dataframeclassificationsummaryrecall.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeClassificationSummaryRecall type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L106-L109 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L106-L109 type DataframeClassificationSummaryRecall struct { AvgRecall Float64 `json:"avg_recall"` Classes []DataframeEvaluationClass `json:"classes"` diff --git a/typedapi/types/dataframeevaluationclass.go b/typedapi/types/dataframeevaluationclass.go index 1275bcf17a..d969e2e497 100644 --- a/typedapi/types/dataframeevaluationclass.go +++ b/typedapi/types/dataframeevaluationclass.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeEvaluationClass type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L116-L118 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L116-L118 type DataframeEvaluationClass struct { ClassName string `json:"class_name"` Value Float64 `json:"value"` diff --git a/typedapi/types/dataframeevaluationclassification.go b/typedapi/types/dataframeevaluationclassification.go index 49c10a5938..87641ee03a 100644 --- a/typedapi/types/dataframeevaluationclassification.go +++ b/typedapi/types/dataframeevaluationclassification.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataframeEvaluationClassification type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L35-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L35-L44 type DataframeEvaluationClassification struct { // ActualField The field of the index which contains the ground truth. The data type of this // field can be boolean or integer. If the data type is integer, the value has diff --git a/typedapi/types/dataframeevaluationclassificationmetrics.go b/typedapi/types/dataframeevaluationclassificationmetrics.go index 11a376bc51..7109dd5b19 100644 --- a/typedapi/types/dataframeevaluationclassificationmetrics.go +++ b/typedapi/types/dataframeevaluationclassificationmetrics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // DataframeEvaluationClassificationMetrics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L73-L78 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L73-L78 type DataframeEvaluationClassificationMetrics struct { // Accuracy Accuracy of predictions (per-class and overall). Accuracy map[string]json.RawMessage `json:"accuracy,omitempty"` diff --git a/typedapi/types/dataframeevaluationclassificationmetricsaucroc.go b/typedapi/types/dataframeevaluationclassificationmetricsaucroc.go index a871c85eff..41989a2503 100644 --- a/typedapi/types/dataframeevaluationclassificationmetricsaucroc.go +++ b/typedapi/types/dataframeevaluationclassificationmetricsaucroc.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeEvaluationClassificationMetricsAucRoc type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L85-L90 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L85-L90 type DataframeEvaluationClassificationMetricsAucRoc struct { // ClassName Name of the only class that is treated as positive during AUC ROC // calculation. Other classes are treated as negative ("one-vs-all" strategy). diff --git a/typedapi/types/dataframeevaluationcontainer.go b/typedapi/types/dataframeevaluationcontainer.go index 3c6ead730a..7969f9c112 100644 --- a/typedapi/types/dataframeevaluationcontainer.go +++ b/typedapi/types/dataframeevaluationcontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DataframeEvaluationContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L25-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L25-L33 type DataframeEvaluationContainer struct { // Classification Classification evaluation evaluates the results of a classification analysis // which outputs a prediction that identifies to which of the classes each diff --git a/typedapi/types/dataframeevaluationmetrics.go b/typedapi/types/dataframeevaluationmetrics.go index ccd6675f4a..567c16bd60 100644 --- a/typedapi/types/dataframeevaluationmetrics.go +++ b/typedapi/types/dataframeevaluationmetrics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // DataframeEvaluationMetrics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L64-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L64-L71 type DataframeEvaluationMetrics struct { // AucRoc The AUC ROC (area under the curve of the receiver operating characteristic) // score and optionally the curve. It is calculated for a specific class diff --git a/typedapi/types/dataframeevaluationoutlierdetection.go b/typedapi/types/dataframeevaluationoutlierdetection.go index 841c13d988..d8e60a1283 100644 --- a/typedapi/types/dataframeevaluationoutlierdetection.go +++ b/typedapi/types/dataframeevaluationoutlierdetection.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataframeEvaluationOutlierDetection type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L46-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L46-L53 type DataframeEvaluationOutlierDetection struct { // ActualField The field of the index which contains the ground truth. The data type of this // field can be boolean or integer. If the data type is integer, the value has diff --git a/typedapi/types/dataframeevaluationoutlierdetectionmetrics.go b/typedapi/types/dataframeevaluationoutlierdetectionmetrics.go index 001c4d5e8c..d9151ba0f1 100644 --- a/typedapi/types/dataframeevaluationoutlierdetectionmetrics.go +++ b/typedapi/types/dataframeevaluationoutlierdetectionmetrics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // DataframeEvaluationOutlierDetectionMetrics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L80-L83 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L80-L83 type DataframeEvaluationOutlierDetectionMetrics struct { // AucRoc The AUC ROC (area under the curve of the receiver operating characteristic) // score and optionally the curve. It is calculated for a specific class diff --git a/typedapi/types/dataframeevaluationregression.go b/typedapi/types/dataframeevaluationregression.go index f95df5d0a0..a96e79cfb8 100644 --- a/typedapi/types/dataframeevaluationregression.go +++ b/typedapi/types/dataframeevaluationregression.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataframeEvaluationRegression type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L55-L62 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L55-L62 type DataframeEvaluationRegression struct { // ActualField The field of the index which contains the ground truth. The data type of this // field must be numerical. diff --git a/typedapi/types/dataframeevaluationregressionmetrics.go b/typedapi/types/dataframeevaluationregressionmetrics.go index 6645854830..a45bde90d2 100644 --- a/typedapi/types/dataframeevaluationregressionmetrics.go +++ b/typedapi/types/dataframeevaluationregressionmetrics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // DataframeEvaluationRegressionMetrics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L92-L110 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L92-L110 type DataframeEvaluationRegressionMetrics struct { // Huber Pseudo Huber loss function. Huber *DataframeEvaluationRegressionMetricsHuber `json:"huber,omitempty"` diff --git a/typedapi/types/dataframeevaluationregressionmetricshuber.go b/typedapi/types/dataframeevaluationregressionmetricshuber.go index a71fa4ec34..750d5fe0cf 100644 --- a/typedapi/types/dataframeevaluationregressionmetricshuber.go +++ b/typedapi/types/dataframeevaluationregressionmetricshuber.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeEvaluationRegressionMetricsHuber type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L117-L120 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L117-L120 type DataframeEvaluationRegressionMetricsHuber struct { // Delta Approximates 1/2 (prediction - actual)2 for values much less than delta and // approximates a straight line with slope delta for values much larger than diff --git a/typedapi/types/dataframeevaluationregressionmetricsmsle.go b/typedapi/types/dataframeevaluationregressionmetricsmsle.go index bbecd7d8b2..ff68b3287f 100644 --- a/typedapi/types/dataframeevaluationregressionmetricsmsle.go +++ b/typedapi/types/dataframeevaluationregressionmetricsmsle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeEvaluationRegressionMetricsMsle type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeEvaluation.ts#L112-L115 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeEvaluation.ts#L112-L115 type DataframeEvaluationRegressionMetricsMsle struct { // Offset Defines the transition point at which you switch from minimizing quadratic // error to minimizing quadratic log error. Defaults to 1. diff --git a/typedapi/types/dataframeevaluationsummaryaucroc.go b/typedapi/types/dataframeevaluationsummaryaucroc.go index caa0ef63d3..c91b7b043b 100644 --- a/typedapi/types/dataframeevaluationsummaryaucroc.go +++ b/typedapi/types/dataframeevaluationsummaryaucroc.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeEvaluationSummaryAucRoc type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L91-L93 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L91-L93 type DataframeEvaluationSummaryAucRoc struct { Curve []DataframeEvaluationSummaryAucRocCurveItem `json:"curve,omitempty"` Value Float64 `json:"value"` diff --git a/typedapi/types/dataframeevaluationsummaryaucroccurveitem.go b/typedapi/types/dataframeevaluationsummaryaucroccurveitem.go index 9e0abea98c..e2f0d49e4d 100644 --- a/typedapi/types/dataframeevaluationsummaryaucroccurveitem.go +++ b/typedapi/types/dataframeevaluationsummaryaucroccurveitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeEvaluationSummaryAucRocCurveItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L95-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L95-L99 type DataframeEvaluationSummaryAucRocCurveItem struct { Fpr Float64 `json:"fpr"` Threshold Float64 `json:"threshold"` diff --git a/typedapi/types/dataframeevaluationvalue.go b/typedapi/types/dataframeevaluationvalue.go index be7c8985be..381e7d5a2c 100644 --- a/typedapi/types/dataframeevaluationvalue.go +++ b/typedapi/types/dataframeevaluationvalue.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframeEvaluationValue type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L87-L89 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L87-L89 type DataframeEvaluationValue struct { Value Float64 `json:"value"` } diff --git a/typedapi/types/dataframeoutlierdetectionsummary.go b/typedapi/types/dataframeoutlierdetectionsummary.go index c8389c1e4d..02dd8bf819 100644 --- a/typedapi/types/dataframeoutlierdetectionsummary.go +++ b/typedapi/types/dataframeoutlierdetectionsummary.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DataframeOutlierDetectionSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L24-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L24-L42 type DataframeOutlierDetectionSummary struct { // AucRoc The AUC ROC (area under the curve of the receiver operating characteristic) // score and optionally the curve. diff --git a/typedapi/types/dataframepreviewconfig.go b/typedapi/types/dataframepreviewconfig.go index 121e17b9d5..752efb92b6 100644 --- a/typedapi/types/dataframepreviewconfig.go +++ b/typedapi/types/dataframepreviewconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataframePreviewConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/preview_data_frame_analytics/types.ts#L27-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/preview_data_frame_analytics/types.ts#L27-L33 type DataframePreviewConfig struct { Analysis DataframeAnalysisContainer `json:"analysis"` AnalyzedFields *DataframeAnalysisAnalyzedFields `json:"analyzed_fields,omitempty"` diff --git a/typedapi/types/dataframeregressionsummary.go b/typedapi/types/dataframeregressionsummary.go index 7abee432bc..9da3387715 100644 --- a/typedapi/types/dataframeregressionsummary.go +++ b/typedapi/types/dataframeregressionsummary.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DataframeRegressionSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/evaluate_data_frame/types.ts#L68-L85 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/evaluate_data_frame/types.ts#L68-L85 type DataframeRegressionSummary struct { // Huber Pseudo Huber loss function. Huber *DataframeEvaluationValue `json:"huber,omitempty"` diff --git a/typedapi/types/datapathstats.go b/typedapi/types/datapathstats.go index c2bb4f677b..b66f83c204 100644 --- a/typedapi/types/datapathstats.go +++ b/typedapi/types/datapathstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataPathStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L550-L594 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L550-L594 type DataPathStats struct { // Available Total amount of disk space available to this Java virtual machine on this // file store. diff --git a/typedapi/types/datastream.go b/typedapi/types/datastream.go index 3b17e63d00..f69aac666d 100644 --- a/typedapi/types/datastream.go +++ b/typedapi/types/datastream.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -28,11 +28,12 @@ import ( "strconv" "github.com/elastic/go-elasticsearch/v8/typedapi/types/enums/healthstatus" + "github.com/elastic/go-elasticsearch/v8/typedapi/types/enums/managedby" ) // DataStream type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/DataStream.ts#L33-L105 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/DataStream.ts#L43-L116 type DataStream struct { // AllowCustomRouting If `true`, the data stream allows custom routing on write request. AllowCustomRouting *bool `json:"allow_custom_routing,omitempty"` @@ -66,7 +67,7 @@ type DataStream struct { Name string `json:"name"` // NextGenerationManagedBy Name of the lifecycle system that'll manage the next generation of the data // stream. - NextGenerationManagedBy ManagedBy `json:"next_generation_managed_by"` + NextGenerationManagedBy managedby.ManagedBy `json:"next_generation_managed_by"` // PreferIlm Indicates if ILM should take precedence over DSL in case both are configured // to managed this data stream. PreferIlm bool `json:"prefer_ilm"` diff --git a/typedapi/types/datastreamindex.go b/typedapi/types/datastreamindex.go index dbc4813a17..5a2fbac70d 100644 --- a/typedapi/types/datastreamindex.go +++ b/typedapi/types/datastreamindex.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,11 +26,13 @@ import ( "errors" "io" "strconv" + + "github.com/elastic/go-elasticsearch/v8/typedapi/types/enums/managedby" ) // DataStreamIndex type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/DataStream.ts#L114-L135 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/DataStream.ts#L125-L146 type DataStreamIndex struct { // IlmPolicy Name of the current ILM lifecycle policy configured for this backing index. IlmPolicy *string `json:"ilm_policy,omitempty"` @@ -39,7 +41,7 @@ type DataStreamIndex struct { // IndexUuid Universally unique identifier (UUID) for the index. IndexUuid string `json:"index_uuid"` // ManagedBy Name of the lifecycle system that's currently managing this backing index. - ManagedBy ManagedBy `json:"managed_by"` + ManagedBy managedby.ManagedBy `json:"managed_by"` // PreferIlm Indicates if ILM should take precedence over DSL in case both are configured // to manage this index. PreferIlm bool `json:"prefer_ilm"` diff --git a/typedapi/types/datastreamlifecycle.go b/typedapi/types/datastreamlifecycle.go index fce813494c..e39eb6ee44 100644 --- a/typedapi/types/datastreamlifecycle.go +++ b/typedapi/types/datastreamlifecycle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataStreamLifecycle type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/DataStreamLifecycle.ts#L25-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/DataStreamLifecycle.ts#L25-L31 type DataStreamLifecycle struct { DataRetention Duration `json:"data_retention,omitempty"` Downsampling *DataStreamLifecycleDownsampling `json:"downsampling,omitempty"` diff --git a/typedapi/types/datastreamlifecycledownsampling.go b/typedapi/types/datastreamlifecycledownsampling.go index e4adab8144..d4bc7bd98f 100644 --- a/typedapi/types/datastreamlifecycledownsampling.go +++ b/typedapi/types/datastreamlifecycledownsampling.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DataStreamLifecycleDownsampling type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/DataStreamLifecycleDownsampling.ts#L22-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/DataStreamLifecycleDownsampling.ts#L22-L27 type DataStreamLifecycleDownsampling struct { // Rounds The list of downsampling rounds to execute as part of this downsampling // configuration diff --git a/typedapi/types/datastreamlifecycleexplain.go b/typedapi/types/datastreamlifecycleexplain.go index 0810f900bf..a2389f169a 100644 --- a/typedapi/types/datastreamlifecycleexplain.go +++ b/typedapi/types/datastreamlifecycleexplain.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataStreamLifecycleExplain type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/explain_data_lifecycle/IndicesExplainDataLifecycleResponse.ts#L31-L41 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/explain_data_lifecycle/IndicesExplainDataLifecycleResponse.ts#L31-L41 type DataStreamLifecycleExplain struct { Error *string `json:"error,omitempty"` GenerationTime Duration `json:"generation_time,omitempty"` diff --git a/typedapi/types/datastreamlifecyclerolloverconditions.go b/typedapi/types/datastreamlifecyclerolloverconditions.go index e94c66a0fd..a38baa78ca 100644 --- a/typedapi/types/datastreamlifecyclerolloverconditions.go +++ b/typedapi/types/datastreamlifecyclerolloverconditions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataStreamLifecycleRolloverConditions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/DataStreamLifecycle.ts#L57-L69 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/DataStreamLifecycle.ts#L57-L69 type DataStreamLifecycleRolloverConditions struct { MaxAge *string `json:"max_age,omitempty"` MaxDocs *int64 `json:"max_docs,omitempty"` diff --git a/typedapi/types/datastreamlifecyclewithrollover.go b/typedapi/types/datastreamlifecyclewithrollover.go index 79654e2dbd..d429dd278c 100644 --- a/typedapi/types/datastreamlifecyclewithrollover.go +++ b/typedapi/types/datastreamlifecyclewithrollover.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataStreamLifecycleWithRollover type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/DataStreamLifecycle.ts#L33-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/DataStreamLifecycle.ts#L33-L55 type DataStreamLifecycleWithRollover struct { // DataRetention If defined, every document added to this data stream will be stored at least // for this time frame. diff --git a/typedapi/types/datastreamnames.go b/typedapi/types/datastreamnames.go index 109c9685bb..0902081cc5 100644 --- a/typedapi/types/datastreamnames.go +++ b/typedapi/types/datastreamnames.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DataStreamNames type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L93-L93 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L94-L94 type DataStreamNames []string diff --git a/typedapi/types/datastreams.go b/typedapi/types/datastreams.go index a45bc8f18b..6c7f2cd82f 100644 --- a/typedapi/types/datastreams.go +++ b/typedapi/types/datastreams.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataStreams type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L81-L84 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L81-L84 type DataStreams struct { Available bool `json:"available"` DataStreams int64 `json:"data_streams"` diff --git a/typedapi/types/datastreamsstatsitem.go b/typedapi/types/datastreamsstatsitem.go index 5a6c93bbe4..052d6d7358 100644 --- a/typedapi/types/datastreamsstatsitem.go +++ b/typedapi/types/datastreamsstatsitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataStreamsStatsItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/data_streams_stats/IndicesDataStreamsStatsResponse.ts#L45-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/data_streams_stats/IndicesDataStreamsStatsResponse.ts#L45-L65 type DataStreamsStatsItem struct { // BackingIndices Current number of backing indices for the data stream. BackingIndices int `json:"backing_indices"` diff --git a/typedapi/types/datastreamtimestamp.go b/typedapi/types/datastreamtimestamp.go index a48f32bbca..308b74e119 100644 --- a/typedapi/types/datastreamtimestamp.go +++ b/typedapi/types/datastreamtimestamp.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataStreamTimestamp type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/TypeMapping.ts#L58-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/TypeMapping.ts#L58-L60 type DataStreamTimestamp struct { Enabled bool `json:"enabled"` } diff --git a/typedapi/types/datastreamtimestampfield.go b/typedapi/types/datastreamtimestampfield.go index aa8695fef0..654413978b 100644 --- a/typedapi/types/datastreamtimestampfield.go +++ b/typedapi/types/datastreamtimestampfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataStreamTimestampField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/DataStream.ts#L107-L112 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/DataStream.ts#L118-L123 type DataStreamTimestampField struct { // Name Name of the timestamp field for the data stream, which must be `@timestamp`. // The `@timestamp` field must be included in every document indexed to the data diff --git a/typedapi/types/datastreamvisibility.go b/typedapi/types/datastreamvisibility.go index a9df36b98c..2bd69598a2 100644 --- a/typedapi/types/datastreamvisibility.go +++ b/typedapi/types/datastreamvisibility.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataStreamVisibility type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/DataStream.ts#L137-L139 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/DataStream.ts#L148-L150 type DataStreamVisibility struct { Hidden *bool `json:"hidden,omitempty"` } diff --git a/typedapi/types/datastreamwithlifecycle.go b/typedapi/types/datastreamwithlifecycle.go index 15d93e2977..25b9c84099 100644 --- a/typedapi/types/datastreamwithlifecycle.go +++ b/typedapi/types/datastreamwithlifecycle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DataStreamWithLifecycle type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_data_lifecycle/IndicesGetDataLifecycleResponse.ts#L27-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_data_lifecycle/IndicesGetDataLifecycleResponse.ts#L27-L30 type DataStreamWithLifecycle struct { Lifecycle *DataStreamLifecycle `json:"lifecycle,omitempty"` Name string `json:"name"` diff --git a/typedapi/types/datatierphasestatistics.go b/typedapi/types/datatierphasestatistics.go index eed768e929..06e25360da 100644 --- a/typedapi/types/datatierphasestatistics.go +++ b/typedapi/types/datatierphasestatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataTierPhaseStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L86-L97 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L86-L97 type DataTierPhaseStatistics struct { DocCount int64 `json:"doc_count"` IndexCount int64 `json:"index_count"` diff --git a/typedapi/types/datatiers.go b/typedapi/types/datatiers.go index ed639544b4..382a2d0438 100644 --- a/typedapi/types/datatiers.go +++ b/typedapi/types/datatiers.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DataTiers type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L339-L349 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L339-L349 type DataTiers struct { Available bool `json:"available"` DataCold DataTierPhaseStatistics `json:"data_cold"` diff --git a/typedapi/types/datedecayfunction.go b/typedapi/types/datedecayfunction.go index 1cd27b4e17..d7aba3826e 100644 --- a/typedapi/types/datedecayfunction.go +++ b/typedapi/types/datedecayfunction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DateDecayFunction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L186-L188 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L186-L188 type DateDecayFunction struct { DateDecayFunction map[string]DecayPlacementDateMathDuration `json:"DateDecayFunction,omitempty"` // MultiValueMode Determines how the distance is calculated when a field used for computing the diff --git a/typedapi/types/datedistancefeaturequery.go b/typedapi/types/datedistancefeaturequery.go index e5f9b2cbae..8cfd70a79b 100644 --- a/typedapi/types/datedistancefeaturequery.go +++ b/typedapi/types/datedistancefeaturequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DateDistanceFeatureQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L67-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L67-L70 type DateDistanceFeatureQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/datehistogramaggregate.go b/typedapi/types/datehistogramaggregate.go index f5794a545a..0ea9c9bf47 100644 --- a/typedapi/types/datehistogramaggregate.go +++ b/typedapi/types/datehistogramaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DateHistogramAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L348-L349 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L348-L349 type DateHistogramAggregate struct { Buckets BucketsDateHistogramBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/datehistogramaggregation.go b/typedapi/types/datehistogramaggregation.go index c888704459..26ad309436 100644 --- a/typedapi/types/datehistogramaggregation.go +++ b/typedapi/types/datehistogramaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // DateHistogramAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L189-L247 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L189-L247 type DateHistogramAggregation struct { // CalendarInterval Calendar-aware interval. // Can be specified using the unit name, such as `month`, or as a single unit diff --git a/typedapi/types/datehistogrambucket.go b/typedapi/types/datehistogrambucket.go index 3876caedc9..1a5b9f2407 100644 --- a/typedapi/types/datehistogrambucket.go +++ b/typedapi/types/datehistogrambucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DateHistogramBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L351-L354 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L351-L354 type DateHistogramBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/datehistogramgrouping.go b/typedapi/types/datehistogramgrouping.go index 0da5627fe9..12ddbceb16 100644 --- a/typedapi/types/datehistogramgrouping.go +++ b/typedapi/types/datehistogramgrouping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DateHistogramGrouping type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/_types/Groupings.ts#L42-L73 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/_types/Groupings.ts#L42-L73 type DateHistogramGrouping struct { // CalendarInterval The interval of time buckets to be generated when rolling up. CalendarInterval Duration `json:"calendar_interval,omitempty"` diff --git a/typedapi/types/dateindexnameprocessor.go b/typedapi/types/dateindexnameprocessor.go index a7e1cb0ee6..ed5f80b01d 100644 --- a/typedapi/types/dateindexnameprocessor.go +++ b/typedapi/types/dateindexnameprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DateIndexNameProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L491-L529 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L491-L529 type DateIndexNameProcessor struct { // DateFormats An array of the expected date formats for parsing dates / timestamps in the // document being preprocessed. diff --git a/typedapi/types/datenanosproperty.go b/typedapi/types/datenanosproperty.go index 77a946510a..2a116a404d 100644 --- a/typedapi/types/datenanosproperty.go +++ b/typedapi/types/datenanosproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DateNanosProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L73-L81 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L73-L81 type DateNanosProperty struct { Boost *Float64 `json:"boost,omitempty"` CopyTo []string `json:"copy_to,omitempty"` @@ -237,6 +237,12 @@ func (s *DateNanosProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -623,6 +629,12 @@ func (s *DateNanosProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/dateprocessor.go b/typedapi/types/dateprocessor.go index aa3c8386ec..c5c04c891e 100644 --- a/typedapi/types/dateprocessor.go +++ b/typedapi/types/dateprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DateProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L531-L558 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L531-L558 type DateProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/dateproperty.go b/typedapi/types/dateproperty.go index abfa6d19cf..70498577a4 100644 --- a/typedapi/types/dateproperty.go +++ b/typedapi/types/dateproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DateProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L61-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L61-L71 type DateProperty struct { Boost *Float64 `json:"boost,omitempty"` CopyTo []string `json:"copy_to,omitempty"` @@ -244,6 +244,12 @@ func (s *DateProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -642,6 +648,12 @@ func (s *DateProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/daterangeaggregate.go b/typedapi/types/daterangeaggregate.go index bdbc2cf3b9..fd859ebfc5 100644 --- a/typedapi/types/daterangeaggregate.go +++ b/typedapi/types/daterangeaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DateRangeAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L543-L548 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L543-L548 type DateRangeAggregate struct { Buckets BucketsRangeBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/daterangeaggregation.go b/typedapi/types/daterangeaggregation.go index 5834520066..2b18412c3d 100644 --- a/typedapi/types/daterangeaggregation.go +++ b/typedapi/types/daterangeaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DateRangeAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L268-L294 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L268-L294 type DateRangeAggregation struct { // Field The date field whose values are use to build ranges. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/daterangeexpression.go b/typedapi/types/daterangeexpression.go index d402468f1e..a243994e20 100644 --- a/typedapi/types/daterangeexpression.go +++ b/typedapi/types/daterangeexpression.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DateRangeExpression type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L305-L318 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L305-L318 type DateRangeExpression struct { // From Start of the range (inclusive). From FieldDateMath `json:"from,omitempty"` diff --git a/typedapi/types/daterangeproperty.go b/typedapi/types/daterangeproperty.go index 6d95db506d..70792a607d 100644 --- a/typedapi/types/daterangeproperty.go +++ b/typedapi/types/daterangeproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DateRangeProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/range.ts#L29-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/range.ts#L29-L32 type DateRangeProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -249,6 +249,12 @@ func (s *DateRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -600,6 +606,12 @@ func (s *DateRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/daterangequery.go b/typedapi/types/daterangequery.go index b977064b86..987973ea7e 100644 --- a/typedapi/types/daterangequery.go +++ b/typedapi/types/daterangequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DateRangeQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L116-L143 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L116-L143 type DateRangeQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/datetime.go b/typedapi/types/datetime.go index 3189c306e8..d56be3d620 100644 --- a/typedapi/types/datetime.go +++ b/typedapi/types/datetime.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // int64 // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Time.ts#L22-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Time.ts#L22-L27 type DateTime interface{} diff --git a/typedapi/types/decayfunction.go b/typedapi/types/decayfunction.go index 72ed998ab3..b5746b6316 100644 --- a/typedapi/types/decayfunction.go +++ b/typedapi/types/decayfunction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ package types // NumericDecayFunction // GeoDecayFunction // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L194-L199 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L194-L199 type DecayFunction interface{} diff --git a/typedapi/types/decayplacementdatemathduration.go b/typedapi/types/decayplacementdatemathduration.go index 972603c050..87313cc1ef 100644 --- a/typedapi/types/decayplacementdatemathduration.go +++ b/typedapi/types/decayplacementdatemathduration.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DecayPlacementDateMathDuration type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L153-L172 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L153-L172 type DecayPlacementDateMathDuration struct { // Decay Defines how documents are scored at the distance given at scale. Decay *Float64 `json:"decay,omitempty"` diff --git a/typedapi/types/decayplacementdoubledouble.go b/typedapi/types/decayplacementdoubledouble.go index 9919882cc2..071407ac0d 100644 --- a/typedapi/types/decayplacementdoubledouble.go +++ b/typedapi/types/decayplacementdoubledouble.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DecayPlacementdoubledouble type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L153-L172 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L153-L172 type DecayPlacementdoubledouble struct { // Decay Defines how documents are scored at the distance given at scale. Decay *Float64 `json:"decay,omitempty"` diff --git a/typedapi/types/decayplacementgeolocationdistance.go b/typedapi/types/decayplacementgeolocationdistance.go index 3f6c009e3c..9001ff7540 100644 --- a/typedapi/types/decayplacementgeolocationdistance.go +++ b/typedapi/types/decayplacementgeolocationdistance.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DecayPlacementGeoLocationDistance type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L153-L172 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L153-L172 type DecayPlacementGeoLocationDistance struct { // Decay Defines how documents are scored at the distance given at scale. Decay *Float64 `json:"decay,omitempty"` diff --git a/typedapi/types/defaults.go b/typedapi/types/defaults.go index 493f1d364a..561094bca2 100644 --- a/typedapi/types/defaults.go +++ b/typedapi/types/defaults.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Defaults type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/info/types.ts#L24-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/info/types.ts#L24-L27 type Defaults struct { AnomalyDetectors AnomalyDetectors `json:"anomaly_detectors"` Datafeeds Datafeeds `json:"datafeeds"` diff --git a/typedapi/types/definition.go b/typedapi/types/definition.go index 7e29d79855..5f1ae95d3f 100644 --- a/typedapi/types/definition.go +++ b/typedapi/types/definition.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Definition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L24-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L24-L29 type Definition struct { // Preprocessors Collection of preprocessors Preprocessors []Preprocessor `json:"preprocessors,omitempty"` diff --git a/typedapi/types/delayeddatacheckconfig.go b/typedapi/types/delayeddatacheckconfig.go index 44975d6b66..a2c6085a45 100644 --- a/typedapi/types/delayeddatacheckconfig.go +++ b/typedapi/types/delayeddatacheckconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DelayedDataCheckConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Datafeed.ts#L119-L130 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Datafeed.ts#L119-L130 type DelayedDataCheckConfig struct { // CheckWindow The window of time that is searched for late data. This window of time ends // with the latest finalized bucket. diff --git a/typedapi/types/deleteoperation.go b/typedapi/types/deleteoperation.go index e122a261a6..6baa2baac9 100644 --- a/typedapi/types/deleteoperation.go +++ b/typedapi/types/deleteoperation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DeleteOperation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/types.ts#L134-L134 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/types.ts#L134-L134 type DeleteOperation struct { // Id_ The document ID. Id_ *string `json:"_id,omitempty"` diff --git a/typedapi/types/delimitedpayloadtokenfilter.go b/typedapi/types/delimitedpayloadtokenfilter.go index dbe9d0285f..1dc9a3636a 100644 --- a/typedapi/types/delimitedpayloadtokenfilter.go +++ b/typedapi/types/delimitedpayloadtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DelimitedPayloadTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L68-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L68-L72 type DelimitedPayloadTokenFilter struct { Delimiter *string `json:"delimiter,omitempty"` Encoding *delimitedpayloadencoding.DelimitedPayloadEncoding `json:"encoding,omitempty"` diff --git a/typedapi/types/densevectorindexoptions.go b/typedapi/types/densevectorindexoptions.go index 48a2519f4f..9c1bf4053a 100644 --- a/typedapi/types/densevectorindexoptions.go +++ b/typedapi/types/densevectorindexoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DenseVectorIndexOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/DenseVectorIndexOptions.ts#L22-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/DenseVectorIndexOptions.ts#L22-L26 type DenseVectorIndexOptions struct { EfConstruction int `json:"ef_construction"` M int `json:"m"` diff --git a/typedapi/types/densevectorproperty.go b/typedapi/types/densevectorproperty.go index f5846efca2..cb03d922d5 100644 --- a/typedapi/types/densevectorproperty.go +++ b/typedapi/types/densevectorproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DenseVectorProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/complex.ts#L51-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/complex.ts#L51-L57 type DenseVectorProperty struct { Dims int `json:"dims"` Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` @@ -201,6 +201,12 @@ func (s *DenseVectorProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -545,6 +551,12 @@ func (s *DenseVectorProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/deprecation.go b/typedapi/types/deprecation.go index bcaf537982..519ef3cf80 100644 --- a/typedapi/types/deprecation.go +++ b/typedapi/types/deprecation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // Deprecation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/migration/deprecations/types.ts#L29-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/migration/deprecations/types.ts#L29-L35 type Deprecation struct { Details string `json:"details"` // Level The level property describes the significance of the issue. diff --git a/typedapi/types/deprecationindexing.go b/typedapi/types/deprecationindexing.go index 4c3c17a5eb..0e4ede231d 100644 --- a/typedapi/types/deprecationindexing.go +++ b/typedapi/types/deprecationindexing.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DeprecationIndexing type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L143-L145 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L143-L145 type DeprecationIndexing struct { Enabled string `json:"enabled"` } diff --git a/typedapi/types/derivativeaggregate.go b/typedapi/types/derivativeaggregate.go index c579c8ecb4..54732276a0 100644 --- a/typedapi/types/derivativeaggregate.go +++ b/typedapi/types/derivativeaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DerivativeAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L227-L231 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L227-L231 type DerivativeAggregate struct { Meta Metadata `json:"meta,omitempty"` NormalizedValue *Float64 `json:"normalized_value,omitempty"` diff --git a/typedapi/types/derivativeaggregation.go b/typedapi/types/derivativeaggregation.go index 2fd060d772..292273b248 100644 --- a/typedapi/types/derivativeaggregation.go +++ b/typedapi/types/derivativeaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DerivativeAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L196-L196 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L196-L196 type DerivativeAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/detectionrule.go b/typedapi/types/detectionrule.go index 7503e05f7a..ba043d8e7d 100644 --- a/typedapi/types/detectionrule.go +++ b/typedapi/types/detectionrule.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // DetectionRule type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Rule.ts#L25-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Rule.ts#L25-L39 type DetectionRule struct { // Actions The set of actions to be triggered when the rule applies. If more than one // action is specified the effects of all actions are combined. diff --git a/typedapi/types/detector.go b/typedapi/types/detector.go index 76ee180ab4..e22e771ec9 100644 --- a/typedapi/types/detector.go +++ b/typedapi/types/detector.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // Detector type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Detector.ts#L25-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Detector.ts#L25-L67 type Detector struct { // ByFieldName The field used to split the data. In particular, this property is used for // analyzing the splits with respect to their own history. It is used for diff --git a/typedapi/types/detectorread.go b/typedapi/types/detectorread.go index 108051896c..42551580e5 100644 --- a/typedapi/types/detectorread.go +++ b/typedapi/types/detectorread.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DetectorRead type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Detector.ts#L69-L125 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Detector.ts#L69-L125 type DetectorRead struct { // ByFieldName The field used to split the data. // In particular, this property is used for analyzing the splits with respect to diff --git a/typedapi/types/diagnosis.go b/typedapi/types/diagnosis.go index 340bcff44f..e284eae030 100644 --- a/typedapi/types/diagnosis.go +++ b/typedapi/types/diagnosis.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Diagnosis type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L49-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L49-L55 type Diagnosis struct { Action string `json:"action"` AffectedResources DiagnosisAffectedResources `json:"affected_resources"` diff --git a/typedapi/types/diagnosisaffectedresources.go b/typedapi/types/diagnosisaffectedresources.go index b14e6c6d9f..9fcd6775dd 100644 --- a/typedapi/types/diagnosisaffectedresources.go +++ b/typedapi/types/diagnosisaffectedresources.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DiagnosisAffectedResources type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L57-L63 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L57-L63 type DiagnosisAffectedResources struct { FeatureStates []string `json:"feature_states,omitempty"` Indices []string `json:"indices,omitempty"` diff --git a/typedapi/types/dictionarydecompoundertokenfilter.go b/typedapi/types/dictionarydecompoundertokenfilter.go index ff5a1b8f22..cf66fcac81 100644 --- a/typedapi/types/dictionarydecompoundertokenfilter.go +++ b/typedapi/types/dictionarydecompoundertokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DictionaryDecompounderTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L54-L56 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L54-L56 type DictionaryDecompounderTokenFilter struct { HyphenationPatternsPath *string `json:"hyphenation_patterns_path,omitempty"` MaxSubwordSize *int `json:"max_subword_size,omitempty"` diff --git a/typedapi/types/directgenerator.go b/typedapi/types/directgenerator.go index b08a903c59..7c8d36602a 100644 --- a/typedapi/types/directgenerator.go +++ b/typedapi/types/directgenerator.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DirectGenerator type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L265-L328 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L265-L328 type DirectGenerator struct { // Field The field to fetch the candidate suggestions from. // Needs to be set globally or per suggestion. diff --git a/typedapi/types/discovery.go b/typedapi/types/discovery.go index db78dd6844..08e5555bae 100644 --- a/typedapi/types/discovery.go +++ b/typedapi/types/discovery.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Discovery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L201-L219 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L201-L219 type Discovery struct { ClusterApplierStats *ClusterAppliedStats `json:"cluster_applier_stats,omitempty"` // ClusterStateQueue Contains statistics for the cluster state queue of the node. diff --git a/typedapi/types/discoverynode.go b/typedapi/types/discoverynode.go index 95fdf0f372..b57cb7b255 100644 --- a/typedapi/types/discoverynode.go +++ b/typedapi/types/discoverynode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DiscoveryNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DiscoveryNode.ts#L24-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DiscoveryNode.ts#L24-L30 type DiscoveryNode struct { Attributes map[string]string `json:"attributes"` EphemeralId string `json:"ephemeral_id"` diff --git a/typedapi/types/diskindicator.go b/typedapi/types/diskindicator.go index 040c734d3d..3f7b054d8a 100644 --- a/typedapi/types/diskindicator.go +++ b/typedapi/types/diskindicator.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DiskIndicator type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L121-L125 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L121-L125 type DiskIndicator struct { Details *DiskIndicatorDetails `json:"details,omitempty"` Diagnosis []Diagnosis `json:"diagnosis,omitempty"` diff --git a/typedapi/types/diskindicatordetails.go b/typedapi/types/diskindicatordetails.go index 17aaba4062..664ab37d17 100644 --- a/typedapi/types/diskindicatordetails.go +++ b/typedapi/types/diskindicatordetails.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DiskIndicatorDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L126-L132 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L126-L132 type DiskIndicatorDetails struct { IndicesWithReadonlyBlock int64 `json:"indices_with_readonly_block"` NodesOverFloodStageWatermark int64 `json:"nodes_over_flood_stage_watermark"` diff --git a/typedapi/types/diskusage.go b/typedapi/types/diskusage.go index a5a5d70ca4..86e0dbffbe 100644 --- a/typedapi/types/diskusage.go +++ b/typedapi/types/diskusage.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DiskUsage type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L62-L69 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L62-L69 type DiskUsage struct { FreeBytes int64 `json:"free_bytes"` FreeDiskPercent Float64 `json:"free_disk_percent"` diff --git a/typedapi/types/dismaxquery.go b/typedapi/types/dismaxquery.go index 15da647bec..1bfc06b62e 100644 --- a/typedapi/types/dismaxquery.go +++ b/typedapi/types/dismaxquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DisMaxQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L78-L90 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L78-L90 type DisMaxQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/dissectprocessor.go b/typedapi/types/dissectprocessor.go index 57083d84c7..a494b0904f 100644 --- a/typedapi/types/dissectprocessor.go +++ b/typedapi/types/dissectprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DissectProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L560-L579 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L560-L579 type DissectProcessor struct { // AppendSeparator The character(s) that separate the appended fields. AppendSeparator *string `json:"append_separator,omitempty"` diff --git a/typedapi/types/distancefeaturequery.go b/typedapi/types/distancefeaturequery.go index 4b0c8839df..f020ab5060 100644 --- a/typedapi/types/distancefeaturequery.go +++ b/typedapi/types/distancefeaturequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // GeoDistanceFeatureQuery // DateDistanceFeatureQuery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L72-L76 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L72-L76 type DistanceFeatureQuery interface{} diff --git a/typedapi/types/distancefeaturequerybasedatemathduration.go b/typedapi/types/distancefeaturequerybasedatemathduration.go index f8bdbd6fba..a35d246945 100644 --- a/typedapi/types/distancefeaturequerybasedatemathduration.go +++ b/typedapi/types/distancefeaturequerybasedatemathduration.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DistanceFeatureQueryBaseDateMathDuration type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L40-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L40-L60 type DistanceFeatureQueryBaseDateMathDuration struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/distancefeaturequerybasegeolocationdistance.go b/typedapi/types/distancefeaturequerybasegeolocationdistance.go index b6c4e4bf89..ee78aad283 100644 --- a/typedapi/types/distancefeaturequerybasegeolocationdistance.go +++ b/typedapi/types/distancefeaturequerybasegeolocationdistance.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DistanceFeatureQueryBaseGeoLocationDistance type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L40-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L40-L60 type DistanceFeatureQueryBaseGeoLocationDistance struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/diversifiedsampleraggregation.go b/typedapi/types/diversifiedsampleraggregation.go index c749aed2fd..27d4bfbc1d 100644 --- a/typedapi/types/diversifiedsampleraggregation.go +++ b/typedapi/types/diversifiedsampleraggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DiversifiedSamplerAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L320-L341 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L320-L341 type DiversifiedSamplerAggregation struct { // ExecutionHint The type of value used for de-duplication. ExecutionHint *sampleraggregationexecutionhint.SamplerAggregationExecutionHint `json:"execution_hint,omitempty"` diff --git a/typedapi/types/docstats.go b/typedapi/types/docstats.go index 8262dcc320..2f004516e4 100644 --- a/typedapi/types/docstats.go +++ b/typedapi/types/docstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DocStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L97-L109 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L97-L109 type DocStats struct { // Count Total number of non-deleted documents across all primary shards assigned to // selected nodes. diff --git a/typedapi/types/document.go b/typedapi/types/document.go index 52251fd83b..002f365fdf 100644 --- a/typedapi/types/document.go +++ b/typedapi/types/document.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Document type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/simulate/types.ts#L41-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/simulate/types.ts#L41-L55 type Document struct { // Id_ Unique identifier for the document. // This ID must be unique within the `_index`. diff --git a/typedapi/types/documentrating.go b/typedapi/types/documentrating.go index 5c6d4a933b..052979ea2d 100644 --- a/typedapi/types/documentrating.go +++ b/typedapi/types/documentrating.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DocumentRating type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L116-L123 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L116-L123 type DocumentRating struct { // Id_ The document ID. Id_ string `json:"_id"` diff --git a/typedapi/types/documentsimulation.go b/typedapi/types/documentsimulation.go index 5b1a45d3ba..2417b38489 100644 --- a/typedapi/types/documentsimulation.go +++ b/typedapi/types/documentsimulation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // DocumentSimulation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/simulate/types.ts#L57-L85 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/simulate/types.ts#L57-L85 type DocumentSimulation struct { DocumentSimulation map[string]string `json:"-"` // Id_ Unique identifier for the document. This ID must be unique within the diff --git a/typedapi/types/dotexpanderprocessor.go b/typedapi/types/dotexpanderprocessor.go index 4d1386fc6e..73bdf0db2b 100644 --- a/typedapi/types/dotexpanderprocessor.go +++ b/typedapi/types/dotexpanderprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DotExpanderProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L581-L592 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L581-L592 type DotExpanderProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/doublenumberproperty.go b/typedapi/types/doublenumberproperty.go index ed8c4aee36..6ae58fa077 100644 --- a/typedapi/types/doublenumberproperty.go +++ b/typedapi/types/doublenumberproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // DoubleNumberProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L144-L147 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L144-L147 type DoubleNumberProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -260,6 +260,12 @@ func (s *DoubleNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -634,6 +640,12 @@ func (s *DoubleNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/doublerangeproperty.go b/typedapi/types/doublerangeproperty.go index 3103a1dd71..618edc8615 100644 --- a/typedapi/types/doublerangeproperty.go +++ b/typedapi/types/doublerangeproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DoubleRangeProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/range.ts#L34-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/range.ts#L34-L36 type DoubleRangeProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -248,6 +248,12 @@ func (s *DoubleRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -587,6 +593,12 @@ func (s *DoubleRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/doubletermsaggregate.go b/typedapi/types/doubletermsaggregate.go index 91db4901b5..d425ef84cf 100644 --- a/typedapi/types/doubletermsaggregate.go +++ b/typedapi/types/doubletermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DoubleTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L411-L416 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L411-L416 type DoubleTermsAggregate struct { Buckets BucketsDoubleTermsBucket `json:"buckets"` DocCountErrorUpperBound *int64 `json:"doc_count_error_upper_bound,omitempty"` diff --git a/typedapi/types/doubletermsbucket.go b/typedapi/types/doubletermsbucket.go index a3a65b37b0..067e3a385b 100644 --- a/typedapi/types/doubletermsbucket.go +++ b/typedapi/types/doubletermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DoubleTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L418-L421 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L418-L421 type DoubleTermsBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/downsampleconfig.go b/typedapi/types/downsampleconfig.go index 3261cf1146..a66f00278b 100644 --- a/typedapi/types/downsampleconfig.go +++ b/typedapi/types/downsampleconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DownsampleConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/Downsample.ts#L22-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/Downsample.ts#L22-L27 type DownsampleConfig struct { // FixedInterval The interval at which to aggregate the original time series index. FixedInterval string `json:"fixed_interval"` diff --git a/typedapi/types/downsamplinground.go b/typedapi/types/downsamplinground.go index 0a2b5e95d2..e19eddfc35 100644 --- a/typedapi/types/downsamplinground.go +++ b/typedapi/types/downsamplinground.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DownsamplingRound type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/DownsamplingRound.ts#L23-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/DownsamplingRound.ts#L23-L32 type DownsamplingRound struct { // After The duration since rollover when this downsampling round should execute After Duration `json:"after"` diff --git a/typedapi/types/dropprocessor.go b/typedapi/types/dropprocessor.go index 00a7bb560b..fa6eb79ec6 100644 --- a/typedapi/types/dropprocessor.go +++ b/typedapi/types/dropprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // DropProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L594-L594 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L594-L594 type DropProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/duration.go b/typedapi/types/duration.go index bbcfb6a6ba..d8b2ca7c2a 100644 --- a/typedapi/types/duration.go +++ b/typedapi/types/duration.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -24,5 +24,5 @@ package types // // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Time.ts#L52-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Time.ts#L52-L58 type Duration interface{} diff --git a/typedapi/types/durationvalueunitfloatmillis.go b/typedapi/types/durationvalueunitfloatmillis.go index e70cb89194..657a0db11c 100644 --- a/typedapi/types/durationvalueunitfloatmillis.go +++ b/typedapi/types/durationvalueunitfloatmillis.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DurationValueUnitFloatMillis type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Time.ts#L67-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Time.ts#L67-L67 type DurationValueUnitFloatMillis Float64 diff --git a/typedapi/types/durationvalueunitmillis.go b/typedapi/types/durationvalueunitmillis.go index 0cb5bf57cf..e18360ad30 100644 --- a/typedapi/types/durationvalueunitmillis.go +++ b/typedapi/types/durationvalueunitmillis.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DurationValueUnitMillis type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Time.ts#L67-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Time.ts#L67-L67 type DurationValueUnitMillis int64 diff --git a/typedapi/types/durationvalueunitnanos.go b/typedapi/types/durationvalueunitnanos.go index d63873e57b..00d0c6b0e4 100644 --- a/typedapi/types/durationvalueunitnanos.go +++ b/typedapi/types/durationvalueunitnanos.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DurationValueUnitNanos type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Time.ts#L67-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Time.ts#L67-L67 type DurationValueUnitNanos int64 diff --git a/typedapi/types/durationvalueunitseconds.go b/typedapi/types/durationvalueunitseconds.go index dc45775541..f61b07b497 100644 --- a/typedapi/types/durationvalueunitseconds.go +++ b/typedapi/types/durationvalueunitseconds.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // DurationValueUnitSeconds type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Time.ts#L67-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Time.ts#L67-L67 type DurationValueUnitSeconds int64 diff --git a/typedapi/types/dutchanalyzer.go b/typedapi/types/dutchanalyzer.go index d7b87d98fb..f71b8bc075 100644 --- a/typedapi/types/dutchanalyzer.go +++ b/typedapi/types/dutchanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // DutchAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L61-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L61-L64 type DutchAnalyzer struct { Stopwords []string `json:"stopwords,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/dynamicproperty.go b/typedapi/types/dynamicproperty.go index 6c933c710c..9d36c6aeeb 100644 --- a/typedapi/types/dynamicproperty.go +++ b/typedapi/types/dynamicproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -36,7 +36,7 @@ import ( // DynamicProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L285-L316 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L285-L316 type DynamicProperty struct { Analyzer *string `json:"analyzer,omitempty"` Boost *Float64 `json:"boost,omitempty"` @@ -311,6 +311,12 @@ func (s *DynamicProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -768,6 +774,12 @@ func (s *DynamicProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/dynamictemplate.go b/typedapi/types/dynamictemplate.go index 0dd8557b22..cbd5cee985 100644 --- a/typedapi/types/dynamictemplate.go +++ b/typedapi/types/dynamictemplate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // DynamicTemplate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/dynamic-template.ts#L22-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/dynamic-template.ts#L22-L30 type DynamicTemplate struct { Mapping Property `json:"mapping,omitempty"` Match *string `json:"match,omitempty"` @@ -174,6 +174,12 @@ func (s *DynamicTemplate) UnmarshalJSON(data []byte) error { return err } s.Mapping = *o + case "sparse_vector": + o := NewSparseVectorProperty() + if err := localDec.Decode(&o); err != nil { + return err + } + s.Mapping = *o case "flattened": o := NewFlattenedProperty() if err := localDec.Decode(&o); err != nil { diff --git a/typedapi/types/edgengramtokenfilter.go b/typedapi/types/edgengramtokenfilter.go index fd35bd5b65..96e0356cad 100644 --- a/typedapi/types/edgengramtokenfilter.go +++ b/typedapi/types/edgengramtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // EdgeNGramTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L79-L85 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L79-L85 type EdgeNGramTokenFilter struct { MaxGram *int `json:"max_gram,omitempty"` MinGram *int `json:"min_gram,omitempty"` diff --git a/typedapi/types/edgengramtokenizer.go b/typedapi/types/edgengramtokenizer.go index 327338d791..565599e747 100644 --- a/typedapi/types/edgengramtokenizer.go +++ b/typedapi/types/edgengramtokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // EdgeNGramTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L31-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L31-L37 type EdgeNGramTokenizer struct { CustomTokenChars *string `json:"custom_token_chars,omitempty"` MaxGram int `json:"max_gram"` diff --git a/typedapi/types/elasticsearchversioninfo.go b/typedapi/types/elasticsearchversioninfo.go index f739402de8..0cf71de9df 100644 --- a/typedapi/types/elasticsearchversioninfo.go +++ b/typedapi/types/elasticsearchversioninfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ElasticsearchVersionInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Base.ts#L54-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Base.ts#L54-L64 type ElasticsearchVersionInfo struct { BuildDate DateTime `json:"build_date"` BuildFlavor string `json:"build_flavor"` diff --git a/typedapi/types/elisiontokenfilter.go b/typedapi/types/elisiontokenfilter.go index 5dfa7ce77a..b6c612a8c9 100644 --- a/typedapi/types/elisiontokenfilter.go +++ b/typedapi/types/elisiontokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ElisionTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L187-L192 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L187-L192 type ElisionTokenFilter struct { Articles []string `json:"articles,omitempty"` ArticlesCase Stringifiedboolean `json:"articles_case,omitempty"` diff --git a/typedapi/types/email.go b/typedapi/types/email.go index 67f429eb48..2ea05ace7d 100644 --- a/typedapi/types/email.go +++ b/typedapi/types/email.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // Email type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L238-L250 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L238-L250 type Email struct { Attachments map[string]EmailAttachmentContainer `json:"attachments,omitempty"` Bcc []string `json:"bcc,omitempty"` diff --git a/typedapi/types/emailaction.go b/typedapi/types/emailaction.go index 167d881b3d..127265a5cb 100644 --- a/typedapi/types/emailaction.go +++ b/typedapi/types/emailaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // EmailAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L252-L252 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L252-L252 type EmailAction struct { Attachments map[string]EmailAttachmentContainer `json:"attachments,omitempty"` Bcc []string `json:"bcc,omitempty"` diff --git a/typedapi/types/emailattachmentcontainer.go b/typedapi/types/emailattachmentcontainer.go index 03796b9be7..75eb7406cd 100644 --- a/typedapi/types/emailattachmentcontainer.go +++ b/typedapi/types/emailattachmentcontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // EmailAttachmentContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L211-L216 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L211-L216 type EmailAttachmentContainer struct { Data *DataEmailAttachment `json:"data,omitempty"` Http *HttpEmailAttachment `json:"http,omitempty"` diff --git a/typedapi/types/emailbody.go b/typedapi/types/emailbody.go index 2825e3a514..23f0347ec5 100644 --- a/typedapi/types/emailbody.go +++ b/typedapi/types/emailbody.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // EmailBody type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L192-L195 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L192-L195 type EmailBody struct { Html *string `json:"html,omitempty"` Text *string `json:"text,omitempty"` diff --git a/typedapi/types/emailresult.go b/typedapi/types/emailresult.go index 9e315d6c30..3868ac1514 100644 --- a/typedapi/types/emailresult.go +++ b/typedapi/types/emailresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // EmailResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L205-L209 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L205-L209 type EmailResult struct { Account *string `json:"account,omitempty"` Message Email `json:"message"` diff --git a/typedapi/types/emptyobject.go b/typedapi/types/emptyobject.go index 1291d75152..fb789a89e7 100644 --- a/typedapi/types/emptyobject.go +++ b/typedapi/types/emptyobject.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // EmptyObject type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L159-L160 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L160-L161 type EmptyObject struct { } diff --git a/typedapi/types/enrichpolicy.go b/typedapi/types/enrichpolicy.go index ec246460ed..2f70d1a2b9 100644 --- a/typedapi/types/enrichpolicy.go +++ b/typedapi/types/enrichpolicy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,14 +30,14 @@ import ( // EnrichPolicy type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/_types/Policy.ts#L33-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/_types/Policy.ts#L34-L41 type EnrichPolicy struct { ElasticsearchVersion *string `json:"elasticsearch_version,omitempty"` EnrichFields []string `json:"enrich_fields"` Indices []string `json:"indices"` MatchField string `json:"match_field"` Name *string `json:"name,omitempty"` - Query *string `json:"query,omitempty"` + Query *Query `json:"query,omitempty"` } func (s *EnrichPolicy) UnmarshalJSON(data []byte) error { @@ -110,16 +110,9 @@ func (s *EnrichPolicy) UnmarshalJSON(data []byte) error { } case "query": - var tmp json.RawMessage - if err := dec.Decode(&tmp); err != nil { + if err := dec.Decode(&s.Query); err != nil { return err } - o := string(tmp[:]) - o, err = strconv.Unquote(o) - if err != nil { - o = string(tmp[:]) - } - s.Query = &o } } diff --git a/typedapi/types/enrichprocessor.go b/typedapi/types/enrichprocessor.go index f612ef478d..07661c630a 100644 --- a/typedapi/types/enrichprocessor.go +++ b/typedapi/types/enrichprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // EnrichProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L596-L635 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L596-L635 type EnrichProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/ensemble.go b/typedapi/types/ensemble.go index 00648038e4..546554e628 100644 --- a/typedapi/types/ensemble.go +++ b/typedapi/types/ensemble.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Ensemble type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L93-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L93-L99 type Ensemble struct { AggregateOutput *AggregateOutput `json:"aggregate_output,omitempty"` ClassificationLabels []string `json:"classification_labels,omitempty"` diff --git a/typedapi/types/enums/accesstokengranttype/accesstokengranttype.go b/typedapi/types/enums/accesstokengranttype/accesstokengranttype.go index 287e01290b..6bc490298b 100644 --- a/typedapi/types/enums/accesstokengranttype/accesstokengranttype.go +++ b/typedapi/types/enums/accesstokengranttype/accesstokengranttype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package accesstokengranttype package accesstokengranttype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_token/types.ts#L23-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_token/types.ts#L23-L28 type AccessTokenGrantType struct { Name string } diff --git a/typedapi/types/enums/acknowledgementoptions/acknowledgementoptions.go b/typedapi/types/enums/acknowledgementoptions/acknowledgementoptions.go index 03614fe003..e253407609 100644 --- a/typedapi/types/enums/acknowledgementoptions/acknowledgementoptions.go +++ b/typedapi/types/enums/acknowledgementoptions/acknowledgementoptions.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package acknowledgementoptions package acknowledgementoptions import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L109-L113 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L109-L113 type AcknowledgementOptions struct { Name string } diff --git a/typedapi/types/enums/actionexecutionmode/actionexecutionmode.go b/typedapi/types/enums/actionexecutionmode/actionexecutionmode.go index 8b39f65c5b..87e5acda97 100644 --- a/typedapi/types/enums/actionexecutionmode/actionexecutionmode.go +++ b/typedapi/types/enums/actionexecutionmode/actionexecutionmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package actionexecutionmode package actionexecutionmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L73-L94 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L73-L94 type ActionExecutionMode struct { Name string } diff --git a/typedapi/types/enums/actionstatusoptions/actionstatusoptions.go b/typedapi/types/enums/actionstatusoptions/actionstatusoptions.go index e3fbd2e3ca..81c20f03cc 100644 --- a/typedapi/types/enums/actionstatusoptions/actionstatusoptions.go +++ b/typedapi/types/enums/actionstatusoptions/actionstatusoptions.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package actionstatusoptions package actionstatusoptions import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L102-L107 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L102-L107 type ActionStatusOptions struct { Name string } diff --git a/typedapi/types/enums/actiontype/actiontype.go b/typedapi/types/enums/actiontype/actiontype.go index c7da4fa621..ad94c7a642 100644 --- a/typedapi/types/enums/actiontype/actiontype.go +++ b/typedapi/types/enums/actiontype/actiontype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package actiontype package actiontype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L64-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L64-L71 type ActionType struct { Name string } diff --git a/typedapi/types/enums/allocationexplaindecision/allocationexplaindecision.go b/typedapi/types/enums/allocationexplaindecision/allocationexplaindecision.go index 11bf771523..1479999a67 100644 --- a/typedapi/types/enums/allocationexplaindecision/allocationexplaindecision.go +++ b/typedapi/types/enums/allocationexplaindecision/allocationexplaindecision.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package allocationexplaindecision package allocationexplaindecision import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L32-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L32-L37 type AllocationExplainDecision struct { Name string } diff --git a/typedapi/types/enums/apikeygranttype/apikeygranttype.go b/typedapi/types/enums/apikeygranttype/apikeygranttype.go index 2870442abe..18d6d34c7c 100644 --- a/typedapi/types/enums/apikeygranttype/apikeygranttype.go +++ b/typedapi/types/enums/apikeygranttype/apikeygranttype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package apikeygranttype package apikeygranttype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/grant_api_key/types.ts#L48-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/grant_api_key/types.ts#L48-L51 type ApiKeyGrantType struct { Name string } diff --git a/typedapi/types/enums/appliesto/appliesto.go b/typedapi/types/enums/appliesto/appliesto.go index c294056bd4..a0de14e30c 100644 --- a/typedapi/types/enums/appliesto/appliesto.go +++ b/typedapi/types/enums/appliesto/appliesto.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package appliesto package appliesto import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Rule.ts#L67-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Rule.ts#L67-L72 type AppliesTo struct { Name string } diff --git a/typedapi/types/enums/boundaryscanner/boundaryscanner.go b/typedapi/types/enums/boundaryscanner/boundaryscanner.go index 5c0db12f2f..d4d991019b 100644 --- a/typedapi/types/enums/boundaryscanner/boundaryscanner.go +++ b/typedapi/types/enums/boundaryscanner/boundaryscanner.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package boundaryscanner package boundaryscanner import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/highlighting.ts#L27-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/highlighting.ts#L27-L46 type BoundaryScanner struct { Name string } diff --git a/typedapi/types/enums/bytes/bytes.go b/typedapi/types/enums/bytes/bytes.go index 3fe0079f23..2480e27ec6 100644 --- a/typedapi/types/enums/bytes/bytes.go +++ b/typedapi/types/enums/bytes/bytes.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package bytes package bytes import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L168-L186 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L169-L187 type Bytes struct { Name string } diff --git a/typedapi/types/enums/calendarinterval/calendarinterval.go b/typedapi/types/enums/calendarinterval/calendarinterval.go index 9b6c168810..dd41c2dbe5 100644 --- a/typedapi/types/enums/calendarinterval/calendarinterval.go +++ b/typedapi/types/enums/calendarinterval/calendarinterval.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package calendarinterval package calendarinterval import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L249-L266 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L249-L266 type CalendarInterval struct { Name string } diff --git a/typedapi/types/enums/cardinalityexecutionmode/cardinalityexecutionmode.go b/typedapi/types/enums/cardinalityexecutionmode/cardinalityexecutionmode.go index 4203b84dd8..32ebf06200 100644 --- a/typedapi/types/enums/cardinalityexecutionmode/cardinalityexecutionmode.go +++ b/typedapi/types/enums/cardinalityexecutionmode/cardinalityexecutionmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package cardinalityexecutionmode package cardinalityexecutionmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L64-L85 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L64-L85 type CardinalityExecutionMode struct { Name string } diff --git a/typedapi/types/enums/catanomalydetectorcolumn/catanomalydetectorcolumn.go b/typedapi/types/enums/catanomalydetectorcolumn/catanomalydetectorcolumn.go index 2127e7ead8..bdae38a67e 100644 --- a/typedapi/types/enums/catanomalydetectorcolumn/catanomalydetectorcolumn.go +++ b/typedapi/types/enums/catanomalydetectorcolumn/catanomalydetectorcolumn.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package catanomalydetectorcolumn package catanomalydetectorcolumn import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/_types/CatBase.ts#L32-L401 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/_types/CatBase.ts#L32-L401 type CatAnomalyDetectorColumn struct { Name string } diff --git a/typedapi/types/enums/catdatafeedcolumn/catdatafeedcolumn.go b/typedapi/types/enums/catdatafeedcolumn/catdatafeedcolumn.go index 13979d7043..e139df5456 100644 --- a/typedapi/types/enums/catdatafeedcolumn/catdatafeedcolumn.go +++ b/typedapi/types/enums/catdatafeedcolumn/catdatafeedcolumn.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package catdatafeedcolumn package catdatafeedcolumn import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/_types/CatBase.ts#L405-L471 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/_types/CatBase.ts#L405-L471 type CatDatafeedColumn struct { Name string } diff --git a/typedapi/types/enums/catdfacolumn/catdfacolumn.go b/typedapi/types/enums/catdfacolumn/catdfacolumn.go index 8ccf6bec7d..1af45885fb 100644 --- a/typedapi/types/enums/catdfacolumn/catdfacolumn.go +++ b/typedapi/types/enums/catdfacolumn/catdfacolumn.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package catdfacolumn package catdfacolumn import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/_types/CatBase.ts#L472-L557 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/_types/CatBase.ts#L472-L557 type CatDfaColumn struct { Name string } diff --git a/typedapi/types/enums/categorizationstatus/categorizationstatus.go b/typedapi/types/enums/categorizationstatus/categorizationstatus.go index 0ceca08543..d7cc24fa7a 100644 --- a/typedapi/types/enums/categorizationstatus/categorizationstatus.go +++ b/typedapi/types/enums/categorizationstatus/categorizationstatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package categorizationstatus package categorizationstatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Model.ts#L83-L86 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Model.ts#L83-L86 type CategorizationStatus struct { Name string } diff --git a/typedapi/types/enums/cattrainedmodelscolumn/cattrainedmodelscolumn.go b/typedapi/types/enums/cattrainedmodelscolumn/cattrainedmodelscolumn.go index 98c9f44c2d..ed43a60462 100644 --- a/typedapi/types/enums/cattrainedmodelscolumn/cattrainedmodelscolumn.go +++ b/typedapi/types/enums/cattrainedmodelscolumn/cattrainedmodelscolumn.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package cattrainedmodelscolumn package cattrainedmodelscolumn import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/_types/CatBase.ts#L561-L635 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/_types/CatBase.ts#L561-L635 type CatTrainedModelsColumn struct { Name string } diff --git a/typedapi/types/enums/cattransformcolumn/cattransformcolumn.go b/typedapi/types/enums/cattransformcolumn/cattransformcolumn.go index 832fb5d22f..6f6a9cb183 100644 --- a/typedapi/types/enums/cattransformcolumn/cattransformcolumn.go +++ b/typedapi/types/enums/cattransformcolumn/cattransformcolumn.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package cattransformcolumn package cattransformcolumn import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/_types/CatBase.ts#L640-L844 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/_types/CatBase.ts#L640-L844 type CatTransformColumn struct { Name string } diff --git a/typedapi/types/enums/childscoremode/childscoremode.go b/typedapi/types/enums/childscoremode/childscoremode.go index 402982fef8..a979252f86 100644 --- a/typedapi/types/enums/childscoremode/childscoremode.go +++ b/typedapi/types/enums/childscoremode/childscoremode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package childscoremode package childscoremode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/joining.ts#L25-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/joining.ts#L25-L39 type ChildScoreMode struct { Name string } diff --git a/typedapi/types/enums/chunkingmode/chunkingmode.go b/typedapi/types/enums/chunkingmode/chunkingmode.go index 9ca64429d5..c487691f1d 100644 --- a/typedapi/types/enums/chunkingmode/chunkingmode.go +++ b/typedapi/types/enums/chunkingmode/chunkingmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package chunkingmode package chunkingmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Datafeed.ts#L233-L237 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Datafeed.ts#L233-L237 type ChunkingMode struct { Name string } diff --git a/typedapi/types/enums/clusterinfotarget/clusterinfotarget.go b/typedapi/types/enums/clusterinfotarget/clusterinfotarget.go index 8807bfbe9f..2202906b52 100644 --- a/typedapi/types/enums/clusterinfotarget/clusterinfotarget.go +++ b/typedapi/types/enums/clusterinfotarget/clusterinfotarget.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package clusterinfotarget package clusterinfotarget import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L383-L389 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L384-L390 type ClusterInfoTarget struct { Name string } diff --git a/typedapi/types/enums/clusterprivilege/clusterprivilege.go b/typedapi/types/enums/clusterprivilege/clusterprivilege.go index 5692d3dd94..5ef6cc6a6a 100644 --- a/typedapi/types/enums/clusterprivilege/clusterprivilege.go +++ b/typedapi/types/enums/clusterprivilege/clusterprivilege.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package clusterprivilege package clusterprivilege import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L41-L80 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L41-L80 type ClusterPrivilege struct { Name string } diff --git a/typedapi/types/enums/clustersearchstatus/clustersearchstatus.go b/typedapi/types/enums/clustersearchstatus/clustersearchstatus.go index 6955c0ec70..2d83084284 100644 --- a/typedapi/types/enums/clustersearchstatus/clustersearchstatus.go +++ b/typedapi/types/enums/clustersearchstatus/clustersearchstatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package clustersearchstatus package clustersearchstatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L37-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L37-L43 type ClusterSearchStatus struct { Name string } diff --git a/typedapi/types/enums/combinedfieldsoperator/combinedfieldsoperator.go b/typedapi/types/enums/combinedfieldsoperator/combinedfieldsoperator.go index 7f47a84fc7..ae2da38d41 100644 --- a/typedapi/types/enums/combinedfieldsoperator/combinedfieldsoperator.go +++ b/typedapi/types/enums/combinedfieldsoperator/combinedfieldsoperator.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package combinedfieldsoperator package combinedfieldsoperator import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/abstractions.ts#L473-L476 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/abstractions.ts#L473-L476 type CombinedFieldsOperator struct { Name string } diff --git a/typedapi/types/enums/combinedfieldszeroterms/combinedfieldszeroterms.go b/typedapi/types/enums/combinedfieldszeroterms/combinedfieldszeroterms.go index 677ce5c274..e06d6be607 100644 --- a/typedapi/types/enums/combinedfieldszeroterms/combinedfieldszeroterms.go +++ b/typedapi/types/enums/combinedfieldszeroterms/combinedfieldszeroterms.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package combinedfieldszeroterms package combinedfieldszeroterms import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/abstractions.ts#L478-L487 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/abstractions.ts#L478-L487 type CombinedFieldsZeroTerms struct { Name string } diff --git a/typedapi/types/enums/conditionop/conditionop.go b/typedapi/types/enums/conditionop/conditionop.go index b4bf8832a3..59d6d2219d 100644 --- a/typedapi/types/enums/conditionop/conditionop.go +++ b/typedapi/types/enums/conditionop/conditionop.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package conditionop package conditionop import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Conditions.ts#L38-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Conditions.ts#L38-L45 type ConditionOp struct { Name string } diff --git a/typedapi/types/enums/conditionoperator/conditionoperator.go b/typedapi/types/enums/conditionoperator/conditionoperator.go index 5c411d970e..0cd179749e 100644 --- a/typedapi/types/enums/conditionoperator/conditionoperator.go +++ b/typedapi/types/enums/conditionoperator/conditionoperator.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package conditionoperator package conditionoperator import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Rule.ts#L74-L79 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Rule.ts#L74-L79 type ConditionOperator struct { Name string } diff --git a/typedapi/types/enums/conditiontype/conditiontype.go b/typedapi/types/enums/conditiontype/conditiontype.go index 9fe12e3243..5b7042e702 100644 --- a/typedapi/types/enums/conditiontype/conditiontype.go +++ b/typedapi/types/enums/conditiontype/conditiontype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package conditiontype package conditiontype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Conditions.ts#L61-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Conditions.ts#L61-L67 type ConditionType struct { Name string } diff --git a/typedapi/types/enums/conflicts/conflicts.go b/typedapi/types/enums/conflicts/conflicts.go index 4f0637f9cd..51ba37fdff 100644 --- a/typedapi/types/enums/conflicts/conflicts.go +++ b/typedapi/types/enums/conflicts/conflicts.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package conflicts package conflicts import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L188-L197 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L189-L198 type Conflicts struct { Name string } diff --git a/typedapi/types/enums/connectionscheme/connectionscheme.go b/typedapi/types/enums/connectionscheme/connectionscheme.go index 337d46958c..e59106892e 100644 --- a/typedapi/types/enums/connectionscheme/connectionscheme.go +++ b/typedapi/types/enums/connectionscheme/connectionscheme.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package connectionscheme package connectionscheme import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L39-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L39-L42 type ConnectionScheme struct { Name string } diff --git a/typedapi/types/enums/converttype/converttype.go b/typedapi/types/enums/converttype/converttype.go index 29e2d11743..8ae4621619 100644 --- a/typedapi/types/enums/converttype/converttype.go +++ b/typedapi/types/enums/converttype/converttype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package converttype package converttype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L424-L432 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L424-L432 type ConvertType struct { Name string } diff --git a/typedapi/types/enums/dataattachmentformat/dataattachmentformat.go b/typedapi/types/enums/dataattachmentformat/dataattachmentformat.go index 67e604f36c..6846b170da 100644 --- a/typedapi/types/enums/dataattachmentformat/dataattachmentformat.go +++ b/typedapi/types/enums/dataattachmentformat/dataattachmentformat.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package dataattachmentformat package dataattachmentformat import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L187-L190 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L187-L190 type DataAttachmentFormat struct { Name string } diff --git a/typedapi/types/enums/datafeedstate/datafeedstate.go b/typedapi/types/enums/datafeedstate/datafeedstate.go index 667fb0cfbf..e1b3ec4b41 100644 --- a/typedapi/types/enums/datafeedstate/datafeedstate.go +++ b/typedapi/types/enums/datafeedstate/datafeedstate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package datafeedstate package datafeedstate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Datafeed.ts#L133-L138 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Datafeed.ts#L133-L138 type DatafeedState struct { Name string } diff --git a/typedapi/types/enums/dataframestate/dataframestate.go b/typedapi/types/enums/dataframestate/dataframestate.go index 5de76acace..8a9bc5ffaf 100644 --- a/typedapi/types/enums/dataframestate/dataframestate.go +++ b/typedapi/types/enums/dataframestate/dataframestate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package dataframestate package dataframestate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Dataframe.ts#L20-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Dataframe.ts#L20-L26 type DataframeState struct { Name string } diff --git a/typedapi/types/enums/day/day.go b/typedapi/types/enums/day/day.go index a52c7daa52..910413baec 100644 --- a/typedapi/types/enums/day/day.go +++ b/typedapi/types/enums/day/day.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package day package day import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L37-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L37-L45 type Day struct { Name string } diff --git a/typedapi/types/enums/decision/decision.go b/typedapi/types/enums/decision/decision.go index bac0cc8796..4b9254b514 100644 --- a/typedapi/types/enums/decision/decision.go +++ b/typedapi/types/enums/decision/decision.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package decision package decision import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L86-L95 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L86-L95 type Decision struct { Name string } diff --git a/typedapi/types/enums/delimitedpayloadencoding/delimitedpayloadencoding.go b/typedapi/types/enums/delimitedpayloadencoding/delimitedpayloadencoding.go index b809475c13..dc87a4b34b 100644 --- a/typedapi/types/enums/delimitedpayloadencoding/delimitedpayloadencoding.go +++ b/typedapi/types/enums/delimitedpayloadencoding/delimitedpayloadencoding.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package delimitedpayloadencoding package delimitedpayloadencoding import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L62-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L62-L66 type DelimitedPayloadEncoding struct { Name string } diff --git a/typedapi/types/enums/deploymentallocationstate/deploymentallocationstate.go b/typedapi/types/enums/deploymentallocationstate/deploymentallocationstate.go index 902100bdd0..94247c8eee 100644 --- a/typedapi/types/enums/deploymentallocationstate/deploymentallocationstate.go +++ b/typedapi/types/enums/deploymentallocationstate/deploymentallocationstate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package deploymentallocationstate package deploymentallocationstate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L288-L301 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L288-L301 type DeploymentAllocationState struct { Name string } diff --git a/typedapi/types/enums/deploymentassignmentstate/deploymentassignmentstate.go b/typedapi/types/enums/deploymentassignmentstate/deploymentassignmentstate.go index 0cad462ae1..a02e7b9916 100644 --- a/typedapi/types/enums/deploymentassignmentstate/deploymentassignmentstate.go +++ b/typedapi/types/enums/deploymentassignmentstate/deploymentassignmentstate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package deploymentassignmentstate package deploymentassignmentstate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L303-L308 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L303-L308 type DeploymentAssignmentState struct { Name string } diff --git a/typedapi/types/enums/deploymentstate/deploymentstate.go b/typedapi/types/enums/deploymentstate/deploymentstate.go index f26eb8a965..d4b89d84dc 100644 --- a/typedapi/types/enums/deploymentstate/deploymentstate.go +++ b/typedapi/types/enums/deploymentstate/deploymentstate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package deploymentstate package deploymentstate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L273-L286 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L273-L286 type DeploymentState struct { Name string } diff --git a/typedapi/types/enums/deprecationlevel/deprecationlevel.go b/typedapi/types/enums/deprecationlevel/deprecationlevel.go index efe377e503..54980dbc9c 100644 --- a/typedapi/types/enums/deprecationlevel/deprecationlevel.go +++ b/typedapi/types/enums/deprecationlevel/deprecationlevel.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package deprecationlevel package deprecationlevel import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/migration/deprecations/types.ts#L20-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/migration/deprecations/types.ts#L20-L27 type DeprecationLevel struct { Name string } diff --git a/typedapi/types/enums/dfiindependencemeasure/dfiindependencemeasure.go b/typedapi/types/enums/dfiindependencemeasure/dfiindependencemeasure.go index cd1b15ebc8..98157c86fd 100644 --- a/typedapi/types/enums/dfiindependencemeasure/dfiindependencemeasure.go +++ b/typedapi/types/enums/dfiindependencemeasure/dfiindependencemeasure.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package dfiindependencemeasure package dfiindependencemeasure import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Similarity.ts#L20-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Similarity.ts#L20-L24 type DFIIndependenceMeasure struct { Name string } diff --git a/typedapi/types/enums/dfraftereffect/dfraftereffect.go b/typedapi/types/enums/dfraftereffect/dfraftereffect.go index 9dadc7fd36..1836fbae04 100644 --- a/typedapi/types/enums/dfraftereffect/dfraftereffect.go +++ b/typedapi/types/enums/dfraftereffect/dfraftereffect.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package dfraftereffect package dfraftereffect import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Similarity.ts#L26-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Similarity.ts#L26-L30 type DFRAfterEffect struct { Name string } diff --git a/typedapi/types/enums/dfrbasicmodel/dfrbasicmodel.go b/typedapi/types/enums/dfrbasicmodel/dfrbasicmodel.go index f3b26dc902..96f7f957a6 100644 --- a/typedapi/types/enums/dfrbasicmodel/dfrbasicmodel.go +++ b/typedapi/types/enums/dfrbasicmodel/dfrbasicmodel.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package dfrbasicmodel package dfrbasicmodel import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Similarity.ts#L32-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Similarity.ts#L32-L40 type DFRBasicModel struct { Name string } diff --git a/typedapi/types/enums/distanceunit/distanceunit.go b/typedapi/types/enums/distanceunit/distanceunit.go index 5af1127d75..78368a0f53 100644 --- a/typedapi/types/enums/distanceunit/distanceunit.go +++ b/typedapi/types/enums/distanceunit/distanceunit.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package distanceunit package distanceunit import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L30-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L30-L49 type DistanceUnit struct { Name string } diff --git a/typedapi/types/enums/dynamicmapping/dynamicmapping.go b/typedapi/types/enums/dynamicmapping/dynamicmapping.go index fd8631c3c3..266818d7dd 100644 --- a/typedapi/types/enums/dynamicmapping/dynamicmapping.go +++ b/typedapi/types/enums/dynamicmapping/dynamicmapping.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package dynamicmapping package dynamicmapping import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/dynamic-template.ts#L37-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/dynamic-template.ts#L37-L46 type DynamicMapping struct { Name string } diff --git a/typedapi/types/enums/edgengramside/edgengramside.go b/typedapi/types/enums/edgengramside/edgengramside.go index 9f07f38d75..e1babaafa8 100644 --- a/typedapi/types/enums/edgengramside/edgengramside.go +++ b/typedapi/types/enums/edgengramside/edgengramside.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package edgengramside package edgengramside import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L74-L77 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L74-L77 type EdgeNGramSide struct { Name string } diff --git a/typedapi/types/enums/emailpriority/emailpriority.go b/typedapi/types/enums/emailpriority/emailpriority.go index 9db97b1119..7aa22f90d0 100644 --- a/typedapi/types/enums/emailpriority/emailpriority.go +++ b/typedapi/types/enums/emailpriority/emailpriority.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package emailpriority package emailpriority import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L197-L203 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L197-L203 type EmailPriority struct { Name string } diff --git a/typedapi/types/enums/enrichpolicyphase/enrichpolicyphase.go b/typedapi/types/enums/enrichpolicyphase/enrichpolicyphase.go index c1676a7449..3ecd2f9784 100644 --- a/typedapi/types/enums/enrichpolicyphase/enrichpolicyphase.go +++ b/typedapi/types/enums/enrichpolicyphase/enrichpolicyphase.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package enrichpolicyphase package enrichpolicyphase import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/execute_policy/types.ts#L24-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/execute_policy/types.ts#L24-L29 type EnrichPolicyPhase struct { Name string } diff --git a/typedapi/types/enums/excludefrequent/excludefrequent.go b/typedapi/types/enums/excludefrequent/excludefrequent.go index 913a06e5dd..bb4ed6397b 100644 --- a/typedapi/types/enums/excludefrequent/excludefrequent.go +++ b/typedapi/types/enums/excludefrequent/excludefrequent.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package excludefrequent package excludefrequent import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Detector.ts#L127-L132 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Detector.ts#L127-L132 type ExcludeFrequent struct { Name string } diff --git a/typedapi/types/enums/executionphase/executionphase.go b/typedapi/types/enums/executionphase/executionphase.go index d4a106e1f8..c99ab6dfe0 100644 --- a/typedapi/types/enums/executionphase/executionphase.go +++ b/typedapi/types/enums/executionphase/executionphase.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package executionphase package executionphase import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Execution.ts#L49-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Execution.ts#L49-L58 type ExecutionPhase struct { Name string } diff --git a/typedapi/types/enums/executionstatus/executionstatus.go b/typedapi/types/enums/executionstatus/executionstatus.go index 0f3905f0d3..a5c7ad772f 100644 --- a/typedapi/types/enums/executionstatus/executionstatus.go +++ b/typedapi/types/enums/executionstatus/executionstatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package executionstatus package executionstatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Execution.ts#L38-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Execution.ts#L38-L47 type ExecutionStatus struct { Name string } diff --git a/typedapi/types/enums/expandwildcard/expandwildcard.go b/typedapi/types/enums/expandwildcard/expandwildcard.go index 9c0fb1c3bf..4cac7049c4 100644 --- a/typedapi/types/enums/expandwildcard/expandwildcard.go +++ b/typedapi/types/enums/expandwildcard/expandwildcard.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package expandwildcard package expandwildcard import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L206-L220 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L207-L221 type ExpandWildcard struct { Name string } diff --git a/typedapi/types/enums/feature/feature.go b/typedapi/types/enums/feature/feature.go index c674a0347b..af17ba29c2 100644 --- a/typedapi/types/enums/feature/feature.go +++ b/typedapi/types/enums/feature/feature.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package feature package feature import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get/IndicesGetRequest.ts#L90-L94 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get/IndicesGetRequest.ts#L90-L94 type Feature struct { Name string } diff --git a/typedapi/types/enums/fieldsortnumerictype/fieldsortnumerictype.go b/typedapi/types/enums/fieldsortnumerictype/fieldsortnumerictype.go index cab918a94c..a2c7f92e72 100644 --- a/typedapi/types/enums/fieldsortnumerictype/fieldsortnumerictype.go +++ b/typedapi/types/enums/fieldsortnumerictype/fieldsortnumerictype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package fieldsortnumerictype package fieldsortnumerictype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L37-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L37-L42 type FieldSortNumericType struct { Name string } diff --git a/typedapi/types/enums/fieldtype/fieldtype.go b/typedapi/types/enums/fieldtype/fieldtype.go index 1d6e162122..e538ef2085 100644 --- a/typedapi/types/enums/fieldtype/fieldtype.go +++ b/typedapi/types/enums/fieldtype/fieldtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package fieldtype package fieldtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/Property.ts#L158-L202 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/Property.ts#L160-L204 type FieldType struct { Name string } diff --git a/typedapi/types/enums/fieldvaluefactormodifier/fieldvaluefactormodifier.go b/typedapi/types/enums/fieldvaluefactormodifier/fieldvaluefactormodifier.go index 4857d90d5e..6cf0770f0d 100644 --- a/typedapi/types/enums/fieldvaluefactormodifier/fieldvaluefactormodifier.go +++ b/typedapi/types/enums/fieldvaluefactormodifier/fieldvaluefactormodifier.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package fieldvaluefactormodifier package fieldvaluefactormodifier import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L298-L341 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L298-L341 type FieldValueFactorModifier struct { Name string } diff --git a/typedapi/types/enums/filtertype/filtertype.go b/typedapi/types/enums/filtertype/filtertype.go index e72964bf12..86857ad899 100644 --- a/typedapi/types/enums/filtertype/filtertype.go +++ b/typedapi/types/enums/filtertype/filtertype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package filtertype package filtertype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Filter.ts#L43-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Filter.ts#L43-L46 type FilterType struct { Name string } diff --git a/typedapi/types/enums/followerindexstatus/followerindexstatus.go b/typedapi/types/enums/followerindexstatus/followerindexstatus.go index 4e9b9f6ab9..def5c6827a 100644 --- a/typedapi/types/enums/followerindexstatus/followerindexstatus.go +++ b/typedapi/types/enums/followerindexstatus/followerindexstatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package followerindexstatus package followerindexstatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/follow_info/types.ts#L30-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/follow_info/types.ts#L30-L33 type FollowerIndexStatus struct { Name string } diff --git a/typedapi/types/enums/functionboostmode/functionboostmode.go b/typedapi/types/enums/functionboostmode/functionboostmode.go index f95332ab6f..1c28ac455b 100644 --- a/typedapi/types/enums/functionboostmode/functionboostmode.go +++ b/typedapi/types/enums/functionboostmode/functionboostmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package functionboostmode package functionboostmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L270-L296 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L270-L296 type FunctionBoostMode struct { Name string } diff --git a/typedapi/types/enums/functionscoremode/functionscoremode.go b/typedapi/types/enums/functionscoremode/functionscoremode.go index 64f2d65652..1b1ceab9ef 100644 --- a/typedapi/types/enums/functionscoremode/functionscoremode.go +++ b/typedapi/types/enums/functionscoremode/functionscoremode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package functionscoremode package functionscoremode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L243-L268 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L243-L268 type FunctionScoreMode struct { Name string } diff --git a/typedapi/types/enums/gappolicy/gappolicy.go b/typedapi/types/enums/gappolicy/gappolicy.go index e83f3fc972..054e3fbb37 100644 --- a/typedapi/types/enums/gappolicy/gappolicy.go +++ b/typedapi/types/enums/gappolicy/gappolicy.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package gappolicy package gappolicy import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L61-L76 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L61-L76 type GapPolicy struct { Name string } diff --git a/typedapi/types/enums/geodistancetype/geodistancetype.go b/typedapi/types/enums/geodistancetype/geodistancetype.go index 7ba126a244..4fe276a4a5 100644 --- a/typedapi/types/enums/geodistancetype/geodistancetype.go +++ b/typedapi/types/enums/geodistancetype/geodistancetype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package geodistancetype package geodistancetype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L51-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L51-L60 type GeoDistanceType struct { Name string } diff --git a/typedapi/types/enums/geoexecution/geoexecution.go b/typedapi/types/enums/geoexecution/geoexecution.go index 0b69a325bb..1a8d2dc833 100644 --- a/typedapi/types/enums/geoexecution/geoexecution.go +++ b/typedapi/types/enums/geoexecution/geoexecution.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package geoexecution package geoexecution import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/geo.ts#L52-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/geo.ts#L52-L55 type GeoExecution struct { Name string } diff --git a/typedapi/types/enums/geoorientation/geoorientation.go b/typedapi/types/enums/geoorientation/geoorientation.go index 7d0a677f2a..7ad0c90062 100644 --- a/typedapi/types/enums/geoorientation/geoorientation.go +++ b/typedapi/types/enums/geoorientation/geoorientation.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package geoorientation package geoorientation import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/geo.ts#L30-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/geo.ts#L30-L35 type GeoOrientation struct { Name string } diff --git a/typedapi/types/enums/geoshaperelation/geoshaperelation.go b/typedapi/types/enums/geoshaperelation/geoshaperelation.go index 5926552a52..d4339fa805 100644 --- a/typedapi/types/enums/geoshaperelation/geoshaperelation.go +++ b/typedapi/types/enums/geoshaperelation/geoshaperelation.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package geoshaperelation package geoshaperelation import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L73-L91 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L73-L91 type GeoShapeRelation struct { Name string } diff --git a/typedapi/types/enums/geostrategy/geostrategy.go b/typedapi/types/enums/geostrategy/geostrategy.go index c138f4ec34..1b81d462df 100644 --- a/typedapi/types/enums/geostrategy/geostrategy.go +++ b/typedapi/types/enums/geostrategy/geostrategy.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package geostrategy package geostrategy import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/geo.ts#L52-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/geo.ts#L52-L55 type GeoStrategy struct { Name string } diff --git a/typedapi/types/enums/geovalidationmethod/geovalidationmethod.go b/typedapi/types/enums/geovalidationmethod/geovalidationmethod.go index 5b4212f2c6..e5b37cca08 100644 --- a/typedapi/types/enums/geovalidationmethod/geovalidationmethod.go +++ b/typedapi/types/enums/geovalidationmethod/geovalidationmethod.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package geovalidationmethod package geovalidationmethod import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/geo.ts#L141-L151 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/geo.ts#L141-L151 type GeoValidationMethod struct { Name string } diff --git a/typedapi/types/enums/granttype/granttype.go b/typedapi/types/enums/granttype/granttype.go index 90a7fdc720..be08d97bcc 100644 --- a/typedapi/types/enums/granttype/granttype.go +++ b/typedapi/types/enums/granttype/granttype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package granttype package granttype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/GrantType.ts#L20-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/GrantType.ts#L20-L29 type GrantType struct { Name string } diff --git a/typedapi/types/enums/gridaggregationtype/gridaggregationtype.go b/typedapi/types/enums/gridaggregationtype/gridaggregationtype.go index 337f0832e2..2b5a69ddb1 100644 --- a/typedapi/types/enums/gridaggregationtype/gridaggregationtype.go +++ b/typedapi/types/enums/gridaggregationtype/gridaggregationtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package gridaggregationtype package gridaggregationtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search_mvt/_types/GridType.ts#L30-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search_mvt/_types/GridType.ts#L30-L33 type GridAggregationType struct { Name string } diff --git a/typedapi/types/enums/gridtype/gridtype.go b/typedapi/types/enums/gridtype/gridtype.go index 0a7bb316db..eca50a1b20 100644 --- a/typedapi/types/enums/gridtype/gridtype.go +++ b/typedapi/types/enums/gridtype/gridtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package gridtype package gridtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search_mvt/_types/GridType.ts#L20-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search_mvt/_types/GridType.ts#L20-L28 type GridType struct { Name string } diff --git a/typedapi/types/enums/groupby/groupby.go b/typedapi/types/enums/groupby/groupby.go index 75e52a90d3..39bdabc279 100644 --- a/typedapi/types/enums/groupby/groupby.go +++ b/typedapi/types/enums/groupby/groupby.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package groupby package groupby import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/tasks/_types/GroupBy.ts#L20-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/tasks/_types/GroupBy.ts#L20-L27 type GroupBy struct { Name string } diff --git a/typedapi/types/enums/healthstatus/healthstatus.go b/typedapi/types/enums/healthstatus/healthstatus.go index f32bf35d03..2044f643bc 100644 --- a/typedapi/types/enums/healthstatus/healthstatus.go +++ b/typedapi/types/enums/healthstatus/healthstatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package healthstatus package healthstatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L224-L244 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L225-L245 type HealthStatus struct { Name string } diff --git a/typedapi/types/enums/highlighterencoder/highlighterencoder.go b/typedapi/types/enums/highlighterencoder/highlighterencoder.go index 684a1a0362..b391f7b466 100644 --- a/typedapi/types/enums/highlighterencoder/highlighterencoder.go +++ b/typedapi/types/enums/highlighterencoder/highlighterencoder.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package highlighterencoder package highlighterencoder import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/highlighting.ts#L158-L161 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/highlighting.ts#L158-L161 type HighlighterEncoder struct { Name string } diff --git a/typedapi/types/enums/highlighterfragmenter/highlighterfragmenter.go b/typedapi/types/enums/highlighterfragmenter/highlighterfragmenter.go index cb5724330a..6352b03ea8 100644 --- a/typedapi/types/enums/highlighterfragmenter/highlighterfragmenter.go +++ b/typedapi/types/enums/highlighterfragmenter/highlighterfragmenter.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package highlighterfragmenter package highlighterfragmenter import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/highlighting.ts#L163-L166 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/highlighting.ts#L163-L166 type HighlighterFragmenter struct { Name string } diff --git a/typedapi/types/enums/highlighterorder/highlighterorder.go b/typedapi/types/enums/highlighterorder/highlighterorder.go index 6f5baecaff..e8f6101400 100644 --- a/typedapi/types/enums/highlighterorder/highlighterorder.go +++ b/typedapi/types/enums/highlighterorder/highlighterorder.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package highlighterorder package highlighterorder import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/highlighting.ts#L168-L170 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/highlighting.ts#L168-L170 type HighlighterOrder struct { Name string } diff --git a/typedapi/types/enums/highlightertagsschema/highlightertagsschema.go b/typedapi/types/enums/highlightertagsschema/highlightertagsschema.go index 46ef354475..ab7fd0650e 100644 --- a/typedapi/types/enums/highlightertagsschema/highlightertagsschema.go +++ b/typedapi/types/enums/highlightertagsschema/highlightertagsschema.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package highlightertagsschema package highlightertagsschema import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/highlighting.ts#L172-L174 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/highlighting.ts#L172-L174 type HighlighterTagsSchema struct { Name string } diff --git a/typedapi/types/enums/highlightertype/highlightertype.go b/typedapi/types/enums/highlightertype/highlightertype.go index fa6cf3ca5e..533af6fa3c 100644 --- a/typedapi/types/enums/highlightertype/highlightertype.go +++ b/typedapi/types/enums/highlightertype/highlightertype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package highlightertype package highlightertype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/highlighting.ts#L176-L191 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/highlighting.ts#L176-L191 type HighlighterType struct { Name string } diff --git a/typedapi/types/enums/holtwinterstype/holtwinterstype.go b/typedapi/types/enums/holtwinterstype/holtwinterstype.go index 99bb45f392..5e11f4a66e 100644 --- a/typedapi/types/enums/holtwinterstype/holtwinterstype.go +++ b/typedapi/types/enums/holtwinterstype/holtwinterstype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package holtwinterstype package holtwinterstype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L283-L288 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L283-L288 type HoltWintersType struct { Name string } diff --git a/typedapi/types/enums/httpinputmethod/httpinputmethod.go b/typedapi/types/enums/httpinputmethod/httpinputmethod.go index a29b2cd7bb..dbfa6e3c03 100644 --- a/typedapi/types/enums/httpinputmethod/httpinputmethod.go +++ b/typedapi/types/enums/httpinputmethod/httpinputmethod.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package httpinputmethod package httpinputmethod import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L59-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L59-L65 type HttpInputMethod struct { Name string } diff --git a/typedapi/types/enums/ibdistribution/ibdistribution.go b/typedapi/types/enums/ibdistribution/ibdistribution.go index 26db6bac55..71f76a7f70 100644 --- a/typedapi/types/enums/ibdistribution/ibdistribution.go +++ b/typedapi/types/enums/ibdistribution/ibdistribution.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package ibdistribution package ibdistribution import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Similarity.ts#L42-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Similarity.ts#L42-L45 type IBDistribution struct { Name string } diff --git a/typedapi/types/enums/iblambda/iblambda.go b/typedapi/types/enums/iblambda/iblambda.go index 6dbddb6dae..f4bac6e7f8 100644 --- a/typedapi/types/enums/iblambda/iblambda.go +++ b/typedapi/types/enums/iblambda/iblambda.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package iblambda package iblambda import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Similarity.ts#L47-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Similarity.ts#L47-L50 type IBLambda struct { Name string } diff --git a/typedapi/types/enums/icucollationalternate/icucollationalternate.go b/typedapi/types/enums/icucollationalternate/icucollationalternate.go index fff24ec2e7..b16e9bedef 100644 --- a/typedapi/types/enums/icucollationalternate/icucollationalternate.go +++ b/typedapi/types/enums/icucollationalternate/icucollationalternate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package icucollationalternate package icucollationalternate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L89-L92 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L89-L92 type IcuCollationAlternate struct { Name string } diff --git a/typedapi/types/enums/icucollationcasefirst/icucollationcasefirst.go b/typedapi/types/enums/icucollationcasefirst/icucollationcasefirst.go index 2501f012cd..dc1634619a 100644 --- a/typedapi/types/enums/icucollationcasefirst/icucollationcasefirst.go +++ b/typedapi/types/enums/icucollationcasefirst/icucollationcasefirst.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package icucollationcasefirst package icucollationcasefirst import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L94-L97 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L94-L97 type IcuCollationCaseFirst struct { Name string } diff --git a/typedapi/types/enums/icucollationdecomposition/icucollationdecomposition.go b/typedapi/types/enums/icucollationdecomposition/icucollationdecomposition.go index e46c0de1e0..caf5a6e844 100644 --- a/typedapi/types/enums/icucollationdecomposition/icucollationdecomposition.go +++ b/typedapi/types/enums/icucollationdecomposition/icucollationdecomposition.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package icucollationdecomposition package icucollationdecomposition import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L99-L102 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L99-L102 type IcuCollationDecomposition struct { Name string } diff --git a/typedapi/types/enums/icucollationstrength/icucollationstrength.go b/typedapi/types/enums/icucollationstrength/icucollationstrength.go index 31b4e271ff..b96245e6ad 100644 --- a/typedapi/types/enums/icucollationstrength/icucollationstrength.go +++ b/typedapi/types/enums/icucollationstrength/icucollationstrength.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package icucollationstrength package icucollationstrength import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L104-L110 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L104-L110 type IcuCollationStrength struct { Name string } diff --git a/typedapi/types/enums/icunormalizationmode/icunormalizationmode.go b/typedapi/types/enums/icunormalizationmode/icunormalizationmode.go index 68ae63b575..b6b31082ad 100644 --- a/typedapi/types/enums/icunormalizationmode/icunormalizationmode.go +++ b/typedapi/types/enums/icunormalizationmode/icunormalizationmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package icunormalizationmode package icunormalizationmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L78-L81 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L78-L81 type IcuNormalizationMode struct { Name string } diff --git a/typedapi/types/enums/icunormalizationtype/icunormalizationtype.go b/typedapi/types/enums/icunormalizationtype/icunormalizationtype.go index 001d7430b7..27a609f6f9 100644 --- a/typedapi/types/enums/icunormalizationtype/icunormalizationtype.go +++ b/typedapi/types/enums/icunormalizationtype/icunormalizationtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package icunormalizationtype package icunormalizationtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L83-L87 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L83-L87 type IcuNormalizationType struct { Name string } diff --git a/typedapi/types/enums/icutransformdirection/icutransformdirection.go b/typedapi/types/enums/icutransformdirection/icutransformdirection.go index 101f1fa159..84358f2586 100644 --- a/typedapi/types/enums/icutransformdirection/icutransformdirection.go +++ b/typedapi/types/enums/icutransformdirection/icutransformdirection.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package icutransformdirection package icutransformdirection import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L73-L76 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L73-L76 type IcuTransformDirection struct { Name string } diff --git a/typedapi/types/enums/impactarea/impactarea.go b/typedapi/types/enums/impactarea/impactarea.go index 8b0f249685..ef0f84c348 100644 --- a/typedapi/types/enums/impactarea/impactarea.go +++ b/typedapi/types/enums/impactarea/impactarea.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package impactarea package impactarea import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L72-L77 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L72-L77 type ImpactArea struct { Name string } diff --git a/typedapi/types/enums/include/include.go b/typedapi/types/enums/include/include.go index b43329ec35..ecdcfca64d 100644 --- a/typedapi/types/enums/include/include.go +++ b/typedapi/types/enums/include/include.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package include package include import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Include.ts#L20-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Include.ts#L20-L47 type Include struct { Name string } diff --git a/typedapi/types/enums/indexcheckonstartup/indexcheckonstartup.go b/typedapi/types/enums/indexcheckonstartup/indexcheckonstartup.go index ddbb1de09b..365b4037cd 100644 --- a/typedapi/types/enums/indexcheckonstartup/indexcheckonstartup.go +++ b/typedapi/types/enums/indexcheckonstartup/indexcheckonstartup.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package indexcheckonstartup package indexcheckonstartup import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L253-L260 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L253-L260 type IndexCheckOnStartup struct { Name string } diff --git a/typedapi/types/enums/indexingjobstate/indexingjobstate.go b/typedapi/types/enums/indexingjobstate/indexingjobstate.go index f12d00f5d8..15519a59d8 100644 --- a/typedapi/types/enums/indexingjobstate/indexingjobstate.go +++ b/typedapi/types/enums/indexingjobstate/indexingjobstate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package indexingjobstate package indexingjobstate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_jobs/types.ts#L66-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_jobs/types.ts#L66-L72 type IndexingJobState struct { Name string } diff --git a/typedapi/types/enums/indexmetadatastate/indexmetadatastate.go b/typedapi/types/enums/indexmetadatastate/indexmetadatastate.go index 0cfaae7845..c8f6bfeac9 100644 --- a/typedapi/types/enums/indexmetadatastate/indexmetadatastate.go +++ b/typedapi/types/enums/indexmetadatastate/indexmetadatastate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package indexmetadatastate package indexmetadatastate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L225-L232 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L225-L232 type IndexMetadataState struct { Name string } diff --git a/typedapi/types/enums/indexoptions/indexoptions.go b/typedapi/types/enums/indexoptions/indexoptions.go index 01eaf0eb51..c9fb841872 100644 --- a/typedapi/types/enums/indexoptions/indexoptions.go +++ b/typedapi/types/enums/indexoptions/indexoptions.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package indexoptions package indexoptions import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L242-L247 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L242-L247 type IndexOptions struct { Name string } diff --git a/typedapi/types/enums/indexprivilege/indexprivilege.go b/typedapi/types/enums/indexprivilege/indexprivilege.go index 92a0274f19..462dcdb3b3 100644 --- a/typedapi/types/enums/indexprivilege/indexprivilege.go +++ b/typedapi/types/enums/indexprivilege/indexprivilege.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package indexprivilege package indexprivilege import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L166-L187 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L166-L187 type IndexPrivilege struct { Name string } diff --git a/typedapi/types/enums/indexroutingallocationoptions/indexroutingallocationoptions.go b/typedapi/types/enums/indexroutingallocationoptions/indexroutingallocationoptions.go index 67cdefde97..ddf4b38fad 100644 --- a/typedapi/types/enums/indexroutingallocationoptions/indexroutingallocationoptions.go +++ b/typedapi/types/enums/indexroutingallocationoptions/indexroutingallocationoptions.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package indexroutingallocationoptions package indexroutingallocationoptions import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexRouting.ts#L38-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexRouting.ts#L38-L43 type IndexRoutingAllocationOptions struct { Name string } diff --git a/typedapi/types/enums/indexroutingrebalanceoptions/indexroutingrebalanceoptions.go b/typedapi/types/enums/indexroutingrebalanceoptions/indexroutingrebalanceoptions.go index 730ee1e013..460c6e8a14 100644 --- a/typedapi/types/enums/indexroutingrebalanceoptions/indexroutingrebalanceoptions.go +++ b/typedapi/types/enums/indexroutingrebalanceoptions/indexroutingrebalanceoptions.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package indexroutingrebalanceoptions package indexroutingrebalanceoptions import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexRouting.ts#L45-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexRouting.ts#L45-L50 type IndexRoutingRebalanceOptions struct { Name string } diff --git a/typedapi/types/enums/indicatorhealthstatus/indicatorhealthstatus.go b/typedapi/types/enums/indicatorhealthstatus/indicatorhealthstatus.go index 2332b4048b..6d3989b15f 100644 --- a/typedapi/types/enums/indicatorhealthstatus/indicatorhealthstatus.go +++ b/typedapi/types/enums/indicatorhealthstatus/indicatorhealthstatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package indicatorhealthstatus package indicatorhealthstatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L25-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L25-L30 type IndicatorHealthStatus struct { Name string } diff --git a/typedapi/types/enums/indicesblockoptions/indicesblockoptions.go b/typedapi/types/enums/indicesblockoptions/indicesblockoptions.go index f02c6d25c9..9257492abd 100644 --- a/typedapi/types/enums/indicesblockoptions/indicesblockoptions.go +++ b/typedapi/types/enums/indicesblockoptions/indicesblockoptions.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package indicesblockoptions package indicesblockoptions import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/add_block/IndicesAddBlockRequest.ts#L43-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/add_block/IndicesAddBlockRequest.ts#L43-L48 type IndicesBlockOptions struct { Name string } diff --git a/typedapi/types/enums/inputtype/inputtype.go b/typedapi/types/enums/inputtype/inputtype.go index 83a5427b0d..40bae7cf13 100644 --- a/typedapi/types/enums/inputtype/inputtype.go +++ b/typedapi/types/enums/inputtype/inputtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package inputtype package inputtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L100-L104 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L100-L104 type InputType struct { Name string } diff --git a/typedapi/types/enums/jobblockedreason/jobblockedreason.go b/typedapi/types/enums/jobblockedreason/jobblockedreason.go index 179a1419b5..c6e55711a2 100644 --- a/typedapi/types/enums/jobblockedreason/jobblockedreason.go +++ b/typedapi/types/enums/jobblockedreason/jobblockedreason.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package jobblockedreason package jobblockedreason import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L397-L401 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L397-L401 type JobBlockedReason struct { Name string } diff --git a/typedapi/types/enums/jobstate/jobstate.go b/typedapi/types/enums/jobstate/jobstate.go index 3a4a478f1d..0756b542ce 100644 --- a/typedapi/types/enums/jobstate/jobstate.go +++ b/typedapi/types/enums/jobstate/jobstate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package jobstate package jobstate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L36-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L36-L52 type JobState struct { Name string } diff --git a/typedapi/types/enums/jsonprocessorconflictstrategy/jsonprocessorconflictstrategy.go b/typedapi/types/enums/jsonprocessorconflictstrategy/jsonprocessorconflictstrategy.go index b724492e7e..7085b706cc 100644 --- a/typedapi/types/enums/jsonprocessorconflictstrategy/jsonprocessorconflictstrategy.go +++ b/typedapi/types/enums/jsonprocessorconflictstrategy/jsonprocessorconflictstrategy.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package jsonprocessorconflictstrategy package jsonprocessorconflictstrategy import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L838-L843 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L838-L843 type JsonProcessorConflictStrategy struct { Name string } diff --git a/typedapi/types/enums/keeptypesmode/keeptypesmode.go b/typedapi/types/enums/keeptypesmode/keeptypesmode.go index c06b70fe34..f30fa3cf9e 100644 --- a/typedapi/types/enums/keeptypesmode/keeptypesmode.go +++ b/typedapi/types/enums/keeptypesmode/keeptypesmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package keeptypesmode package keeptypesmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L213-L216 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L213-L216 type KeepTypesMode struct { Name string } diff --git a/typedapi/types/enums/kuromojitokenizationmode/kuromojitokenizationmode.go b/typedapi/types/enums/kuromojitokenizationmode/kuromojitokenizationmode.go index d2ac9acdc3..da8de94a63 100644 --- a/typedapi/types/enums/kuromojitokenizationmode/kuromojitokenizationmode.go +++ b/typedapi/types/enums/kuromojitokenizationmode/kuromojitokenizationmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package kuromojitokenizationmode package kuromojitokenizationmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/kuromoji-plugin.ts#L52-L56 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/kuromoji-plugin.ts#L52-L56 type KuromojiTokenizationMode struct { Name string } diff --git a/typedapi/types/enums/language/language.go b/typedapi/types/enums/language/language.go index 4679ebcd2b..5fb92e01e7 100644 --- a/typedapi/types/enums/language/language.go +++ b/typedapi/types/enums/language/language.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package language package language import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/languages.ts#L20-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/languages.ts#L20-L55 type Language struct { Name string } diff --git a/typedapi/types/enums/level/level.go b/typedapi/types/enums/level/level.go index 13a978ce9e..16d6f8b673 100644 --- a/typedapi/types/enums/level/level.go +++ b/typedapi/types/enums/level/level.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package level package level import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L254-L258 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L255-L259 type Level struct { Name string } diff --git a/typedapi/types/enums/licensestatus/licensestatus.go b/typedapi/types/enums/licensestatus/licensestatus.go index 922d463493..a27e90a1b7 100644 --- a/typedapi/types/enums/licensestatus/licensestatus.go +++ b/typedapi/types/enums/licensestatus/licensestatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package licensestatus package licensestatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/_types/License.ts#L35-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/_types/License.ts#L35-L40 type LicenseStatus struct { Name string } diff --git a/typedapi/types/enums/licensetype/licensetype.go b/typedapi/types/enums/licensetype/licensetype.go index cb79a441c8..6a9cafe009 100644 --- a/typedapi/types/enums/licensetype/licensetype.go +++ b/typedapi/types/enums/licensetype/licensetype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package licensetype package licensetype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/_types/License.ts#L23-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/_types/License.ts#L23-L33 type LicenseType struct { Name string } diff --git a/typedapi/types/enums/lifecycleoperationmode/lifecycleoperationmode.go b/typedapi/types/enums/lifecycleoperationmode/lifecycleoperationmode.go index b98e318191..7bef230bdb 100644 --- a/typedapi/types/enums/lifecycleoperationmode/lifecycleoperationmode.go +++ b/typedapi/types/enums/lifecycleoperationmode/lifecycleoperationmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package lifecycleoperationmode package lifecycleoperationmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Lifecycle.ts#L20-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Lifecycle.ts#L20-L24 type LifecycleOperationMode struct { Name string } diff --git a/typedapi/types/enums/managedby/managedby.go b/typedapi/types/enums/managedby/managedby.go new file mode 100644 index 0000000000..44d3e9cee7 --- /dev/null +++ b/typedapi/types/enums/managedby/managedby.go @@ -0,0 +1,61 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +// Package managedby +package managedby + +import "strings" + +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/DataStream.ts#L32-L41 +type ManagedBy struct { + Name string +} + +var ( + IndexLifecycleManagement = ManagedBy{"Index Lifecycle Management"} + + DataStreamLifecycle = ManagedBy{"Data stream lifecycle"} + + Unmanaged = ManagedBy{"Unmanaged"} +) + +func (m ManagedBy) MarshalText() (text []byte, err error) { + return []byte(m.String()), nil +} + +func (m *ManagedBy) UnmarshalText(text []byte) error { + switch strings.ReplaceAll(strings.ToLower(string(text)), "\"", "") { + + case "Index Lifecycle Management": + *m = IndexLifecycleManagement + case "Data stream lifecycle": + *m = DataStreamLifecycle + case "Unmanaged": + *m = Unmanaged + default: + *m = ManagedBy{string(text)} + } + + return nil +} + +func (m ManagedBy) String() string { + return m.Name +} diff --git a/typedapi/types/enums/matchtype/matchtype.go b/typedapi/types/enums/matchtype/matchtype.go index f627b4c0cd..7790f9f57e 100644 --- a/typedapi/types/enums/matchtype/matchtype.go +++ b/typedapi/types/enums/matchtype/matchtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package matchtype package matchtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/dynamic-template.ts#L32-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/dynamic-template.ts#L32-L35 type MatchType struct { Name string } diff --git a/typedapi/types/enums/memorystatus/memorystatus.go b/typedapi/types/enums/memorystatus/memorystatus.go index fb3d2e2c1e..facdc49b84 100644 --- a/typedapi/types/enums/memorystatus/memorystatus.go +++ b/typedapi/types/enums/memorystatus/memorystatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package memorystatus package memorystatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Model.ts#L88-L92 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Model.ts#L88-L92 type MemoryStatus struct { Name string } diff --git a/typedapi/types/enums/metric/metric.go b/typedapi/types/enums/metric/metric.go index 915f947c55..6242566d42 100644 --- a/typedapi/types/enums/metric/metric.go +++ b/typedapi/types/enums/metric/metric.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package metric package metric import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/_types/Metric.ts#L22-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/_types/Metric.ts#L22-L28 type Metric struct { Name string } diff --git a/typedapi/types/enums/migrationstatus/migrationstatus.go b/typedapi/types/enums/migrationstatus/migrationstatus.go index 318639fa21..e427d0a14a 100644 --- a/typedapi/types/enums/migrationstatus/migrationstatus.go +++ b/typedapi/types/enums/migrationstatus/migrationstatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package migrationstatus package migrationstatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L30-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L30-L35 type MigrationStatus struct { Name string } diff --git a/typedapi/types/enums/minimuminterval/minimuminterval.go b/typedapi/types/enums/minimuminterval/minimuminterval.go index af282072f1..8f86b077d6 100644 --- a/typedapi/types/enums/minimuminterval/minimuminterval.go +++ b/typedapi/types/enums/minimuminterval/minimuminterval.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package minimuminterval package minimuminterval import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L102-L109 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L102-L109 type MinimumInterval struct { Name string } diff --git a/typedapi/types/enums/missingorder/missingorder.go b/typedapi/types/enums/missingorder/missingorder.go index fa470d5ee1..5654b31c72 100644 --- a/typedapi/types/enums/missingorder/missingorder.go +++ b/typedapi/types/enums/missingorder/missingorder.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package missingorder package missingorder import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/AggregationContainer.ts#L518-L522 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/AggregationContainer.ts#L518-L522 type MissingOrder struct { Name string } diff --git a/typedapi/types/enums/month/month.go b/typedapi/types/enums/month/month.go index 472b71daaf..6df9716f31 100644 --- a/typedapi/types/enums/month/month.go +++ b/typedapi/types/enums/month/month.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package month package month import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L70-L83 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L70-L83 type Month struct { Name string } diff --git a/typedapi/types/enums/multivaluemode/multivaluemode.go b/typedapi/types/enums/multivaluemode/multivaluemode.go index b41fad676f..9361377676 100644 --- a/typedapi/types/enums/multivaluemode/multivaluemode.go +++ b/typedapi/types/enums/multivaluemode/multivaluemode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package multivaluemode package multivaluemode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L343-L360 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L343-L360 type MultiValueMode struct { Name string } diff --git a/typedapi/types/enums/noderole/noderole.go b/typedapi/types/enums/noderole/noderole.go index bed4e4398f..cee51f0dd3 100644 --- a/typedapi/types/enums/noderole/noderole.go +++ b/typedapi/types/enums/noderole/noderole.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package noderole package noderole import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Node.ts#L77-L95 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Node.ts#L77-L95 type NodeRole struct { Name string } diff --git a/typedapi/types/enums/noridecompoundmode/noridecompoundmode.go b/typedapi/types/enums/noridecompoundmode/noridecompoundmode.go index 666f0aa4ea..b8c1a0e493 100644 --- a/typedapi/types/enums/noridecompoundmode/noridecompoundmode.go +++ b/typedapi/types/enums/noridecompoundmode/noridecompoundmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package noridecompoundmode package noridecompoundmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L75-L79 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L75-L79 type NoriDecompoundMode struct { Name string } diff --git a/typedapi/types/enums/normalization/normalization.go b/typedapi/types/enums/normalization/normalization.go index ef720c1ec6..1171e2a79b 100644 --- a/typedapi/types/enums/normalization/normalization.go +++ b/typedapi/types/enums/normalization/normalization.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package normalization package normalization import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Similarity.ts#L52-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Similarity.ts#L52-L58 type Normalization struct { Name string } diff --git a/typedapi/types/enums/normalizemethod/normalizemethod.go b/typedapi/types/enums/normalizemethod/normalizemethod.go index ab0760f36c..ff87fbfbe4 100644 --- a/typedapi/types/enums/normalizemethod/normalizemethod.go +++ b/typedapi/types/enums/normalizemethod/normalizemethod.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package normalizemethod package normalizemethod import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L328-L354 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L328-L354 type NormalizeMethod struct { Name string } diff --git a/typedapi/types/enums/numericfielddataformat/numericfielddataformat.go b/typedapi/types/enums/numericfielddataformat/numericfielddataformat.go index 18a7669140..ea1e597b13 100644 --- a/typedapi/types/enums/numericfielddataformat/numericfielddataformat.go +++ b/typedapi/types/enums/numericfielddataformat/numericfielddataformat.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package numericfielddataformat package numericfielddataformat import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/NumericFielddataFormat.ts#L20-L23 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/NumericFielddataFormat.ts#L20-L23 type NumericFielddataFormat struct { Name string } diff --git a/typedapi/types/enums/onscripterror/onscripterror.go b/typedapi/types/enums/onscripterror/onscripterror.go index 821df38a1f..6b6acb764f 100644 --- a/typedapi/types/enums/onscripterror/onscripterror.go +++ b/typedapi/types/enums/onscripterror/onscripterror.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package onscripterror package onscripterror import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L129-L132 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L129-L132 type OnScriptError struct { Name string } diff --git a/typedapi/types/enums/operationtype/operationtype.go b/typedapi/types/enums/operationtype/operationtype.go index 3f7f351647..4d237e597f 100644 --- a/typedapi/types/enums/operationtype/operationtype.go +++ b/typedapi/types/enums/operationtype/operationtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package operationtype package operationtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/types.ts#L83-L88 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/types.ts#L83-L88 type OperationType struct { Name string } diff --git a/typedapi/types/enums/operator/operator.go b/typedapi/types/enums/operator/operator.go index 0dde9feacb..b73b5a39ce 100644 --- a/typedapi/types/enums/operator/operator.go +++ b/typedapi/types/enums/operator/operator.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package operator package operator import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/Operator.ts#L22-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/Operator.ts#L22-L27 type Operator struct { Name string } diff --git a/typedapi/types/enums/optype/optype.go b/typedapi/types/enums/optype/optype.go index d48a33f449..30b6742f43 100644 --- a/typedapi/types/enums/optype/optype.go +++ b/typedapi/types/enums/optype/optype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package optype package optype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L260-L269 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L261-L270 type OpType struct { Name string } diff --git a/typedapi/types/enums/pagerdutycontexttype/pagerdutycontexttype.go b/typedapi/types/enums/pagerdutycontexttype/pagerdutycontexttype.go index f55b2480b7..0331c74be0 100644 --- a/typedapi/types/enums/pagerdutycontexttype/pagerdutycontexttype.go +++ b/typedapi/types/enums/pagerdutycontexttype/pagerdutycontexttype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package pagerdutycontexttype package pagerdutycontexttype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L67-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L67-L70 type PagerDutyContextType struct { Name string } diff --git a/typedapi/types/enums/pagerdutyeventtype/pagerdutyeventtype.go b/typedapi/types/enums/pagerdutyeventtype/pagerdutyeventtype.go index b7bcb7d3a8..ff22114b7b 100644 --- a/typedapi/types/enums/pagerdutyeventtype/pagerdutyeventtype.go +++ b/typedapi/types/enums/pagerdutyeventtype/pagerdutyeventtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package pagerdutyeventtype package pagerdutyeventtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L72-L76 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L72-L76 type PagerDutyEventType struct { Name string } diff --git a/typedapi/types/enums/phoneticencoder/phoneticencoder.go b/typedapi/types/enums/phoneticencoder/phoneticencoder.go index a70c5a8bb6..9837c24e21 100644 --- a/typedapi/types/enums/phoneticencoder/phoneticencoder.go +++ b/typedapi/types/enums/phoneticencoder/phoneticencoder.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package phoneticencoder package phoneticencoder import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/phonetic-plugin.ts#L23-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/phonetic-plugin.ts#L23-L36 type PhoneticEncoder struct { Name string } diff --git a/typedapi/types/enums/phoneticlanguage/phoneticlanguage.go b/typedapi/types/enums/phoneticlanguage/phoneticlanguage.go index 7629f2c897..8c30e866ef 100644 --- a/typedapi/types/enums/phoneticlanguage/phoneticlanguage.go +++ b/typedapi/types/enums/phoneticlanguage/phoneticlanguage.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package phoneticlanguage package phoneticlanguage import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/phonetic-plugin.ts#L38-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/phonetic-plugin.ts#L38-L51 type PhoneticLanguage struct { Name string } diff --git a/typedapi/types/enums/phoneticnametype/phoneticnametype.go b/typedapi/types/enums/phoneticnametype/phoneticnametype.go index dd2edaf04e..8a2d4a303d 100644 --- a/typedapi/types/enums/phoneticnametype/phoneticnametype.go +++ b/typedapi/types/enums/phoneticnametype/phoneticnametype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package phoneticnametype package phoneticnametype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/phonetic-plugin.ts#L53-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/phonetic-plugin.ts#L53-L57 type PhoneticNameType struct { Name string } diff --git a/typedapi/types/enums/phoneticruletype/phoneticruletype.go b/typedapi/types/enums/phoneticruletype/phoneticruletype.go index a0964b441c..5712ec891e 100644 --- a/typedapi/types/enums/phoneticruletype/phoneticruletype.go +++ b/typedapi/types/enums/phoneticruletype/phoneticruletype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package phoneticruletype package phoneticruletype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/phonetic-plugin.ts#L59-L62 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/phonetic-plugin.ts#L59-L62 type PhoneticRuleType struct { Name string } diff --git a/typedapi/types/enums/policytype/policytype.go b/typedapi/types/enums/policytype/policytype.go index 2fcb53850b..fc5bd66136 100644 --- a/typedapi/types/enums/policytype/policytype.go +++ b/typedapi/types/enums/policytype/policytype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package policytype package policytype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/_types/Policy.ts#L27-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/_types/Policy.ts#L28-L32 type PolicyType struct { Name string } diff --git a/typedapi/types/enums/quantifier/quantifier.go b/typedapi/types/enums/quantifier/quantifier.go index 939389e068..f58d47b8a4 100644 --- a/typedapi/types/enums/quantifier/quantifier.go +++ b/typedapi/types/enums/quantifier/quantifier.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package quantifier package quantifier import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Conditions.ts#L71-L74 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Conditions.ts#L71-L74 type Quantifier struct { Name string } diff --git a/typedapi/types/enums/queryrulecriteriatype/queryrulecriteriatype.go b/typedapi/types/enums/queryrulecriteriatype/queryrulecriteriatype.go index 8ef06818fb..b480a21d63 100644 --- a/typedapi/types/enums/queryrulecriteriatype/queryrulecriteriatype.go +++ b/typedapi/types/enums/queryrulecriteriatype/queryrulecriteriatype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package queryrulecriteriatype package queryrulecriteriatype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/_types/QueryRuleset.ts#L54-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/_types/QueryRuleset.ts#L54-L65 type QueryRuleCriteriaType struct { Name string } diff --git a/typedapi/types/enums/queryruletype/queryruletype.go b/typedapi/types/enums/queryruletype/queryruletype.go index 7599eba56c..598e8ebc0e 100644 --- a/typedapi/types/enums/queryruletype/queryruletype.go +++ b/typedapi/types/enums/queryruletype/queryruletype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package queryruletype package queryruletype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/_types/QueryRuleset.ts#L44-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/_types/QueryRuleset.ts#L44-L46 type QueryRuleType struct { Name string } diff --git a/typedapi/types/enums/rangerelation/rangerelation.go b/typedapi/types/enums/rangerelation/rangerelation.go index 8bd6f9caa5..3a9a5bcd56 100644 --- a/typedapi/types/enums/rangerelation/rangerelation.go +++ b/typedapi/types/enums/rangerelation/rangerelation.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package rangerelation package rangerelation import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L170-L183 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L170-L183 type RangeRelation struct { Name string } diff --git a/typedapi/types/enums/ratemode/ratemode.go b/typedapi/types/enums/ratemode/ratemode.go index 3d5768fb9a..ffb132b4f1 100644 --- a/typedapi/types/enums/ratemode/ratemode.go +++ b/typedapi/types/enums/ratemode/ratemode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package ratemode package ratemode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L243-L252 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L243-L252 type RateMode struct { Name string } diff --git a/typedapi/types/enums/refresh/refresh.go b/typedapi/types/enums/refresh/refresh.go index 89e5eb15ff..50fafe9d48 100644 --- a/typedapi/types/enums/refresh/refresh.go +++ b/typedapi/types/enums/refresh/refresh.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package refresh package refresh import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L271-L278 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L272-L279 type Refresh struct { Name string } diff --git a/typedapi/types/enums/responsecontenttype/responsecontenttype.go b/typedapi/types/enums/responsecontenttype/responsecontenttype.go index babce81ef9..1b2e1bd2d1 100644 --- a/typedapi/types/enums/responsecontenttype/responsecontenttype.go +++ b/typedapi/types/enums/responsecontenttype/responsecontenttype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package responsecontenttype package responsecontenttype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L106-L110 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L106-L110 type ResponseContentType struct { Name string } diff --git a/typedapi/types/enums/result/result.go b/typedapi/types/enums/result/result.go index 82cfa5c3a5..9b8d467e6e 100644 --- a/typedapi/types/enums/result/result.go +++ b/typedapi/types/enums/result/result.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package result package result import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Result.ts#L20-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Result.ts#L20-L27 type Result struct { Name string } diff --git a/typedapi/types/enums/resultposition/resultposition.go b/typedapi/types/enums/resultposition/resultposition.go index 668fb59f6e..94190fb984 100644 --- a/typedapi/types/enums/resultposition/resultposition.go +++ b/typedapi/types/enums/resultposition/resultposition.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package resultposition package resultposition import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/eql/search/types.ts#L20-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/eql/search/types.ts#L20-L32 type ResultPosition struct { Name string } diff --git a/typedapi/types/enums/routingstate/routingstate.go b/typedapi/types/enums/routingstate/routingstate.go index 3175f08a66..28422f00f4 100644 --- a/typedapi/types/enums/routingstate/routingstate.go +++ b/typedapi/types/enums/routingstate/routingstate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package routingstate package routingstate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L350-L371 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L350-L371 type RoutingState struct { Name string } diff --git a/typedapi/types/enums/ruleaction/ruleaction.go b/typedapi/types/enums/ruleaction/ruleaction.go index 0f1110331e..579f0c7a3f 100644 --- a/typedapi/types/enums/ruleaction/ruleaction.go +++ b/typedapi/types/enums/ruleaction/ruleaction.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package ruleaction package ruleaction import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Rule.ts#L41-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Rule.ts#L41-L50 type RuleAction struct { Name string } diff --git a/typedapi/types/enums/runtimefieldtype/runtimefieldtype.go b/typedapi/types/enums/runtimefieldtype/runtimefieldtype.go index 9f9649c818..25a8249678 100644 --- a/typedapi/types/enums/runtimefieldtype/runtimefieldtype.go +++ b/typedapi/types/enums/runtimefieldtype/runtimefieldtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package runtimefieldtype package runtimefieldtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/RuntimeFields.ts#L56-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/RuntimeFields.ts#L56-L65 type RuntimeFieldType struct { Name string } diff --git a/typedapi/types/enums/sampleraggregationexecutionhint/sampleraggregationexecutionhint.go b/typedapi/types/enums/sampleraggregationexecutionhint/sampleraggregationexecutionhint.go index d69e812df4..a0a2fb6640 100644 --- a/typedapi/types/enums/sampleraggregationexecutionhint/sampleraggregationexecutionhint.go +++ b/typedapi/types/enums/sampleraggregationexecutionhint/sampleraggregationexecutionhint.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package sampleraggregationexecutionhint package sampleraggregationexecutionhint import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L343-L356 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L343-L356 type SamplerAggregationExecutionHint struct { Name string } diff --git a/typedapi/types/enums/scoremode/scoremode.go b/typedapi/types/enums/scoremode/scoremode.go index c2440be2e9..2cb42bbaab 100644 --- a/typedapi/types/enums/scoremode/scoremode.go +++ b/typedapi/types/enums/scoremode/scoremode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package scoremode package scoremode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/rescoring.ts#L52-L74 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/rescoring.ts#L52-L74 type ScoreMode struct { Name string } diff --git a/typedapi/types/enums/scriptlanguage/scriptlanguage.go b/typedapi/types/enums/scriptlanguage/scriptlanguage.go index 453177c9a8..6afa497508 100644 --- a/typedapi/types/enums/scriptlanguage/scriptlanguage.go +++ b/typedapi/types/enums/scriptlanguage/scriptlanguage.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package scriptlanguage package scriptlanguage import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Scripting.ts#L24-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Scripting.ts#L24-L45 type ScriptLanguage struct { Name string } diff --git a/typedapi/types/enums/scriptsorttype/scriptsorttype.go b/typedapi/types/enums/scriptsorttype/scriptsorttype.go index 30bc760892..c4f4777dbc 100644 --- a/typedapi/types/enums/scriptsorttype/scriptsorttype.go +++ b/typedapi/types/enums/scriptsorttype/scriptsorttype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package scriptsorttype package scriptsorttype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L76-L80 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L76-L80 type ScriptSortType struct { Name string } diff --git a/typedapi/types/enums/searchtype/searchtype.go b/typedapi/types/enums/searchtype/searchtype.go index e8792815ea..97a56d7aa5 100644 --- a/typedapi/types/enums/searchtype/searchtype.go +++ b/typedapi/types/enums/searchtype/searchtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package searchtype package searchtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L280-L285 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L281-L286 type SearchType struct { Name string } diff --git a/typedapi/types/enums/segmentsortmissing/segmentsortmissing.go b/typedapi/types/enums/segmentsortmissing/segmentsortmissing.go index b3a5d81427..3de1a13bb3 100644 --- a/typedapi/types/enums/segmentsortmissing/segmentsortmissing.go +++ b/typedapi/types/enums/segmentsortmissing/segmentsortmissing.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package segmentsortmissing package segmentsortmissing import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSegmentSort.ts#L43-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSegmentSort.ts#L43-L48 type SegmentSortMissing struct { Name string } diff --git a/typedapi/types/enums/segmentsortmode/segmentsortmode.go b/typedapi/types/enums/segmentsortmode/segmentsortmode.go index 1f7fe5cc2d..802a17004d 100644 --- a/typedapi/types/enums/segmentsortmode/segmentsortmode.go +++ b/typedapi/types/enums/segmentsortmode/segmentsortmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package segmentsortmode package segmentsortmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSegmentSort.ts#L36-L41 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSegmentSort.ts#L36-L41 type SegmentSortMode struct { Name string } diff --git a/typedapi/types/enums/segmentsortorder/segmentsortorder.go b/typedapi/types/enums/segmentsortorder/segmentsortorder.go index 01c15ffc41..661c705ee7 100644 --- a/typedapi/types/enums/segmentsortorder/segmentsortorder.go +++ b/typedapi/types/enums/segmentsortorder/segmentsortorder.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package segmentsortorder package segmentsortorder import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSegmentSort.ts#L29-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSegmentSort.ts#L29-L34 type SegmentSortOrder struct { Name string } diff --git a/typedapi/types/enums/shapetype/shapetype.go b/typedapi/types/enums/shapetype/shapetype.go index bee8dc1fc7..3d94310322 100644 --- a/typedapi/types/enums/shapetype/shapetype.go +++ b/typedapi/types/enums/shapetype/shapetype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package shapetype package shapetype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L1029-L1032 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L1029-L1032 type ShapeType struct { Name string } diff --git a/typedapi/types/enums/shardroutingstate/shardroutingstate.go b/typedapi/types/enums/shardroutingstate/shardroutingstate.go index 0e191859e5..c455471d4d 100644 --- a/typedapi/types/enums/shardroutingstate/shardroutingstate.go +++ b/typedapi/types/enums/shardroutingstate/shardroutingstate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package shardroutingstate package shardroutingstate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L169-L174 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L169-L174 type ShardRoutingState struct { Name string } diff --git a/typedapi/types/enums/shardsstatsstage/shardsstatsstage.go b/typedapi/types/enums/shardsstatsstage/shardsstatsstage.go index 58a58d5669..7b077089cc 100644 --- a/typedapi/types/enums/shardsstatsstage/shardsstatsstage.go +++ b/typedapi/types/enums/shardsstatsstage/shardsstatsstage.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package shardsstatsstage package shardsstatsstage import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotShardsStatsStage.ts#L20-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotShardsStatsStage.ts#L20-L31 type ShardsStatsStage struct { Name string } diff --git a/typedapi/types/enums/shardstoreallocation/shardstoreallocation.go b/typedapi/types/enums/shardstoreallocation/shardstoreallocation.go index 4741a1a5c6..44361e764f 100644 --- a/typedapi/types/enums/shardstoreallocation/shardstoreallocation.go +++ b/typedapi/types/enums/shardstoreallocation/shardstoreallocation.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package shardstoreallocation package shardstoreallocation import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/shard_stores/types.ts#L45-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/shard_stores/types.ts#L45-L49 type ShardStoreAllocation struct { Name string } diff --git a/typedapi/types/enums/shardstorestatus/shardstorestatus.go b/typedapi/types/enums/shardstorestatus/shardstorestatus.go index 3721f61cc8..61bbfe05c9 100644 --- a/typedapi/types/enums/shardstorestatus/shardstorestatus.go +++ b/typedapi/types/enums/shardstorestatus/shardstorestatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package shardstorestatus package shardstorestatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/shard_stores/types.ts#L60-L69 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/shard_stores/types.ts#L60-L69 type ShardStoreStatus struct { Name string } diff --git a/typedapi/types/enums/shutdownstatus/shutdownstatus.go b/typedapi/types/enums/shutdownstatus/shutdownstatus.go index 6a4d83c136..8dbdbce10a 100644 --- a/typedapi/types/enums/shutdownstatus/shutdownstatus.go +++ b/typedapi/types/enums/shutdownstatus/shutdownstatus.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package shutdownstatus package shutdownstatus import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L45-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L45-L50 type ShutdownStatus struct { Name string } diff --git a/typedapi/types/enums/shutdowntype/shutdowntype.go b/typedapi/types/enums/shutdowntype/shutdowntype.go index 49b60fd577..9c4b4032b1 100644 --- a/typedapi/types/enums/shutdowntype/shutdowntype.go +++ b/typedapi/types/enums/shutdowntype/shutdowntype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package shutdowntype package shutdowntype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L40-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L40-L43 type ShutdownType struct { Name string } diff --git a/typedapi/types/enums/simplequerystringflag/simplequerystringflag.go b/typedapi/types/enums/simplequerystringflag/simplequerystringflag.go index dbd6048223..4a9f3cb284 100644 --- a/typedapi/types/enums/simplequerystringflag/simplequerystringflag.go +++ b/typedapi/types/enums/simplequerystringflag/simplequerystringflag.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package simplequerystringflag package simplequerystringflag import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L708-L763 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L708-L763 type SimpleQueryStringFlag struct { Name string } diff --git a/typedapi/types/enums/slicescalculation/slicescalculation.go b/typedapi/types/enums/slicescalculation/slicescalculation.go index 23c5c138e2..acf044d6ac 100644 --- a/typedapi/types/enums/slicescalculation/slicescalculation.go +++ b/typedapi/types/enums/slicescalculation/slicescalculation.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package slicescalculation package slicescalculation import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L373-L381 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L374-L382 type SlicesCalculation struct { Name string } diff --git a/typedapi/types/enums/snapshotsort/snapshotsort.go b/typedapi/types/enums/snapshotsort/snapshotsort.go index 432fd3a525..c28efff731 100644 --- a/typedapi/types/enums/snapshotsort/snapshotsort.go +++ b/typedapi/types/enums/snapshotsort/snapshotsort.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package snapshotsort package snapshotsort import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotInfo.ts#L73-L93 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotInfo.ts#L73-L93 type SnapshotSort struct { Name string } diff --git a/typedapi/types/enums/snapshotupgradestate/snapshotupgradestate.go b/typedapi/types/enums/snapshotupgradestate/snapshotupgradestate.go index a60d2c5331..c729d6fed4 100644 --- a/typedapi/types/enums/snapshotupgradestate/snapshotupgradestate.go +++ b/typedapi/types/enums/snapshotupgradestate/snapshotupgradestate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package snapshotupgradestate package snapshotupgradestate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Model.ts#L94-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Model.ts#L94-L99 type SnapshotUpgradeState struct { Name string } diff --git a/typedapi/types/enums/snowballlanguage/snowballlanguage.go b/typedapi/types/enums/snowballlanguage/snowballlanguage.go index e8ad374b55..0f9bcef20a 100644 --- a/typedapi/types/enums/snowballlanguage/snowballlanguage.go +++ b/typedapi/types/enums/snowballlanguage/snowballlanguage.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package snowballlanguage package snowballlanguage import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/languages.ts#L57-L80 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/languages.ts#L57-L80 type SnowballLanguage struct { Name string } diff --git a/typedapi/types/enums/sortmode/sortmode.go b/typedapi/types/enums/sortmode/sortmode.go index 7f09b7e339..6dc3b88f4e 100644 --- a/typedapi/types/enums/sortmode/sortmode.go +++ b/typedapi/types/enums/sortmode/sortmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package sortmode package sortmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L103-L112 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L103-L112 type SortMode struct { Name string } diff --git a/typedapi/types/enums/sortorder/sortorder.go b/typedapi/types/enums/sortorder/sortorder.go index e584dc061d..49282d5b42 100644 --- a/typedapi/types/enums/sortorder/sortorder.go +++ b/typedapi/types/enums/sortorder/sortorder.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package sortorder package sortorder import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L114-L123 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L114-L123 type SortOrder struct { Name string } diff --git a/typedapi/types/enums/sourcefieldmode/sourcefieldmode.go b/typedapi/types/enums/sourcefieldmode/sourcefieldmode.go index d569bff28b..b462e41743 100644 --- a/typedapi/types/enums/sourcefieldmode/sourcefieldmode.go +++ b/typedapi/types/enums/sourcefieldmode/sourcefieldmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package sourcefieldmode package sourcefieldmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/meta-fields.ts#L67-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/meta-fields.ts#L67-L75 type SourceFieldMode struct { Name string } diff --git a/typedapi/types/enums/statslevel/statslevel.go b/typedapi/types/enums/statslevel/statslevel.go index b22bad2a5e..297b8f3c86 100644 --- a/typedapi/types/enums/statslevel/statslevel.go +++ b/typedapi/types/enums/statslevel/statslevel.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package statslevel package statslevel import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/searchable_snapshots/_types/stats.ts#L20-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/searchable_snapshots/_types/stats.ts#L20-L24 type StatsLevel struct { Name string } diff --git a/typedapi/types/enums/storagetype/storagetype.go b/typedapi/types/enums/storagetype/storagetype.go index 41f6647517..9b96f8e7bd 100644 --- a/typedapi/types/enums/storagetype/storagetype.go +++ b/typedapi/types/enums/storagetype/storagetype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package storagetype package storagetype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L502-L532 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L502-L532 type StorageType struct { Name string } diff --git a/typedapi/types/enums/stringdistance/stringdistance.go b/typedapi/types/enums/stringdistance/stringdistance.go index 3da37198f8..571ea128e6 100644 --- a/typedapi/types/enums/stringdistance/stringdistance.go +++ b/typedapi/types/enums/stringdistance/stringdistance.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package stringdistance package stringdistance import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L469-L490 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L469-L490 type StringDistance struct { Name string } diff --git a/typedapi/types/enums/suggestmode/suggestmode.go b/typedapi/types/enums/suggestmode/suggestmode.go index edc1967028..71d41bfaae 100644 --- a/typedapi/types/enums/suggestmode/suggestmode.go +++ b/typedapi/types/enums/suggestmode/suggestmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package suggestmode package suggestmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L287-L300 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L288-L301 type SuggestMode struct { Name string } diff --git a/typedapi/types/enums/suggestsort/suggestsort.go b/typedapi/types/enums/suggestsort/suggestsort.go index 5aa74a6122..bbd6409e88 100644 --- a/typedapi/types/enums/suggestsort/suggestsort.go +++ b/typedapi/types/enums/suggestsort/suggestsort.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package suggestsort package suggestsort import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L492-L501 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L492-L501 type SuggestSort struct { Name string } diff --git a/typedapi/types/enums/synonymformat/synonymformat.go b/typedapi/types/enums/synonymformat/synonymformat.go index fef848b183..fbc5599178 100644 --- a/typedapi/types/enums/synonymformat/synonymformat.go +++ b/typedapi/types/enums/synonymformat/synonymformat.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package synonymformat package synonymformat import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L105-L108 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L105-L108 type SynonymFormat struct { Name string } diff --git a/typedapi/types/enums/tasktype/tasktype.go b/typedapi/types/enums/tasktype/tasktype.go new file mode 100644 index 0000000000..94198e41b2 --- /dev/null +++ b/typedapi/types/enums/tasktype/tasktype.go @@ -0,0 +1,57 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +// Package tasktype +package tasktype + +import "strings" + +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/_types/TaskType.ts#L20-L26 +type TaskType struct { + Name string +} + +var ( + Sparseembedding = TaskType{"sparse_embedding"} + + Textembedding = TaskType{"text_embedding"} +) + +func (t TaskType) MarshalText() (text []byte, err error) { + return []byte(t.String()), nil +} + +func (t *TaskType) UnmarshalText(text []byte) error { + switch strings.ReplaceAll(strings.ToLower(string(text)), "\"", "") { + + case "sparse_embedding": + *t = Sparseembedding + case "text_embedding": + *t = Textembedding + default: + *t = TaskType{string(text)} + } + + return nil +} + +func (t TaskType) String() string { + return t.Name +} diff --git a/typedapi/types/enums/templateformat/templateformat.go b/typedapi/types/enums/templateformat/templateformat.go index ff031a8c14..825630df87 100644 --- a/typedapi/types/enums/templateformat/templateformat.go +++ b/typedapi/types/enums/templateformat/templateformat.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package templateformat package templateformat import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_role/types.ts#L44-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/RoleTemplate.ts#L22-L25 type TemplateFormat struct { Name string } diff --git a/typedapi/types/enums/termsaggregationcollectmode/termsaggregationcollectmode.go b/typedapi/types/enums/termsaggregationcollectmode/termsaggregationcollectmode.go index 73d791ddb3..07accc9150 100644 --- a/typedapi/types/enums/termsaggregationcollectmode/termsaggregationcollectmode.go +++ b/typedapi/types/enums/termsaggregationcollectmode/termsaggregationcollectmode.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package termsaggregationcollectmode package termsaggregationcollectmode import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L980-L989 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L980-L989 type TermsAggregationCollectMode struct { Name string } diff --git a/typedapi/types/enums/termsaggregationexecutionhint/termsaggregationexecutionhint.go b/typedapi/types/enums/termsaggregationexecutionhint/termsaggregationexecutionhint.go index 8bf9002753..8aed2433c2 100644 --- a/typedapi/types/enums/termsaggregationexecutionhint/termsaggregationexecutionhint.go +++ b/typedapi/types/enums/termsaggregationexecutionhint/termsaggregationexecutionhint.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package termsaggregationexecutionhint package termsaggregationexecutionhint import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L991-L996 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L991-L996 type TermsAggregationExecutionHint struct { Name string } diff --git a/typedapi/types/enums/termvectoroption/termvectoroption.go b/typedapi/types/enums/termvectoroption/termvectoroption.go index 34614c9dce..1f6cc58cd5 100644 --- a/typedapi/types/enums/termvectoroption/termvectoroption.go +++ b/typedapi/types/enums/termvectoroption/termvectoroption.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package termvectoroption package termvectoroption import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/TermVectorOption.ts#L20-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/TermVectorOption.ts#L20-L28 type TermVectorOption struct { Name string } diff --git a/typedapi/types/enums/textquerytype/textquerytype.go b/typedapi/types/enums/textquerytype/textquerytype.go index 8f861a3852..26c34c5126 100644 --- a/typedapi/types/enums/textquerytype/textquerytype.go +++ b/typedapi/types/enums/textquerytype/textquerytype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package textquerytype package textquerytype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L541-L567 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L541-L567 type TextQueryType struct { Name string } diff --git a/typedapi/types/enums/threadtype/threadtype.go b/typedapi/types/enums/threadtype/threadtype.go index ca4f99d5cf..3ce1d24ca6 100644 --- a/typedapi/types/enums/threadtype/threadtype.go +++ b/typedapi/types/enums/threadtype/threadtype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package threadtype package threadtype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L302-L308 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L303-L309 type ThreadType struct { Name string } diff --git a/typedapi/types/enums/timeseriesmetrictype/timeseriesmetrictype.go b/typedapi/types/enums/timeseriesmetrictype/timeseriesmetrictype.go index 9cf2b42f78..c853a7dd74 100644 --- a/typedapi/types/enums/timeseriesmetrictype/timeseriesmetrictype.go +++ b/typedapi/types/enums/timeseriesmetrictype/timeseriesmetrictype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package timeseriesmetrictype package timeseriesmetrictype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/TimeSeriesMetricType.ts#L20-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/TimeSeriesMetricType.ts#L20-L26 type TimeSeriesMetricType struct { Name string } diff --git a/typedapi/types/enums/timeunit/timeunit.go b/typedapi/types/enums/timeunit/timeunit.go index ca683e89e8..992ae73d2c 100644 --- a/typedapi/types/enums/timeunit/timeunit.go +++ b/typedapi/types/enums/timeunit/timeunit.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package timeunit package timeunit import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Time.ts#L69-L84 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Time.ts#L69-L84 type TimeUnit struct { Name string } diff --git a/typedapi/types/enums/tokenchar/tokenchar.go b/typedapi/types/enums/tokenchar/tokenchar.go index 4fd44b822c..8c238f8401 100644 --- a/typedapi/types/enums/tokenchar/tokenchar.go +++ b/typedapi/types/enums/tokenchar/tokenchar.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package tokenchar package tokenchar import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L47-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L47-L54 type TokenChar struct { Name string } diff --git a/typedapi/types/enums/tokenizationtruncate/tokenizationtruncate.go b/typedapi/types/enums/tokenizationtruncate/tokenizationtruncate.go index 25a18d8d5c..20b246b4c6 100644 --- a/typedapi/types/enums/tokenizationtruncate/tokenizationtruncate.go +++ b/typedapi/types/enums/tokenizationtruncate/tokenizationtruncate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package tokenizationtruncate package tokenizationtruncate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L350-L354 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L350-L354 type TokenizationTruncate struct { Name string } diff --git a/typedapi/types/enums/totalhitsrelation/totalhitsrelation.go b/typedapi/types/enums/totalhitsrelation/totalhitsrelation.go index 26c8503ed1..9144e94455 100644 --- a/typedapi/types/enums/totalhitsrelation/totalhitsrelation.go +++ b/typedapi/types/enums/totalhitsrelation/totalhitsrelation.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package totalhitsrelation package totalhitsrelation import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/hits.ts#L99-L104 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/hits.ts#L99-L104 type TotalHitsRelation struct { Name string } diff --git a/typedapi/types/enums/trainedmodeltype/trainedmodeltype.go b/typedapi/types/enums/trainedmodeltype/trainedmodeltype.go index 5ca70774fa..bbd4edd2a8 100644 --- a/typedapi/types/enums/trainedmodeltype/trainedmodeltype.go +++ b/typedapi/types/enums/trainedmodeltype/trainedmodeltype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package trainedmodeltype package trainedmodeltype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L257-L271 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L257-L271 type TrainedModelType struct { Name string } diff --git a/typedapi/types/enums/trainingpriority/trainingpriority.go b/typedapi/types/enums/trainingpriority/trainingpriority.go index 91af27050a..4cc3623383 100644 --- a/typedapi/types/enums/trainingpriority/trainingpriority.go +++ b/typedapi/types/enums/trainingpriority/trainingpriority.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package trainingpriority package trainingpriority import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L310-L313 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L310-L313 type TrainingPriority struct { Name string } diff --git a/typedapi/types/enums/translogdurability/translogdurability.go b/typedapi/types/enums/translogdurability/translogdurability.go index 6470ca84d5..8ee6cc7496 100644 --- a/typedapi/types/enums/translogdurability/translogdurability.go +++ b/typedapi/types/enums/translogdurability/translogdurability.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package translogdurability package translogdurability import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L356-L371 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L356-L371 type TranslogDurability struct { Name string } diff --git a/typedapi/types/enums/ttesttype/ttesttype.go b/typedapi/types/enums/ttesttype/ttesttype.go index 1deee239c7..1105b81bdf 100644 --- a/typedapi/types/enums/ttesttype/ttesttype.go +++ b/typedapi/types/enums/ttesttype/ttesttype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package ttesttype package ttesttype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L322-L335 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L322-L335 type TTestType struct { Name string } diff --git a/typedapi/types/enums/type_/type_.go b/typedapi/types/enums/type_/type_.go index 9a3fbb3f82..8607197a6e 100644 --- a/typedapi/types/enums/type_/type_.go +++ b/typedapi/types/enums/type_/type_.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package type_ package type_ import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/_types/types.ts#L20-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/_types/types.ts#L20-L24 type Type struct { Name string } diff --git a/typedapi/types/enums/unassignedinformationreason/unassignedinformationreason.go b/typedapi/types/enums/unassignedinformationreason/unassignedinformationreason.go index 2e3db9aa21..eb40f312e8 100644 --- a/typedapi/types/enums/unassignedinformationreason/unassignedinformationreason.go +++ b/typedapi/types/enums/unassignedinformationreason/unassignedinformationreason.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package unassignedinformationreason package unassignedinformationreason import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L127-L146 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L127-L146 type UnassignedInformationReason struct { Name string } diff --git a/typedapi/types/enums/useragentproperty/useragentproperty.go b/typedapi/types/enums/useragentproperty/useragentproperty.go index 6320022199..92a932711b 100644 --- a/typedapi/types/enums/useragentproperty/useragentproperty.go +++ b/typedapi/types/enums/useragentproperty/useragentproperty.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package useragentproperty package useragentproperty import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L260-L271 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L260-L271 type UserAgentProperty struct { Name string } diff --git a/typedapi/types/enums/valuetype/valuetype.go b/typedapi/types/enums/valuetype/valuetype.go index 8d13b58338..0e416e6b0f 100644 --- a/typedapi/types/enums/valuetype/valuetype.go +++ b/typedapi/types/enums/valuetype/valuetype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package valuetype package valuetype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L419-L430 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L419-L430 type ValueType struct { Name string } diff --git a/typedapi/types/enums/versiontype/versiontype.go b/typedapi/types/enums/versiontype/versiontype.go index da72d77c57..4c6bd8d84b 100644 --- a/typedapi/types/enums/versiontype/versiontype.go +++ b/typedapi/types/enums/versiontype/versiontype.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package versiontype package versiontype import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L105-L121 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L106-L122 type VersionType struct { Name string } diff --git a/typedapi/types/enums/waitforactiveshardoptions/waitforactiveshardoptions.go b/typedapi/types/enums/waitforactiveshardoptions/waitforactiveshardoptions.go index 00263461c5..de342f7783 100644 --- a/typedapi/types/enums/waitforactiveshardoptions/waitforactiveshardoptions.go +++ b/typedapi/types/enums/waitforactiveshardoptions/waitforactiveshardoptions.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package waitforactiveshardoptions package waitforactiveshardoptions import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L310-L314 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L311-L315 type WaitForActiveShardOptions struct { Name string } diff --git a/typedapi/types/enums/waitforevents/waitforevents.go b/typedapi/types/enums/waitforevents/waitforevents.go index b4ebd0f2d0..d1a0c25557 100644 --- a/typedapi/types/enums/waitforevents/waitforevents.go +++ b/typedapi/types/enums/waitforevents/waitforevents.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package waitforevents package waitforevents import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L316-L323 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L317-L324 type WaitForEvents struct { Name string } diff --git a/typedapi/types/enums/watchermetric/watchermetric.go b/typedapi/types/enums/watchermetric/watchermetric.go index 676f6c45cf..76b73cac28 100644 --- a/typedapi/types/enums/watchermetric/watchermetric.go +++ b/typedapi/types/enums/watchermetric/watchermetric.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package watchermetric package watchermetric import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/stats/types.ts#L42-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/stats/types.ts#L42-L48 type WatcherMetric struct { Name string } diff --git a/typedapi/types/enums/watcherstate/watcherstate.go b/typedapi/types/enums/watcherstate/watcherstate.go index 521406bb13..361ed766d5 100644 --- a/typedapi/types/enums/watcherstate/watcherstate.go +++ b/typedapi/types/enums/watcherstate/watcherstate.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package watcherstate package watcherstate import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/stats/types.ts#L26-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/stats/types.ts#L26-L31 type WatcherState struct { Name string } diff --git a/typedapi/types/enums/zerotermsquery/zerotermsquery.go b/typedapi/types/enums/zerotermsquery/zerotermsquery.go index d3c1d3a057..1029fe1d68 100644 --- a/typedapi/types/enums/zerotermsquery/zerotermsquery.go +++ b/typedapi/types/enums/zerotermsquery/zerotermsquery.go @@ -16,14 +16,14 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Package zerotermsquery package zerotermsquery import "strings" -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L569-L578 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L569-L578 type ZeroTermsQuery struct { Name string } diff --git a/typedapi/types/epochtimeunitmillis.go b/typedapi/types/epochtimeunitmillis.go index 48943ab1e4..8fb0659ae5 100644 --- a/typedapi/types/epochtimeunitmillis.go +++ b/typedapi/types/epochtimeunitmillis.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // EpochTimeUnitMillis type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Time.ts#L40-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Time.ts#L40-L40 type EpochTimeUnitMillis int64 diff --git a/typedapi/types/epochtimeunitseconds.go b/typedapi/types/epochtimeunitseconds.go index a55d5f496c..f784f2fbc4 100644 --- a/typedapi/types/epochtimeunitseconds.go +++ b/typedapi/types/epochtimeunitseconds.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // EpochTimeUnitSeconds type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Time.ts#L40-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Time.ts#L40-L40 type EpochTimeUnitSeconds int64 diff --git a/typedapi/types/eql.go b/typedapi/types/eql.go index 9da3163d9d..33924d7ba5 100644 --- a/typedapi/types/eql.go +++ b/typedapi/types/eql.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Eql type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L351-L354 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L351-L354 type Eql struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/eqlfeatures.go b/typedapi/types/eqlfeatures.go index 9bb446f4d8..10c267a0bc 100644 --- a/typedapi/types/eqlfeatures.go +++ b/typedapi/types/eqlfeatures.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // EqlFeatures type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L99-L107 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L99-L107 type EqlFeatures struct { Event uint `json:"event"` Join uint `json:"join"` diff --git a/typedapi/types/eqlfeaturesjoin.go b/typedapi/types/eqlfeaturesjoin.go index 11ec4176d5..5086feb411 100644 --- a/typedapi/types/eqlfeaturesjoin.go +++ b/typedapi/types/eqlfeaturesjoin.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // EqlFeaturesJoin type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L109-L115 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L109-L115 type EqlFeaturesJoin struct { JoinQueriesFiveOrMore uint `json:"join_queries_five_or_more"` JoinQueriesFour uint `json:"join_queries_four"` diff --git a/typedapi/types/eqlfeatureskeys.go b/typedapi/types/eqlfeatureskeys.go index e9a587bd0f..70954f3992 100644 --- a/typedapi/types/eqlfeatureskeys.go +++ b/typedapi/types/eqlfeatureskeys.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // EqlFeaturesKeys type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L117-L123 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L117-L123 type EqlFeaturesKeys struct { JoinKeysFiveOrMore uint `json:"join_keys_five_or_more"` JoinKeysFour uint `json:"join_keys_four"` diff --git a/typedapi/types/eqlfeaturespipes.go b/typedapi/types/eqlfeaturespipes.go index e775596676..4c8634548e 100644 --- a/typedapi/types/eqlfeaturespipes.go +++ b/typedapi/types/eqlfeaturespipes.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // EqlFeaturesPipes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L125-L128 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L125-L128 type EqlFeaturesPipes struct { PipeHead uint `json:"pipe_head"` PipeTail uint `json:"pipe_tail"` diff --git a/typedapi/types/eqlfeaturessequences.go b/typedapi/types/eqlfeaturessequences.go index 7bdd33fd4e..7f35718d68 100644 --- a/typedapi/types/eqlfeaturessequences.go +++ b/typedapi/types/eqlfeaturessequences.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // EqlFeaturesSequences type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L130-L137 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L130-L137 type EqlFeaturesSequences struct { SequenceMaxspan uint `json:"sequence_maxspan"` SequenceQueriesFiveOrMore uint `json:"sequence_queries_five_or_more"` diff --git a/typedapi/types/eqlhits.go b/typedapi/types/eqlhits.go index dbdc009477..66d76be6e9 100644 --- a/typedapi/types/eqlhits.go +++ b/typedapi/types/eqlhits.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // EqlHits type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/eql/_types/EqlHits.ts#L25-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/eql/_types/EqlHits.ts#L25-L39 type EqlHits struct { // Events Contains events matching the query. Each object represents a matching event. Events []HitsEvent `json:"events,omitempty"` diff --git a/typedapi/types/errorcause.go b/typedapi/types/errorcause.go index f69377c4de..475e75bc80 100644 --- a/typedapi/types/errorcause.go +++ b/typedapi/types/errorcause.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // ErrorCause type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Errors.ts#L25-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Errors.ts#L25-L48 type ErrorCause struct { CausedBy *ErrorCause `json:"caused_by,omitempty"` Metadata map[string]json.RawMessage `json:"-"` diff --git a/typedapi/types/managedby.go b/typedapi/types/esqlcolumns.go similarity index 72% rename from typedapi/types/managedby.go rename to typedapi/types/esqlcolumns.go index 64db0a7437..c16ef85a17 100644 --- a/typedapi/types/managedby.go +++ b/typedapi/types/esqlcolumns.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types -// ManagedBy holds the union for the following types: +// EsqlColumns type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L74-L77 -type ManagedBy interface{} +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Binary.ts#L24-L24 +type EsqlColumns []byte diff --git a/typedapi/types/eventdatastream.go b/typedapi/types/eventdatastream.go index 4ababc8f54..0b650b5a9a 100644 --- a/typedapi/types/eventdatastream.go +++ b/typedapi/types/eventdatastream.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // EventDataStream type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/_types/BehavioralAnalytics.ts#L29-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/_types/BehavioralAnalytics.ts#L29-L31 type EventDataStream struct { Name string `json:"name"` } diff --git a/typedapi/types/ewmamodelsettings.go b/typedapi/types/ewmamodelsettings.go index 9f00587a16..426a4cfbd1 100644 --- a/typedapi/types/ewmamodelsettings.go +++ b/typedapi/types/ewmamodelsettings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // EwmaModelSettings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L267-L269 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L267-L269 type EwmaModelSettings struct { Alpha *float32 `json:"alpha,omitempty"` } diff --git a/typedapi/types/ewmamovingaverageaggregation.go b/typedapi/types/ewmamovingaverageaggregation.go index af4e95b9f6..a07c898644 100644 --- a/typedapi/types/ewmamovingaverageaggregation.go +++ b/typedapi/types/ewmamovingaverageaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // EwmaMovingAverageAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L252-L255 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L252-L255 type EwmaMovingAverageAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/executeenrichpolicystatus.go b/typedapi/types/executeenrichpolicystatus.go index 365d58bf6c..6f3d6f5d3a 100644 --- a/typedapi/types/executeenrichpolicystatus.go +++ b/typedapi/types/executeenrichpolicystatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // ExecuteEnrichPolicyStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/execute_policy/types.ts#L20-L22 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/execute_policy/types.ts#L20-L22 type ExecuteEnrichPolicyStatus struct { Phase enrichpolicyphase.EnrichPolicyPhase `json:"phase"` } diff --git a/typedapi/types/executingpolicy.go b/typedapi/types/executingpolicy.go index af3a4a9852..b9e67e7457 100644 --- a/typedapi/types/executingpolicy.go +++ b/typedapi/types/executingpolicy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ExecutingPolicy type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/stats/types.ts#L24-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/stats/types.ts#L24-L27 type ExecutingPolicy struct { Name string `json:"name"` Task TaskInfo `json:"task"` diff --git a/typedapi/types/executionresult.go b/typedapi/types/executionresult.go index be82470b07..5e4e35b20f 100644 --- a/typedapi/types/executionresult.go +++ b/typedapi/types/executionresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ExecutionResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Execution.ts#L60-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Execution.ts#L60-L66 type ExecutionResult struct { Actions []ExecutionResultAction `json:"actions"` Condition ExecutionResultCondition `json:"condition"` diff --git a/typedapi/types/executionresultaction.go b/typedapi/types/executionresultaction.go index de0709bf2f..92dc446929 100644 --- a/typedapi/types/executionresultaction.go +++ b/typedapi/types/executionresultaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // ExecutionResultAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Execution.ts#L74-L86 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Execution.ts#L74-L86 type ExecutionResultAction struct { Email *EmailResult `json:"email,omitempty"` Error *ErrorCause `json:"error,omitempty"` diff --git a/typedapi/types/executionresultcondition.go b/typedapi/types/executionresultcondition.go index 23bffd4bdb..4a7a4bfa58 100644 --- a/typedapi/types/executionresultcondition.go +++ b/typedapi/types/executionresultcondition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // ExecutionResultCondition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Execution.ts#L68-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Execution.ts#L68-L72 type ExecutionResultCondition struct { Met bool `json:"met"` Status actionstatusoptions.ActionStatusOptions `json:"status"` diff --git a/typedapi/types/executionresultinput.go b/typedapi/types/executionresultinput.go index d7f32b21d8..d46764acb5 100644 --- a/typedapi/types/executionresultinput.go +++ b/typedapi/types/executionresultinput.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ExecutionResultInput type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Execution.ts#L88-L92 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Execution.ts#L88-L92 type ExecutionResultInput struct { Payload map[string]json.RawMessage `json:"payload"` Status actionstatusoptions.ActionStatusOptions `json:"status"` diff --git a/typedapi/types/executionstate.go b/typedapi/types/executionstate.go index 041002c5db..9afd8b055c 100644 --- a/typedapi/types/executionstate.go +++ b/typedapi/types/executionstate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ExecutionState type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L120-L124 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L120-L124 type ExecutionState struct { Reason *string `json:"reason,omitempty"` Successful bool `json:"successful"` diff --git a/typedapi/types/executionthreadpool.go b/typedapi/types/executionthreadpool.go index 4cdee094d7..bcc411550d 100644 --- a/typedapi/types/executionthreadpool.go +++ b/typedapi/types/executionthreadpool.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ExecutionThreadPool type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Execution.ts#L94-L97 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Execution.ts#L94-L97 type ExecutionThreadPool struct { MaxSize int64 `json:"max_size"` QueueSize int64 `json:"queue_size"` diff --git a/typedapi/types/existsquery.go b/typedapi/types/existsquery.go index 331be69f3f..eac7f8b62e 100644 --- a/typedapi/types/existsquery.go +++ b/typedapi/types/existsquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ExistsQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L36-L41 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L36-L41 type ExistsQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/expandwildcards.go b/typedapi/types/expandwildcards.go index feb17bd4da..e388d68eac 100644 --- a/typedapi/types/expandwildcards.go +++ b/typedapi/types/expandwildcards.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ import ( // ExpandWildcards type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L222-L222 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L223-L223 type ExpandWildcards []expandwildcard.ExpandWildcard diff --git a/typedapi/types/explainanalyzetoken.go b/typedapi/types/explainanalyzetoken.go index 1e5e13a15a..06acf751b6 100644 --- a/typedapi/types/explainanalyzetoken.go +++ b/typedapi/types/explainanalyzetoken.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // ExplainAnalyzeToken type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/analyze/types.ts#L52-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/analyze/types.ts#L52-L64 type ExplainAnalyzeToken struct { Bytes string `json:"bytes"` EndOffset int64 `json:"end_offset"` diff --git a/typedapi/types/explanation.go b/typedapi/types/explanation.go index 9b682e12a8..94b6031c5a 100644 --- a/typedapi/types/explanation.go +++ b/typedapi/types/explanation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Explanation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/explain/types.ts#L22-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/explain/types.ts#L22-L26 type Explanation struct { Description string `json:"description"` Details []ExplanationDetail `json:"details"` diff --git a/typedapi/types/explanationdetail.go b/typedapi/types/explanationdetail.go index c79b7f81cc..566b49f20f 100644 --- a/typedapi/types/explanationdetail.go +++ b/typedapi/types/explanationdetail.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ExplanationDetail type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/explain/types.ts#L28-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/explain/types.ts#L28-L32 type ExplanationDetail struct { Description string `json:"description"` Details []ExplanationDetail `json:"details,omitempty"` diff --git a/typedapi/types/explorecontrols.go b/typedapi/types/explorecontrols.go index a8b2f314bf..e1c3375743 100644 --- a/typedapi/types/explorecontrols.go +++ b/typedapi/types/explorecontrols.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ExploreControls type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/graph/_types/ExploreControls.ts#L24-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/graph/_types/ExploreControls.ts#L24-L49 type ExploreControls struct { // SampleDiversity To avoid the top-matching documents sample being dominated by a single source // of results, it is sometimes necessary to request diversity in the sample. diff --git a/typedapi/types/extendedboundsdouble.go b/typedapi/types/extendedboundsdouble.go index 877b09a0dd..97dda7b1b9 100644 --- a/typedapi/types/extendedboundsdouble.go +++ b/typedapi/types/extendedboundsdouble.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ExtendedBoundsdouble type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L489-L498 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L489-L498 type ExtendedBoundsdouble struct { // Max Maximum value for the bound. Max Float64 `json:"max"` diff --git a/typedapi/types/extendedboundsfielddatemath.go b/typedapi/types/extendedboundsfielddatemath.go index 1268e5e448..933a00f6a5 100644 --- a/typedapi/types/extendedboundsfielddatemath.go +++ b/typedapi/types/extendedboundsfielddatemath.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ExtendedBoundsFieldDateMath type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L489-L498 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L489-L498 type ExtendedBoundsFieldDateMath struct { // Max Maximum value for the bound. Max FieldDateMath `json:"max"` diff --git a/typedapi/types/extendedmemorystats.go b/typedapi/types/extendedmemorystats.go index 772c8552da..8a0a748034 100644 --- a/typedapi/types/extendedmemorystats.go +++ b/typedapi/types/extendedmemorystats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ExtendedMemoryStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L622-L631 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L622-L631 type ExtendedMemoryStats struct { // AdjustedTotalInBytes If the amount of physical memory has been overridden using the // `es`.`total_memory_bytes` system property then this reports the overridden diff --git a/typedapi/types/extendedstatsaggregate.go b/typedapi/types/extendedstatsaggregate.go index 764a1d52cd..e7fd0eebc0 100644 --- a/typedapi/types/extendedstatsaggregate.go +++ b/typedapi/types/extendedstatsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ExtendedStatsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L278-L296 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L278-L296 type ExtendedStatsAggregate struct { Avg Float64 `json:"avg,omitempty"` AvgAsString *string `json:"avg_as_string,omitempty"` diff --git a/typedapi/types/extendedstatsaggregation.go b/typedapi/types/extendedstatsaggregation.go index 4dc881af76..780e59925e 100644 --- a/typedapi/types/extendedstatsaggregation.go +++ b/typedapi/types/extendedstatsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ExtendedStatsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L101-L106 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L101-L106 type ExtendedStatsAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/extendedstatsbucketaggregate.go b/typedapi/types/extendedstatsbucketaggregate.go index 76260a8be8..f88075f1a3 100644 --- a/typedapi/types/extendedstatsbucketaggregate.go +++ b/typedapi/types/extendedstatsbucketaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ExtendedStatsBucketAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L298-L299 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L298-L299 type ExtendedStatsBucketAggregate struct { Avg Float64 `json:"avg,omitempty"` AvgAsString *string `json:"avg_as_string,omitempty"` diff --git a/typedapi/types/extendedstatsbucketaggregation.go b/typedapi/types/extendedstatsbucketaggregation.go index a8cc02847f..4b62f91129 100644 --- a/typedapi/types/extendedstatsbucketaggregation.go +++ b/typedapi/types/extendedstatsbucketaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ExtendedStatsBucketAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L198-L203 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L198-L203 type ExtendedStatsBucketAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/failprocessor.go b/typedapi/types/failprocessor.go index acd22bfcc7..c15e0ae866 100644 --- a/typedapi/types/failprocessor.go +++ b/typedapi/types/failprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FailProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L637-L643 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L637-L643 type FailProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/feature.go b/typedapi/types/feature.go index 97144b09ca..2dc7f4c813 100644 --- a/typedapi/types/feature.go +++ b/typedapi/types/feature.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Feature type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/features/_types/Feature.ts#L20-L23 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/features/_types/Feature.ts#L20-L23 type Feature struct { Description string `json:"description"` Name string `json:"name"` diff --git a/typedapi/types/features.go b/typedapi/types/features.go index 505133189e..7165691185 100644 --- a/typedapi/types/features.go +++ b/typedapi/types/features.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ import ( // Features type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get/IndicesGetRequest.ts#L95-L95 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get/IndicesGetRequest.ts#L95-L95 type Features []feature.Feature diff --git a/typedapi/types/featuretoggle.go b/typedapi/types/featuretoggle.go index 834097f842..2e4104a524 100644 --- a/typedapi/types/featuretoggle.go +++ b/typedapi/types/featuretoggle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FeatureToggle type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L40-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L40-L42 type FeatureToggle struct { Enabled bool `json:"enabled"` } diff --git a/typedapi/types/fetchprofile.go b/typedapi/types/fetchprofile.go index 9d8fe06872..36d7505b48 100644 --- a/typedapi/types/fetchprofile.go +++ b/typedapi/types/fetchprofile.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FetchProfile type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L139-L146 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L139-L146 type FetchProfile struct { Breakdown FetchProfileBreakdown `json:"breakdown"` Children []FetchProfile `json:"children,omitempty"` diff --git a/typedapi/types/fetchprofilebreakdown.go b/typedapi/types/fetchprofilebreakdown.go index 2551a3fd19..9545f0a5e0 100644 --- a/typedapi/types/fetchprofilebreakdown.go +++ b/typedapi/types/fetchprofilebreakdown.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FetchProfileBreakdown type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L148-L157 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L148-L157 type FetchProfileBreakdown struct { LoadSource *int `json:"load_source,omitempty"` LoadSourceCount *int `json:"load_source_count,omitempty"` diff --git a/typedapi/types/fetchprofiledebug.go b/typedapi/types/fetchprofiledebug.go index 474858a52e..265029fb62 100644 --- a/typedapi/types/fetchprofiledebug.go +++ b/typedapi/types/fetchprofiledebug.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FetchProfileDebug type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L159-L162 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L159-L162 type FetchProfileDebug struct { FastPath *int `json:"fast_path,omitempty"` StoredFields []string `json:"stored_fields,omitempty"` diff --git a/typedapi/types/fieldaliasproperty.go b/typedapi/types/fieldaliasproperty.go index fb1e57d8a6..dadc782a25 100644 --- a/typedapi/types/fieldaliasproperty.go +++ b/typedapi/types/fieldaliasproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // FieldAliasProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/specialized.ts#L49-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/specialized.ts#L49-L52 type FieldAliasProperty struct { Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` Fields map[string]Property `json:"fields,omitempty"` @@ -182,6 +182,12 @@ func (s *FieldAliasProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -512,6 +518,12 @@ func (s *FieldAliasProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/fieldandformat.go b/typedapi/types/fieldandformat.go index 3606110427..9765b4ac75 100644 --- a/typedapi/types/fieldandformat.go +++ b/typedapi/types/fieldandformat.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldAndFormat type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/abstractions.ts#L489-L503 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/abstractions.ts#L489-L503 type FieldAndFormat struct { // Field Wildcard pattern. The request returns values for field names matching this // pattern. diff --git a/typedapi/types/fieldcapability.go b/typedapi/types/fieldcapability.go index 01b2be7d6c..593903cd25 100644 --- a/typedapi/types/fieldcapability.go +++ b/typedapi/types/fieldcapability.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // FieldCapability type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/field_caps/types.ts#L23-L81 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/field_caps/types.ts#L23-L81 type FieldCapability struct { // Aggregatable Whether this field can be aggregated on all indices. Aggregatable bool `json:"aggregatable"` diff --git a/typedapi/types/fieldcollapse.go b/typedapi/types/fieldcollapse.go index 4fe83e3b3d..32b8f9c82d 100644 --- a/typedapi/types/fieldcollapse.go +++ b/typedapi/types/fieldcollapse.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldCollapse type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/FieldCollapse.ts#L24-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/FieldCollapse.ts#L24-L38 type FieldCollapse struct { Collapse *FieldCollapse `json:"collapse,omitempty"` // Field The field to collapse the result set on diff --git a/typedapi/types/fielddatafrequencyfilter.go b/typedapi/types/fielddatafrequencyfilter.go index 35eb5ef664..2f9fe64018 100644 --- a/typedapi/types/fielddatafrequencyfilter.go +++ b/typedapi/types/fielddatafrequencyfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FielddataFrequencyFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/FielddataFrequencyFilter.ts#L22-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/FielddataFrequencyFilter.ts#L22-L26 type FielddataFrequencyFilter struct { Max Float64 `json:"max"` Min Float64 `json:"min"` diff --git a/typedapi/types/fielddatarecord.go b/typedapi/types/fielddatarecord.go index 0d91469382..60c4443fb7 100644 --- a/typedapi/types/fielddatarecord.go +++ b/typedapi/types/fielddatarecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FielddataRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/fielddata/types.ts#L20-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/fielddata/types.ts#L20-L48 type FielddataRecord struct { // Field field name Field *string `json:"field,omitempty"` diff --git a/typedapi/types/fielddatastats.go b/typedapi/types/fielddatastats.go index de16a29ba9..9bc8adce0c 100644 --- a/typedapi/types/fielddatastats.go +++ b/typedapi/types/fielddatastats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FielddataStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L111-L116 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L111-L116 type FielddataStats struct { Evictions *int64 `json:"evictions,omitempty"` Fields map[string]FieldMemoryUsage `json:"fields,omitempty"` diff --git a/typedapi/types/fielddatemath.go b/typedapi/types/fielddatemath.go index 2b88cd9305..d1e6406756 100644 --- a/typedapi/types/fielddatemath.go +++ b/typedapi/types/fielddatemath.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // Float64 // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L296-L303 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L296-L303 type FieldDateMath interface{} diff --git a/typedapi/types/fieldlookup.go b/typedapi/types/fieldlookup.go index c962072258..1071e1d128 100644 --- a/typedapi/types/fieldlookup.go +++ b/typedapi/types/fieldlookup.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // FieldLookup type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/abstractions.ts#L393-L410 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/abstractions.ts#L393-L410 type FieldLookup struct { // Id `id` of the document. Id string `json:"id"` diff --git a/typedapi/types/fieldmapping.go b/typedapi/types/fieldmapping.go index d139a80e1e..69deb35f11 100644 --- a/typedapi/types/fieldmapping.go +++ b/typedapi/types/fieldmapping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldMapping type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/meta-fields.ts#L24-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/meta-fields.ts#L24-L27 type FieldMapping struct { FullName string `json:"full_name"` Mapping map[string]Property `json:"mapping"` @@ -181,6 +181,12 @@ func (s *FieldMapping) UnmarshalJSON(data []byte) error { return err } s.Mapping[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Mapping[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/fieldmemoryusage.go b/typedapi/types/fieldmemoryusage.go index a628281c95..195dedfb75 100644 --- a/typedapi/types/fieldmemoryusage.go +++ b/typedapi/types/fieldmemoryusage.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldMemoryUsage type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L118-L121 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L118-L121 type FieldMemoryUsage struct { MemorySize ByteSize `json:"memory_size,omitempty"` MemorySizeInBytes int64 `json:"memory_size_in_bytes"` diff --git a/typedapi/types/fieldmetric.go b/typedapi/types/fieldmetric.go index 233091a79c..add3ce24c7 100644 --- a/typedapi/types/fieldmetric.go +++ b/typedapi/types/fieldmetric.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // FieldMetric type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/_types/Metric.ts#L30-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/_types/Metric.ts#L30-L35 type FieldMetric struct { // Field The field to collect metrics for. This must be a numeric of some kind. Field string `json:"field"` diff --git a/typedapi/types/fieldnamesfield.go b/typedapi/types/fieldnamesfield.go index 5f721c0588..2d1bd6cb44 100644 --- a/typedapi/types/fieldnamesfield.go +++ b/typedapi/types/fieldnamesfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldNamesField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/meta-fields.ts#L42-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/meta-fields.ts#L42-L44 type FieldNamesField struct { Enabled bool `json:"enabled"` } diff --git a/typedapi/types/fieldrule.go b/typedapi/types/fieldrule.go index c2dfdeee5f..2a9198119d 100644 --- a/typedapi/types/fieldrule.go +++ b/typedapi/types/fieldrule.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // FieldRule type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/RoleMappingRule.ts#L33-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/RoleMappingRule.ts#L33-L42 type FieldRule struct { Dn []string `json:"dn,omitempty"` Groups []string `json:"groups,omitempty"` diff --git a/typedapi/types/fields.go b/typedapi/types/fields.go index 83ac590d04..f7be08e9c9 100644 --- a/typedapi/types/fields.go +++ b/typedapi/types/fields.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Fields type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L139-L139 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L140-L140 type Fields []string diff --git a/typedapi/types/fieldsecurity.go b/typedapi/types/fieldsecurity.go index 04200ae361..f6dc182610 100644 --- a/typedapi/types/fieldsecurity.go +++ b/typedapi/types/fieldsecurity.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // FieldSecurity type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/FieldSecurity.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/FieldSecurity.ts#L22-L25 type FieldSecurity struct { Except []string `json:"except,omitempty"` Grant []string `json:"grant,omitempty"` diff --git a/typedapi/types/fieldsizeusage.go b/typedapi/types/fieldsizeusage.go index cda742ef7a..3f2bb2cb11 100644 --- a/typedapi/types/fieldsizeusage.go +++ b/typedapi/types/fieldsizeusage.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldSizeUsage type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L92-L95 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L92-L95 type FieldSizeUsage struct { Size ByteSize `json:"size,omitempty"` SizeInBytes int64 `json:"size_in_bytes"` diff --git a/typedapi/types/fieldsort.go b/typedapi/types/fieldsort.go index 19506237f9..a252d79dd5 100644 --- a/typedapi/types/fieldsort.go +++ b/typedapi/types/fieldsort.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -35,7 +35,7 @@ import ( // FieldSort type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L44-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L44-L53 type FieldSort struct { Format *string `json:"format,omitempty"` Missing Missing `json:"missing,omitempty"` diff --git a/typedapi/types/fieldstat.go b/typedapi/types/fieldstat.go index 06cb7a6581..8a58dbefa7 100644 --- a/typedapi/types/fieldstat.go +++ b/typedapi/types/fieldstat.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldStat type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/text_structure/find_structure/types.ts#L23-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/text_structure/find_structure/types.ts#L23-L33 type FieldStat struct { Cardinality int `json:"cardinality"` Count int `json:"count"` diff --git a/typedapi/types/fieldstatistics.go b/typedapi/types/fieldstatistics.go index 8e87455139..d4dd92e03a 100644 --- a/typedapi/types/fieldstatistics.go +++ b/typedapi/types/fieldstatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/termvectors/types.ts#L28-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/termvectors/types.ts#L28-L32 type FieldStatistics struct { DocCount int `json:"doc_count"` SumDocFreq int64 `json:"sum_doc_freq"` diff --git a/typedapi/types/fieldsuggester.go b/typedapi/types/fieldsuggester.go index 05c976473c..8523e6f48d 100644 --- a/typedapi/types/fieldsuggester.go +++ b/typedapi/types/fieldsuggester.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldSuggester type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L106-L139 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L106-L139 type FieldSuggester struct { // Completion Provides auto-complete/search-as-you-type functionality. Completion *CompletionSuggester `json:"completion,omitempty"` diff --git a/typedapi/types/fieldsummary.go b/typedapi/types/fieldsummary.go index ea20b67c2b..cccd208c19 100644 --- a/typedapi/types/fieldsummary.go +++ b/typedapi/types/fieldsummary.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // FieldSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L54-L63 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L54-L63 type FieldSummary struct { Any uint `json:"any"` DocValues uint `json:"doc_values"` diff --git a/typedapi/types/fieldsusagebody.go b/typedapi/types/fieldsusagebody.go index a4d72febe3..741be34149 100644 --- a/typedapi/types/fieldsusagebody.go +++ b/typedapi/types/fieldsusagebody.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -27,7 +27,7 @@ import ( // FieldsUsageBody type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L32-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L32-L36 type FieldsUsageBody struct { FieldsUsageBody map[string]UsageStatsIndex `json:"-"` Shards_ ShardStatistics `json:"_shards"` diff --git a/typedapi/types/fieldtypes.go b/typedapi/types/fieldtypes.go index 4bd76fe58d..3561c89bfd 100644 --- a/typedapi/types/fieldtypes.go +++ b/typedapi/types/fieldtypes.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldTypes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L136-L167 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L136-L167 type FieldTypes struct { // Count The number of occurrences of the field type in selected nodes. Count int `json:"count"` diff --git a/typedapi/types/fieldtypesmappings.go b/typedapi/types/fieldtypesmappings.go index 2a3e943b37..deea52cc87 100644 --- a/typedapi/types/fieldtypesmappings.go +++ b/typedapi/types/fieldtypesmappings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FieldTypesMappings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L109-L134 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L109-L134 type FieldTypesMappings struct { // FieldTypes Contains statistics about field data types used in selected nodes. FieldTypes []FieldTypes `json:"field_types"` diff --git a/typedapi/types/fieldvalue.go b/typedapi/types/fieldvalue.go index e1de58e336..0e57f09234 100644 --- a/typedapi/types/fieldvalue.go +++ b/typedapi/types/fieldvalue.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,5 +29,5 @@ package types // nil // json.RawMessage // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L25-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L25-L37 type FieldValue interface{} diff --git a/typedapi/types/fieldvaluefactorscorefunction.go b/typedapi/types/fieldvaluefactorscorefunction.go index f5b4642838..774ea1a5a7 100644 --- a/typedapi/types/fieldvaluefactorscorefunction.go +++ b/typedapi/types/fieldvaluefactorscorefunction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // FieldValueFactorScoreFunction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L132-L151 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L132-L151 type FieldValueFactorScoreFunction struct { // Factor Optional factor to multiply the field value with. Factor *Float64 `json:"factor,omitempty"` diff --git a/typedapi/types/filecountsnapshotstats.go b/typedapi/types/filecountsnapshotstats.go index 53257100b1..14513e9896 100644 --- a/typedapi/types/filecountsnapshotstats.go +++ b/typedapi/types/filecountsnapshotstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FileCountSnapshotStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/FileCountSnapshotStats.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/FileCountSnapshotStats.ts#L22-L25 type FileCountSnapshotStats struct { FileCount int `json:"file_count"` SizeInBytes int64 `json:"size_in_bytes"` diff --git a/typedapi/types/filedetails.go b/typedapi/types/filedetails.go index 3643cc6058..0f9d0ad958 100644 --- a/typedapi/types/filedetails.go +++ b/typedapi/types/filedetails.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FileDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/types.ts#L50-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/types.ts#L50-L54 type FileDetails struct { Length int64 `json:"length"` Name string `json:"name"` diff --git a/typedapi/types/filesystem.go b/typedapi/types/filesystem.go index 8f47044c0b..b428d38544 100644 --- a/typedapi/types/filesystem.go +++ b/typedapi/types/filesystem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FileSystem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L698-L716 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L698-L716 type FileSystem struct { // Data List of all file stores. Data []DataPathStats `json:"data,omitempty"` diff --git a/typedapi/types/filesystemtotal.go b/typedapi/types/filesystemtotal.go index e57295f4e4..b7ff756137 100644 --- a/typedapi/types/filesystemtotal.go +++ b/typedapi/types/filesystemtotal.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FileSystemTotal type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L757-L786 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L757-L786 type FileSystemTotal struct { // Available Total disk space available to this Java virtual machine on all file stores. // Depending on OS or process level restrictions, this might appear less than diff --git a/typedapi/types/fillmaskinferenceoptions.go b/typedapi/types/fillmaskinferenceoptions.go index ff1d4078b4..ad57c7c04f 100644 --- a/typedapi/types/fillmaskinferenceoptions.go +++ b/typedapi/types/fillmaskinferenceoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FillMaskInferenceOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L266-L280 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L266-L280 type FillMaskInferenceOptions struct { // MaskToken The string/token which will be removed from incoming documents and replaced // with the inference prediction(s). diff --git a/typedapi/types/fillmaskinferenceupdateoptions.go b/typedapi/types/fillmaskinferenceupdateoptions.go index c50705dd98..a590f68ac2 100644 --- a/typedapi/types/fillmaskinferenceupdateoptions.go +++ b/typedapi/types/fillmaskinferenceupdateoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FillMaskInferenceUpdateOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L411-L418 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L411-L418 type FillMaskInferenceUpdateOptions struct { // NumTopClasses Specifies the number of top class predictions to return. Defaults to 0. NumTopClasses *int `json:"num_top_classes,omitempty"` diff --git a/typedapi/types/filteraggregate.go b/typedapi/types/filteraggregate.go index d765ea86f6..3afdac3428 100644 --- a/typedapi/types/filteraggregate.go +++ b/typedapi/types/filteraggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // FilterAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L495-L496 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L495-L496 type FilterAggregate struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/filterref.go b/typedapi/types/filterref.go index 16257c826a..dd15cdf074 100644 --- a/typedapi/types/filterref.go +++ b/typedapi/types/filterref.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // FilterRef type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Filter.ts#L31-L41 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Filter.ts#L31-L41 type FilterRef struct { // FilterId The identifier for the filter. FilterId string `json:"filter_id"` diff --git a/typedapi/types/filtersaggregate.go b/typedapi/types/filtersaggregate.go index b31155e445..a578451b50 100644 --- a/typedapi/types/filtersaggregate.go +++ b/typedapi/types/filtersaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // FiltersAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L568-L569 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L568-L569 type FiltersAggregate struct { Buckets BucketsFiltersBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/filtersaggregation.go b/typedapi/types/filtersaggregation.go index 641c080e3d..e873f4e7d8 100644 --- a/typedapi/types/filtersaggregation.go +++ b/typedapi/types/filtersaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FiltersAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L358-L378 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L358-L378 type FiltersAggregation struct { // Filters Collection of queries from which to build buckets. Filters BucketsQuery `json:"filters,omitempty"` diff --git a/typedapi/types/filtersbucket.go b/typedapi/types/filtersbucket.go index 1326e6758b..fa6c9ce1bd 100644 --- a/typedapi/types/filtersbucket.go +++ b/typedapi/types/filtersbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // FiltersBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L571-L571 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L571-L571 type FiltersBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/fingerprintanalyzer.go b/typedapi/types/fingerprintanalyzer.go index 5f16fa99ad..eec5bdcce5 100644 --- a/typedapi/types/fingerprintanalyzer.go +++ b/typedapi/types/fingerprintanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FingerprintAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L37-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L37-L45 type FingerprintAnalyzer struct { MaxOutputSize int `json:"max_output_size"` PreserveOriginal bool `json:"preserve_original"` diff --git a/typedapi/types/fingerprinttokenfilter.go b/typedapi/types/fingerprinttokenfilter.go index f70b8bcf90..93f170a423 100644 --- a/typedapi/types/fingerprinttokenfilter.go +++ b/typedapi/types/fingerprinttokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FingerprintTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L194-L198 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L194-L198 type FingerprintTokenFilter struct { MaxOutputSize *int `json:"max_output_size,omitempty"` Separator *string `json:"separator,omitempty"` diff --git a/typedapi/types/flattened.go b/typedapi/types/flattened.go index c21b54494a..a0949d7c29 100644 --- a/typedapi/types/flattened.go +++ b/typedapi/types/flattened.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Flattened type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L356-L358 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L356-L358 type Flattened struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/flattenedproperty.go b/typedapi/types/flattenedproperty.go index ab7704c51f..a346dce036 100644 --- a/typedapi/types/flattenedproperty.go +++ b/typedapi/types/flattenedproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // FlattenedProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/complex.ts#L26-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/complex.ts#L26-L37 type FlattenedProperty struct { Boost *Float64 `json:"boost,omitempty"` DepthLimit *int `json:"depth_limit,omitempty"` @@ -251,6 +251,12 @@ func (s *FlattenedProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -607,6 +613,12 @@ func (s *FlattenedProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/floatnumberproperty.go b/typedapi/types/floatnumberproperty.go index 5d41e6cf08..87abbdb607 100644 --- a/typedapi/types/floatnumberproperty.go +++ b/typedapi/types/floatnumberproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // FloatNumberProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L134-L137 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L134-L137 type FloatNumberProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -260,6 +260,12 @@ func (s *FloatNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -634,6 +640,12 @@ func (s *FloatNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/floatrangeproperty.go b/typedapi/types/floatrangeproperty.go index c7d910ff74..c4dbee7240 100644 --- a/typedapi/types/floatrangeproperty.go +++ b/typedapi/types/floatrangeproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // FloatRangeProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/range.ts#L38-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/range.ts#L38-L40 type FloatRangeProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -248,6 +248,12 @@ func (s *FloatRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -587,6 +593,12 @@ func (s *FloatRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/flushstats.go b/typedapi/types/flushstats.go index 329716a7ed..707ca94552 100644 --- a/typedapi/types/flushstats.go +++ b/typedapi/types/flushstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FlushStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L123-L128 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L123-L128 type FlushStats struct { Periodic int64 `json:"periodic"` Total int64 `json:"total"` diff --git a/typedapi/types/followerindex.go b/typedapi/types/followerindex.go index 06fd8d6338..3f7b0348ff 100644 --- a/typedapi/types/followerindex.go +++ b/typedapi/types/followerindex.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // FollowerIndex type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/follow_info/types.ts#L22-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/follow_info/types.ts#L22-L28 type FollowerIndex struct { FollowerIndex string `json:"follower_index"` LeaderIndex string `json:"leader_index"` diff --git a/typedapi/types/followerindexparameters.go b/typedapi/types/followerindexparameters.go index ffa6cf1c12..bc0f183b7b 100644 --- a/typedapi/types/followerindexparameters.go +++ b/typedapi/types/followerindexparameters.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FollowerIndexParameters type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/follow_info/types.ts#L38-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/follow_info/types.ts#L38-L49 type FollowerIndexParameters struct { MaxOutstandingReadRequests int `json:"max_outstanding_read_requests"` MaxOutstandingWriteRequests int `json:"max_outstanding_write_requests"` diff --git a/typedapi/types/followindexstats.go b/typedapi/types/followindexstats.go index 3aa9b7c561..764d8b70db 100644 --- a/typedapi/types/followindexstats.go +++ b/typedapi/types/followindexstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // FollowIndexStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/_types/FollowIndexStats.ts#L30-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/_types/FollowIndexStats.ts#L30-L33 type FollowIndexStats struct { Index string `json:"index"` Shards []CcrShardStats `json:"shards"` diff --git a/typedapi/types/followstats.go b/typedapi/types/followstats.go index 2531ebd2c3..9ff7a63121 100644 --- a/typedapi/types/followstats.go +++ b/typedapi/types/followstats.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // FollowStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/stats/types.ts.ts#L41-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/stats/types.ts.ts#L41-L43 type FollowStats struct { Indices []FollowIndexStats `json:"indices"` } diff --git a/typedapi/types/forcemergeconfiguration.go b/typedapi/types/forcemergeconfiguration.go index 64689c66ad..20785a815f 100644 --- a/typedapi/types/forcemergeconfiguration.go +++ b/typedapi/types/forcemergeconfiguration.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ForceMergeConfiguration type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/_types/Phase.ts#L56-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/_types/Phase.ts#L56-L58 type ForceMergeConfiguration struct { MaxNumSegments int `json:"max_num_segments"` } diff --git a/typedapi/types/forcemergeresponsebody.go b/typedapi/types/forcemergeresponsebody.go index 6310c99abd..b241e7a7a9 100644 --- a/typedapi/types/forcemergeresponsebody.go +++ b/typedapi/types/forcemergeresponsebody.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ForceMergeResponseBody type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/forcemerge/_types/response.ts#L22-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/forcemerge/_types/response.ts#L22-L28 type ForceMergeResponseBody struct { Shards_ ShardStatistics `json:"_shards"` // Task task contains a task id returned when wait_for_completion=false, diff --git a/typedapi/types/foreachprocessor.go b/typedapi/types/foreachprocessor.go index f1f7c4bbe0..a8886e06ef 100644 --- a/typedapi/types/foreachprocessor.go +++ b/typedapi/types/foreachprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ForeachProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L645-L659 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L645-L659 type ForeachProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/formattablemetricaggregation.go b/typedapi/types/formattablemetricaggregation.go index c7645dbe5c..0a605dba31 100644 --- a/typedapi/types/formattablemetricaggregation.go +++ b/typedapi/types/formattablemetricaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FormattableMetricAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L51-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L51-L53 type FormattableMetricAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/foundstatus.go b/typedapi/types/foundstatus.go index c56d1dd2a5..078b036aff 100644 --- a/typedapi/types/foundstatus.go +++ b/typedapi/types/foundstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FoundStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/delete_privileges/types.ts#L20-L22 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/delete_privileges/types.ts#L20-L22 type FoundStatus struct { Found bool `json:"found"` } diff --git a/typedapi/types/frequencyencodingpreprocessor.go b/typedapi/types/frequencyencodingpreprocessor.go index 9714955c0d..686ebde763 100644 --- a/typedapi/types/frequencyencodingpreprocessor.go +++ b/typedapi/types/frequencyencodingpreprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FrequencyEncodingPreprocessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L38-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L38-L42 type FrequencyEncodingPreprocessor struct { FeatureName string `json:"feature_name"` Field string `json:"field"` diff --git a/typedapi/types/frequentitemsetsaggregate.go b/typedapi/types/frequentitemsetsaggregate.go index f29f609535..aaf5fbb05a 100644 --- a/typedapi/types/frequentitemsetsaggregate.go +++ b/typedapi/types/frequentitemsetsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // FrequentItemSetsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L639-L640 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L639-L640 type FrequentItemSetsAggregate struct { Buckets BucketsFrequentItemSetsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/frequentitemsetsaggregation.go b/typedapi/types/frequentitemsetsaggregation.go index f32715e85a..35c8f4867e 100644 --- a/typedapi/types/frequentitemsetsaggregation.go +++ b/typedapi/types/frequentitemsetsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FrequentItemSetsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L1159-L1183 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L1159-L1183 type FrequentItemSetsAggregation struct { // Fields Fields to analyze. Fields []FrequentItemSetsField `json:"fields"` diff --git a/typedapi/types/frequentitemsetsbucket.go b/typedapi/types/frequentitemsetsbucket.go index 8089dd88b7..8e45a32bad 100644 --- a/typedapi/types/frequentitemsetsbucket.go +++ b/typedapi/types/frequentitemsetsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // FrequentItemSetsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L642-L645 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L642-L645 type FrequentItemSetsBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/frequentitemsetsfield.go b/typedapi/types/frequentitemsetsfield.go index eaf65f7a61..cdc14feb91 100644 --- a/typedapi/types/frequentitemsetsfield.go +++ b/typedapi/types/frequentitemsetsfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // FrequentItemSetsField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L1145-L1157 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L1145-L1157 type FrequentItemSetsField struct { // Exclude Values to exclude. // Can be regular expression strings or arrays of strings of exact terms. diff --git a/typedapi/types/frozenindices.go b/typedapi/types/frozenindices.go index b84a2e11e8..4f8cb089e8 100644 --- a/typedapi/types/frozenindices.go +++ b/typedapi/types/frozenindices.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FrozenIndices type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L360-L362 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L360-L362 type FrozenIndices struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/functionscore.go b/typedapi/types/functionscore.go index 46a977898c..459ccae9bc 100644 --- a/typedapi/types/functionscore.go +++ b/typedapi/types/functionscore.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FunctionScore type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L201-L241 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L201-L241 type FunctionScore struct { // Exp Function that scores a document with a exponential decay, depending on the // distance of a numeric field value of the document from an origin. diff --git a/typedapi/types/functionscorequery.go b/typedapi/types/functionscorequery.go index f74fabf597..72085577dc 100644 --- a/typedapi/types/functionscorequery.go +++ b/typedapi/types/functionscorequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // FunctionScoreQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L92-L118 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L92-L118 type FunctionScoreQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/fuzziness.go b/typedapi/types/fuzziness.go index 9b91b43a95..83fb98bbc2 100644 --- a/typedapi/types/fuzziness.go +++ b/typedapi/types/fuzziness.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // int // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L132-L133 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L133-L134 type Fuzziness interface{} diff --git a/typedapi/types/fuzzyquery.go b/typedapi/types/fuzzyquery.go index 79d874d93e..862b2bb64d 100644 --- a/typedapi/types/fuzzyquery.go +++ b/typedapi/types/fuzzyquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // FuzzyQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L43-L78 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L43-L78 type FuzzyQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/garbagecollector.go b/typedapi/types/garbagecollector.go index 96d05befe0..b590f715a1 100644 --- a/typedapi/types/garbagecollector.go +++ b/typedapi/types/garbagecollector.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // GarbageCollector type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L923-L928 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L923-L928 type GarbageCollector struct { // Collectors Contains statistics about JVM garbage collectors for the node. Collectors map[string]GarbageCollectorTotal `json:"collectors,omitempty"` diff --git a/typedapi/types/garbagecollectortotal.go b/typedapi/types/garbagecollectortotal.go index 777b1ed715..4020bcab10 100644 --- a/typedapi/types/garbagecollectortotal.go +++ b/typedapi/types/garbagecollectortotal.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GarbageCollectorTotal type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L930-L943 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L930-L943 type GarbageCollectorTotal struct { // CollectionCount Total number of JVM garbage collectors that collect objects. CollectionCount *int64 `json:"collection_count,omitempty"` diff --git a/typedapi/types/geoboundingboxquery.go b/typedapi/types/geoboundingboxquery.go index 78eaf3ff4a..01a682dab1 100644 --- a/typedapi/types/geoboundingboxquery.go +++ b/typedapi/types/geoboundingboxquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // GeoBoundingBoxQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/geo.ts#L32-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/geo.ts#L32-L50 type GeoBoundingBoxQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/geobounds.go b/typedapi/types/geobounds.go index f59a06f455..a11b7ded64 100644 --- a/typedapi/types/geobounds.go +++ b/typedapi/types/geobounds.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -27,5 +27,5 @@ package types // TopRightBottomLeftGeoBounds // WktGeoBounds // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L144-L157 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L144-L157 type GeoBounds interface{} diff --git a/typedapi/types/geoboundsaggregate.go b/typedapi/types/geoboundsaggregate.go index 92c8cb2219..2fe1f5698d 100644 --- a/typedapi/types/geoboundsaggregate.go +++ b/typedapi/types/geoboundsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GeoBoundsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L303-L306 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L303-L306 type GeoBoundsAggregate struct { Bounds GeoBounds `json:"bounds,omitempty"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/geoboundsaggregation.go b/typedapi/types/geoboundsaggregation.go index 09c01a1927..20b46233c8 100644 --- a/typedapi/types/geoboundsaggregation.go +++ b/typedapi/types/geoboundsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoBoundsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L108-L114 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L108-L114 type GeoBoundsAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/geocentroidaggregate.go b/typedapi/types/geocentroidaggregate.go index 162dd89680..3aad0f8d03 100644 --- a/typedapi/types/geocentroidaggregate.go +++ b/typedapi/types/geocentroidaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoCentroidAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L308-L312 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L308-L312 type GeoCentroidAggregate struct { Count int64 `json:"count"` Location GeoLocation `json:"location,omitempty"` diff --git a/typedapi/types/geocentroidaggregation.go b/typedapi/types/geocentroidaggregation.go index cf122f6a5c..04c683a4fb 100644 --- a/typedapi/types/geocentroidaggregation.go +++ b/typedapi/types/geocentroidaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoCentroidAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L116-L119 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L116-L119 type GeoCentroidAggregation struct { Count *int64 `json:"count,omitempty"` // Field The field on which to run the aggregation. diff --git a/typedapi/types/geodecayfunction.go b/typedapi/types/geodecayfunction.go index 353ac45b69..7a769b2ac0 100644 --- a/typedapi/types/geodecayfunction.go +++ b/typedapi/types/geodecayfunction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GeoDecayFunction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L190-L192 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L190-L192 type GeoDecayFunction struct { GeoDecayFunction map[string]DecayPlacementGeoLocationDistance `json:"GeoDecayFunction,omitempty"` // MultiValueMode Determines how the distance is calculated when a field used for computing the diff --git a/typedapi/types/geodistanceaggregate.go b/typedapi/types/geodistanceaggregate.go index c18ceb43f6..84eb1f9429 100644 --- a/typedapi/types/geodistanceaggregate.go +++ b/typedapi/types/geodistanceaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GeoDistanceAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L550-L554 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L550-L554 type GeoDistanceAggregate struct { Buckets BucketsRangeBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/geodistanceaggregation.go b/typedapi/types/geodistanceaggregation.go index 56edc00546..662e9b4aa0 100644 --- a/typedapi/types/geodistanceaggregation.go +++ b/typedapi/types/geodistanceaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // GeoDistanceAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L380-L403 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L380-L403 type GeoDistanceAggregation struct { // DistanceType The distance calculation type. DistanceType *geodistancetype.GeoDistanceType `json:"distance_type,omitempty"` diff --git a/typedapi/types/geodistancefeaturequery.go b/typedapi/types/geodistancefeaturequery.go index 95db4d5faf..7b0d359802 100644 --- a/typedapi/types/geodistancefeaturequery.go +++ b/typedapi/types/geodistancefeaturequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoDistanceFeatureQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L62-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L62-L65 type GeoDistanceFeatureQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/geodistancequery.go b/typedapi/types/geodistancequery.go index e6ee5dce9a..b208f21a93 100644 --- a/typedapi/types/geodistancequery.go +++ b/typedapi/types/geodistancequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // GeoDistanceQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/geo.ts#L57-L79 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/geo.ts#L57-L79 type GeoDistanceQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/geodistancesort.go b/typedapi/types/geodistancesort.go index ef5752a88d..23103fc72b 100644 --- a/typedapi/types/geodistancesort.go +++ b/typedapi/types/geodistancesort.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -36,7 +36,7 @@ import ( // GeoDistanceSort type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L58-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L58-L66 type GeoDistanceSort struct { DistanceType *geodistancetype.GeoDistanceType `json:"distance_type,omitempty"` GeoDistanceSort map[string][]GeoLocation `json:"GeoDistanceSort,omitempty"` diff --git a/typedapi/types/geohashgridaggregate.go b/typedapi/types/geohashgridaggregate.go index 17d3815d89..be9dead601 100644 --- a/typedapi/types/geohashgridaggregate.go +++ b/typedapi/types/geohashgridaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GeoHashGridAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L506-L508 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L506-L508 type GeoHashGridAggregate struct { Buckets BucketsGeoHashGridBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/geohashgridaggregation.go b/typedapi/types/geohashgridaggregation.go index 5eb2270d85..3c6245e40e 100644 --- a/typedapi/types/geohashgridaggregation.go +++ b/typedapi/types/geohashgridaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoHashGridAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L405-L430 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L405-L430 type GeoHashGridAggregation struct { // Bounds The bounding box to filter the points in each bucket. Bounds GeoBounds `json:"bounds,omitempty"` diff --git a/typedapi/types/geohashgridbucket.go b/typedapi/types/geohashgridbucket.go index 8525772ad1..d1a6a6bc9e 100644 --- a/typedapi/types/geohashgridbucket.go +++ b/typedapi/types/geohashgridbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // GeoHashGridBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L510-L512 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L510-L512 type GeoHashGridBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/geohashlocation.go b/typedapi/types/geohashlocation.go index bced03ddea..766074b2b4 100644 --- a/typedapi/types/geohashlocation.go +++ b/typedapi/types/geohashlocation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GeoHashLocation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L140-L142 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L140-L142 type GeoHashLocation struct { Geohash string `json:"geohash"` } diff --git a/typedapi/types/geohashprecision.go b/typedapi/types/geohashprecision.go index 4f977646ee..c15e9d517b 100644 --- a/typedapi/types/geohashprecision.go +++ b/typedapi/types/geohashprecision.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // int // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L95-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L95-L99 type GeoHashPrecision interface{} diff --git a/typedapi/types/geohexgridaggregate.go b/typedapi/types/geohexgridaggregate.go index 7b99e9fcf6..9f4b957f15 100644 --- a/typedapi/types/geohexgridaggregate.go +++ b/typedapi/types/geohexgridaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GeoHexGridAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L522-L523 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L522-L523 type GeoHexGridAggregate struct { Buckets BucketsGeoHexGridBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/geohexgridaggregation.go b/typedapi/types/geohexgridaggregation.go index e2770c597e..73b99c15c7 100644 --- a/typedapi/types/geohexgridaggregation.go +++ b/typedapi/types/geohexgridaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeohexGridAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L460-L485 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L460-L485 type GeohexGridAggregation struct { // Bounds Bounding box used to filter the geo-points in each bucket. Bounds GeoBounds `json:"bounds,omitempty"` diff --git a/typedapi/types/geohexgridbucket.go b/typedapi/types/geohexgridbucket.go index 1e80d89e65..6b20fe0e53 100644 --- a/typedapi/types/geohexgridbucket.go +++ b/typedapi/types/geohexgridbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // GeoHexGridBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L525-L527 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L525-L527 type GeoHexGridBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/geoipdownloadstatistics.go b/typedapi/types/geoipdownloadstatistics.go index 86f6eabd57..af95ace029 100644 --- a/typedapi/types/geoipdownloadstatistics.go +++ b/typedapi/types/geoipdownloadstatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoIpDownloadStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/geo_ip_stats/types.ts#L24-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/geo_ip_stats/types.ts#L24-L35 type GeoIpDownloadStatistics struct { // DatabaseCount Current number of databases available for use. DatabaseCount int `json:"database_count"` diff --git a/typedapi/types/geoipnodedatabasename.go b/typedapi/types/geoipnodedatabasename.go index eaa41d292f..36375dfccf 100644 --- a/typedapi/types/geoipnodedatabasename.go +++ b/typedapi/types/geoipnodedatabasename.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GeoIpNodeDatabaseName type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/geo_ip_stats/types.ts#L45-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/geo_ip_stats/types.ts#L45-L48 type GeoIpNodeDatabaseName struct { // Name Name of the database. Name string `json:"name"` diff --git a/typedapi/types/geoipnodedatabases.go b/typedapi/types/geoipnodedatabases.go index ba459a91ba..16830c5804 100644 --- a/typedapi/types/geoipnodedatabases.go +++ b/typedapi/types/geoipnodedatabases.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // GeoIpNodeDatabases type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/geo_ip_stats/types.ts#L37-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/geo_ip_stats/types.ts#L37-L43 type GeoIpNodeDatabases struct { // Databases Downloaded databases for the node. Databases []GeoIpNodeDatabaseName `json:"databases"` diff --git a/typedapi/types/geoipprocessor.go b/typedapi/types/geoipprocessor.go index 8f795fce9b..90aa2b82c1 100644 --- a/typedapi/types/geoipprocessor.go +++ b/typedapi/types/geoipprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoIpProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L328-L357 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L328-L357 type GeoIpProcessor struct { // DatabaseFile The database filename referring to a database the module ships with // (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom diff --git a/typedapi/types/geoline.go b/typedapi/types/geoline.go index cffe297d3a..dc174366f3 100644 --- a/typedapi/types/geoline.go +++ b/typedapi/types/geoline.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoLine type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L65-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L65-L71 type GeoLine struct { // Coordinates Array of `[lon, lat]` coordinates Coordinates [][]Float64 `json:"coordinates"` diff --git a/typedapi/types/geolineaggregate.go b/typedapi/types/geolineaggregate.go index dc7f5d4bd4..e068392ea0 100644 --- a/typedapi/types/geolineaggregate.go +++ b/typedapi/types/geolineaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoLineAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L784-L791 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L784-L791 type GeoLineAggregate struct { Geometry GeoLine `json:"geometry"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/geolineaggregation.go b/typedapi/types/geolineaggregation.go index d227e5d35e..515bbf94ca 100644 --- a/typedapi/types/geolineaggregation.go +++ b/typedapi/types/geolineaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // GeoLineAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L121-L146 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L121-L146 type GeoLineAggregation struct { // IncludeSort When `true`, returns an additional array of the sort values in the feature // properties. diff --git a/typedapi/types/geolinepoint.go b/typedapi/types/geolinepoint.go index 57b57c35e7..43ea3bbef5 100644 --- a/typedapi/types/geolinepoint.go +++ b/typedapi/types/geolinepoint.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GeoLinePoint type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L155-L160 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L155-L160 type GeoLinePoint struct { // Field The name of the geo_point field. Field string `json:"field"` diff --git a/typedapi/types/geolinesort.go b/typedapi/types/geolinesort.go index 6ce3ea7419..3cfbee1f93 100644 --- a/typedapi/types/geolinesort.go +++ b/typedapi/types/geolinesort.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GeoLineSort type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L148-L153 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L148-L153 type GeoLineSort struct { // Field The name of the numeric field to use as the sort key for ordering the points. Field string `json:"field"` diff --git a/typedapi/types/geolocation.go b/typedapi/types/geolocation.go index d2daaf1e8c..f64a83de94 100644 --- a/typedapi/types/geolocation.go +++ b/typedapi/types/geolocation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -27,5 +27,5 @@ package types // []Float64 // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L113-L127 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L113-L127 type GeoLocation interface{} diff --git a/typedapi/types/geopointproperty.go b/typedapi/types/geopointproperty.go index 3a348064f2..af763eee76 100644 --- a/typedapi/types/geopointproperty.go +++ b/typedapi/types/geopointproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // GeoPointProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/geo.ts#L23-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/geo.ts#L23-L28 type GeoPointProperty struct { CopyTo []string `json:"copy_to,omitempty"` DocValues *bool `json:"doc_values,omitempty"` @@ -218,6 +218,12 @@ func (s *GeoPointProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -576,6 +582,12 @@ func (s *GeoPointProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/geopolygonpoints.go b/typedapi/types/geopolygonpoints.go index 552ba9f7b6..b9fbe942e0 100644 --- a/typedapi/types/geopolygonpoints.go +++ b/typedapi/types/geopolygonpoints.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // GeoPolygonPoints type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/geo.ts#L81-L83 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/geo.ts#L81-L83 type GeoPolygonPoints struct { Points []GeoLocation `json:"points"` } diff --git a/typedapi/types/geopolygonquery.go b/typedapi/types/geopolygonquery.go index ff14e63b1c..8e385da188 100644 --- a/typedapi/types/geopolygonquery.go +++ b/typedapi/types/geopolygonquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // GeoPolygonQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/geo.ts#L85-L93 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/geo.ts#L85-L93 type GeoPolygonQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/georesults.go b/typedapi/types/georesults.go index b456021186..6c3c5d5ed9 100644 --- a/typedapi/types/georesults.go +++ b/typedapi/types/georesults.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoResults type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Anomaly.ts#L145-L154 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Anomaly.ts#L145-L154 type GeoResults struct { // ActualPoint The actual value for the bucket formatted as a `geo_point`. ActualPoint string `json:"actual_point"` diff --git a/typedapi/types/geoshapefieldquery.go b/typedapi/types/geoshapefieldquery.go index 93470bdd3b..361d125a48 100644 --- a/typedapi/types/geoshapefieldquery.go +++ b/typedapi/types/geoshapefieldquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // GeoShapeFieldQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/geo.ts#L100-L111 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/geo.ts#L100-L111 type GeoShapeFieldQuery struct { // IndexedShape Query using an indexed shape retrieved from the the specified document and // path. diff --git a/typedapi/types/geoshapeproperty.go b/typedapi/types/geoshapeproperty.go index 21a40c8af5..130e7ed28d 100644 --- a/typedapi/types/geoshapeproperty.go +++ b/typedapi/types/geoshapeproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // GeoShapeProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/geo.ts#L37-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/geo.ts#L37-L50 type GeoShapeProperty struct { Coerce *bool `json:"coerce,omitempty"` CopyTo []string `json:"copy_to,omitempty"` @@ -236,6 +236,12 @@ func (s *GeoShapeProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -594,6 +600,12 @@ func (s *GeoShapeProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/geoshapequery.go b/typedapi/types/geoshapequery.go index a956e43c7a..2f73b7cf49 100644 --- a/typedapi/types/geoshapequery.go +++ b/typedapi/types/geoshapequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // GeoShapeQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/geo.ts#L115-L125 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/geo.ts#L115-L125 type GeoShapeQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/geotilegridaggregate.go b/typedapi/types/geotilegridaggregate.go index fb51866332..e6606b53bc 100644 --- a/typedapi/types/geotilegridaggregate.go +++ b/typedapi/types/geotilegridaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GeoTileGridAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L514-L516 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L514-L516 type GeoTileGridAggregate struct { Buckets BucketsGeoTileGridBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/geotilegridaggregation.go b/typedapi/types/geotilegridaggregation.go index 8849bad7a3..979f28b92f 100644 --- a/typedapi/types/geotilegridaggregation.go +++ b/typedapi/types/geotilegridaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GeoTileGridAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L432-L458 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L432-L458 type GeoTileGridAggregation struct { // Bounds A bounding box to filter the geo-points or geo-shapes in each bucket. Bounds GeoBounds `json:"bounds,omitempty"` diff --git a/typedapi/types/geotilegridbucket.go b/typedapi/types/geotilegridbucket.go index d23844e274..d965a3a946 100644 --- a/typedapi/types/geotilegridbucket.go +++ b/typedapi/types/geotilegridbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // GeoTileGridBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L518-L520 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L518-L520 type GeoTileGridBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/getmigrationfeature.go b/typedapi/types/getmigrationfeature.go index b368a41630..f7adc67e15 100644 --- a/typedapi/types/getmigrationfeature.go +++ b/typedapi/types/getmigrationfeature.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // GetMigrationFeature type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L37-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L37-L42 type GetMigrationFeature struct { FeatureName string `json:"feature_name"` Indices []MigrationFeatureIndexInfo `json:"indices"` diff --git a/typedapi/types/getresult.go b/typedapi/types/getresult.go index d092573e8d..bf69c4773c 100644 --- a/typedapi/types/getresult.go +++ b/typedapi/types/getresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GetResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/get/types.ts#L25-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/get/types.ts#L25-L35 type GetResult struct { Fields map[string]json.RawMessage `json:"fields,omitempty"` Found bool `json:"found"` diff --git a/typedapi/types/getscriptcontext.go b/typedapi/types/getscriptcontext.go index a5842ee63b..43d493d297 100644 --- a/typedapi/types/getscriptcontext.go +++ b/typedapi/types/getscriptcontext.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GetScriptContext type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/get_script_context/types.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/get_script_context/types.ts#L22-L25 type GetScriptContext struct { Methods []ContextMethod `json:"methods"` Name string `json:"name"` diff --git a/typedapi/types/getstats.go b/typedapi/types/getstats.go index 0439948a56..474f501f82 100644 --- a/typedapi/types/getstats.go +++ b/typedapi/types/getstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GetStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L130-L141 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L130-L141 type GetStats struct { Current int64 `json:"current"` ExistsTime Duration `json:"exists_time,omitempty"` diff --git a/typedapi/types/getuserprofileerrors.go b/typedapi/types/getuserprofileerrors.go index 97880813f9..e9ff6b070d 100644 --- a/typedapi/types/getuserprofileerrors.go +++ b/typedapi/types/getuserprofileerrors.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GetUserProfileErrors type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_user_profile/types.ts#L25-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_user_profile/types.ts#L25-L28 type GetUserProfileErrors struct { Count int64 `json:"count"` Details map[string]ErrorCause `json:"details"` diff --git a/typedapi/types/globalaggregate.go b/typedapi/types/globalaggregate.go index 32d9469dfe..a4fcb1531e 100644 --- a/typedapi/types/globalaggregate.go +++ b/typedapi/types/globalaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // GlobalAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L492-L493 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L492-L493 type GlobalAggregate struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/globalaggregation.go b/typedapi/types/globalaggregation.go index f737771d8f..a1256ea6c2 100644 --- a/typedapi/types/globalaggregation.go +++ b/typedapi/types/globalaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GlobalAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L487-L487 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L487-L487 type GlobalAggregation struct { Meta Metadata `json:"meta,omitempty"` Name *string `json:"name,omitempty"` diff --git a/typedapi/types/globalprivilege.go b/typedapi/types/globalprivilege.go index 69d3f717ec..22c2a8c997 100644 --- a/typedapi/types/globalprivilege.go +++ b/typedapi/types/globalprivilege.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // GlobalPrivilege type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L189-L191 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L189-L191 type GlobalPrivilege struct { Application ApplicationGlobalUserPrivileges `json:"application"` } diff --git a/typedapi/types/googlenormalizeddistanceheuristic.go b/typedapi/types/googlenormalizeddistanceheuristic.go index dcb5284db7..5a7b7387ab 100644 --- a/typedapi/types/googlenormalizeddistanceheuristic.go +++ b/typedapi/types/googlenormalizeddistanceheuristic.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GoogleNormalizedDistanceHeuristic type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L746-L751 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L746-L751 type GoogleNormalizedDistanceHeuristic struct { // BackgroundIsSuperset Set to `false` if you defined a custom background filter that represents a // different set of documents that you want to compare to. diff --git a/typedapi/types/grantapikey.go b/typedapi/types/grantapikey.go index e083ab81ee..9b13499376 100644 --- a/typedapi/types/grantapikey.go +++ b/typedapi/types/grantapikey.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // GrantApiKey type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/grant_api_key/types.ts#L25-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/grant_api_key/types.ts#L25-L46 type GrantApiKey struct { // Expiration Expiration time for the API key. By default, API keys never expire. Expiration *string `json:"expiration,omitempty"` diff --git a/typedapi/types/grokprocessor.go b/typedapi/types/grokprocessor.go index 4b512d0710..98187e57ce 100644 --- a/typedapi/types/grokprocessor.go +++ b/typedapi/types/grokprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GrokProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L661-L686 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L661-L686 type GrokProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/groupings.go b/typedapi/types/groupings.go index f6121dd755..3a69ea6f9e 100644 --- a/typedapi/types/groupings.go +++ b/typedapi/types/groupings.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Groupings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/_types/Groupings.ts#L24-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/_types/Groupings.ts#L24-L40 type Groupings struct { // DateHistogram A date histogram group aggregates a date field into time-based buckets. // This group is mandatory; you currently cannot roll up documents without a diff --git a/typedapi/types/gsubprocessor.go b/typedapi/types/gsubprocessor.go index be33892e61..140a0eb52a 100644 --- a/typedapi/types/gsubprocessor.go +++ b/typedapi/types/gsubprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // GsubProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L688-L712 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L688-L712 type GsubProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/halffloatnumberproperty.go b/typedapi/types/halffloatnumberproperty.go index 6f769389a2..5f51d6dc34 100644 --- a/typedapi/types/halffloatnumberproperty.go +++ b/typedapi/types/halffloatnumberproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // HalfFloatNumberProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L139-L142 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L139-L142 type HalfFloatNumberProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -260,6 +260,12 @@ func (s *HalfFloatNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -634,6 +640,12 @@ func (s *HalfFloatNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/haschildquery.go b/typedapi/types/haschildquery.go index 1f01df95da..07b82f6096 100644 --- a/typedapi/types/haschildquery.go +++ b/typedapi/types/haschildquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // HasChildQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/joining.ts#L41-L76 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/joining.ts#L41-L76 type HasChildQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/hasparentquery.go b/typedapi/types/hasparentquery.go index 5240a13bda..57304f9569 100644 --- a/typedapi/types/hasparentquery.go +++ b/typedapi/types/hasparentquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HasParentQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/joining.ts#L78-L104 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/joining.ts#L78-L104 type HasParentQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/hasprivilegesuserprofileerrors.go b/typedapi/types/hasprivilegesuserprofileerrors.go index 7834ae0fe3..9b45aa84a0 100644 --- a/typedapi/types/hasprivilegesuserprofileerrors.go +++ b/typedapi/types/hasprivilegesuserprofileerrors.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HasPrivilegesUserProfileErrors type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges_user_profile/types.ts#L39-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges_user_profile/types.ts#L39-L42 type HasPrivilegesUserProfileErrors struct { Count int64 `json:"count"` Details map[string]ErrorCause `json:"details"` diff --git a/typedapi/types/hdrmethod.go b/typedapi/types/hdrmethod.go index e122079f30..de66c4f761 100644 --- a/typedapi/types/hdrmethod.go +++ b/typedapi/types/hdrmethod.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HdrMethod type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L216-L221 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L216-L221 type HdrMethod struct { // NumberOfSignificantValueDigits Specifies the resolution of values for the histogram in number of significant // digits. diff --git a/typedapi/types/hdrpercentileranksaggregate.go b/typedapi/types/hdrpercentileranksaggregate.go index ee2240bbb0..560c9c35c7 100644 --- a/typedapi/types/hdrpercentileranksaggregate.go +++ b/typedapi/types/hdrpercentileranksaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // HdrPercentileRanksAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L169-L170 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L169-L170 type HdrPercentileRanksAggregate struct { Meta Metadata `json:"meta,omitempty"` Values Percentiles `json:"values"` diff --git a/typedapi/types/hdrpercentilesaggregate.go b/typedapi/types/hdrpercentilesaggregate.go index 354fd4f245..11dc1fb45b 100644 --- a/typedapi/types/hdrpercentilesaggregate.go +++ b/typedapi/types/hdrpercentilesaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // HdrPercentilesAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L166-L167 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L166-L167 type HdrPercentilesAggregate struct { Meta Metadata `json:"meta,omitempty"` Values Percentiles `json:"values"` diff --git a/typedapi/types/healthrecord.go b/typedapi/types/healthrecord.go index 63463e1185..84eec61cb9 100644 --- a/typedapi/types/healthrecord.go +++ b/typedapi/types/healthrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HealthRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/health/types.ts#L23-L94 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/health/types.ts#L23-L94 type HealthRecord struct { // ActiveShardsPercent active number of shards in percent ActiveShardsPercent *string `json:"active_shards_percent,omitempty"` diff --git a/typedapi/types/healthresponsebody.go b/typedapi/types/healthresponsebody.go index 73a7f82a0a..025df21586 100644 --- a/typedapi/types/healthresponsebody.go +++ b/typedapi/types/healthresponsebody.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // HealthResponseBody type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/health/ClusterHealthResponse.ts#L39-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/health/ClusterHealthResponse.ts#L39-L72 type HealthResponseBody struct { // ActivePrimaryShards The number of active primary shards. ActivePrimaryShards int `json:"active_primary_shards"` diff --git a/typedapi/types/healthstatistics.go b/typedapi/types/healthstatistics.go index 888175e23c..0a4756e248 100644 --- a/typedapi/types/healthstatistics.go +++ b/typedapi/types/healthstatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HealthStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L153-L155 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L153-L155 type HealthStatistics struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/helprecord.go b/typedapi/types/helprecord.go index 0e5229f089..65b78517fe 100644 --- a/typedapi/types/helprecord.go +++ b/typedapi/types/helprecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HelpRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/help/types.ts#L20-L22 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/help/types.ts#L20-L22 type HelpRecord struct { Endpoint string `json:"endpoint"` } diff --git a/typedapi/types/highlight.go b/typedapi/types/highlight.go index 25f2df80e2..3b9bf4f62c 100644 --- a/typedapi/types/highlight.go +++ b/typedapi/types/highlight.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -37,7 +37,7 @@ import ( // Highlight type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/highlighting.ts#L153-L156 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/highlighting.ts#L153-L156 type Highlight struct { // BoundaryChars A string that contains each boundary character. BoundaryChars *string `json:"boundary_chars,omitempty"` diff --git a/typedapi/types/highlightfield.go b/typedapi/types/highlightfield.go index 221fb11942..eebc877f37 100644 --- a/typedapi/types/highlightfield.go +++ b/typedapi/types/highlightfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -36,7 +36,7 @@ import ( // HighlightField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/highlighting.ts#L193-L197 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/highlighting.ts#L193-L197 type HighlightField struct { Analyzer Analyzer `json:"analyzer,omitempty"` // BoundaryChars A string that contains each boundary character. diff --git a/typedapi/types/hint.go b/typedapi/types/hint.go index 2c6c616b25..058ed1bba6 100644 --- a/typedapi/types/hint.go +++ b/typedapi/types/hint.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Hint type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/suggest_user_profiles/types.ts#L23-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/suggest_user_profiles/types.ts#L23-L34 type Hint struct { // Labels A single key-value pair to match against the labels section // of a profile. A profile is considered matching if it matches diff --git a/typedapi/types/histogramaggregate.go b/typedapi/types/histogramaggregate.go index 47612d6616..5f586c0a97 100644 --- a/typedapi/types/histogramaggregate.go +++ b/typedapi/types/histogramaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // HistogramAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L340-L341 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L340-L341 type HistogramAggregate struct { Buckets BucketsHistogramBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/histogramaggregation.go b/typedapi/types/histogramaggregation.go index 3236cc4e8d..03774a11e1 100644 --- a/typedapi/types/histogramaggregation.go +++ b/typedapi/types/histogramaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // HistogramAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L500-L546 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L500-L546 type HistogramAggregation struct { // ExtendedBounds Enables extending the bounds of the histogram beyond the data itself. ExtendedBounds *ExtendedBoundsdouble `json:"extended_bounds,omitempty"` diff --git a/typedapi/types/histogrambucket.go b/typedapi/types/histogrambucket.go index 93647dec2e..767613e949 100644 --- a/typedapi/types/histogrambucket.go +++ b/typedapi/types/histogrambucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // HistogramBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L343-L346 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L343-L346 type HistogramBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/histogramgrouping.go b/typedapi/types/histogramgrouping.go index 39c856da49..8bc87a71dc 100644 --- a/typedapi/types/histogramgrouping.go +++ b/typedapi/types/histogramgrouping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HistogramGrouping type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/_types/Groupings.ts#L84-L97 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/_types/Groupings.ts#L84-L97 type HistogramGrouping struct { // Fields The set of fields that you wish to build histograms for. // All fields specified must be some kind of numeric. diff --git a/typedapi/types/histogramproperty.go b/typedapi/types/histogramproperty.go index 29f91f3608..20560e503e 100644 --- a/typedapi/types/histogramproperty.go +++ b/typedapi/types/histogramproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // HistogramProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/specialized.ts#L54-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/specialized.ts#L54-L57 type HistogramProperty struct { Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` Fields map[string]Property `json:"fields,omitempty"` @@ -182,6 +182,12 @@ func (s *HistogramProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -521,6 +527,12 @@ func (s *HistogramProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/hit.go b/typedapi/types/hit.go index 156119fdfe..0896f90861 100644 --- a/typedapi/types/hit.go +++ b/typedapi/types/hit.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Hit type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/hits.ts#L40-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/hits.ts#L40-L64 type Hit struct { Explanation_ *Explanation `json:"_explanation,omitempty"` Fields map[string]json.RawMessage `json:"fields,omitempty"` diff --git a/typedapi/types/hitsevent.go b/typedapi/types/hitsevent.go index 9eba5a734b..50ab54d2d4 100644 --- a/typedapi/types/hitsevent.go +++ b/typedapi/types/hitsevent.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // HitsEvent type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/eql/_types/EqlHits.ts#L41-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/eql/_types/EqlHits.ts#L41-L49 type HitsEvent struct { Fields map[string][]json.RawMessage `json:"fields,omitempty"` // Id_ Unique identifier for the event. This ID is only unique within the index. diff --git a/typedapi/types/hitsmetadata.go b/typedapi/types/hitsmetadata.go index 86f369906e..b20c3064a3 100644 --- a/typedapi/types/hitsmetadata.go +++ b/typedapi/types/hitsmetadata.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // HitsMetadata type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/hits.ts#L66-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/hits.ts#L66-L72 type HitsMetadata struct { Hits []Hit `json:"hits"` MaxScore Float64 `json:"max_score,omitempty"` diff --git a/typedapi/types/hitssequence.go b/typedapi/types/hitssequence.go index 9b7a599f66..fdd0f046cf 100644 --- a/typedapi/types/hitssequence.go +++ b/typedapi/types/hitssequence.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // HitsSequence type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/eql/_types/EqlHits.ts#L51-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/eql/_types/EqlHits.ts#L51-L59 type HitsSequence struct { // Events Contains events matching the query. Each object represents a matching event. Events []HitsEvent `json:"events"` diff --git a/typedapi/types/holtlinearmodelsettings.go b/typedapi/types/holtlinearmodelsettings.go index 4549935e91..95164f07ac 100644 --- a/typedapi/types/holtlinearmodelsettings.go +++ b/typedapi/types/holtlinearmodelsettings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HoltLinearModelSettings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L271-L274 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L271-L274 type HoltLinearModelSettings struct { Alpha *float32 `json:"alpha,omitempty"` Beta *float32 `json:"beta,omitempty"` diff --git a/typedapi/types/holtmovingaverageaggregation.go b/typedapi/types/holtmovingaverageaggregation.go index 3dee66a26a..f05d583800 100644 --- a/typedapi/types/holtmovingaverageaggregation.go +++ b/typedapi/types/holtmovingaverageaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // HoltMovingAverageAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L257-L260 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L257-L260 type HoltMovingAverageAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/holtwintersmodelsettings.go b/typedapi/types/holtwintersmodelsettings.go index bc87fbf95b..a767320879 100644 --- a/typedapi/types/holtwintersmodelsettings.go +++ b/typedapi/types/holtwintersmodelsettings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // HoltWintersModelSettings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L275-L282 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L275-L282 type HoltWintersModelSettings struct { Alpha *float32 `json:"alpha,omitempty"` Beta *float32 `json:"beta,omitempty"` diff --git a/typedapi/types/holtwintersmovingaverageaggregation.go b/typedapi/types/holtwintersmovingaverageaggregation.go index 1816fd0303..c020fd0995 100644 --- a/typedapi/types/holtwintersmovingaverageaggregation.go +++ b/typedapi/types/holtwintersmovingaverageaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // HoltWintersMovingAverageAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L262-L265 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L262-L265 type HoltWintersMovingAverageAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/hop.go b/typedapi/types/hop.go index b64b18c0cd..5fbcc58a85 100644 --- a/typedapi/types/hop.go +++ b/typedapi/types/hop.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Hop type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/graph/_types/Hop.ts#L23-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/graph/_types/Hop.ts#L23-L36 type Hop struct { // Connections Specifies one or more fields from which you want to extract terms that are // associated with the specified vertices. diff --git a/typedapi/types/hotthread.go b/typedapi/types/hotthread.go index 4684befb06..24622a34ce 100644 --- a/typedapi/types/hotthread.go +++ b/typedapi/types/hotthread.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // HotThread type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/hot_threads/types.ts#L23-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/hot_threads/types.ts#L23-L28 type HotThread struct { Hosts []string `json:"hosts"` NodeId string `json:"node_id"` diff --git a/typedapi/types/hourandminute.go b/typedapi/types/hourandminute.go index d9d31b1f15..4abefe1349 100644 --- a/typedapi/types/hourandminute.go +++ b/typedapi/types/hourandminute.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // HourAndMinute type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L110-L113 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L110-L113 type HourAndMinute struct { Hour []int `json:"hour"` Minute []int `json:"minute"` diff --git a/typedapi/types/hourlyschedule.go b/typedapi/types/hourlyschedule.go index 9a7dc4f9cc..f9e53a7f27 100644 --- a/typedapi/types/hourlyschedule.go +++ b/typedapi/types/hourlyschedule.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // HourlySchedule type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L47-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L47-L49 type HourlySchedule struct { Minute []int `json:"minute"` } diff --git a/typedapi/types/htmlstripcharfilter.go b/typedapi/types/htmlstripcharfilter.go index f736b887c8..9da6ca881b 100644 --- a/typedapi/types/htmlstripcharfilter.go +++ b/typedapi/types/htmlstripcharfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // HtmlStripCharFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/char_filters.ts#L43-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/char_filters.ts#L43-L45 type HtmlStripCharFilter struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/http.go b/typedapi/types/http.go index 61ec2f3393..0e38e0d6a9 100644 --- a/typedapi/types/http.go +++ b/typedapi/types/http.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Http type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L633-L647 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L633-L647 type Http struct { // Clients Information on current and recently-closed HTTP client connections. // Clients that have been closed longer than the diff --git a/typedapi/types/httpemailattachment.go b/typedapi/types/httpemailattachment.go index d4ed753f63..1aee3959fe 100644 --- a/typedapi/types/httpemailattachment.go +++ b/typedapi/types/httpemailattachment.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HttpEmailAttachment type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L218-L222 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L218-L222 type HttpEmailAttachment struct { ContentType *string `json:"content_type,omitempty"` Inline *bool `json:"inline,omitempty"` diff --git a/typedapi/types/httpheaders.go b/typedapi/types/httpheaders.go index 44dc0e9d51..3ae091e1f8 100644 --- a/typedapi/types/httpheaders.go +++ b/typedapi/types/httpheaders.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // HttpHeaders type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L157-L157 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L158-L158 type HttpHeaders map[string][]string diff --git a/typedapi/types/httpinput.go b/typedapi/types/httpinput.go index 4da680a5ae..cd9120cb21 100644 --- a/typedapi/types/httpinput.go +++ b/typedapi/types/httpinput.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // HttpInput type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L44-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L44-L48 type HttpInput struct { Extract []string `json:"extract,omitempty"` Request *HttpInputRequestDefinition `json:"request,omitempty"` diff --git a/typedapi/types/httpinputauthentication.go b/typedapi/types/httpinputauthentication.go index 9698ad6544..3b291b013d 100644 --- a/typedapi/types/httpinputauthentication.go +++ b/typedapi/types/httpinputauthentication.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // HttpInputAuthentication type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L50-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L50-L52 type HttpInputAuthentication struct { Basic HttpInputBasicAuthentication `json:"basic"` } diff --git a/typedapi/types/httpinputbasicauthentication.go b/typedapi/types/httpinputbasicauthentication.go index 7d0572d4f6..6e446124b9 100644 --- a/typedapi/types/httpinputbasicauthentication.go +++ b/typedapi/types/httpinputbasicauthentication.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // HttpInputBasicAuthentication type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L54-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L54-L57 type HttpInputBasicAuthentication struct { Password string `json:"password"` Username string `json:"username"` diff --git a/typedapi/types/httpinputproxy.go b/typedapi/types/httpinputproxy.go index d4d7964bcc..860902ba7f 100644 --- a/typedapi/types/httpinputproxy.go +++ b/typedapi/types/httpinputproxy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // HttpInputProxy type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L67-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L67-L70 type HttpInputProxy struct { Host string `json:"host"` Port uint `json:"port"` diff --git a/typedapi/types/httpinputrequestdefinition.go b/typedapi/types/httpinputrequestdefinition.go index 1512adbe4b..33dbe06455 100644 --- a/typedapi/types/httpinputrequestdefinition.go +++ b/typedapi/types/httpinputrequestdefinition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // HttpInputRequestDefinition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L72-L86 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L72-L86 type HttpInputRequestDefinition struct { Auth *HttpInputAuthentication `json:"auth,omitempty"` Body *string `json:"body,omitempty"` diff --git a/typedapi/types/httpinputrequestresult.go b/typedapi/types/httpinputrequestresult.go index 6adf40919c..8bd1c877d7 100644 --- a/typedapi/types/httpinputrequestresult.go +++ b/typedapi/types/httpinputrequestresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // HttpInputRequestResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L300-L300 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L300-L300 type HttpInputRequestResult struct { Auth *HttpInputAuthentication `json:"auth,omitempty"` Body *string `json:"body,omitempty"` diff --git a/typedapi/types/httpinputresponseresult.go b/typedapi/types/httpinputresponseresult.go index 5c58cf32be..8d840eec9f 100644 --- a/typedapi/types/httpinputresponseresult.go +++ b/typedapi/types/httpinputresponseresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HttpInputResponseResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L302-L306 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L302-L306 type HttpInputResponseResult struct { Body string `json:"body"` Headers HttpHeaders `json:"headers"` diff --git a/typedapi/types/hunspelltokenfilter.go b/typedapi/types/hunspelltokenfilter.go index 47f7c5042e..7ea48880cc 100644 --- a/typedapi/types/hunspelltokenfilter.go +++ b/typedapi/types/hunspelltokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HunspellTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L200-L206 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L200-L206 type HunspellTokenFilter struct { Dedup *bool `json:"dedup,omitempty"` Dictionary *string `json:"dictionary,omitempty"` diff --git a/typedapi/types/hyperparameter.go b/typedapi/types/hyperparameter.go index b4e3710842..1d7eeb8a76 100644 --- a/typedapi/types/hyperparameter.go +++ b/typedapi/types/hyperparameter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Hyperparameter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L216-L230 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L216-L230 type Hyperparameter struct { // AbsoluteImportance A positive number showing how much the parameter influences the variation of // the loss function. For hyperparameters with values that are not specified by diff --git a/typedapi/types/hyperparameters.go b/typedapi/types/hyperparameters.go index 66d117d494..fadbb24efe 100644 --- a/typedapi/types/hyperparameters.go +++ b/typedapi/types/hyperparameters.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Hyperparameters type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L419-L525 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L419-L525 type Hyperparameters struct { // Alpha Advanced configuration option. // Machine learning uses loss guided tree growing, which means that the decision diff --git a/typedapi/types/hyphenationdecompoundertokenfilter.go b/typedapi/types/hyphenationdecompoundertokenfilter.go index b73ae4d56c..e770938eed 100644 --- a/typedapi/types/hyphenationdecompoundertokenfilter.go +++ b/typedapi/types/hyphenationdecompoundertokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // HyphenationDecompounderTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L58-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L58-L60 type HyphenationDecompounderTokenFilter struct { HyphenationPatternsPath *string `json:"hyphenation_patterns_path,omitempty"` MaxSubwordSize *int `json:"max_subword_size,omitempty"` diff --git a/typedapi/types/icuanalyzer.go b/typedapi/types/icuanalyzer.go index 18334ffec9..3f1d77ee08 100644 --- a/typedapi/types/icuanalyzer.go +++ b/typedapi/types/icuanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IcuAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L67-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L67-L71 type IcuAnalyzer struct { Method icunormalizationtype.IcuNormalizationType `json:"method"` Mode icunormalizationmode.IcuNormalizationMode `json:"mode"` diff --git a/typedapi/types/icucollationtokenfilter.go b/typedapi/types/icucollationtokenfilter.go index f76b835d3f..92c5d955ac 100644 --- a/typedapi/types/icucollationtokenfilter.go +++ b/typedapi/types/icucollationtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -35,7 +35,7 @@ import ( // IcuCollationTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L51-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L51-L65 type IcuCollationTokenFilter struct { Alternate *icucollationalternate.IcuCollationAlternate `json:"alternate,omitempty"` CaseFirst *icucollationcasefirst.IcuCollationCaseFirst `json:"caseFirst,omitempty"` diff --git a/typedapi/types/icufoldingtokenfilter.go b/typedapi/types/icufoldingtokenfilter.go index fe9a30ee90..ecef9b7ee9 100644 --- a/typedapi/types/icufoldingtokenfilter.go +++ b/typedapi/types/icufoldingtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IcuFoldingTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L46-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L46-L49 type IcuFoldingTokenFilter struct { Type string `json:"type,omitempty"` UnicodeSetFilter string `json:"unicode_set_filter"` diff --git a/typedapi/types/icunormalizationcharfilter.go b/typedapi/types/icunormalizationcharfilter.go index acf34d6f1f..1b57532e2f 100644 --- a/typedapi/types/icunormalizationcharfilter.go +++ b/typedapi/types/icunormalizationcharfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IcuNormalizationCharFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L40-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L40-L44 type IcuNormalizationCharFilter struct { Mode *icunormalizationmode.IcuNormalizationMode `json:"mode,omitempty"` Name *icunormalizationtype.IcuNormalizationType `json:"name,omitempty"` diff --git a/typedapi/types/icunormalizationtokenfilter.go b/typedapi/types/icunormalizationtokenfilter.go index 5669739dc8..eeb4f3df5d 100644 --- a/typedapi/types/icunormalizationtokenfilter.go +++ b/typedapi/types/icunormalizationtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // IcuNormalizationTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L35-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L35-L38 type IcuNormalizationTokenFilter struct { Name icunormalizationtype.IcuNormalizationType `json:"name"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/icutokenizer.go b/typedapi/types/icutokenizer.go index 80ba517b4f..84668c42af 100644 --- a/typedapi/types/icutokenizer.go +++ b/typedapi/types/icutokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IcuTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L30-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L30-L33 type IcuTokenizer struct { RuleFiles string `json:"rule_files"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/icutransformtokenfilter.go b/typedapi/types/icutransformtokenfilter.go index 4bfc273330..a114271afc 100644 --- a/typedapi/types/icutransformtokenfilter.go +++ b/typedapi/types/icutransformtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IcuTransformTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/icu-plugin.ts#L24-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/icu-plugin.ts#L24-L28 type IcuTransformTokenFilter struct { Dir *icutransformdirection.IcuTransformDirection `json:"dir,omitempty"` Id string `json:"id"` diff --git a/typedapi/types/ids.go b/typedapi/types/ids.go index d3b3571c93..e76df5fe3e 100644 --- a/typedapi/types/ids.go +++ b/typedapi/types/ids.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Ids type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L56-L56 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L62-L62 type Ids []string diff --git a/typedapi/types/idsquery.go b/typedapi/types/idsquery.go index 811036a029..67d8962965 100644 --- a/typedapi/types/idsquery.go +++ b/typedapi/types/idsquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IdsQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L80-L85 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L80-L85 type IdsQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/ilm.go b/typedapi/types/ilm.go index b6dc0378c4..789628e846 100644 --- a/typedapi/types/ilm.go +++ b/typedapi/types/ilm.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Ilm type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L162-L165 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L162-L165 type Ilm struct { PolicyCount int `json:"policy_count"` PolicyStats []IlmPolicyStatistics `json:"policy_stats"` diff --git a/typedapi/types/ilmindicator.go b/typedapi/types/ilmindicator.go index f08c2e63a9..19708ba909 100644 --- a/typedapi/types/ilmindicator.go +++ b/typedapi/types/ilmindicator.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IlmIndicator type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L145-L149 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L145-L149 type IlmIndicator struct { Details *IlmIndicatorDetails `json:"details,omitempty"` Diagnosis []Diagnosis `json:"diagnosis,omitempty"` diff --git a/typedapi/types/ilmindicatordetails.go b/typedapi/types/ilmindicatordetails.go index d47c4358f6..1c2b2d1671 100644 --- a/typedapi/types/ilmindicatordetails.go +++ b/typedapi/types/ilmindicatordetails.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IlmIndicatorDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L150-L153 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L150-L153 type IlmIndicatorDetails struct { IlmStatus lifecycleoperationmode.LifecycleOperationMode `json:"ilm_status"` Policies int64 `json:"policies"` diff --git a/typedapi/types/ilmpolicy.go b/typedapi/types/ilmpolicy.go index d8d8bfe417..0a918b84f6 100644 --- a/typedapi/types/ilmpolicy.go +++ b/typedapi/types/ilmpolicy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IlmPolicy type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/_types/Policy.ts#L23-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/_types/Policy.ts#L23-L26 type IlmPolicy struct { Meta_ Metadata `json:"_meta,omitempty"` Phases Phases `json:"phases"` diff --git a/typedapi/types/ilmpolicystatistics.go b/typedapi/types/ilmpolicystatistics.go index 128ef0f7b7..4dff607b0d 100644 --- a/typedapi/types/ilmpolicystatistics.go +++ b/typedapi/types/ilmpolicystatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IlmPolicyStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L157-L160 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L157-L160 type IlmPolicyStatistics struct { IndicesManaged int `json:"indices_managed"` Phases Phases `json:"phases"` diff --git a/typedapi/types/impact.go b/typedapi/types/impact.go index d4298a59ed..6dceb77ef1 100644 --- a/typedapi/types/impact.go +++ b/typedapi/types/impact.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // Impact type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L65-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L65-L70 type Impact struct { Description string `json:"description"` Id string `json:"id"` diff --git a/typedapi/types/indexaction.go b/typedapi/types/indexaction.go index 97df79fd00..63e8e7baec 100644 --- a/typedapi/types/indexaction.go +++ b/typedapi/types/indexaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IndexAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L256-L265 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L256-L265 type IndexAction struct { DocId *string `json:"doc_id,omitempty"` ExecutionTimeField *string `json:"execution_time_field,omitempty"` diff --git a/typedapi/types/indexaliases.go b/typedapi/types/indexaliases.go index d884c620ae..a19e4c13b6 100644 --- a/typedapi/types/indexaliases.go +++ b/typedapi/types/indexaliases.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndexAliases type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_alias/IndicesGetAliasResponse.ts#L36-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_alias/IndicesGetAliasResponse.ts#L36-L38 type IndexAliases struct { Aliases map[string]AliasDefinition `json:"aliases"` } diff --git a/typedapi/types/indexanddatastreamaction.go b/typedapi/types/indexanddatastreamaction.go index 60f64c8ded..ff71311ac3 100644 --- a/typedapi/types/indexanddatastreamaction.go +++ b/typedapi/types/indexanddatastreamaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IndexAndDataStreamAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/modify_data_stream/types.ts#L39-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/modify_data_stream/types.ts#L39-L44 type IndexAndDataStreamAction struct { // DataStream Data stream targeted by the action. DataStream string `json:"data_stream"` diff --git a/typedapi/types/indexcapabilities.go b/typedapi/types/indexcapabilities.go index 0d17f30d8f..096de037ba 100644 --- a/typedapi/types/indexcapabilities.go +++ b/typedapi/types/indexcapabilities.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndexCapabilities type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_rollup_index_caps/types.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_rollup_index_caps/types.ts#L24-L26 type IndexCapabilities struct { RollupJobs []RollupJobSummary `json:"rollup_jobs"` } diff --git a/typedapi/types/indexdetails.go b/typedapi/types/indexdetails.go index b7c7421bd5..9402512a2e 100644 --- a/typedapi/types/indexdetails.go +++ b/typedapi/types/indexdetails.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotIndexDetails.ts#L23-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotIndexDetails.ts#L23-L28 type IndexDetails struct { MaxSegmentsPerShard int64 `json:"max_segments_per_shard"` ShardCount int `json:"shard_count"` diff --git a/typedapi/types/indexfield.go b/typedapi/types/indexfield.go index 1135be8347..3981309e20 100644 --- a/typedapi/types/indexfield.go +++ b/typedapi/types/indexfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/meta-fields.ts#L46-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/meta-fields.ts#L46-L48 type IndexField struct { Enabled bool `json:"enabled"` } diff --git a/typedapi/types/indexhealthstats.go b/typedapi/types/indexhealthstats.go index f7379beeef..1e86c6f339 100644 --- a/typedapi/types/indexhealthstats.go +++ b/typedapi/types/indexhealthstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IndexHealthStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/health/types.ts#L24-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/health/types.ts#L24-L34 type IndexHealthStats struct { ActivePrimaryShards int `json:"active_primary_shards"` ActiveShards int `json:"active_shards"` diff --git a/typedapi/types/indexingpressurememorysummary.go b/typedapi/types/indexingpressurememorysummary.go index 68bda3ff07..651ded8a32 100644 --- a/typedapi/types/indexingpressurememorysummary.go +++ b/typedapi/types/indexingpressurememorysummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexingPressureMemorySummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L580-L589 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L580-L589 type IndexingPressureMemorySummary struct { AllInBytes int64 `json:"all_in_bytes"` CombinedCoordinatingAndPrimaryInBytes int64 `json:"combined_coordinating_and_primary_in_bytes"` diff --git a/typedapi/types/indexingslowlogsettings.go b/typedapi/types/indexingslowlogsettings.go index 775bcfc49a..e8be6b9157 100644 --- a/typedapi/types/indexingslowlogsettings.go +++ b/typedapi/types/indexingslowlogsettings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexingSlowlogSettings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L547-L552 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L547-L552 type IndexingSlowlogSettings struct { Level *string `json:"level,omitempty"` Reformat *bool `json:"reformat,omitempty"` diff --git a/typedapi/types/indexingslowlogtresholds.go b/typedapi/types/indexingslowlogtresholds.go index 046b6ac095..ca3083e49e 100644 --- a/typedapi/types/indexingslowlogtresholds.go +++ b/typedapi/types/indexingslowlogtresholds.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndexingSlowlogTresholds type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L554-L561 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L554-L561 type IndexingSlowlogTresholds struct { // Index The indexing slow log, similar in functionality to the search slow log. The // log file name ends with `_index_indexing_slowlog.json`. diff --git a/typedapi/types/indexingstats.go b/typedapi/types/indexingstats.go index eafdd2785e..3409980497 100644 --- a/typedapi/types/indexingstats.go +++ b/typedapi/types/indexingstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexingStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L143-L159 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L143-L159 type IndexingStats struct { DeleteCurrent int64 `json:"delete_current"` DeleteTime Duration `json:"delete_time,omitempty"` diff --git a/typedapi/types/indexmappingrecord.go b/typedapi/types/indexmappingrecord.go index a7e42a3f40..b47987b09e 100644 --- a/typedapi/types/indexmappingrecord.go +++ b/typedapi/types/indexmappingrecord.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndexMappingRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_mapping/IndicesGetMappingResponse.ts#L28-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_mapping/IndicesGetMappingResponse.ts#L28-L31 type IndexMappingRecord struct { Item *TypeMapping `json:"item,omitempty"` Mappings TypeMapping `json:"mappings"` diff --git a/typedapi/types/indexoperation.go b/typedapi/types/indexoperation.go index 6b719ae841..17f2ebdfe9 100644 --- a/typedapi/types/indexoperation.go +++ b/typedapi/types/indexoperation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IndexOperation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/types.ts#L132-L132 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/types.ts#L132-L132 type IndexOperation struct { // DynamicTemplates A map from the full name of fields to the name of dynamic templates. // Defaults to an empty map. diff --git a/typedapi/types/indexprivilegescheck.go b/typedapi/types/indexprivilegescheck.go index 107fb5da86..e5e64f0c44 100644 --- a/typedapi/types/indexprivilegescheck.go +++ b/typedapi/types/indexprivilegescheck.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IndexPrivilegesCheck type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges/types.ts#L33-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges/types.ts#L33-L44 type IndexPrivilegesCheck struct { // AllowRestrictedIndices This needs to be set to true (default is false) if using wildcards or regexps // for patterns that cover restricted indices. diff --git a/typedapi/types/indexresult.go b/typedapi/types/indexresult.go index 25ca66bb50..63c1860b32 100644 --- a/typedapi/types/indexresult.go +++ b/typedapi/types/indexresult.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndexResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L267-L269 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L267-L269 type IndexResult struct { Response IndexResultSummary `json:"response"` } diff --git a/typedapi/types/indexresultsummary.go b/typedapi/types/indexresultsummary.go index 38dff9af7b..0e9fd65ea0 100644 --- a/typedapi/types/indexresultsummary.go +++ b/typedapi/types/indexresultsummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IndexResultSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L271-L277 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L271-L277 type IndexResultSummary struct { Created bool `json:"created"` Id string `json:"id"` diff --git a/typedapi/types/indexrouting.go b/typedapi/types/indexrouting.go index 26e32ce502..733a822b3d 100644 --- a/typedapi/types/indexrouting.go +++ b/typedapi/types/indexrouting.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndexRouting type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexRouting.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexRouting.ts#L22-L25 type IndexRouting struct { Allocation *IndexRoutingAllocation `json:"allocation,omitempty"` Rebalance *IndexRoutingRebalance `json:"rebalance,omitempty"` diff --git a/typedapi/types/indexroutingallocation.go b/typedapi/types/indexroutingallocation.go index 60e71eaaff..8b64fa134e 100644 --- a/typedapi/types/indexroutingallocation.go +++ b/typedapi/types/indexroutingallocation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // IndexRoutingAllocation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexRouting.ts#L27-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexRouting.ts#L27-L32 type IndexRoutingAllocation struct { Disk *IndexRoutingAllocationDisk `json:"disk,omitempty"` Enable *indexroutingallocationoptions.IndexRoutingAllocationOptions `json:"enable,omitempty"` diff --git a/typedapi/types/indexroutingallocationdisk.go b/typedapi/types/indexroutingallocationdisk.go index a606c4a28f..0ef193c7ea 100644 --- a/typedapi/types/indexroutingallocationdisk.go +++ b/typedapi/types/indexroutingallocationdisk.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexRoutingAllocationDisk type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexRouting.ts#L62-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexRouting.ts#L62-L64 type IndexRoutingAllocationDisk struct { ThresholdEnabled string `json:"threshold_enabled,omitempty"` } diff --git a/typedapi/types/indexroutingallocationinclude.go b/typedapi/types/indexroutingallocationinclude.go index 885fb4e98c..8fc993fb4d 100644 --- a/typedapi/types/indexroutingallocationinclude.go +++ b/typedapi/types/indexroutingallocationinclude.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexRoutingAllocationInclude type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexRouting.ts#L52-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexRouting.ts#L52-L55 type IndexRoutingAllocationInclude struct { Id_ *string `json:"_id,omitempty"` TierPreference_ *string `json:"_tier_preference,omitempty"` diff --git a/typedapi/types/indexroutingallocationinitialrecovery.go b/typedapi/types/indexroutingallocationinitialrecovery.go index 082bac4115..175ae02920 100644 --- a/typedapi/types/indexroutingallocationinitialrecovery.go +++ b/typedapi/types/indexroutingallocationinitialrecovery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IndexRoutingAllocationInitialRecovery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexRouting.ts#L57-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexRouting.ts#L57-L59 type IndexRoutingAllocationInitialRecovery struct { Id_ *string `json:"_id,omitempty"` } diff --git a/typedapi/types/indexroutingrebalance.go b/typedapi/types/indexroutingrebalance.go index afe7345ef3..fa8ec59cb5 100644 --- a/typedapi/types/indexroutingrebalance.go +++ b/typedapi/types/indexroutingrebalance.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // IndexRoutingRebalance type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexRouting.ts#L34-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexRouting.ts#L34-L36 type IndexRoutingRebalance struct { Enable indexroutingrebalanceoptions.IndexRoutingRebalanceOptions `json:"enable"` } diff --git a/typedapi/types/indexsegment.go b/typedapi/types/indexsegment.go index 8f61210bc7..af40b72509 100644 --- a/typedapi/types/indexsegment.go +++ b/typedapi/types/indexsegment.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndexSegment type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/segments/types.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/segments/types.ts#L24-L26 type IndexSegment struct { Shards map[string][]ShardsSegment `json:"shards"` } diff --git a/typedapi/types/indexsegmentsort.go b/typedapi/types/indexsegmentsort.go index 90f3a51762..2dee94f2c9 100644 --- a/typedapi/types/indexsegmentsort.go +++ b/typedapi/types/indexsegmentsort.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // IndexSegmentSort type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSegmentSort.ts#L22-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSegmentSort.ts#L22-L27 type IndexSegmentSort struct { Field []string `json:"field,omitempty"` Missing []segmentsortmissing.SegmentSortMissing `json:"missing,omitempty"` diff --git a/typedapi/types/indexsettingblocks.go b/typedapi/types/indexsettingblocks.go index 38655649d1..1fff6061ae 100644 --- a/typedapi/types/indexsettingblocks.go +++ b/typedapi/types/indexsettingblocks.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IndexSettingBlocks type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L245-L251 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L245-L251 type IndexSettingBlocks struct { Metadata Stringifiedboolean `json:"metadata,omitempty"` Read Stringifiedboolean `json:"read,omitempty"` diff --git a/typedapi/types/indexsettings.go b/typedapi/types/indexsettings.go index e3798fcdd2..f33b1eae22 100644 --- a/typedapi/types/indexsettings.go +++ b/typedapi/types/indexsettings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // IndexSettings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L69-L168 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L69-L168 type IndexSettings struct { Analysis *IndexSettingsAnalysis `json:"analysis,omitempty"` // Analyze Settings to define analyzers, tokenizers, token filters and character diff --git a/typedapi/types/indexsettingsanalysis.go b/typedapi/types/indexsettingsanalysis.go index 5358038a0b..47904f3dc5 100644 --- a/typedapi/types/indexsettingsanalysis.go +++ b/typedapi/types/indexsettingsanalysis.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IndexSettingsAnalysis type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L310-L316 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L310-L316 type IndexSettingsAnalysis struct { Analyzer map[string]Analyzer `json:"analyzer,omitempty"` CharFilter map[string]CharFilter `json:"char_filter,omitempty"` diff --git a/typedapi/types/indexsettingslifecycle.go b/typedapi/types/indexsettingslifecycle.go index f64c6e3cec..035c07066c 100644 --- a/typedapi/types/indexsettingslifecycle.go +++ b/typedapi/types/indexsettingslifecycle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexSettingsLifecycle type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L267-L300 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L267-L300 type IndexSettingsLifecycle struct { // IndexingComplete Indicates whether or not the index has been rolled over. Automatically set to // true when ILM completes the rollover action. diff --git a/typedapi/types/indexsettingslifecyclestep.go b/typedapi/types/indexsettingslifecyclestep.go index e856a27e15..64300d7b92 100644 --- a/typedapi/types/indexsettingslifecyclestep.go +++ b/typedapi/types/indexsettingslifecyclestep.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IndexSettingsLifecycleStep type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L302-L308 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L302-L308 type IndexSettingsLifecycleStep struct { // WaitTimeThreshold Time to wait for the cluster to resolve allocation issues during an ILM // shrink action. Must be greater than 1h (1 hour). diff --git a/typedapi/types/indexsettingstimeseries.go b/typedapi/types/indexsettingstimeseries.go index 306181cc61..227aaf5446 100644 --- a/typedapi/types/indexsettingstimeseries.go +++ b/typedapi/types/indexsettingstimeseries.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IndexSettingsTimeSeries type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L318-L321 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L318-L321 type IndexSettingsTimeSeries struct { EndTime DateTime `json:"end_time,omitempty"` StartTime DateTime `json:"start_time,omitempty"` diff --git a/typedapi/types/indexstate.go b/typedapi/types/indexstate.go index aee313dc3d..e22a63d36d 100644 --- a/typedapi/types/indexstate.go +++ b/typedapi/types/indexstate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IndexState type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexState.ts#L27-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexState.ts#L27-L40 type IndexState struct { Aliases map[string]Alias `json:"aliases,omitempty"` DataStream *string `json:"data_stream,omitempty"` diff --git a/typedapi/types/indexstats.go b/typedapi/types/indexstats.go index 91d4c95af4..2345cbf94b 100644 --- a/typedapi/types/indexstats.go +++ b/typedapi/types/indexstats.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndexStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L52-L93 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L52-L93 type IndexStats struct { Bulk *BulkStats `json:"bulk,omitempty"` // Completion Contains statistics about completions across all shards assigned to the node. diff --git a/typedapi/types/indextemplate.go b/typedapi/types/indextemplate.go index 8b3f34fad0..24667372e3 100644 --- a/typedapi/types/indextemplate.go +++ b/typedapi/types/indextemplate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexTemplate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexTemplate.ts#L31-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexTemplate.ts#L31-L70 type IndexTemplate struct { AllowAutoCreate *bool `json:"allow_auto_create,omitempty"` // ComposedOf An ordered list of component template names. diff --git a/typedapi/types/indextemplatedatastreamconfiguration.go b/typedapi/types/indextemplatedatastreamconfiguration.go index 5d51c1dc25..805c3f4e0d 100644 --- a/typedapi/types/indextemplatedatastreamconfiguration.go +++ b/typedapi/types/indextemplatedatastreamconfiguration.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexTemplateDataStreamConfiguration type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexTemplate.ts#L72-L83 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexTemplate.ts#L72-L83 type IndexTemplateDataStreamConfiguration struct { // AllowCustomRouting If true, the data stream supports custom routing. AllowCustomRouting *bool `json:"allow_custom_routing,omitempty"` diff --git a/typedapi/types/indextemplateitem.go b/typedapi/types/indextemplateitem.go index 167a06360d..8a9cf9454e 100644 --- a/typedapi/types/indextemplateitem.go +++ b/typedapi/types/indextemplateitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IndexTemplateItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_index_template/IndicesGetIndexTemplateResponse.ts#L29-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_index_template/IndicesGetIndexTemplateResponse.ts#L29-L32 type IndexTemplateItem struct { IndexTemplate IndexTemplate `json:"index_template"` Name string `json:"name"` diff --git a/typedapi/types/indextemplatemapping.go b/typedapi/types/indextemplatemapping.go index 54c69111b7..3680a30a7d 100644 --- a/typedapi/types/indextemplatemapping.go +++ b/typedapi/types/indextemplatemapping.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndexTemplateMapping type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/put_index_template/IndicesPutIndexTemplateRequest.ts#L97-L119 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/put_index_template/IndicesPutIndexTemplateRequest.ts#L97-L119 type IndexTemplateMapping struct { // Aliases Aliases to add. // If the index template includes a `data_stream` object, these are data stream diff --git a/typedapi/types/indextemplatesummary.go b/typedapi/types/indextemplatesummary.go index ecc1da8ca9..47a92be441 100644 --- a/typedapi/types/indextemplatesummary.go +++ b/typedapi/types/indextemplatesummary.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndexTemplateSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexTemplate.ts#L85-L107 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexTemplate.ts#L85-L107 type IndexTemplateSummary struct { // Aliases Aliases to add. // If the index template includes a `data_stream` object, these are data stream diff --git a/typedapi/types/indexversioning.go b/typedapi/types/indexversioning.go index 79913bfeae..692c926694 100644 --- a/typedapi/types/indexversioning.go +++ b/typedapi/types/indexversioning.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndexVersioning type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L262-L265 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L262-L265 type IndexVersioning struct { Created *string `json:"created,omitempty"` CreatedString *string `json:"created_string,omitempty"` diff --git a/typedapi/types/indicatornode.go b/typedapi/types/indicatornode.go index 29ae36a6a5..cfbe0af70e 100644 --- a/typedapi/types/indicatornode.go +++ b/typedapi/types/indicatornode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndicatorNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L90-L93 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L90-L93 type IndicatorNode struct { Name string `json:"name,omitempty"` NodeId string `json:"node_id,omitempty"` diff --git a/typedapi/types/indicators.go b/typedapi/types/indicators.go index 525dd23d32..da880a0d4c 100644 --- a/typedapi/types/indicators.go +++ b/typedapi/types/indicators.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Indicators type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L32-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L32-L40 type Indicators struct { Disk *DiskIndicator `json:"disk,omitempty"` Ilm *IlmIndicator `json:"ilm,omitempty"` diff --git a/typedapi/types/indices.go b/typedapi/types/indices.go index e0e85350cb..c4c7fc4e1d 100644 --- a/typedapi/types/indices.go +++ b/typedapi/types/indices.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Indices type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L61-L61 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L67-L67 type Indices []string diff --git a/typedapi/types/indicesaction.go b/typedapi/types/indicesaction.go index 74f1fd010c..bbbf452b0a 100644 --- a/typedapi/types/indicesaction.go +++ b/typedapi/types/indicesaction.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndicesAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/update_aliases/types.ts#L23-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/update_aliases/types.ts#L23-L39 type IndicesAction struct { // Add Adds a data stream or index to an alias. // If the alias doesn’t exist, the `add` action creates it. diff --git a/typedapi/types/indicesblockstatus.go b/typedapi/types/indicesblockstatus.go index 4f81b87082..a0fc33cadc 100644 --- a/typedapi/types/indicesblockstatus.go +++ b/typedapi/types/indicesblockstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndicesBlockStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/add_block/IndicesAddBlockResponse.ts#L30-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/add_block/IndicesAddBlockResponse.ts#L30-L33 type IndicesBlockStatus struct { Blocked bool `json:"blocked"` Name string `json:"name"` diff --git a/typedapi/types/indicesindexingpressure.go b/typedapi/types/indicesindexingpressure.go index be9b79d94a..a54d2f9f20 100644 --- a/typedapi/types/indicesindexingpressure.go +++ b/typedapi/types/indicesindexingpressure.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndicesIndexingPressure type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L534-L536 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L534-L536 type IndicesIndexingPressure struct { Memory IndicesIndexingPressureMemory `json:"memory"` } diff --git a/typedapi/types/indicesindexingpressurememory.go b/typedapi/types/indicesindexingpressurememory.go index 9e8116b9c8..716bbe760d 100644 --- a/typedapi/types/indicesindexingpressurememory.go +++ b/typedapi/types/indicesindexingpressurememory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndicesIndexingPressureMemory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L538-L545 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L538-L545 type IndicesIndexingPressureMemory struct { // Limit Number of outstanding bytes that may be consumed by indexing requests. When // this limit is reached or exceeded, diff --git a/typedapi/types/indicesmodifyaction.go b/typedapi/types/indicesmodifyaction.go index 42aa6a1e23..ecfac59427 100644 --- a/typedapi/types/indicesmodifyaction.go +++ b/typedapi/types/indicesmodifyaction.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndicesModifyAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/modify_data_stream/types.ts#L22-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/modify_data_stream/types.ts#L22-L37 type IndicesModifyAction struct { // AddBackingIndex Adds an existing index as a backing index for a data stream. // The index is hidden as part of this operation. diff --git a/typedapi/types/indicesoptions.go b/typedapi/types/indicesoptions.go index a4b622b1ba..29ebfc2e30 100644 --- a/typedapi/types/indicesoptions.go +++ b/typedapi/types/indicesoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IndicesOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L337-L364 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L338-L365 type IndicesOptions struct { // AllowNoIndices If false, the request returns an error if any wildcard expression, index // alias, or `_all` value targets only diff --git a/typedapi/types/indicesprivileges.go b/typedapi/types/indicesprivileges.go index 462a35c28d..b3c95f76fe 100644 --- a/typedapi/types/indicesprivileges.go +++ b/typedapi/types/indicesprivileges.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IndicesPrivileges type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L82-L105 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L82-L105 type IndicesPrivileges struct { // AllowRestrictedIndices Set to `true` if using wildcard or regular expressions for patterns that // cover restricted indices. Implicitly, restricted indices have limited diff --git a/typedapi/types/indicesprivilegesquery.go b/typedapi/types/indicesprivilegesquery.go index e6fcbdf072..0d0302f71d 100644 --- a/typedapi/types/indicesprivilegesquery.go +++ b/typedapi/types/indicesprivilegesquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ package types // Query // RoleTemplateQuery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L131-L139 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L131-L139 type IndicesPrivilegesQuery interface{} diff --git a/typedapi/types/indicesrecord.go b/typedapi/types/indicesrecord.go index 60e34a9e90..7894abfbee 100644 --- a/typedapi/types/indicesrecord.go +++ b/typedapi/types/indicesrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndicesRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/indices/types.ts#L20-L801 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/indices/types.ts#L20-L801 type IndicesRecord struct { // BulkAvgSizeInBytes average size in bytes of shard bulk BulkAvgSizeInBytes *string `json:"bulk.avg_size_in_bytes,omitempty"` diff --git a/typedapi/types/indicesshardsstats.go b/typedapi/types/indicesshardsstats.go index fb264d4b24..219e7b1977 100644 --- a/typedapi/types/indicesshardsstats.go +++ b/typedapi/types/indicesshardsstats.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndicesShardsStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L49-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L49-L52 type IndicesShardsStats struct { AllFields FieldSummary `json:"all_fields"` Fields map[string]FieldSummary `json:"fields"` diff --git a/typedapi/types/indicesshardstats.go b/typedapi/types/indicesshardstats.go index 31bd22d78b..0b7edafc73 100644 --- a/typedapi/types/indicesshardstats.go +++ b/typedapi/types/indicesshardstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // IndicesShardStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L192-L223 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L192-L223 type IndicesShardStats struct { Bulk *BulkStats `json:"bulk,omitempty"` Commit *ShardCommit `json:"commit,omitempty"` diff --git a/typedapi/types/indicesshardstores.go b/typedapi/types/indicesshardstores.go index 01a1fada2c..7051020c77 100644 --- a/typedapi/types/indicesshardstores.go +++ b/typedapi/types/indicesshardstores.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IndicesShardStores type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/shard_stores/types.ts#L26-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/shard_stores/types.ts#L26-L28 type IndicesShardStores struct { Shards map[string]ShardStoreWrapper `json:"shards"` } diff --git a/typedapi/types/indicesstats.go b/typedapi/types/indicesstats.go index 5f1ca7f6c5..96438ea155 100644 --- a/typedapi/types/indicesstats.go +++ b/typedapi/types/indicesstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IndicesStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L95-L110 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L95-L110 type IndicesStats struct { Health *healthstatus.HealthStatus `json:"health,omitempty"` Primaries *IndexStats `json:"primaries,omitempty"` diff --git a/typedapi/types/indicesvalidationexplanation.go b/typedapi/types/indicesvalidationexplanation.go index ed725c2af0..c599f594ad 100644 --- a/typedapi/types/indicesvalidationexplanation.go +++ b/typedapi/types/indicesvalidationexplanation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndicesValidationExplanation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/validate_query/IndicesValidateQueryResponse.ts#L32-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/validate_query/IndicesValidateQueryResponse.ts#L32-L37 type IndicesValidationExplanation struct { Error *string `json:"error,omitempty"` Explanation *string `json:"explanation,omitempty"` diff --git a/typedapi/types/indicesversions.go b/typedapi/types/indicesversions.go index 759a42c1d6..77d2bc26e7 100644 --- a/typedapi/types/indicesversions.go +++ b/typedapi/types/indicesversions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IndicesVersions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L263-L268 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L263-L268 type IndicesVersions struct { IndexCount int `json:"index_count"` PrimaryShardCount int `json:"primary_shard_count"` diff --git a/typedapi/types/inferenceaggregate.go b/typedapi/types/inferenceaggregate.go index bff3c32810..adfe2e976a 100644 --- a/typedapi/types/inferenceaggregate.go +++ b/typedapi/types/inferenceaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // InferenceAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L659-L670 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L659-L670 type InferenceAggregate struct { Data map[string]json.RawMessage `json:"-"` FeatureImportance []InferenceFeatureImportance `json:"feature_importance,omitempty"` diff --git a/typedapi/types/inferenceaggregation.go b/typedapi/types/inferenceaggregation.go index b14f604173..1986739d99 100644 --- a/typedapi/types/inferenceaggregation.go +++ b/typedapi/types/inferenceaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // InferenceAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L205-L214 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L205-L214 type InferenceAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/inferenceclassimportance.go b/typedapi/types/inferenceclassimportance.go index e7cb0172fa..7a5282e834 100644 --- a/typedapi/types/inferenceclassimportance.go +++ b/typedapi/types/inferenceclassimportance.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // InferenceClassImportance type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L684-L687 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L684-L687 type InferenceClassImportance struct { ClassName string `json:"class_name"` Importance Float64 `json:"importance"` diff --git a/typedapi/types/inferenceconfig.go b/typedapi/types/inferenceconfig.go index e162c801a0..e9d4a9f89a 100644 --- a/typedapi/types/inferenceconfig.go +++ b/typedapi/types/inferenceconfig.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // InferenceConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L735-L747 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L735-L747 type InferenceConfig struct { // Classification Classification configuration for inference. Classification *InferenceConfigClassification `json:"classification,omitempty"` diff --git a/typedapi/types/inferenceconfigclassification.go b/typedapi/types/inferenceconfigclassification.go index 53a18265b6..566906a1dc 100644 --- a/typedapi/types/inferenceconfigclassification.go +++ b/typedapi/types/inferenceconfigclassification.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // InferenceConfigClassification type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L762-L788 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L762-L788 type InferenceConfigClassification struct { // NumTopClasses Specifies the number of top class predictions to return. NumTopClasses *int `json:"num_top_classes,omitempty"` diff --git a/typedapi/types/inferenceconfigcontainer.go b/typedapi/types/inferenceconfigcontainer.go index 3df7399a73..49d73009f3 100644 --- a/typedapi/types/inferenceconfigcontainer.go +++ b/typedapi/types/inferenceconfigcontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // InferenceConfigContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L216-L222 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L216-L222 type InferenceConfigContainer struct { // Classification Classification configuration for inference. Classification *ClassificationInferenceOptions `json:"classification,omitempty"` diff --git a/typedapi/types/inferenceconfigcreatecontainer.go b/typedapi/types/inferenceconfigcreatecontainer.go index 4d52d11aec..9e38db190e 100644 --- a/typedapi/types/inferenceconfigcreatecontainer.go +++ b/typedapi/types/inferenceconfigcreatecontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // InferenceConfigCreateContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L23-L80 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L23-L80 type InferenceConfigCreateContainer struct { // Classification Classification configuration for inference. Classification *ClassificationInferenceOptions `json:"classification,omitempty"` diff --git a/typedapi/types/inferenceconfigregression.go b/typedapi/types/inferenceconfigregression.go index c82bfb9e8a..4d48ba9dcd 100644 --- a/typedapi/types/inferenceconfigregression.go +++ b/typedapi/types/inferenceconfigregression.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // InferenceConfigRegression type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L749-L760 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L749-L760 type InferenceConfigRegression struct { // NumTopFeatureImportanceValues Specifies the maximum number of feature importance values per document. NumTopFeatureImportanceValues *int `json:"num_top_feature_importance_values,omitempty"` diff --git a/typedapi/types/inferenceconfigupdatecontainer.go b/typedapi/types/inferenceconfigupdatecontainer.go index 041e08c03d..eca3e7b027 100644 --- a/typedapi/types/inferenceconfigupdatecontainer.go +++ b/typedapi/types/inferenceconfigupdatecontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // InferenceConfigUpdateContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L296-L318 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L296-L318 type InferenceConfigUpdateContainer struct { // Classification Classification configuration for inference. Classification *ClassificationInferenceOptions `json:"classification,omitempty"` diff --git a/typedapi/types/inferencefeatureimportance.go b/typedapi/types/inferencefeatureimportance.go index 5ee40e9bc7..ae329405f1 100644 --- a/typedapi/types/inferencefeatureimportance.go +++ b/typedapi/types/inferencefeatureimportance.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // InferenceFeatureImportance type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L678-L682 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L678-L682 type InferenceFeatureImportance struct { Classes []InferenceClassImportance `json:"classes,omitempty"` FeatureName string `json:"feature_name"` diff --git a/typedapi/types/inferenceprocessor.go b/typedapi/types/inferenceprocessor.go index 02bb8d03e5..25a01d9a86 100644 --- a/typedapi/types/inferenceprocessor.go +++ b/typedapi/types/inferenceprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // InferenceProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L714-L733 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L714-L733 type InferenceProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/inferenceresponseresult.go b/typedapi/types/inferenceresponseresult.go index c192355be9..62a9ab8bed 100644 --- a/typedapi/types/inferenceresponseresult.go +++ b/typedapi/types/inferenceresponseresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // InferenceResponseResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L459-L506 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L459-L506 type InferenceResponseResult struct { // Entities If the model is trained for named entity recognition (NER) tasks, the // response contains the recognized entities. diff --git a/typedapi/types/inferenceresult.go b/typedapi/types/inferenceresult.go new file mode 100644 index 0000000000..1f5d1f2e76 --- /dev/null +++ b/typedapi/types/inferenceresult.go @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package types + +// InferenceResult type. +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/_types/Results.ts#L46-L53 +type InferenceResult struct { + SparseEmbedding []SparseEmbeddingResult `json:"sparse_embedding,omitempty"` + TextEmbedding []TextEmbeddingResult `json:"text_embedding,omitempty"` +} + +// NewInferenceResult returns a InferenceResult. +func NewInferenceResult() *InferenceResult { + r := &InferenceResult{} + + return r +} diff --git a/typedapi/types/inferencetopclassentry.go b/typedapi/types/inferencetopclassentry.go index 9acb816ee1..a3d783d29e 100644 --- a/typedapi/types/inferencetopclassentry.go +++ b/typedapi/types/inferencetopclassentry.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // InferenceTopClassEntry type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L672-L676 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L672-L676 type InferenceTopClassEntry struct { ClassName FieldValue `json:"class_name"` ClassProbability Float64 `json:"class_probability"` diff --git a/typedapi/types/influence.go b/typedapi/types/influence.go index 33ce7840b1..759eaaabce 100644 --- a/typedapi/types/influence.go +++ b/typedapi/types/influence.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Influence type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Anomaly.ts#L140-L143 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Anomaly.ts#L140-L143 type Influence struct { InfluencerFieldName string `json:"influencer_field_name"` InfluencerFieldValues []string `json:"influencer_field_values"` diff --git a/typedapi/types/influencer.go b/typedapi/types/influencer.go index 95d02ce479..04ef04597a 100644 --- a/typedapi/types/influencer.go +++ b/typedapi/types/influencer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Influencer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Influencer.ts#L31-L83 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Influencer.ts#L31-L83 type Influencer struct { // BucketSpan The length of the bucket in seconds. This value matches the bucket span that // is specified in the job. diff --git a/typedapi/types/infofeaturestate.go b/typedapi/types/infofeaturestate.go index 228cae4ef3..892fa51b69 100644 --- a/typedapi/types/infofeaturestate.go +++ b/typedapi/types/infofeaturestate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // InfoFeatureState type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotInfoFeatureState.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotInfoFeatureState.ts#L22-L25 type InfoFeatureState struct { FeatureName string `json:"feature_name"` Indices []string `json:"indices"` diff --git a/typedapi/types/ingestpipeline.go b/typedapi/types/ingestpipeline.go index a794c0fbc5..5f5351a13a 100644 --- a/typedapi/types/ingestpipeline.go +++ b/typedapi/types/ingestpipeline.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,10 +30,13 @@ import ( // IngestPipeline type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Pipeline.ts#L23-L41 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Pipeline.ts#L23-L45 type IngestPipeline struct { // Description Description of the ingest pipeline. Description *string `json:"description,omitempty"` + // Meta_ Arbitrary metadata about the ingest pipeline. This map is not automatically + // generated by Elasticsearch. + Meta_ Metadata `json:"_meta"` // OnFailure Processors to run immediately after a processor failure. OnFailure []ProcessorContainer `json:"on_failure,omitempty"` // Processors Processors used to perform transformations on documents before indexing. @@ -70,6 +73,11 @@ func (s *IngestPipeline) UnmarshalJSON(data []byte) error { } s.Description = &o + case "_meta": + if err := dec.Decode(&s.Meta_); err != nil { + return err + } + case "on_failure": if err := dec.Decode(&s.OnFailure); err != nil { return err diff --git a/typedapi/types/ingesttotal.go b/typedapi/types/ingesttotal.go index aa06fb3511..92266e4118 100644 --- a/typedapi/types/ingesttotal.go +++ b/typedapi/types/ingesttotal.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IngestTotal type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L356-L377 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L356-L377 type IngestTotal struct { // Count Total number of documents ingested during the lifetime of this node. Count *int64 `json:"count,omitempty"` diff --git a/typedapi/types/inlineget.go b/typedapi/types/inlineget.go index 6de6156766..13a3b26146 100644 --- a/typedapi/types/inlineget.go +++ b/typedapi/types/inlineget.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // InlineGet type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L326-L335 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L327-L336 type InlineGet struct { Fields map[string]json.RawMessage `json:"fields,omitempty"` Found bool `json:"found"` diff --git a/typedapi/types/inlinegetdictuserdefined.go b/typedapi/types/inlinegetdictuserdefined.go index 95d7721ecb..371ba43f07 100644 --- a/typedapi/types/inlinegetdictuserdefined.go +++ b/typedapi/types/inlinegetdictuserdefined.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // InlineGetDictUserDefined type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L326-L335 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L327-L336 type InlineGetDictUserDefined struct { Fields map[string]json.RawMessage `json:"fields,omitempty"` Found bool `json:"found"` diff --git a/typedapi/types/inlinescript.go b/typedapi/types/inlinescript.go index 3598b53193..ca269e422f 100644 --- a/typedapi/types/inlinescript.go +++ b/typedapi/types/inlinescript.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // InlineScript type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Scripting.ts#L67-L79 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Scripting.ts#L67-L79 type InlineScript struct { // Lang Specifies the language the script is written in. Lang *scriptlanguage.ScriptLanguage `json:"lang,omitempty"` diff --git a/typedapi/types/innerhits.go b/typedapi/types/innerhits.go index 70413c4287..8b176b23a4 100644 --- a/typedapi/types/innerhits.go +++ b/typedapi/types/innerhits.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // InnerHits type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/hits.ts#L106-L140 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/hits.ts#L106-L140 type InnerHits struct { Collapse *FieldCollapse `json:"collapse,omitempty"` DocvalueFields []FieldAndFormat `json:"docvalue_fields,omitempty"` diff --git a/typedapi/types/innerhitsresult.go b/typedapi/types/innerhitsresult.go index 98213bdf6d..282ddda89f 100644 --- a/typedapi/types/innerhitsresult.go +++ b/typedapi/types/innerhitsresult.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // InnerHitsResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/hits.ts#L84-L86 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/hits.ts#L84-L86 type InnerHitsResult struct { Hits *HitsMetadata `json:"hits,omitempty"` } diff --git a/typedapi/types/inprogress.go b/typedapi/types/inprogress.go index 200a06eb00..91de4bf90b 100644 --- a/typedapi/types/inprogress.go +++ b/typedapi/types/inprogress.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // InProgress type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/_types/SnapshotLifecycle.ts#L131-L136 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/_types/SnapshotLifecycle.ts#L131-L136 type InProgress struct { Name string `json:"name"` StartTimeMillis int64 `json:"start_time_millis"` diff --git a/typedapi/types/input.go b/typedapi/types/input.go index 2b5fdbd519..0ef8e7d8c8 100644 --- a/typedapi/types/input.go +++ b/typedapi/types/input.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Input type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L56-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L56-L58 type Input struct { FieldNames []string `json:"field_names"` } diff --git a/typedapi/types/integernumberproperty.go b/typedapi/types/integernumberproperty.go index 29d0e38182..253869d0c3 100644 --- a/typedapi/types/integernumberproperty.go +++ b/typedapi/types/integernumberproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // IntegerNumberProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L149-L152 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L149-L152 type IntegerNumberProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -260,6 +260,12 @@ func (s *IntegerNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -634,6 +640,12 @@ func (s *IntegerNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/integerrangeproperty.go b/typedapi/types/integerrangeproperty.go index c25d93f0a7..5572207acf 100644 --- a/typedapi/types/integerrangeproperty.go +++ b/typedapi/types/integerrangeproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IntegerRangeProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/range.ts#L42-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/range.ts#L42-L44 type IntegerRangeProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -248,6 +248,12 @@ func (s *IntegerRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -587,6 +593,12 @@ func (s *IntegerRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/intervals.go b/typedapi/types/intervals.go index 2e03b0a45d..8aaca59d61 100644 --- a/typedapi/types/intervals.go +++ b/typedapi/types/intervals.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Intervals type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L83-L110 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L83-L110 type Intervals struct { // AllOf Returns matches that span a combination of other rules. AllOf *IntervalsAllOf `json:"all_of,omitempty"` diff --git a/typedapi/types/intervalsallof.go b/typedapi/types/intervalsallof.go index 3b8b5c6d2d..270c3fc7bf 100644 --- a/typedapi/types/intervalsallof.go +++ b/typedapi/types/intervalsallof.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IntervalsAllOf type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L50-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L50-L70 type IntervalsAllOf struct { // Filter Rule used to filter returned intervals. Filter *IntervalsFilter `json:"filter,omitempty"` diff --git a/typedapi/types/intervalsanyof.go b/typedapi/types/intervalsanyof.go index 799ec0faf7..b51551a13e 100644 --- a/typedapi/types/intervalsanyof.go +++ b/typedapi/types/intervalsanyof.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IntervalsAnyOf type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L72-L81 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L72-L81 type IntervalsAnyOf struct { // Filter Rule used to filter returned intervals. Filter *IntervalsFilter `json:"filter,omitempty"` diff --git a/typedapi/types/intervalsfilter.go b/typedapi/types/intervalsfilter.go index cd314c520c..6010c7ee2c 100644 --- a/typedapi/types/intervalsfilter.go +++ b/typedapi/types/intervalsfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IntervalsFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L112-L152 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L112-L152 type IntervalsFilter struct { // After Query used to return intervals that follow an interval from the `filter` // rule. diff --git a/typedapi/types/intervalsfuzzy.go b/typedapi/types/intervalsfuzzy.go index f96cfdc27f..5531847d1f 100644 --- a/typedapi/types/intervalsfuzzy.go +++ b/typedapi/types/intervalsfuzzy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IntervalsFuzzy type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L154-L184 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L154-L184 type IntervalsFuzzy struct { // Analyzer Analyzer used to normalize the term. Analyzer *string `json:"analyzer,omitempty"` diff --git a/typedapi/types/intervalsmatch.go b/typedapi/types/intervalsmatch.go index 6b4d6670da..b53858da7f 100644 --- a/typedapi/types/intervalsmatch.go +++ b/typedapi/types/intervalsmatch.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IntervalsMatch type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L186-L216 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L186-L216 type IntervalsMatch struct { // Analyzer Analyzer used to analyze terms in the query. Analyzer *string `json:"analyzer,omitempty"` diff --git a/typedapi/types/intervalsprefix.go b/typedapi/types/intervalsprefix.go index 8ffe600bb5..d00588bce5 100644 --- a/typedapi/types/intervalsprefix.go +++ b/typedapi/types/intervalsprefix.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IntervalsPrefix type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L218-L233 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L218-L233 type IntervalsPrefix struct { // Analyzer Analyzer used to analyze the `prefix`. Analyzer *string `json:"analyzer,omitempty"` diff --git a/typedapi/types/intervalsquery.go b/typedapi/types/intervalsquery.go index f4667bc734..7ca3b60ec3 100644 --- a/typedapi/types/intervalsquery.go +++ b/typedapi/types/intervalsquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IntervalsQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L235-L263 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L235-L263 type IntervalsQuery struct { // AllOf Returns matches that span a combination of other rules. AllOf *IntervalsAllOf `json:"all_of,omitempty"` diff --git a/typedapi/types/intervalswildcard.go b/typedapi/types/intervalswildcard.go index 3dcdded422..2d7f75ec8d 100644 --- a/typedapi/types/intervalswildcard.go +++ b/typedapi/types/intervalswildcard.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IntervalsWildcard type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L265-L280 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L265-L280 type IntervalsWildcard struct { // Analyzer Analyzer used to analyze the `pattern`. // Defaults to the top-level field's analyzer. diff --git a/typedapi/types/invertedindex.go b/typedapi/types/invertedindex.go index b9103c263e..f4f1ed8f94 100644 --- a/typedapi/types/invertedindex.go +++ b/typedapi/types/invertedindex.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // InvertedIndex type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L65-L73 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L65-L73 type InvertedIndex struct { Offsets uint `json:"offsets"` Payloads uint `json:"payloads"` diff --git a/typedapi/types/invocation.go b/typedapi/types/invocation.go index d4e9791578..d62ee76310 100644 --- a/typedapi/types/invocation.go +++ b/typedapi/types/invocation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Invocation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/_types/SnapshotLifecycle.ts#L138-L141 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/_types/SnapshotLifecycle.ts#L138-L141 type Invocation struct { SnapshotName string `json:"snapshot_name"` Time DateTime `json:"time"` diff --git a/typedapi/types/invocations.go b/typedapi/types/invocations.go index a739d6fd3c..46c1b25c66 100644 --- a/typedapi/types/invocations.go +++ b/typedapi/types/invocations.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Invocations type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L44-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L44-L46 type Invocations struct { Total int64 `json:"total"` } diff --git a/typedapi/types/iostatdevice.go b/typedapi/types/iostatdevice.go index 4906f19a6e..3377f06db0 100644 --- a/typedapi/types/iostatdevice.go +++ b/typedapi/types/iostatdevice.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IoStatDevice type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L730-L755 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L730-L755 type IoStatDevice struct { // DeviceName The Linux device name. DeviceName *string `json:"device_name,omitempty"` diff --git a/typedapi/types/iostats.go b/typedapi/types/iostats.go index a965270ef6..24274d88da 100644 --- a/typedapi/types/iostats.go +++ b/typedapi/types/iostats.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // IoStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L718-L728 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L718-L728 type IoStats struct { // Devices Array of disk metrics for each device that is backing an Elasticsearch data // path. diff --git a/typedapi/types/ipfilter.go b/typedapi/types/ipfilter.go index cb9e2f833d..4684bfdf31 100644 --- a/typedapi/types/ipfilter.go +++ b/typedapi/types/ipfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IpFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L167-L170 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L167-L170 type IpFilter struct { Http bool `json:"http"` Transport bool `json:"transport"` diff --git a/typedapi/types/ipprefixaggregate.go b/typedapi/types/ipprefixaggregate.go index 0c79cf0d8a..d331b95fbb 100644 --- a/typedapi/types/ipprefixaggregate.go +++ b/typedapi/types/ipprefixaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IpPrefixAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L629-L630 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L629-L630 type IpPrefixAggregate struct { Buckets BucketsIpPrefixBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/ipprefixaggregation.go b/typedapi/types/ipprefixaggregation.go index e10206f38d..1609b6430e 100644 --- a/typedapi/types/ipprefixaggregation.go +++ b/typedapi/types/ipprefixaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IpPrefixAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L1114-L1143 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L1114-L1143 type IpPrefixAggregation struct { // AppendPrefixLength Defines whether the prefix length is appended to IP address keys in the // response. diff --git a/typedapi/types/ipprefixbucket.go b/typedapi/types/ipprefixbucket.go index 61261bcdae..53eea5a795 100644 --- a/typedapi/types/ipprefixbucket.go +++ b/typedapi/types/ipprefixbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IpPrefixBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L632-L637 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L632-L637 type IpPrefixBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/ipproperty.go b/typedapi/types/ipproperty.go index 53bd095be5..4de87f2411 100644 --- a/typedapi/types/ipproperty.go +++ b/typedapi/types/ipproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // IpProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/specialized.ts#L59-L73 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/specialized.ts#L59-L73 type IpProperty struct { Boost *Float64 `json:"boost,omitempty"` CopyTo []string `json:"copy_to,omitempty"` @@ -241,6 +241,12 @@ func (s *IpProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -611,6 +617,12 @@ func (s *IpProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/iprangeaggregate.go b/typedapi/types/iprangeaggregate.go index 01c3535512..4d91f26e4f 100644 --- a/typedapi/types/iprangeaggregate.go +++ b/typedapi/types/iprangeaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // IpRangeAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L556-L558 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L556-L558 type IpRangeAggregate struct { Buckets BucketsIpRangeBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/iprangeaggregation.go b/typedapi/types/iprangeaggregation.go index 91a7000cb1..272e4fbfe1 100644 --- a/typedapi/types/iprangeaggregation.go +++ b/typedapi/types/iprangeaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IpRangeAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L548-L557 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L548-L557 type IpRangeAggregation struct { // Field The date field whose values are used to build ranges. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/iprangeaggregationrange.go b/typedapi/types/iprangeaggregationrange.go index 01d7cccb06..343c00de55 100644 --- a/typedapi/types/iprangeaggregationrange.go +++ b/typedapi/types/iprangeaggregationrange.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // IpRangeAggregationRange type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L559-L572 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L559-L572 type IpRangeAggregationRange struct { // From Start of the range. From string `json:"from,omitempty"` diff --git a/typedapi/types/iprangebucket.go b/typedapi/types/iprangebucket.go index fd7c2dd699..54ab12b6e3 100644 --- a/typedapi/types/iprangebucket.go +++ b/typedapi/types/iprangebucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IpRangeBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L560-L564 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L560-L564 type IpRangeBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/iprangeproperty.go b/typedapi/types/iprangeproperty.go index 6fd99d34fd..023ca94474 100644 --- a/typedapi/types/iprangeproperty.go +++ b/typedapi/types/iprangeproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // IpRangeProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/range.ts#L46-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/range.ts#L46-L48 type IpRangeProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -248,6 +248,12 @@ func (s *IpRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -587,6 +593,12 @@ func (s *IpRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/job.go b/typedapi/types/job.go index 64b1e1a1c9..33b3c62303 100644 --- a/typedapi/types/job.go +++ b/typedapi/types/job.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Job type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L61-L180 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L61-L180 type Job struct { // AllowLazyOpen Advanced configuration option. // Specifies whether this job can open when there is insufficient machine diff --git a/typedapi/types/jobblocked.go b/typedapi/types/jobblocked.go index c9155fdb0c..188166c523 100644 --- a/typedapi/types/jobblocked.go +++ b/typedapi/types/jobblocked.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // JobBlocked type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L392-L395 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L392-L395 type JobBlocked struct { Reason jobblockedreason.JobBlockedReason `json:"reason"` TaskId TaskId `json:"task_id,omitempty"` diff --git a/typedapi/types/jobconfig.go b/typedapi/types/jobconfig.go index 9baf04f5ef..c1220db79d 100644 --- a/typedapi/types/jobconfig.go +++ b/typedapi/types/jobconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // JobConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L182-L283 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L182-L283 type JobConfig struct { // AllowLazyOpen Advanced configuration option. Specifies whether this job can open when there // is insufficient machine learning node capacity for it to be immediately diff --git a/typedapi/types/jobforecaststatistics.go b/typedapi/types/jobforecaststatistics.go index 22611d567a..5bbb5057af 100644 --- a/typedapi/types/jobforecaststatistics.go +++ b/typedapi/types/jobforecaststatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // JobForecastStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L343-L350 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L343-L350 type JobForecastStatistics struct { ForecastedJobs int `json:"forecasted_jobs"` MemoryBytes *JobStatistics `json:"memory_bytes,omitempty"` diff --git a/typedapi/types/jobsrecord.go b/typedapi/types/jobsrecord.go index 6397c58ed6..1bea4359cf 100644 --- a/typedapi/types/jobsrecord.go +++ b/typedapi/types/jobsrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // JobsRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/ml_jobs/types.ts#L24-L347 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/ml_jobs/types.ts#L24-L347 type JobsRecord struct { // AssignmentExplanation For open anomaly detection jobs only, contains messages relating to the // selection of a node to run the job. diff --git a/typedapi/types/jobstatistics.go b/typedapi/types/jobstatistics.go index c770b592b4..748a5fd57b 100644 --- a/typedapi/types/jobstatistics.go +++ b/typedapi/types/jobstatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // JobStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L54-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L54-L59 type JobStatistics struct { Avg Float64 `json:"avg"` Max Float64 `json:"max"` diff --git a/typedapi/types/jobstats.go b/typedapi/types/jobstats.go index 304e1ab3f5..906732f35d 100644 --- a/typedapi/types/jobstats.go +++ b/typedapi/types/jobstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // JobStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L284-L330 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L284-L330 type JobStats struct { // AssignmentExplanation For open anomaly detection jobs only, contains messages relating to the // selection of a node to run the job. diff --git a/typedapi/types/jobtimingstats.go b/typedapi/types/jobtimingstats.go index 8f88b634ca..f93e98be91 100644 --- a/typedapi/types/jobtimingstats.go +++ b/typedapi/types/jobtimingstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // JobTimingStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Job.ts#L332-L341 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Job.ts#L332-L341 type JobTimingStats struct { AverageBucketProcessingTimeMs Float64 `json:"average_bucket_processing_time_ms,omitempty"` BucketCount int64 `json:"bucket_count"` diff --git a/typedapi/types/jobusage.go b/typedapi/types/jobusage.go index f3e90e0246..9d015a3ee2 100644 --- a/typedapi/types/jobusage.go +++ b/typedapi/types/jobusage.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // JobUsage type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L364-L370 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L364-L370 type JobUsage struct { Count int `json:"count"` CreatedBy map[string]int64 `json:"created_by"` diff --git a/typedapi/types/joinprocessor.go b/typedapi/types/joinprocessor.go index 515b07f91c..145dc47f45 100644 --- a/typedapi/types/joinprocessor.go +++ b/typedapi/types/joinprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // JoinProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L790-L805 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L790-L805 type JoinProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/joinproperty.go b/typedapi/types/joinproperty.go index 6f2b38fa45..3afa737ad4 100644 --- a/typedapi/types/joinproperty.go +++ b/typedapi/types/joinproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // JoinProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L83-L87 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L83-L87 type JoinProperty struct { Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` EagerGlobalOrdinals *bool `json:"eager_global_ordinals,omitempty"` @@ -197,6 +197,12 @@ func (s *JoinProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -522,6 +528,12 @@ func (s *JoinProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/jsonprocessor.go b/typedapi/types/jsonprocessor.go index 6c5d5bc18f..c22522776a 100644 --- a/typedapi/types/jsonprocessor.go +++ b/typedapi/types/jsonprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // JsonProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L807-L836 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L807-L836 type JsonProcessor struct { // AddToRoot Flag that forces the parsed JSON to be added at the top level of the // document. diff --git a/typedapi/types/jvm.go b/typedapi/types/jvm.go index cd279e00f7..664074321f 100644 --- a/typedapi/types/jvm.go +++ b/typedapi/types/jvm.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Jvm type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L811-L845 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L811-L845 type Jvm struct { // BufferPools Contains statistics about JVM buffer pools for the node. BufferPools map[string]NodeBufferPool `json:"buffer_pools,omitempty"` diff --git a/typedapi/types/jvmclasses.go b/typedapi/types/jvmclasses.go index 579cb8e67b..d9000a56ad 100644 --- a/typedapi/types/jvmclasses.go +++ b/typedapi/types/jvmclasses.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // JvmClasses type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L908-L921 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L908-L921 type JvmClasses struct { // CurrentLoadedCount Number of classes currently loaded by JVM. CurrentLoadedCount *int64 `json:"current_loaded_count,omitempty"` diff --git a/typedapi/types/jvmmemorystats.go b/typedapi/types/jvmmemorystats.go index a768e04cb1..ea10d38859 100644 --- a/typedapi/types/jvmmemorystats.go +++ b/typedapi/types/jvmmemorystats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // JvmMemoryStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L847-L876 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L847-L876 type JvmMemoryStats struct { // HeapCommittedInBytes Amount of memory, in bytes, available for use by the heap. HeapCommittedInBytes *int64 `json:"heap_committed_in_bytes,omitempty"` diff --git a/typedapi/types/jvmstats.go b/typedapi/types/jvmstats.go index 63550816fe..be984aece4 100644 --- a/typedapi/types/jvmstats.go +++ b/typedapi/types/jvmstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // JvmStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_memory_stats/types.ts#L50-L63 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_memory_stats/types.ts#L50-L63 type JvmStats struct { // HeapMax Maximum amount of memory available for use by the heap. HeapMax ByteSize `json:"heap_max,omitempty"` diff --git a/typedapi/types/jvmthreads.go b/typedapi/types/jvmthreads.go index a35963752a..b046b29d70 100644 --- a/typedapi/types/jvmthreads.go +++ b/typedapi/types/jvmthreads.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // JvmThreads type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L897-L906 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L897-L906 type JvmThreads struct { // Count Number of active threads in use by JVM. Count *int64 `json:"count,omitempty"` diff --git a/typedapi/types/keeptypestokenfilter.go b/typedapi/types/keeptypestokenfilter.go index b23422d18a..491a754ec1 100644 --- a/typedapi/types/keeptypestokenfilter.go +++ b/typedapi/types/keeptypestokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // KeepTypesTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L218-L222 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L218-L222 type KeepTypesTokenFilter struct { Mode *keeptypesmode.KeepTypesMode `json:"mode,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/keepwordstokenfilter.go b/typedapi/types/keepwordstokenfilter.go index b496ab8b58..018d321cf3 100644 --- a/typedapi/types/keepwordstokenfilter.go +++ b/typedapi/types/keepwordstokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // KeepWordsTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L224-L229 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L224-L229 type KeepWordsTokenFilter struct { KeepWords []string `json:"keep_words,omitempty"` KeepWordsCase *bool `json:"keep_words_case,omitempty"` diff --git a/typedapi/types/keyedpercentiles.go b/typedapi/types/keyedpercentiles.go index b6a5986c8d..d8bb51af01 100644 --- a/typedapi/types/keyedpercentiles.go +++ b/typedapi/types/keyedpercentiles.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // KeyedPercentiles type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L158-L158 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L158-L158 type KeyedPercentiles map[string]string func (s KeyedPercentiles) UnmarshalJSON(data []byte) error { diff --git a/typedapi/types/keyedprocessor.go b/typedapi/types/keyedprocessor.go index 915ddda26a..0d7c79d34c 100644 --- a/typedapi/types/keyedprocessor.go +++ b/typedapi/types/keyedprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // KeyedProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L379-L382 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L379-L382 type KeyedProcessor struct { Stats *Processor `json:"stats,omitempty"` Type *string `json:"type,omitempty"` diff --git a/typedapi/types/keyvalueprocessor.go b/typedapi/types/keyvalueprocessor.go index 71eadf1b3c..c88311b8ec 100644 --- a/typedapi/types/keyvalueprocessor.go +++ b/typedapi/types/keyvalueprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // KeyValueProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L845-L897 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L845-L897 type KeyValueProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/keywordanalyzer.go b/typedapi/types/keywordanalyzer.go index bd8078517a..0e88efa3c0 100644 --- a/typedapi/types/keywordanalyzer.go +++ b/typedapi/types/keywordanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // KeywordAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L47-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L47-L50 type KeywordAnalyzer struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/keywordmarkertokenfilter.go b/typedapi/types/keywordmarkertokenfilter.go index 95c3ae8821..ba783567dd 100644 --- a/typedapi/types/keywordmarkertokenfilter.go +++ b/typedapi/types/keywordmarkertokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // KeywordMarkerTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L231-L237 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L231-L237 type KeywordMarkerTokenFilter struct { IgnoreCase *bool `json:"ignore_case,omitempty"` Keywords []string `json:"keywords,omitempty"` diff --git a/typedapi/types/keywordproperty.go b/typedapi/types/keywordproperty.go index f8000e825d..6240d69514 100644 --- a/typedapi/types/keywordproperty.go +++ b/typedapi/types/keywordproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // KeywordProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L89-L105 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L89-L105 type KeywordProperty struct { Boost *Float64 `json:"boost,omitempty"` CopyTo []string `json:"copy_to,omitempty"` @@ -257,6 +257,12 @@ func (s *KeywordProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -639,6 +645,12 @@ func (s *KeywordProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/keywordtokenizer.go b/typedapi/types/keywordtokenizer.go index ba409ca2cc..123bd20f33 100644 --- a/typedapi/types/keywordtokenizer.go +++ b/typedapi/types/keywordtokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // KeywordTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L62-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L62-L65 type KeywordTokenizer struct { BufferSize int `json:"buffer_size"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/kibanatoken.go b/typedapi/types/kibanatoken.go index 6428800f9a..2660deb513 100644 --- a/typedapi/types/kibanatoken.go +++ b/typedapi/types/kibanatoken.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // KibanaToken type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/enroll_kibana/Response.ts#L27-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/enroll_kibana/Response.ts#L27-L30 type KibanaToken struct { Name string `json:"name"` Value string `json:"value"` diff --git a/typedapi/types/knnquery.go b/typedapi/types/knnquery.go index 65560c7fc6..081dfb597f 100644 --- a/typedapi/types/knnquery.go +++ b/typedapi/types/knnquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // KnnQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Knn.ts#L26-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Knn.ts#L26-L43 type KnnQuery struct { // Boost Boost value to apply to kNN scores Boost *float32 `json:"boost,omitempty"` diff --git a/typedapi/types/kstemtokenfilter.go b/typedapi/types/kstemtokenfilter.go index 8153315a9c..dfc4efcf7c 100644 --- a/typedapi/types/kstemtokenfilter.go +++ b/typedapi/types/kstemtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // KStemTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L239-L241 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L239-L241 type KStemTokenFilter struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/kuromojianalyzer.go b/typedapi/types/kuromojianalyzer.go index 20ceba4307..1917851f0a 100644 --- a/typedapi/types/kuromojianalyzer.go +++ b/typedapi/types/kuromojianalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // KuromojiAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/kuromoji-plugin.ts#L25-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/kuromoji-plugin.ts#L25-L29 type KuromojiAnalyzer struct { Mode kuromojitokenizationmode.KuromojiTokenizationMode `json:"mode"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/kuromojiiterationmarkcharfilter.go b/typedapi/types/kuromojiiterationmarkcharfilter.go index a8f43ac88b..9eff0e32f2 100644 --- a/typedapi/types/kuromojiiterationmarkcharfilter.go +++ b/typedapi/types/kuromojiiterationmarkcharfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // KuromojiIterationMarkCharFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/kuromoji-plugin.ts#L31-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/kuromoji-plugin.ts#L31-L35 type KuromojiIterationMarkCharFilter struct { NormalizeKana bool `json:"normalize_kana"` NormalizeKanji bool `json:"normalize_kanji"` diff --git a/typedapi/types/kuromojipartofspeechtokenfilter.go b/typedapi/types/kuromojipartofspeechtokenfilter.go index 25d16cefe9..615c87ff09 100644 --- a/typedapi/types/kuromojipartofspeechtokenfilter.go +++ b/typedapi/types/kuromojipartofspeechtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // KuromojiPartOfSpeechTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/kuromoji-plugin.ts#L37-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/kuromoji-plugin.ts#L37-L40 type KuromojiPartOfSpeechTokenFilter struct { Stoptags []string `json:"stoptags"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/kuromojireadingformtokenfilter.go b/typedapi/types/kuromojireadingformtokenfilter.go index a983e7244e..6df362e210 100644 --- a/typedapi/types/kuromojireadingformtokenfilter.go +++ b/typedapi/types/kuromojireadingformtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // KuromojiReadingFormTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/kuromoji-plugin.ts#L42-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/kuromoji-plugin.ts#L42-L45 type KuromojiReadingFormTokenFilter struct { Type string `json:"type,omitempty"` UseRomaji bool `json:"use_romaji"` diff --git a/typedapi/types/kuromojistemmertokenfilter.go b/typedapi/types/kuromojistemmertokenfilter.go index 7f2d7d7ee7..c557afd59b 100644 --- a/typedapi/types/kuromojistemmertokenfilter.go +++ b/typedapi/types/kuromojistemmertokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // KuromojiStemmerTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/kuromoji-plugin.ts#L47-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/kuromoji-plugin.ts#L47-L50 type KuromojiStemmerTokenFilter struct { MinimumLength int `json:"minimum_length"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/kuromojitokenizer.go b/typedapi/types/kuromojitokenizer.go index ca37207b1b..96f5bacad9 100644 --- a/typedapi/types/kuromojitokenizer.go +++ b/typedapi/types/kuromojitokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // KuromojiTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/kuromoji-plugin.ts#L58-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/kuromoji-plugin.ts#L58-L67 type KuromojiTokenizer struct { DiscardCompoundToken *bool `json:"discard_compound_token,omitempty"` DiscardPunctuation *bool `json:"discard_punctuation,omitempty"` diff --git a/typedapi/types/languageanalyzer.go b/typedapi/types/languageanalyzer.go index 43226efeee..74af0b8c84 100644 --- a/typedapi/types/languageanalyzer.go +++ b/typedapi/types/languageanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // LanguageAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L52-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L52-L59 type LanguageAnalyzer struct { Language language.Language `json:"language"` StemExclusion []string `json:"stem_exclusion"` diff --git a/typedapi/types/languagecontext.go b/typedapi/types/languagecontext.go index c93ec43546..a2cb16284b 100644 --- a/typedapi/types/languagecontext.go +++ b/typedapi/types/languagecontext.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // LanguageContext type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/get_script_languages/types.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/get_script_languages/types.ts#L22-L25 type LanguageContext struct { Contexts []string `json:"contexts"` Language scriptlanguage.ScriptLanguage `json:"language"` diff --git a/typedapi/types/laplacesmoothingmodel.go b/typedapi/types/laplacesmoothingmodel.go index 14bc53403f..e07b7029ad 100644 --- a/typedapi/types/laplacesmoothingmodel.go +++ b/typedapi/types/laplacesmoothingmodel.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LaplaceSmoothingModel type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L427-L432 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L427-L432 type LaplaceSmoothingModel struct { // Alpha A constant that is added to all counts to balance weights. Alpha Float64 `json:"alpha"` diff --git a/typedapi/types/latest.go b/typedapi/types/latest.go index d303d64189..f344b4e9ba 100644 --- a/typedapi/types/latest.go +++ b/typedapi/types/latest.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Latest type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/_types/Transform.ts#L47-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/_types/Transform.ts#L47-L52 type Latest struct { // Sort Specifies the date field that is used to identify the latest documents. Sort string `json:"sort"` diff --git a/typedapi/types/latlongeolocation.go b/typedapi/types/latlongeolocation.go index a9f01076f8..a63cb0500b 100644 --- a/typedapi/types/latlongeolocation.go +++ b/typedapi/types/latlongeolocation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LatLonGeoLocation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L129-L138 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L129-L138 type LatLonGeoLocation struct { // Lat Latitude Lat Float64 `json:"lat"` diff --git a/typedapi/types/lengthtokenfilter.go b/typedapi/types/lengthtokenfilter.go index 58c4295c37..b1fa9714d7 100644 --- a/typedapi/types/lengthtokenfilter.go +++ b/typedapi/types/lengthtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LengthTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L243-L247 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L243-L247 type LengthTokenFilter struct { Max *int `json:"max,omitempty"` Min *int `json:"min,omitempty"` diff --git a/typedapi/types/lettertokenizer.go b/typedapi/types/lettertokenizer.go index 209041af81..c542c49564 100644 --- a/typedapi/types/lettertokenizer.go +++ b/typedapi/types/lettertokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // LetterTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L67-L69 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L67-L69 type LetterTokenizer struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/license.go b/typedapi/types/license.go index d46b5fcf5b..1443067d7a 100644 --- a/typedapi/types/license.go +++ b/typedapi/types/license.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // License type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/_types/License.ts#L42-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/_types/License.ts#L42-L53 type License struct { ExpiryDateInMillis int64 `json:"expiry_date_in_millis"` IssueDateInMillis int64 `json:"issue_date_in_millis"` diff --git a/typedapi/types/licenseinformation.go b/typedapi/types/licenseinformation.go index b23c1fc2bb..e804328b57 100644 --- a/typedapi/types/licenseinformation.go +++ b/typedapi/types/licenseinformation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // LicenseInformation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/license/get/types.ts#L25-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/license/get/types.ts#L25-L38 type LicenseInformation struct { ExpiryDate DateTime `json:"expiry_date,omitempty"` ExpiryDateInMillis *int64 `json:"expiry_date_in_millis,omitempty"` diff --git a/typedapi/types/lifecycle.go b/typedapi/types/lifecycle.go index cc22efd230..4454a91e5e 100644 --- a/typedapi/types/lifecycle.go +++ b/typedapi/types/lifecycle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Lifecycle type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/get_lifecycle/types.ts#L24-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/get_lifecycle/types.ts#L24-L28 type Lifecycle struct { ModifiedDate DateTime `json:"modified_date"` Policy IlmPolicy `json:"policy"` diff --git a/typedapi/types/lifecycleexplain.go b/typedapi/types/lifecycleexplain.go index c30b52d339..afae8e810f 100644 --- a/typedapi/types/lifecycleexplain.go +++ b/typedapi/types/lifecycleexplain.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // LifecycleExplainManaged // LifecycleExplainUnmanaged // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/explain_lifecycle/types.ts#L59-L62 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/explain_lifecycle/types.ts#L59-L62 type LifecycleExplain interface{} diff --git a/typedapi/types/lifecycleexplainmanaged.go b/typedapi/types/lifecycleexplainmanaged.go index e9b6b6e96c..00dd02b471 100644 --- a/typedapi/types/lifecycleexplainmanaged.go +++ b/typedapi/types/lifecycleexplainmanaged.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LifecycleExplainManaged type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/explain_lifecycle/types.ts#L26-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/explain_lifecycle/types.ts#L26-L52 type LifecycleExplainManaged struct { Action *string `json:"action,omitempty"` ActionTime DateTime `json:"action_time,omitempty"` diff --git a/typedapi/types/lifecycleexplainphaseexecution.go b/typedapi/types/lifecycleexplainphaseexecution.go index a01914313a..f322ef4c1b 100644 --- a/typedapi/types/lifecycleexplainphaseexecution.go +++ b/typedapi/types/lifecycleexplainphaseexecution.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // LifecycleExplainPhaseExecution type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/explain_lifecycle/types.ts#L64-L68 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/explain_lifecycle/types.ts#L64-L68 type LifecycleExplainPhaseExecution struct { ModifiedDateInMillis int64 `json:"modified_date_in_millis"` Policy string `json:"policy"` diff --git a/typedapi/types/lifecycleexplainunmanaged.go b/typedapi/types/lifecycleexplainunmanaged.go index 26c59c367c..d633804690 100644 --- a/typedapi/types/lifecycleexplainunmanaged.go +++ b/typedapi/types/lifecycleexplainunmanaged.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // LifecycleExplainUnmanaged type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/explain_lifecycle/types.ts#L54-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/explain_lifecycle/types.ts#L54-L57 type LifecycleExplainUnmanaged struct { Index string `json:"index"` Managed bool `json:"managed,omitempty"` diff --git a/typedapi/types/like.go b/typedapi/types/like.go index c268f2a06c..93e80eebce 100644 --- a/typedapi/types/like.go +++ b/typedapi/types/like.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // LikeDocument // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L186-L191 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L186-L191 type Like interface{} diff --git a/typedapi/types/likedocument.go b/typedapi/types/likedocument.go index 25be9966d9..198d01f753 100644 --- a/typedapi/types/likedocument.go +++ b/typedapi/types/likedocument.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // LikeDocument type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L165-L184 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L165-L184 type LikeDocument struct { // Doc A document not present in the index. Doc json.RawMessage `json:"doc,omitempty"` diff --git a/typedapi/types/limits.go b/typedapi/types/limits.go index 5093ba202f..a95c86055c 100644 --- a/typedapi/types/limits.go +++ b/typedapi/types/limits.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Limits type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/info/types.ts#L34-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/info/types.ts#L34-L38 type Limits struct { EffectiveMaxModelMemoryLimit string `json:"effective_max_model_memory_limit"` MaxModelMemoryLimit *string `json:"max_model_memory_limit,omitempty"` diff --git a/typedapi/types/limittokencounttokenfilter.go b/typedapi/types/limittokencounttokenfilter.go index ffff79f714..b6fe4f6514 100644 --- a/typedapi/types/limittokencounttokenfilter.go +++ b/typedapi/types/limittokencounttokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LimitTokenCountTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L249-L253 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L249-L253 type LimitTokenCountTokenFilter struct { ConsumeAllTokens *bool `json:"consume_all_tokens,omitempty"` MaxTokenCount Stringifiedinteger `json:"max_token_count,omitempty"` diff --git a/typedapi/types/linearinterpolationsmoothingmodel.go b/typedapi/types/linearinterpolationsmoothingmodel.go index ad722c271b..a6703c9225 100644 --- a/typedapi/types/linearinterpolationsmoothingmodel.go +++ b/typedapi/types/linearinterpolationsmoothingmodel.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LinearInterpolationSmoothingModel type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L434-L438 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L434-L438 type LinearInterpolationSmoothingModel struct { BigramLambda Float64 `json:"bigram_lambda"` TrigramLambda Float64 `json:"trigram_lambda"` diff --git a/typedapi/types/linearmovingaverageaggregation.go b/typedapi/types/linearmovingaverageaggregation.go index 111fad6092..d357a9d75d 100644 --- a/typedapi/types/linearmovingaverageaggregation.go +++ b/typedapi/types/linearmovingaverageaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // LinearMovingAverageAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L242-L245 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L242-L245 type LinearMovingAverageAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/loggingaction.go b/typedapi/types/loggingaction.go index 9ac7cbd2e9..6af4938a80 100644 --- a/typedapi/types/loggingaction.go +++ b/typedapi/types/loggingaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LoggingAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L281-L285 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L281-L285 type LoggingAction struct { Category *string `json:"category,omitempty"` Level *string `json:"level,omitempty"` diff --git a/typedapi/types/loggingresult.go b/typedapi/types/loggingresult.go index effae9a91a..4c95f50b84 100644 --- a/typedapi/types/loggingresult.go +++ b/typedapi/types/loggingresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LoggingResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L287-L289 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L287-L289 type LoggingResult struct { LoggedText string `json:"logged_text"` } diff --git a/typedapi/types/logstashpipeline.go b/typedapi/types/logstashpipeline.go index d77c4123c3..495743de9c 100644 --- a/typedapi/types/logstashpipeline.go +++ b/typedapi/types/logstashpipeline.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LogstashPipeline type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/logstash/_types/Pipeline.ts#L60-L92 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/logstash/_types/Pipeline.ts#L60-L92 type LogstashPipeline struct { // Description Description of the pipeline. // This description is not used by Elasticsearch or Logstash. diff --git a/typedapi/types/longnumberproperty.go b/typedapi/types/longnumberproperty.go index 81a49f5e52..f5b2018186 100644 --- a/typedapi/types/longnumberproperty.go +++ b/typedapi/types/longnumberproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // LongNumberProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L154-L157 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L154-L157 type LongNumberProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -260,6 +260,12 @@ func (s *LongNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -633,6 +639,12 @@ func (s *LongNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/longrangeproperty.go b/typedapi/types/longrangeproperty.go index 1ff5969a70..6f8156d139 100644 --- a/typedapi/types/longrangeproperty.go +++ b/typedapi/types/longrangeproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // LongRangeProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/range.ts#L50-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/range.ts#L50-L52 type LongRangeProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -248,6 +248,12 @@ func (s *LongRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -587,6 +593,12 @@ func (s *LongRangeProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/longraretermsaggregate.go b/typedapi/types/longraretermsaggregate.go index 6b332f2977..d7ca56077e 100644 --- a/typedapi/types/longraretermsaggregate.go +++ b/typedapi/types/longraretermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // LongRareTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L431-L436 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L431-L436 type LongRareTermsAggregate struct { Buckets BucketsLongRareTermsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/longraretermsbucket.go b/typedapi/types/longraretermsbucket.go index 7e801d2c84..19d0619682 100644 --- a/typedapi/types/longraretermsbucket.go +++ b/typedapi/types/longraretermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // LongRareTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L438-L441 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L438-L441 type LongRareTermsBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/longtermsaggregate.go b/typedapi/types/longtermsaggregate.go index 5155b276a9..c3a66cbdb1 100644 --- a/typedapi/types/longtermsaggregate.go +++ b/typedapi/types/longtermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LongTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L399-L404 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L399-L404 type LongTermsAggregate struct { Buckets BucketsLongTermsBucket `json:"buckets"` DocCountErrorUpperBound *int64 `json:"doc_count_error_upper_bound,omitempty"` diff --git a/typedapi/types/longtermsbucket.go b/typedapi/types/longtermsbucket.go index 7240a20cb0..1b932c570c 100644 --- a/typedapi/types/longtermsbucket.go +++ b/typedapi/types/longtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // LongTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L406-L409 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L406-L409 type LongTermsBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/lowercasenormalizer.go b/typedapi/types/lowercasenormalizer.go index b77ec498be..e91ef7b3b4 100644 --- a/typedapi/types/lowercasenormalizer.go +++ b/typedapi/types/lowercasenormalizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // LowercaseNormalizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/normalizers.ts#L26-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/normalizers.ts#L26-L28 type LowercaseNormalizer struct { Type string `json:"type,omitempty"` } diff --git a/typedapi/types/lowercaseprocessor.go b/typedapi/types/lowercaseprocessor.go index 0871f971fc..8e92119aac 100644 --- a/typedapi/types/lowercaseprocessor.go +++ b/typedapi/types/lowercaseprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LowercaseProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L899-L915 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L899-L915 type LowercaseProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/lowercasetokenfilter.go b/typedapi/types/lowercasetokenfilter.go index 4bde4e2ed1..7516417e1d 100644 --- a/typedapi/types/lowercasetokenfilter.go +++ b/typedapi/types/lowercasetokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // LowercaseTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L255-L258 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L255-L258 type LowercaseTokenFilter struct { Language *string `json:"language,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/lowercasetokenizer.go b/typedapi/types/lowercasetokenizer.go index f7b8e7ffb6..6be175ab4f 100644 --- a/typedapi/types/lowercasetokenizer.go +++ b/typedapi/types/lowercasetokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // LowercaseTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L71-L73 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L71-L73 type LowercaseTokenizer struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/machinelearning.go b/typedapi/types/machinelearning.go index 3ef566fe8f..f3353f8d74 100644 --- a/typedapi/types/machinelearning.go +++ b/typedapi/types/machinelearning.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MachineLearning type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L372-L379 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L372-L379 type MachineLearning struct { Available bool `json:"available"` DataFrameAnalyticsJobs MlDataFrameAnalyticsJobs `json:"data_frame_analytics_jobs"` diff --git a/typedapi/types/manageuserprivileges.go b/typedapi/types/manageuserprivileges.go index 563998896c..3d3257596b 100644 --- a/typedapi/types/manageuserprivileges.go +++ b/typedapi/types/manageuserprivileges.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ManageUserPrivileges type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L197-L199 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L197-L199 type ManageUserPrivileges struct { Applications []string `json:"applications"` } diff --git a/typedapi/types/mapboxvectortiles.go b/typedapi/types/mapboxvectortiles.go index e07c525cba..2fc5248ae3 100644 --- a/typedapi/types/mapboxvectortiles.go +++ b/typedapi/types/mapboxvectortiles.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // MapboxVectorTiles type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Binary.ts#L21-L21 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Binary.ts#L21-L21 type MapboxVectorTiles []byte diff --git a/typedapi/types/mappingcharfilter.go b/typedapi/types/mappingcharfilter.go index ea97d359d5..86d510b110 100644 --- a/typedapi/types/mappingcharfilter.go +++ b/typedapi/types/mappingcharfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MappingCharFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/char_filters.ts#L47-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/char_filters.ts#L47-L51 type MappingCharFilter struct { Mappings []string `json:"mappings,omitempty"` MappingsPath *string `json:"mappings_path,omitempty"` diff --git a/typedapi/types/mappinglimitsettings.go b/typedapi/types/mappinglimitsettings.go index 6ad02bcffd..fe02700a7c 100644 --- a/typedapi/types/mappinglimitsettings.go +++ b/typedapi/types/mappinglimitsettings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MappingLimitSettings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L402-L415 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L402-L415 type MappingLimitSettings struct { Coerce *bool `json:"coerce,omitempty"` Depth *MappingLimitSettingsDepth `json:"depth,omitempty"` diff --git a/typedapi/types/mappinglimitsettingsdepth.go b/typedapi/types/mappinglimitsettingsdepth.go index b69fddde07..fedd06df20 100644 --- a/typedapi/types/mappinglimitsettingsdepth.go +++ b/typedapi/types/mappinglimitsettingsdepth.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MappingLimitSettingsDepth type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L427-L434 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L427-L434 type MappingLimitSettingsDepth struct { // Limit The maximum depth for a field, which is measured as the number of inner // objects. For instance, if all fields are defined diff --git a/typedapi/types/mappinglimitsettingsdimensionfields.go b/typedapi/types/mappinglimitsettingsdimensionfields.go index 536a520951..064f5eaf65 100644 --- a/typedapi/types/mappinglimitsettingsdimensionfields.go +++ b/typedapi/types/mappinglimitsettingsdimensionfields.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MappingLimitSettingsDimensionFields type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L464-L470 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L464-L470 type MappingLimitSettingsDimensionFields struct { // Limit [preview] This functionality is in technical preview and may be changed or // removed in a future release. diff --git a/typedapi/types/mappinglimitsettingsfieldnamelength.go b/typedapi/types/mappinglimitsettingsfieldnamelength.go index 0c1fed798a..a83751f5f8 100644 --- a/typedapi/types/mappinglimitsettingsfieldnamelength.go +++ b/typedapi/types/mappinglimitsettingsfieldnamelength.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MappingLimitSettingsFieldNameLength type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L455-L462 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L455-L462 type MappingLimitSettingsFieldNameLength struct { // Limit Setting for the maximum length of a field name. This setting isn’t really // something that addresses mappings explosion but diff --git a/typedapi/types/mappinglimitsettingsnestedfields.go b/typedapi/types/mappinglimitsettingsnestedfields.go index 0c580d9c78..cfecb30fef 100644 --- a/typedapi/types/mappinglimitsettingsnestedfields.go +++ b/typedapi/types/mappinglimitsettingsnestedfields.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MappingLimitSettingsNestedFields type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L436-L444 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L436-L444 type MappingLimitSettingsNestedFields struct { // Limit The maximum number of distinct nested mappings in an index. The nested type // should only be used in special cases, when diff --git a/typedapi/types/mappinglimitsettingsnestedobjects.go b/typedapi/types/mappinglimitsettingsnestedobjects.go index e7f393f6d9..442942605e 100644 --- a/typedapi/types/mappinglimitsettingsnestedobjects.go +++ b/typedapi/types/mappinglimitsettingsnestedobjects.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MappingLimitSettingsNestedObjects type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L446-L453 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L446-L453 type MappingLimitSettingsNestedObjects struct { // Limit The maximum number of nested JSON objects that a single document can contain // across all nested types. This limit helps diff --git a/typedapi/types/mappinglimitsettingstotalfields.go b/typedapi/types/mappinglimitsettingstotalfields.go index b7dfa26936..b829ea9b88 100644 --- a/typedapi/types/mappinglimitsettingstotalfields.go +++ b/typedapi/types/mappinglimitsettingstotalfields.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MappingLimitSettingsTotalFields type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L417-L425 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L417-L425 type MappingLimitSettingsTotalFields struct { // Limit The maximum number of fields in an index. Field and object mappings, as well // as field aliases count towards this limit. diff --git a/typedapi/types/mappingstats.go b/typedapi/types/mappingstats.go index 4afb937f62..f591ea4051 100644 --- a/typedapi/types/mappingstats.go +++ b/typedapi/types/mappingstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MappingStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L186-L190 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L186-L190 type MappingStats struct { TotalCount int64 `json:"total_count"` TotalEstimatedOverhead ByteSize `json:"total_estimated_overhead,omitempty"` diff --git a/typedapi/types/masterisstableindicator.go b/typedapi/types/masterisstableindicator.go index 79270cc96a..f1971e323d 100644 --- a/typedapi/types/masterisstableindicator.go +++ b/typedapi/types/masterisstableindicator.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MasterIsStableIndicator type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L79-L83 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L79-L83 type MasterIsStableIndicator struct { Details *MasterIsStableIndicatorDetails `json:"details,omitempty"` Diagnosis []Diagnosis `json:"diagnosis,omitempty"` diff --git a/typedapi/types/masterisstableindicatorclusterformationnode.go b/typedapi/types/masterisstableindicatorclusterformationnode.go index c585d6e461..c1994f9d99 100644 --- a/typedapi/types/masterisstableindicatorclusterformationnode.go +++ b/typedapi/types/masterisstableindicatorclusterformationnode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MasterIsStableIndicatorClusterFormationNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L98-L102 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L98-L102 type MasterIsStableIndicatorClusterFormationNode struct { ClusterFormationMessage string `json:"cluster_formation_message"` Name *string `json:"name,omitempty"` diff --git a/typedapi/types/masterisstableindicatordetails.go b/typedapi/types/masterisstableindicatordetails.go index 0b8305e622..429b7bca4c 100644 --- a/typedapi/types/masterisstableindicatordetails.go +++ b/typedapi/types/masterisstableindicatordetails.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // MasterIsStableIndicatorDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L84-L89 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L84-L89 type MasterIsStableIndicatorDetails struct { ClusterFormation []MasterIsStableIndicatorClusterFormationNode `json:"cluster_formation,omitempty"` CurrentMaster IndicatorNode `json:"current_master"` diff --git a/typedapi/types/masterisstableindicatorexceptionfetchinghistory.go b/typedapi/types/masterisstableindicatorexceptionfetchinghistory.go index d0c71ae664..424ad47c34 100644 --- a/typedapi/types/masterisstableindicatorexceptionfetchinghistory.go +++ b/typedapi/types/masterisstableindicatorexceptionfetchinghistory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MasterIsStableIndicatorExceptionFetchingHistory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L94-L97 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L94-L97 type MasterIsStableIndicatorExceptionFetchingHistory struct { Message string `json:"message"` StackTrace string `json:"stack_trace"` diff --git a/typedapi/types/masterrecord.go b/typedapi/types/masterrecord.go index 7787720f25..df645977ce 100644 --- a/typedapi/types/masterrecord.go +++ b/typedapi/types/masterrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MasterRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/master/types.ts#L20-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/master/types.ts#L20-L39 type MasterRecord struct { // Host host name Host *string `json:"host,omitempty"` diff --git a/typedapi/types/matchallquery.go b/typedapi/types/matchallquery.go index d8c4ed3152..544643219d 100644 --- a/typedapi/types/matchallquery.go +++ b/typedapi/types/matchallquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MatchAllQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/MatchAllQuery.ts#L22-L22 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/MatchAllQuery.ts#L22-L22 type MatchAllQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/matchboolprefixquery.go b/typedapi/types/matchboolprefixquery.go index 58bc9c7d28..7544edb354 100644 --- a/typedapi/types/matchboolprefixquery.go +++ b/typedapi/types/matchboolprefixquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MatchBoolPrefixQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L349-L403 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L349-L403 type MatchBoolPrefixQuery struct { // Analyzer Analyzer used to convert the text in the query value into tokens. Analyzer *string `json:"analyzer,omitempty"` diff --git a/typedapi/types/matchnonequery.go b/typedapi/types/matchnonequery.go index 4d378ec234..eac8c77968 100644 --- a/typedapi/types/matchnonequery.go +++ b/typedapi/types/matchnonequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MatchNoneQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/MatchNoneQuery.ts#L22-L22 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/MatchNoneQuery.ts#L22-L22 type MatchNoneQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/matchonlytextproperty.go b/typedapi/types/matchonlytextproperty.go index f68b9861ab..641ff5a0b6 100644 --- a/typedapi/types/matchonlytextproperty.go +++ b/typedapi/types/matchonlytextproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MatchOnlyTextProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L215-L240 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L215-L240 type MatchOnlyTextProperty struct { // CopyTo Allows you to copy the values of multiple fields into a group // field, which can then be queried as a single field. @@ -193,6 +193,12 @@ func (s *MatchOnlyTextProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/matchphraseprefixquery.go b/typedapi/types/matchphraseprefixquery.go index 97665df7c2..018b8d128d 100644 --- a/typedapi/types/matchphraseprefixquery.go +++ b/typedapi/types/matchphraseprefixquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MatchPhrasePrefixQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L428-L454 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L428-L454 type MatchPhrasePrefixQuery struct { // Analyzer Analyzer used to convert text in the query value into tokens. Analyzer *string `json:"analyzer,omitempty"` diff --git a/typedapi/types/matchphrasequery.go b/typedapi/types/matchphrasequery.go index 87a179dcd9..13f0c9ebbd 100644 --- a/typedapi/types/matchphrasequery.go +++ b/typedapi/types/matchphrasequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MatchPhraseQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L405-L426 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L405-L426 type MatchPhraseQuery struct { // Analyzer Analyzer used to convert the text in the query value into tokens. Analyzer *string `json:"analyzer,omitempty"` diff --git a/typedapi/types/matchquery.go b/typedapi/types/matchquery.go index cf1763fae9..44d4e3c455 100644 --- a/typedapi/types/matchquery.go +++ b/typedapi/types/matchquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // MatchQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L282-L347 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L282-L347 type MatchQuery struct { // Analyzer Analyzer used to convert the text in the query value into tokens. Analyzer *string `json:"analyzer,omitempty"` diff --git a/typedapi/types/matrixaggregation.go b/typedapi/types/matrixaggregation.go index 4e249f7178..b0f50cee02 100644 --- a/typedapi/types/matrixaggregation.go +++ b/typedapi/types/matrixaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MatrixAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/matrix.ts#L26-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/matrix.ts#L26-L36 type MatrixAggregation struct { // Fields An array of fields for computing the statistics. Fields []string `json:"fields,omitempty"` diff --git a/typedapi/types/matrixstatsaggregate.go b/typedapi/types/matrixstatsaggregate.go index 0550d5d889..9f7ee7f1c8 100644 --- a/typedapi/types/matrixstatsaggregate.go +++ b/typedapi/types/matrixstatsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MatrixStatsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L757-L761 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L757-L761 type MatrixStatsAggregate struct { DocCount int64 `json:"doc_count"` Fields []MatrixStatsFields `json:"fields,omitempty"` diff --git a/typedapi/types/matrixstatsaggregation.go b/typedapi/types/matrixstatsaggregation.go index 536ca5d909..5afe6541f0 100644 --- a/typedapi/types/matrixstatsaggregation.go +++ b/typedapi/types/matrixstatsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MatrixStatsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/matrix.ts#L38-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/matrix.ts#L38-L44 type MatrixStatsAggregation struct { // Fields An array of fields for computing the statistics. Fields []string `json:"fields,omitempty"` diff --git a/typedapi/types/matrixstatsfields.go b/typedapi/types/matrixstatsfields.go index 9b164e035a..a79413a7ef 100644 --- a/typedapi/types/matrixstatsfields.go +++ b/typedapi/types/matrixstatsfields.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MatrixStatsFields type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L763-L772 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L763-L772 type MatrixStatsFields struct { Correlation map[string]Float64 `json:"correlation"` Count int64 `json:"count"` diff --git a/typedapi/types/maxaggregate.go b/typedapi/types/maxaggregate.go index aa87d88979..bf248ad6e2 100644 --- a/typedapi/types/maxaggregate.go +++ b/typedapi/types/maxaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MaxAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L200-L201 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L200-L201 type MaxAggregate struct { Meta Metadata `json:"meta,omitempty"` // Value The metric value. A missing value generally means that there was no data to diff --git a/typedapi/types/maxaggregation.go b/typedapi/types/maxaggregation.go index 33e2541cec..fffe7ae65c 100644 --- a/typedapi/types/maxaggregation.go +++ b/typedapi/types/maxaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MaxAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L162-L162 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L162-L162 type MaxAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/maxbucketaggregation.go b/typedapi/types/maxbucketaggregation.go index f3d9d52ffa..90c6f5fa8c 100644 --- a/typedapi/types/maxbucketaggregation.go +++ b/typedapi/types/maxbucketaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MaxBucketAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L224-L224 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L224-L224 type MaxBucketAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/medianabsolutedeviationaggregate.go b/typedapi/types/medianabsolutedeviationaggregate.go index 2e6d6acf10..dfa9256de6 100644 --- a/typedapi/types/medianabsolutedeviationaggregate.go +++ b/typedapi/types/medianabsolutedeviationaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MedianAbsoluteDeviationAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L194-L195 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L194-L195 type MedianAbsoluteDeviationAggregate struct { Meta Metadata `json:"meta,omitempty"` // Value The metric value. A missing value generally means that there was no data to diff --git a/typedapi/types/medianabsolutedeviationaggregation.go b/typedapi/types/medianabsolutedeviationaggregation.go index c3fc90b6f9..af1ee85fe6 100644 --- a/typedapi/types/medianabsolutedeviationaggregation.go +++ b/typedapi/types/medianabsolutedeviationaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MedianAbsoluteDeviationAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L164-L170 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L164-L170 type MedianAbsoluteDeviationAggregation struct { // Compression Limits the maximum number of nodes used by the underlying TDigest algorithm // to `20 * compression`, enabling control of memory usage and approximation diff --git a/typedapi/types/memmlstats.go b/typedapi/types/memmlstats.go index 57c74dafd2..6fd41e966a 100644 --- a/typedapi/types/memmlstats.go +++ b/typedapi/types/memmlstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MemMlStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_memory_stats/types.ts#L90-L111 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_memory_stats/types.ts#L90-L111 type MemMlStats struct { // AnomalyDetectors Amount of native memory set aside for anomaly detection jobs. AnomalyDetectors ByteSize `json:"anomaly_detectors,omitempty"` diff --git a/typedapi/types/memory.go b/typedapi/types/memory.go index e038c279d8..4edb9ea35c 100644 --- a/typedapi/types/memory.go +++ b/typedapi/types/memory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Memory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_memory_stats/types.ts#L25-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_memory_stats/types.ts#L25-L48 type Memory struct { Attributes map[string]string `json:"attributes"` EphemeralId string `json:"ephemeral_id"` diff --git a/typedapi/types/memorystats.go b/typedapi/types/memorystats.go index 8fcf1e97a5..90c129c5ee 100644 --- a/typedapi/types/memorystats.go +++ b/typedapi/types/memorystats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MemoryStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L596-L620 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L596-L620 type MemoryStats struct { // AdjustedTotalInBytes If the amount of physical memory has been overridden using the // `es`.`total_memory_bytes` system property then this reports the overridden diff --git a/typedapi/types/memstats.go b/typedapi/types/memstats.go index b045db3cc0..5a8363c32f 100644 --- a/typedapi/types/memstats.go +++ b/typedapi/types/memstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MemStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/get_memory_stats/types.ts#L65-L88 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/get_memory_stats/types.ts#L65-L88 type MemStats struct { // AdjustedTotal If the amount of physical memory has been overridden using the // es.total_memory_bytes system property diff --git a/typedapi/types/merge.go b/typedapi/types/merge.go index 1fa5c70cec..9f945ff8c5 100644 --- a/typedapi/types/merge.go +++ b/typedapi/types/merge.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Merge type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L323-L325 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L323-L325 type Merge struct { Scheduler *MergeScheduler `json:"scheduler,omitempty"` } diff --git a/typedapi/types/mergescheduler.go b/typedapi/types/mergescheduler.go index a67701a984..aad0190042 100644 --- a/typedapi/types/mergescheduler.go +++ b/typedapi/types/mergescheduler.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MergeScheduler type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L327-L330 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L327-L330 type MergeScheduler struct { MaxMergeCount Stringifiedinteger `json:"max_merge_count,omitempty"` MaxThreadCount Stringifiedinteger `json:"max_thread_count,omitempty"` diff --git a/typedapi/types/mergesstats.go b/typedapi/types/mergesstats.go index 3de5eadb55..a1185830ce 100644 --- a/typedapi/types/mergesstats.go +++ b/typedapi/types/mergesstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MergesStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L161-L178 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L161-L178 type MergesStats struct { Current int64 `json:"current"` CurrentDocs int64 `json:"current_docs"` diff --git a/typedapi/types/metadata.go b/typedapi/types/metadata.go index 12c48dad9c..71e3bca967 100644 --- a/typedapi/types/metadata.go +++ b/typedapi/types/metadata.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ import ( // Metadata type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L98-L98 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L99-L99 type Metadata map[string]json.RawMessage diff --git a/typedapi/types/metrics.go b/typedapi/types/metrics.go index f6715d4ee8..c5f5c8273d 100644 --- a/typedapi/types/metrics.go +++ b/typedapi/types/metrics.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Metrics type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L70-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L76-L76 type Metrics []string diff --git a/typedapi/types/mgetoperation.go b/typedapi/types/mgetoperation.go index 0741b6a30c..a5ad0949a6 100644 --- a/typedapi/types/mgetoperation.go +++ b/typedapi/types/mgetoperation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // MgetOperation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/mget/types.ts#L32-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/mget/types.ts#L32-L55 type MgetOperation struct { // Id_ The unique document ID. Id_ string `json:"_id"` diff --git a/typedapi/types/mgetresponseitem.go b/typedapi/types/mgetresponseitem.go index 32c9c033c1..1c46ca3ad3 100644 --- a/typedapi/types/mgetresponseitem.go +++ b/typedapi/types/mgetresponseitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // GetResult // MultiGetError // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/mget/types.ts#L57-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/mget/types.ts#L57-L60 type MgetResponseItem interface{} diff --git a/typedapi/types/migrationfeatureindexinfo.go b/typedapi/types/migrationfeatureindexinfo.go index 15c060786e..acb6c73559 100644 --- a/typedapi/types/migrationfeatureindexinfo.go +++ b/typedapi/types/migrationfeatureindexinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MigrationFeatureIndexInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L44-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L44-L48 type MigrationFeatureIndexInfo struct { FailureCause *ErrorCause `json:"failure_cause,omitempty"` Index string `json:"index"` diff --git a/typedapi/types/minaggregate.go b/typedapi/types/minaggregate.go index a9ec22716f..d9b03f35c9 100644 --- a/typedapi/types/minaggregate.go +++ b/typedapi/types/minaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MinAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L197-L198 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L197-L198 type MinAggregate struct { Meta Metadata `json:"meta,omitempty"` // Value The metric value. A missing value generally means that there was no data to diff --git a/typedapi/types/minaggregation.go b/typedapi/types/minaggregation.go index 9e61bf1059..57b6fafcd1 100644 --- a/typedapi/types/minaggregation.go +++ b/typedapi/types/minaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MinAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L172-L172 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L172-L172 type MinAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/minbucketaggregation.go b/typedapi/types/minbucketaggregation.go index f7e23aa8bd..2db13cceb3 100644 --- a/typedapi/types/minbucketaggregation.go +++ b/typedapi/types/minbucketaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MinBucketAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L226-L226 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L226-L226 type MinBucketAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/minimallicenseinformation.go b/typedapi/types/minimallicenseinformation.go index e4b51c86cb..6ddc2973f1 100644 --- a/typedapi/types/minimallicenseinformation.go +++ b/typedapi/types/minimallicenseinformation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // MinimalLicenseInformation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/info/types.ts#L34-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/info/types.ts#L34-L40 type MinimalLicenseInformation struct { ExpiryDateInMillis int64 `json:"expiry_date_in_millis"` Mode licensetype.LicenseType `json:"mode"` diff --git a/typedapi/types/minimumshouldmatch.go b/typedapi/types/minimumshouldmatch.go index 20b646bd6c..d84cab0a43 100644 --- a/typedapi/types/minimumshouldmatch.go +++ b/typedapi/types/minimumshouldmatch.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // int // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L162-L166 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L163-L167 type MinimumShouldMatch interface{} diff --git a/typedapi/types/missing.go b/typedapi/types/missing.go index 41a934a809..638c4df75e 100644 --- a/typedapi/types/missing.go +++ b/typedapi/types/missing.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -27,5 +27,5 @@ package types // Float64 // bool // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/AggregationContainer.ts#L517-L517 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/AggregationContainer.ts#L517-L517 type Missing interface{} diff --git a/typedapi/types/missingaggregate.go b/typedapi/types/missingaggregate.go index f3f208fa0c..5abb0b9714 100644 --- a/typedapi/types/missingaggregate.go +++ b/typedapi/types/missingaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MissingAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L483-L484 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L483-L484 type MissingAggregate struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/missingaggregation.go b/typedapi/types/missingaggregation.go index 3539a7e072..27bd60678d 100644 --- a/typedapi/types/missingaggregation.go +++ b/typedapi/types/missingaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MissingAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L574-L580 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L574-L580 type MissingAggregation struct { // Field The name of the field. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/mlcounter.go b/typedapi/types/mlcounter.go index 1bae679b08..400e295035 100644 --- a/typedapi/types/mlcounter.go +++ b/typedapi/types/mlcounter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MlCounter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L255-L257 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L255-L257 type MlCounter struct { Count int64 `json:"count"` } diff --git a/typedapi/types/mldatafeed.go b/typedapi/types/mldatafeed.go index 79aa46c045..d7701d6717 100644 --- a/typedapi/types/mldatafeed.go +++ b/typedapi/types/mldatafeed.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MLDatafeed type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Datafeed.ts#L37-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Datafeed.ts#L37-L58 type MLDatafeed struct { Aggregations map[string]Aggregations `json:"aggregations,omitempty"` // Authorization The security privileges that the datafeed uses to run its queries. If Elastic diff --git a/typedapi/types/mldataframeanalyticsjobs.go b/typedapi/types/mldataframeanalyticsjobs.go index f3fb301161..39765286f1 100644 --- a/typedapi/types/mldataframeanalyticsjobs.go +++ b/typedapi/types/mldataframeanalyticsjobs.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // MlDataFrameAnalyticsJobs type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L177-L182 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L177-L182 type MlDataFrameAnalyticsJobs struct { All_ MlDataFrameAnalyticsJobsCount `json:"_all"` AnalysisCounts *MlDataFrameAnalyticsJobsAnalysis `json:"analysis_counts,omitempty"` diff --git a/typedapi/types/mldataframeanalyticsjobsanalysis.go b/typedapi/types/mldataframeanalyticsjobsanalysis.go index e6b9b08b10..c862605c1a 100644 --- a/typedapi/types/mldataframeanalyticsjobsanalysis.go +++ b/typedapi/types/mldataframeanalyticsjobsanalysis.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MlDataFrameAnalyticsJobsAnalysis type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L184-L188 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L184-L188 type MlDataFrameAnalyticsJobsAnalysis struct { Classification *int `json:"classification,omitempty"` OutlierDetection *int `json:"outlier_detection,omitempty"` diff --git a/typedapi/types/mldataframeanalyticsjobscount.go b/typedapi/types/mldataframeanalyticsjobscount.go index de2bceac94..a0b354f24d 100644 --- a/typedapi/types/mldataframeanalyticsjobscount.go +++ b/typedapi/types/mldataframeanalyticsjobscount.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MlDataFrameAnalyticsJobsCount type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L194-L196 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L194-L196 type MlDataFrameAnalyticsJobsCount struct { Count int64 `json:"count"` } diff --git a/typedapi/types/mldataframeanalyticsjobsmemory.go b/typedapi/types/mldataframeanalyticsjobsmemory.go index 91bfd7dd6a..fb76c6388f 100644 --- a/typedapi/types/mldataframeanalyticsjobsmemory.go +++ b/typedapi/types/mldataframeanalyticsjobsmemory.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // MlDataFrameAnalyticsJobsMemory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L190-L192 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L190-L192 type MlDataFrameAnalyticsJobsMemory struct { PeakUsageBytes JobStatistics `json:"peak_usage_bytes"` } diff --git a/typedapi/types/mlfilter.go b/typedapi/types/mlfilter.go index a53801f07a..c2b506eeaa 100644 --- a/typedapi/types/mlfilter.go +++ b/typedapi/types/mlfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MLFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Filter.ts#L22-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Filter.ts#L22-L29 type MLFilter struct { // Description A description of the filter. Description *string `json:"description,omitempty"` diff --git a/typedapi/types/mlinference.go b/typedapi/types/mlinference.go index d61cdb4e28..6cc0965dd2 100644 --- a/typedapi/types/mlinference.go +++ b/typedapi/types/mlinference.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // MlInference type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L198-L206 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L198-L206 type MlInference struct { Deployments *MlInferenceDeployments `json:"deployments,omitempty"` IngestProcessors map[string]MlInferenceIngestProcessor `json:"ingest_processors"` diff --git a/typedapi/types/mlinferencedeployments.go b/typedapi/types/mlinferencedeployments.go index 6e71e43ace..fdd8f668e9 100644 --- a/typedapi/types/mlinferencedeployments.go +++ b/typedapi/types/mlinferencedeployments.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MlInferenceDeployments type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L227-L232 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L227-L232 type MlInferenceDeployments struct { Count int `json:"count"` InferenceCounts JobStatistics `json:"inference_counts"` diff --git a/typedapi/types/mlinferencedeploymentstimems.go b/typedapi/types/mlinferencedeploymentstimems.go index ff4594939e..446899a148 100644 --- a/typedapi/types/mlinferencedeploymentstimems.go +++ b/typedapi/types/mlinferencedeploymentstimems.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MlInferenceDeploymentsTimeMs type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L234-L236 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L234-L236 type MlInferenceDeploymentsTimeMs struct { Avg Float64 `json:"avg"` } diff --git a/typedapi/types/mlinferenceingestprocessor.go b/typedapi/types/mlinferenceingestprocessor.go index 0132c8501e..b97db845b1 100644 --- a/typedapi/types/mlinferenceingestprocessor.go +++ b/typedapi/types/mlinferenceingestprocessor.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // MlInferenceIngestProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L208-L213 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L208-L213 type MlInferenceIngestProcessor struct { NumDocsProcessed MlInferenceIngestProcessorCount `json:"num_docs_processed"` NumFailures MlInferenceIngestProcessorCount `json:"num_failures"` diff --git a/typedapi/types/mlinferenceingestprocessorcount.go b/typedapi/types/mlinferenceingestprocessorcount.go index cb9e87a026..60c5adf1b2 100644 --- a/typedapi/types/mlinferenceingestprocessorcount.go +++ b/typedapi/types/mlinferenceingestprocessorcount.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MlInferenceIngestProcessorCount type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L238-L242 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L238-L242 type MlInferenceIngestProcessorCount struct { Max int64 `json:"max"` Min int64 `json:"min"` diff --git a/typedapi/types/mlinferencetrainedmodels.go b/typedapi/types/mlinferencetrainedmodels.go index f691612ff8..1a11457fe7 100644 --- a/typedapi/types/mlinferencetrainedmodels.go +++ b/typedapi/types/mlinferencetrainedmodels.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // MlInferenceTrainedModels type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L215-L225 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L215-L225 type MlInferenceTrainedModels struct { All_ MlCounter `json:"_all"` Count *MlInferenceTrainedModelsCount `json:"count,omitempty"` diff --git a/typedapi/types/mlinferencetrainedmodelscount.go b/typedapi/types/mlinferencetrainedmodelscount.go index b1ce3dfae9..5867bf3da6 100644 --- a/typedapi/types/mlinferencetrainedmodelscount.go +++ b/typedapi/types/mlinferencetrainedmodelscount.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MlInferenceTrainedModelsCount type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L244-L253 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L244-L253 type MlInferenceTrainedModelsCount struct { Classification *int64 `json:"classification,omitempty"` Ner *int64 `json:"ner,omitempty"` diff --git a/typedapi/types/mljobforecasts.go b/typedapi/types/mljobforecasts.go index dff886b19e..42795cf05e 100644 --- a/typedapi/types/mljobforecasts.go +++ b/typedapi/types/mljobforecasts.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MlJobForecasts type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L172-L175 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L172-L175 type MlJobForecasts struct { ForecastedJobs int64 `json:"forecasted_jobs"` Total int64 `json:"total"` diff --git a/typedapi/types/modelconfig.go b/typedapi/types/modelconfig.go new file mode 100644 index 0000000000..ba154d2c4b --- /dev/null +++ b/typedapi/types/modelconfig.go @@ -0,0 +1,90 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package types + +import ( + "bytes" + "encoding/json" + "errors" + "io" + "strconv" +) + +// ModelConfig type. +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/_types/Services.ts#L23-L39 +type ModelConfig struct { + // Service The service type + Service string `json:"service"` + // ServiceSettings Settings specific to the service + ServiceSettings json.RawMessage `json:"service_settings"` + // TaskSettings Task settings specific to the service and model + TaskSettings json.RawMessage `json:"task_settings"` +} + +func (s *ModelConfig) UnmarshalJSON(data []byte) error { + + dec := json.NewDecoder(bytes.NewReader(data)) + + for { + t, err := dec.Token() + if err != nil { + if errors.Is(err, io.EOF) { + break + } + return err + } + + switch t { + + case "service": + var tmp json.RawMessage + if err := dec.Decode(&tmp); err != nil { + return err + } + o := string(tmp[:]) + o, err = strconv.Unquote(o) + if err != nil { + o = string(tmp[:]) + } + s.Service = o + + case "service_settings": + if err := dec.Decode(&s.ServiceSettings); err != nil { + return err + } + + case "task_settings": + if err := dec.Decode(&s.TaskSettings); err != nil { + return err + } + + } + } + return nil +} + +// NewModelConfig returns a ModelConfig. +func NewModelConfig() *ModelConfig { + r := &ModelConfig{} + + return r +} diff --git a/typedapi/types/modelconfigcontainer.go b/typedapi/types/modelconfigcontainer.go new file mode 100644 index 0000000000..ac90676ce5 --- /dev/null +++ b/typedapi/types/modelconfigcontainer.go @@ -0,0 +1,113 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package types + +import ( + "bytes" + "encoding/json" + "errors" + "io" + "strconv" + + "github.com/elastic/go-elasticsearch/v8/typedapi/types/enums/tasktype" +) + +// ModelConfigContainer type. +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/_types/Services.ts#L41-L53 +type ModelConfigContainer struct { + // ModelId The model Id + ModelId string `json:"model_id"` + // Service The service type + Service string `json:"service"` + // ServiceSettings Settings specific to the service + ServiceSettings json.RawMessage `json:"service_settings"` + // TaskSettings Task settings specific to the service and model + TaskSettings json.RawMessage `json:"task_settings"` + // TaskType The model's task type + TaskType tasktype.TaskType `json:"task_type"` +} + +func (s *ModelConfigContainer) UnmarshalJSON(data []byte) error { + + dec := json.NewDecoder(bytes.NewReader(data)) + + for { + t, err := dec.Token() + if err != nil { + if errors.Is(err, io.EOF) { + break + } + return err + } + + switch t { + + case "model_id": + var tmp json.RawMessage + if err := dec.Decode(&tmp); err != nil { + return err + } + o := string(tmp[:]) + o, err = strconv.Unquote(o) + if err != nil { + o = string(tmp[:]) + } + s.ModelId = o + + case "service": + var tmp json.RawMessage + if err := dec.Decode(&tmp); err != nil { + return err + } + o := string(tmp[:]) + o, err = strconv.Unquote(o) + if err != nil { + o = string(tmp[:]) + } + s.Service = o + + case "service_settings": + if err := dec.Decode(&s.ServiceSettings); err != nil { + return err + } + + case "task_settings": + if err := dec.Decode(&s.TaskSettings); err != nil { + return err + } + + case "task_type": + if err := dec.Decode(&s.TaskType); err != nil { + return err + } + + } + } + return nil +} + +// NewModelConfigContainer returns a ModelConfigContainer. +func NewModelConfigContainer() *ModelConfigContainer { + r := &ModelConfigContainer{} + + return r +} diff --git a/typedapi/types/modelplotconfig.go b/typedapi/types/modelplotconfig.go index 663ce9af12..2f856a5653 100644 --- a/typedapi/types/modelplotconfig.go +++ b/typedapi/types/modelplotconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ModelPlotConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/ModelPlot.ts#L23-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/ModelPlot.ts#L23-L42 type ModelPlotConfig struct { // AnnotationsEnabled If true, enables calculation and storage of the model change annotations for // each entity that is being analyzed. diff --git a/typedapi/types/modelsizestats.go b/typedapi/types/modelsizestats.go index 06bdfc2f67..6a72f830f2 100644 --- a/typedapi/types/modelsizestats.go +++ b/typedapi/types/modelsizestats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // ModelSizeStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Model.ts#L59-L81 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Model.ts#L59-L81 type ModelSizeStats struct { AssignmentMemoryBasis *string `json:"assignment_memory_basis,omitempty"` BucketAllocationFailuresCount int64 `json:"bucket_allocation_failures_count"` diff --git a/typedapi/types/modelsnapshot.go b/typedapi/types/modelsnapshot.go index 000d3492fc..d12f91c749 100644 --- a/typedapi/types/modelsnapshot.go +++ b/typedapi/types/modelsnapshot.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ModelSnapshot type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Model.ts#L25-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Model.ts#L25-L46 type ModelSnapshot struct { // Description An optional description of the job. Description *string `json:"description,omitempty"` diff --git a/typedapi/types/modelsnapshotupgrade.go b/typedapi/types/modelsnapshotupgrade.go index bbe272d9fe..a02d4fe04f 100644 --- a/typedapi/types/modelsnapshotupgrade.go +++ b/typedapi/types/modelsnapshotupgrade.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ModelSnapshotUpgrade type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Model.ts#L48-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Model.ts#L48-L57 type ModelSnapshotUpgrade struct { AssignmentExplanation string `json:"assignment_explanation"` JobId string `json:"job_id"` diff --git a/typedapi/types/monitoring.go b/typedapi/types/monitoring.go index 1337d0e175..f4484cfa43 100644 --- a/typedapi/types/monitoring.go +++ b/typedapi/types/monitoring.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Monitoring type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L381-L384 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L381-L384 type Monitoring struct { Available bool `json:"available"` CollectionEnabled bool `json:"collection_enabled"` diff --git a/typedapi/types/morelikethisquery.go b/typedapi/types/morelikethisquery.go index 7a4e2a5ba2..15ccbc8bf1 100644 --- a/typedapi/types/morelikethisquery.go +++ b/typedapi/types/morelikethisquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MoreLikeThisQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L78-L163 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L78-L163 type MoreLikeThisQuery struct { // Analyzer The analyzer that is used to analyze the free form text. // Defaults to the analyzer associated with the first field in fields. diff --git a/typedapi/types/mountedsnapshot.go b/typedapi/types/mountedsnapshot.go index 8c5212903e..b2e9eb4509 100644 --- a/typedapi/types/mountedsnapshot.go +++ b/typedapi/types/mountedsnapshot.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MountedSnapshot type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/searchable_snapshots/mount/types.ts#L23-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/searchable_snapshots/mount/types.ts#L23-L27 type MountedSnapshot struct { Indices []string `json:"indices"` Shards ShardStatistics `json:"shards"` diff --git a/typedapi/types/movingaverageaggregation.go b/typedapi/types/movingaverageaggregation.go index 9fa3d06387..6256fafcb3 100644 --- a/typedapi/types/movingaverageaggregation.go +++ b/typedapi/types/movingaverageaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -28,5 +28,5 @@ package types // HoltMovingAverageAggregation // HoltWintersMovingAverageAggregation // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L228-L234 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L228-L234 type MovingAverageAggregation interface{} diff --git a/typedapi/types/movingfunctionaggregation.go b/typedapi/types/movingfunctionaggregation.go index 142ccd44ee..927f56e5e5 100644 --- a/typedapi/types/movingfunctionaggregation.go +++ b/typedapi/types/movingfunctionaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MovingFunctionAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L290-L305 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L290-L305 type MovingFunctionAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/movingpercentilesaggregation.go b/typedapi/types/movingpercentilesaggregation.go index 41767467db..3f2ed1323b 100644 --- a/typedapi/types/movingpercentilesaggregation.go +++ b/typedapi/types/movingpercentilesaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MovingPercentilesAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L307-L319 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L307-L319 type MovingPercentilesAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/msearchrequestitem.go b/typedapi/types/msearchrequestitem.go index 8c05b6f492..ab24684298 100644 --- a/typedapi/types/msearchrequestitem.go +++ b/typedapi/types/msearchrequestitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // MultisearchHeader // MultisearchBody // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch/types.ts#L48-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch/types.ts#L48-L51 type MsearchRequestItem interface{} diff --git a/typedapi/types/msearchresponseitem.go b/typedapi/types/msearchresponseitem.go index f510a3452e..2ecb3d89f9 100644 --- a/typedapi/types/msearchresponseitem.go +++ b/typedapi/types/msearchresponseitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // MultiSearchItem // ErrorResponseBase // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch/types.ts#L209-L212 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch/types.ts#L209-L212 type MsearchResponseItem interface{} diff --git a/typedapi/types/mtermvectorsoperation.go b/typedapi/types/mtermvectorsoperation.go index 9e7a9a5982..4a8ceed08e 100644 --- a/typedapi/types/mtermvectorsoperation.go +++ b/typedapi/types/mtermvectorsoperation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MTermVectorsOperation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/mtermvectors/types.ts#L35-L94 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/mtermvectors/types.ts#L35-L94 type MTermVectorsOperation struct { // Doc An artificial document (a document not present in the index) for which you // want to retrieve term vectors. diff --git a/typedapi/types/multibucketaggregatebaseadjacencymatrixbucket.go b/typedapi/types/multibucketaggregatebaseadjacencymatrixbucket.go index 1afe6217e3..7ba79467b2 100644 --- a/typedapi/types/multibucketaggregatebaseadjacencymatrixbucket.go +++ b/typedapi/types/multibucketaggregatebaseadjacencymatrixbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseAdjacencyMatrixBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseAdjacencyMatrixBucket struct { Buckets BucketsAdjacencyMatrixBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasecompositebucket.go b/typedapi/types/multibucketaggregatebasecompositebucket.go index 2a10773717..5615a03740 100644 --- a/typedapi/types/multibucketaggregatebasecompositebucket.go +++ b/typedapi/types/multibucketaggregatebasecompositebucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseCompositeBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseCompositeBucket struct { Buckets BucketsCompositeBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasedatehistogrambucket.go b/typedapi/types/multibucketaggregatebasedatehistogrambucket.go index 93bb14889e..4ad0658a7c 100644 --- a/typedapi/types/multibucketaggregatebasedatehistogrambucket.go +++ b/typedapi/types/multibucketaggregatebasedatehistogrambucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseDateHistogramBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseDateHistogramBucket struct { Buckets BucketsDateHistogramBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasedoubletermsbucket.go b/typedapi/types/multibucketaggregatebasedoubletermsbucket.go index 8d178ec017..b1b99b05fa 100644 --- a/typedapi/types/multibucketaggregatebasedoubletermsbucket.go +++ b/typedapi/types/multibucketaggregatebasedoubletermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseDoubleTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseDoubleTermsBucket struct { Buckets BucketsDoubleTermsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasefiltersbucket.go b/typedapi/types/multibucketaggregatebasefiltersbucket.go index 93e357b96e..6c5bca5536 100644 --- a/typedapi/types/multibucketaggregatebasefiltersbucket.go +++ b/typedapi/types/multibucketaggregatebasefiltersbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseFiltersBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseFiltersBucket struct { Buckets BucketsFiltersBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasefrequentitemsetsbucket.go b/typedapi/types/multibucketaggregatebasefrequentitemsetsbucket.go index 4a31df5227..a7356ce929 100644 --- a/typedapi/types/multibucketaggregatebasefrequentitemsetsbucket.go +++ b/typedapi/types/multibucketaggregatebasefrequentitemsetsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseFrequentItemSetsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseFrequentItemSetsBucket struct { Buckets BucketsFrequentItemSetsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasegeohashgridbucket.go b/typedapi/types/multibucketaggregatebasegeohashgridbucket.go index 0b9fb47898..325dc53e4b 100644 --- a/typedapi/types/multibucketaggregatebasegeohashgridbucket.go +++ b/typedapi/types/multibucketaggregatebasegeohashgridbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseGeoHashGridBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseGeoHashGridBucket struct { Buckets BucketsGeoHashGridBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasegeohexgridbucket.go b/typedapi/types/multibucketaggregatebasegeohexgridbucket.go index 43dc85ac99..dd3b37133b 100644 --- a/typedapi/types/multibucketaggregatebasegeohexgridbucket.go +++ b/typedapi/types/multibucketaggregatebasegeohexgridbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseGeoHexGridBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseGeoHexGridBucket struct { Buckets BucketsGeoHexGridBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasegeotilegridbucket.go b/typedapi/types/multibucketaggregatebasegeotilegridbucket.go index a4a2622ac4..9d3ee31e47 100644 --- a/typedapi/types/multibucketaggregatebasegeotilegridbucket.go +++ b/typedapi/types/multibucketaggregatebasegeotilegridbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseGeoTileGridBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseGeoTileGridBucket struct { Buckets BucketsGeoTileGridBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasehistogrambucket.go b/typedapi/types/multibucketaggregatebasehistogrambucket.go index 8f62bbab0b..d26e3055f9 100644 --- a/typedapi/types/multibucketaggregatebasehistogrambucket.go +++ b/typedapi/types/multibucketaggregatebasehistogrambucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseHistogramBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseHistogramBucket struct { Buckets BucketsHistogramBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebaseipprefixbucket.go b/typedapi/types/multibucketaggregatebaseipprefixbucket.go index ad61cb4f7e..bcf5bc808a 100644 --- a/typedapi/types/multibucketaggregatebaseipprefixbucket.go +++ b/typedapi/types/multibucketaggregatebaseipprefixbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseIpPrefixBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseIpPrefixBucket struct { Buckets BucketsIpPrefixBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebaseiprangebucket.go b/typedapi/types/multibucketaggregatebaseiprangebucket.go index d7edce3c2a..e40a025c60 100644 --- a/typedapi/types/multibucketaggregatebaseiprangebucket.go +++ b/typedapi/types/multibucketaggregatebaseiprangebucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseIpRangeBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseIpRangeBucket struct { Buckets BucketsIpRangeBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebaselongraretermsbucket.go b/typedapi/types/multibucketaggregatebaselongraretermsbucket.go index 961c539d7f..d19f8348f8 100644 --- a/typedapi/types/multibucketaggregatebaselongraretermsbucket.go +++ b/typedapi/types/multibucketaggregatebaselongraretermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseLongRareTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseLongRareTermsBucket struct { Buckets BucketsLongRareTermsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebaselongtermsbucket.go b/typedapi/types/multibucketaggregatebaselongtermsbucket.go index f38ec6c1dc..b61953dbd6 100644 --- a/typedapi/types/multibucketaggregatebaselongtermsbucket.go +++ b/typedapi/types/multibucketaggregatebaselongtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseLongTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseLongTermsBucket struct { Buckets BucketsLongTermsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasemultitermsbucket.go b/typedapi/types/multibucketaggregatebasemultitermsbucket.go index b8cf916f6d..3834b7087b 100644 --- a/typedapi/types/multibucketaggregatebasemultitermsbucket.go +++ b/typedapi/types/multibucketaggregatebasemultitermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseMultiTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseMultiTermsBucket struct { Buckets BucketsMultiTermsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebaserangebucket.go b/typedapi/types/multibucketaggregatebaserangebucket.go index 3070868f7a..b62a85aa02 100644 --- a/typedapi/types/multibucketaggregatebaserangebucket.go +++ b/typedapi/types/multibucketaggregatebaserangebucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseRangeBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseRangeBucket struct { Buckets BucketsRangeBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasesignificantlongtermsbucket.go b/typedapi/types/multibucketaggregatebasesignificantlongtermsbucket.go index 5e1a93601f..af37664d89 100644 --- a/typedapi/types/multibucketaggregatebasesignificantlongtermsbucket.go +++ b/typedapi/types/multibucketaggregatebasesignificantlongtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseSignificantLongTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseSignificantLongTermsBucket struct { Buckets BucketsSignificantLongTermsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasesignificantstringtermsbucket.go b/typedapi/types/multibucketaggregatebasesignificantstringtermsbucket.go index b7f52401e5..12fcf97e62 100644 --- a/typedapi/types/multibucketaggregatebasesignificantstringtermsbucket.go +++ b/typedapi/types/multibucketaggregatebasesignificantstringtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseSignificantStringTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseSignificantStringTermsBucket struct { Buckets BucketsSignificantStringTermsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasestringraretermsbucket.go b/typedapi/types/multibucketaggregatebasestringraretermsbucket.go index 47d888f79e..cc3136c812 100644 --- a/typedapi/types/multibucketaggregatebasestringraretermsbucket.go +++ b/typedapi/types/multibucketaggregatebasestringraretermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseStringRareTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseStringRareTermsBucket struct { Buckets BucketsStringRareTermsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasestringtermsbucket.go b/typedapi/types/multibucketaggregatebasestringtermsbucket.go index f85be9fc25..1d7bbf038e 100644 --- a/typedapi/types/multibucketaggregatebasestringtermsbucket.go +++ b/typedapi/types/multibucketaggregatebasestringtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseStringTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseStringTermsBucket struct { Buckets BucketsStringTermsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasevariablewidthhistogrambucket.go b/typedapi/types/multibucketaggregatebasevariablewidthhistogrambucket.go index a9c9ba69ed..03e31c2b4f 100644 --- a/typedapi/types/multibucketaggregatebasevariablewidthhistogrambucket.go +++ b/typedapi/types/multibucketaggregatebasevariablewidthhistogrambucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseVariableWidthHistogramBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseVariableWidthHistogramBucket struct { Buckets BucketsVariableWidthHistogramBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multibucketaggregatebasevoid.go b/typedapi/types/multibucketaggregatebasevoid.go index 902cfe4f14..8f657c8d5d 100644 --- a/typedapi/types/multibucketaggregatebasevoid.go +++ b/typedapi/types/multibucketaggregatebasevoid.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiBucketAggregateBaseVoid type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L327-L329 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L327-L329 type MultiBucketAggregateBaseVoid struct { Buckets BucketsVoid `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/multigeterror.go b/typedapi/types/multigeterror.go index f41c9f1749..4043251569 100644 --- a/typedapi/types/multigeterror.go +++ b/typedapi/types/multigeterror.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiGetError type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/mget/types.ts#L62-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/mget/types.ts#L62-L66 type MultiGetError struct { Error ErrorCause `json:"error"` Id_ string `json:"_id"` diff --git a/typedapi/types/multimatchquery.go b/typedapi/types/multimatchquery.go index bc686d68e4..65a79ce9b2 100644 --- a/typedapi/types/multimatchquery.go +++ b/typedapi/types/multimatchquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // MultiMatchQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L456-L539 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L456-L539 type MultiMatchQuery struct { // Analyzer Analyzer used to convert the text in the query value into tokens. Analyzer *string `json:"analyzer,omitempty"` diff --git a/typedapi/types/multiplexertokenfilter.go b/typedapi/types/multiplexertokenfilter.go index 9fae68e5fc..7667bf4422 100644 --- a/typedapi/types/multiplexertokenfilter.go +++ b/typedapi/types/multiplexertokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiplexerTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L260-L264 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L260-L264 type MultiplexerTokenFilter struct { Filters []string `json:"filters"` PreserveOriginal Stringifiedboolean `json:"preserve_original,omitempty"` diff --git a/typedapi/types/multisearchbody.go b/typedapi/types/multisearchbody.go index b0a8ad71dd..38bf5a5ac9 100644 --- a/typedapi/types/multisearchbody.go +++ b/typedapi/types/multisearchbody.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MultisearchBody type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch/types.ts#L71-L202 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch/types.ts#L71-L202 type MultisearchBody struct { Aggregations map[string]Aggregations `json:"aggregations,omitempty"` Collapse *FieldCollapse `json:"collapse,omitempty"` diff --git a/typedapi/types/multisearchheader.go b/typedapi/types/multisearchheader.go index 71d4b04599..9f3be488b2 100644 --- a/typedapi/types/multisearchheader.go +++ b/typedapi/types/multisearchheader.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // MultisearchHeader type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch/types.ts#L53-L68 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch/types.ts#L53-L68 type MultisearchHeader struct { AllowNoIndices *bool `json:"allow_no_indices,omitempty"` AllowPartialSearchResults *bool `json:"allow_partial_search_results,omitempty"` diff --git a/typedapi/types/multisearchitem.go b/typedapi/types/multisearchitem.go index fb379f7ba9..7c282adc6b 100644 --- a/typedapi/types/multisearchitem.go +++ b/typedapi/types/multisearchitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // MultiSearchItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch/types.ts#L214-L217 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch/types.ts#L214-L217 type MultiSearchItem struct { Aggregations map[string]Aggregate `json:"aggregations,omitempty"` Clusters_ *ClusterStatistics `json:"_clusters,omitempty"` diff --git a/typedapi/types/multisearchresult.go b/typedapi/types/multisearchresult.go index 8fa14ae718..eb840449c9 100644 --- a/typedapi/types/multisearchresult.go +++ b/typedapi/types/multisearchresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MultiSearchResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch/types.ts#L204-L207 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch/types.ts#L204-L207 type MultiSearchResult struct { Responses []MsearchResponseItem `json:"responses"` Took int64 `json:"took"` diff --git a/typedapi/types/multitermlookup.go b/typedapi/types/multitermlookup.go index eec0d87a5d..ad550d5731 100644 --- a/typedapi/types/multitermlookup.go +++ b/typedapi/types/multitermlookup.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // MultiTermLookup type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L624-L634 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L624-L634 type MultiTermLookup struct { // Field A fields from which to retrieve terms. Field string `json:"field"` diff --git a/typedapi/types/multitermsaggregate.go b/typedapi/types/multitermsaggregate.go index d45c17cc75..8c75c866b8 100644 --- a/typedapi/types/multitermsaggregate.go +++ b/typedapi/types/multitermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MultiTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L461-L463 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L461-L463 type MultiTermsAggregate struct { Buckets BucketsMultiTermsBucket `json:"buckets"` DocCountErrorUpperBound *int64 `json:"doc_count_error_upper_bound,omitempty"` diff --git a/typedapi/types/multitermsaggregation.go b/typedapi/types/multitermsaggregation.go index 9796919afa..acb3082496 100644 --- a/typedapi/types/multitermsaggregation.go +++ b/typedapi/types/multitermsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // MultiTermsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L582-L622 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L582-L622 type MultiTermsAggregation struct { // CollectMode Specifies the strategy for data collection. CollectMode *termsaggregationcollectmode.TermsAggregationCollectMode `json:"collect_mode,omitempty"` diff --git a/typedapi/types/multitermsbucket.go b/typedapi/types/multitermsbucket.go index cd18e2a8dc..da681da574 100644 --- a/typedapi/types/multitermsbucket.go +++ b/typedapi/types/multitermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // MultiTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L465-L469 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L465-L469 type MultiTermsBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/murmur3hashproperty.go b/typedapi/types/murmur3hashproperty.go index 43f1ac9cf2..ca81159da6 100644 --- a/typedapi/types/murmur3hashproperty.go +++ b/typedapi/types/murmur3hashproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // Murmur3HashProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/specialized.ts#L75-L77 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/specialized.ts#L75-L77 type Murmur3HashProperty struct { CopyTo []string `json:"copy_to,omitempty"` DocValues *bool `json:"doc_values,omitempty"` @@ -215,6 +215,12 @@ func (s *Murmur3HashProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -540,6 +546,12 @@ func (s *Murmur3HashProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/mutualinformationheuristic.go b/typedapi/types/mutualinformationheuristic.go index 7ea3aa69f2..11fa340515 100644 --- a/typedapi/types/mutualinformationheuristic.go +++ b/typedapi/types/mutualinformationheuristic.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // MutualInformationHeuristic type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L753-L762 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L753-L762 type MutualInformationHeuristic struct { // BackgroundIsSuperset Set to `false` if you defined a custom background filter that represents a // different set of documents that you want to compare to. diff --git a/typedapi/types/names.go b/typedapi/types/names.go index 742511666d..06ae8c81a8 100644 --- a/typedapi/types/names.go +++ b/typedapi/types/names.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Names type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L80-L80 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L81-L81 type Names []string diff --git a/typedapi/types/nativecode.go b/typedapi/types/nativecode.go index ed9ac2da42..c0633c3985 100644 --- a/typedapi/types/nativecode.go +++ b/typedapi/types/nativecode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NativeCode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/info/types.ts#L29-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/info/types.ts#L29-L32 type NativeCode struct { BuildHash string `json:"build_hash"` Version string `json:"version"` diff --git a/typedapi/types/nativecodeinformation.go b/typedapi/types/nativecodeinformation.go index b6b6eb11e8..91f0d86f98 100644 --- a/typedapi/types/nativecodeinformation.go +++ b/typedapi/types/nativecodeinformation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NativeCodeInformation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/info/types.ts#L29-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/info/types.ts#L29-L32 type NativeCodeInformation struct { BuildHash string `json:"build_hash"` Version string `json:"version"` diff --git a/typedapi/types/nerinferenceoptions.go b/typedapi/types/nerinferenceoptions.go index 87995c3ce3..039cbb17c5 100644 --- a/typedapi/types/nerinferenceoptions.go +++ b/typedapi/types/nerinferenceoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NerInferenceOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L255-L264 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L255-L264 type NerInferenceOptions struct { // ClassificationLabels The token classification labels. Must be IOB formatted tags ClassificationLabels []string `json:"classification_labels,omitempty"` diff --git a/typedapi/types/nerinferenceupdateoptions.go b/typedapi/types/nerinferenceupdateoptions.go index b0b878d3bf..3496f07f23 100644 --- a/typedapi/types/nerinferenceupdateoptions.go +++ b/typedapi/types/nerinferenceupdateoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NerInferenceUpdateOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L404-L409 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L404-L409 type NerInferenceUpdateOptions struct { // ResultsField The field that is added to incoming documents to contain the inference // prediction. Defaults to predicted_value. diff --git a/typedapi/types/nestedaggregate.go b/typedapi/types/nestedaggregate.go index a16b04bf11..c7c8d61ff9 100644 --- a/typedapi/types/nestedaggregate.go +++ b/typedapi/types/nestedaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NestedAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L486-L487 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L486-L487 type NestedAggregate struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/nestedaggregation.go b/typedapi/types/nestedaggregation.go index 04ef22fa3d..3649cd737a 100644 --- a/typedapi/types/nestedaggregation.go +++ b/typedapi/types/nestedaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NestedAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L636-L641 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L636-L641 type NestedAggregation struct { Meta Metadata `json:"meta,omitempty"` Name *string `json:"name,omitempty"` diff --git a/typedapi/types/nestedidentity.go b/typedapi/types/nestedidentity.go index b4a3aaa215..197dc63bb1 100644 --- a/typedapi/types/nestedidentity.go +++ b/typedapi/types/nestedidentity.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NestedIdentity type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/hits.ts#L88-L92 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/hits.ts#L88-L92 type NestedIdentity struct { Field string `json:"field"` Nested_ *NestedIdentity `json:"_nested,omitempty"` diff --git a/typedapi/types/nestedproperty.go b/typedapi/types/nestedproperty.go index 962b14f594..4452adb515 100644 --- a/typedapi/types/nestedproperty.go +++ b/typedapi/types/nestedproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NestedProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/complex.ts#L39-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/complex.ts#L39-L44 type NestedProperty struct { CopyTo []string `json:"copy_to,omitempty"` Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` @@ -217,6 +217,12 @@ func (s *NestedProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -570,6 +576,12 @@ func (s *NestedProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/nestedquery.go b/typedapi/types/nestedquery.go index 271be581bd..27dba4e050 100644 --- a/typedapi/types/nestedquery.go +++ b/typedapi/types/nestedquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NestedQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/joining.ts#L106-L130 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/joining.ts#L106-L130 type NestedQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/nestedsortvalue.go b/typedapi/types/nestedsortvalue.go index bd24f4e9bc..2cfaed6b38 100644 --- a/typedapi/types/nestedsortvalue.go +++ b/typedapi/types/nestedsortvalue.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NestedSortValue type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L30-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L30-L35 type NestedSortValue struct { Filter *Query `json:"filter,omitempty"` MaxChildren *int `json:"max_children,omitempty"` diff --git a/typedapi/types/nevercondition.go b/typedapi/types/nevercondition.go index 000f57475b..4950cfd714 100644 --- a/typedapi/types/nevercondition.go +++ b/typedapi/types/nevercondition.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NeverCondition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Conditions.ts#L69-L69 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Conditions.ts#L69-L69 type NeverCondition struct { } diff --git a/typedapi/types/ngramtokenfilter.go b/typedapi/types/ngramtokenfilter.go index 2ba53019f0..aa865856c4 100644 --- a/typedapi/types/ngramtokenfilter.go +++ b/typedapi/types/ngramtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NGramTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L266-L271 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L266-L271 type NGramTokenFilter struct { MaxGram *int `json:"max_gram,omitempty"` MinGram *int `json:"min_gram,omitempty"` diff --git a/typedapi/types/ngramtokenizer.go b/typedapi/types/ngramtokenizer.go index d6505dae37..c2b941edcc 100644 --- a/typedapi/types/ngramtokenizer.go +++ b/typedapi/types/ngramtokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NGramTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L39-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L39-L45 type NGramTokenizer struct { CustomTokenChars *string `json:"custom_token_chars,omitempty"` MaxGram int `json:"max_gram"` diff --git a/typedapi/types/nlpberttokenizationconfig.go b/typedapi/types/nlpberttokenizationconfig.go index 02153f9ffb..705ce6d82b 100644 --- a/typedapi/types/nlpberttokenizationconfig.go +++ b/typedapi/types/nlpberttokenizationconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NlpBertTokenizationConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L131-L158 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L131-L158 type NlpBertTokenizationConfig struct { // DoLowerCase Should the tokenizer lower case the text DoLowerCase *bool `json:"do_lower_case,omitempty"` diff --git a/typedapi/types/nlprobertatokenizationconfig.go b/typedapi/types/nlprobertatokenizationconfig.go index 6ff01fe74a..ac5336563f 100644 --- a/typedapi/types/nlprobertatokenizationconfig.go +++ b/typedapi/types/nlprobertatokenizationconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NlpRobertaTokenizationConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L160-L187 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L160-L187 type NlpRobertaTokenizationConfig struct { // AddPrefixSpace Should the tokenizer prefix input with a space character AddPrefixSpace *bool `json:"add_prefix_space,omitempty"` diff --git a/typedapi/types/nlptokenizationupdateoptions.go b/typedapi/types/nlptokenizationupdateoptions.go index 3751f1b26b..0604f06c86 100644 --- a/typedapi/types/nlptokenizationupdateoptions.go +++ b/typedapi/types/nlptokenizationupdateoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NlpTokenizationUpdateOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L356-L361 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L356-L361 type NlpTokenizationUpdateOptions struct { // Span Span options to apply Span *int `json:"span,omitempty"` diff --git a/typedapi/types/node.go b/typedapi/types/node.go index 318858f815..893f876aad 100644 --- a/typedapi/types/node.go +++ b/typedapi/types/node.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Node type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/searchable_snapshots/cache_stats/Response.ts#L30-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/searchable_snapshots/cache_stats/Response.ts#L30-L32 type Node struct { SharedCache Shared `json:"shared_cache"` } diff --git a/typedapi/types/nodeallocationexplanation.go b/typedapi/types/nodeallocationexplanation.go index ae9aedef8e..dc4c5895c2 100644 --- a/typedapi/types/nodeallocationexplanation.go +++ b/typedapi/types/nodeallocationexplanation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NodeAllocationExplanation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L97-L106 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L97-L106 type NodeAllocationExplanation struct { Deciders []AllocationDecision `json:"deciders"` NodeAttributes map[string]string `json:"node_attributes"` diff --git a/typedapi/types/nodeattributes.go b/typedapi/types/nodeattributes.go index e9d435024b..66026a3b72 100644 --- a/typedapi/types/nodeattributes.go +++ b/typedapi/types/nodeattributes.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NodeAttributes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Node.ts#L41-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Node.ts#L41-L58 type NodeAttributes struct { // Attributes Lists node attributes. Attributes map[string]string `json:"attributes"` diff --git a/typedapi/types/nodeattributesrecord.go b/typedapi/types/nodeattributesrecord.go index c749ab9bf8..0345cff7b2 100644 --- a/typedapi/types/nodeattributesrecord.go +++ b/typedapi/types/nodeattributesrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeAttributesRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/nodeattrs/types.ts#L20-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/nodeattrs/types.ts#L20-L55 type NodeAttributesRecord struct { // Attr The attribute name. Attr *string `json:"attr,omitempty"` diff --git a/typedapi/types/nodebufferpool.go b/typedapi/types/nodebufferpool.go index 3dac4fc62e..9d921e8f55 100644 --- a/typedapi/types/nodebufferpool.go +++ b/typedapi/types/nodebufferpool.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeBufferPool type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L788-L809 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L788-L809 type NodeBufferPool struct { // Count Number of buffer pools. Count *int64 `json:"count,omitempty"` diff --git a/typedapi/types/nodediskusage.go b/typedapi/types/nodediskusage.go index 13330184a6..9aa6275ec8 100644 --- a/typedapi/types/nodediskusage.go +++ b/typedapi/types/nodediskusage.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // NodeDiskUsage type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L56-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L56-L60 type NodeDiskUsage struct { LeastAvailable DiskUsage `json:"least_available"` MostAvailable DiskUsage `json:"most_available"` diff --git a/typedapi/types/nodeids.go b/typedapi/types/nodeids.go index 8f54968a71..871f6795bb 100644 --- a/typedapi/types/nodeids.go +++ b/typedapi/types/nodeids.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeIds type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L58-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L64-L64 type NodeIds []string diff --git a/typedapi/types/nodeinfo.go b/typedapi/types/nodeinfo.go index 24f824e0a5..6c35116416 100644 --- a/typedapi/types/nodeinfo.go +++ b/typedapi/types/nodeinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NodeInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L30-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L30-L66 type NodeInfo struct { Aggregations map[string]NodeInfoAggregation `json:"aggregations,omitempty"` Attributes map[string]string `json:"attributes"` diff --git a/typedapi/types/nodeinfoaction.go b/typedapi/types/nodeinfoaction.go index 860e67123a..3a14a16b5b 100644 --- a/typedapi/types/nodeinfoaction.go +++ b/typedapi/types/nodeinfoaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L176-L178 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L176-L178 type NodeInfoAction struct { DestructiveRequiresName string `json:"destructive_requires_name"` } diff --git a/typedapi/types/nodeinfoaggregation.go b/typedapi/types/nodeinfoaggregation.go index aa0cc99a05..e8092ae3bb 100644 --- a/typedapi/types/nodeinfoaggregation.go +++ b/typedapi/types/nodeinfoaggregation.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L227-L229 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L227-L229 type NodeInfoAggregation struct { Types []string `json:"types"` } diff --git a/typedapi/types/nodeinfobootstrap.go b/typedapi/types/nodeinfobootstrap.go index 274f0caf3f..b6c5dcc901 100644 --- a/typedapi/types/nodeinfobootstrap.go +++ b/typedapi/types/nodeinfobootstrap.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoBootstrap type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L196-L198 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L196-L198 type NodeInfoBootstrap struct { MemoryLock string `json:"memory_lock"` } diff --git a/typedapi/types/nodeinfoclient.go b/typedapi/types/nodeinfoclient.go index 56d3b338f0..1e5cfdab70 100644 --- a/typedapi/types/nodeinfoclient.go +++ b/typedapi/types/nodeinfoclient.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoClient type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L180-L182 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L180-L182 type NodeInfoClient struct { Type string `json:"type"` } diff --git a/typedapi/types/nodeinfodiscover.go b/typedapi/types/nodeinfodiscover.go index d1bf2c269a..1dfdabc844 100644 --- a/typedapi/types/nodeinfodiscover.go +++ b/typedapi/types/nodeinfodiscover.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoDiscover type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L172-L174 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L172-L174 type NodeInfoDiscover struct { SeedHosts string `json:"seed_hosts"` } diff --git a/typedapi/types/nodeinfohttp.go b/typedapi/types/nodeinfohttp.go index 6d199c7d50..7fe251e7c5 100644 --- a/typedapi/types/nodeinfohttp.go +++ b/typedapi/types/nodeinfohttp.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoHttp type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L298-L303 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L298-L303 type NodeInfoHttp struct { BoundAddress []string `json:"bound_address"` MaxContentLength ByteSize `json:"max_content_length,omitempty"` diff --git a/typedapi/types/nodeinfoingest.go b/typedapi/types/nodeinfoingest.go index bc64025ae6..b837d3462f 100644 --- a/typedapi/types/nodeinfoingest.go +++ b/typedapi/types/nodeinfoingest.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoIngest type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L219-L221 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L219-L221 type NodeInfoIngest struct { Processors []NodeInfoIngestProcessor `json:"processors"` } diff --git a/typedapi/types/nodeinfoingestdownloader.go b/typedapi/types/nodeinfoingestdownloader.go index c3029b6c2f..80a64b3f7c 100644 --- a/typedapi/types/nodeinfoingestdownloader.go +++ b/typedapi/types/nodeinfoingestdownloader.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoIngestDownloader type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L127-L129 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L127-L129 type NodeInfoIngestDownloader struct { Enabled string `json:"enabled"` } diff --git a/typedapi/types/nodeinfoingestinfo.go b/typedapi/types/nodeinfoingestinfo.go index acb1a086bb..b771e4b159 100644 --- a/typedapi/types/nodeinfoingestinfo.go +++ b/typedapi/types/nodeinfoingestinfo.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoIngestInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L123-L125 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L123-L125 type NodeInfoIngestInfo struct { Downloader NodeInfoIngestDownloader `json:"downloader"` } diff --git a/typedapi/types/nodeinfoingestprocessor.go b/typedapi/types/nodeinfoingestprocessor.go index d2c8fb93b4..81ab635103 100644 --- a/typedapi/types/nodeinfoingestprocessor.go +++ b/typedapi/types/nodeinfoingestprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoIngestProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L223-L225 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L223-L225 type NodeInfoIngestProcessor struct { Type string `json:"type"` } diff --git a/typedapi/types/nodeinfojvmmemory.go b/typedapi/types/nodeinfojvmmemory.go index 0ca12f8f5e..3b294a4642 100644 --- a/typedapi/types/nodeinfojvmmemory.go +++ b/typedapi/types/nodeinfojvmmemory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoJvmMemory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L305-L316 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L305-L316 type NodeInfoJvmMemory struct { DirectMax ByteSize `json:"direct_max,omitempty"` DirectMaxInBytes int64 `json:"direct_max_in_bytes"` diff --git a/typedapi/types/nodeinfomemory.go b/typedapi/types/nodeinfomemory.go index b3a55500ba..7c9dddd14f 100644 --- a/typedapi/types/nodeinfomemory.go +++ b/typedapi/types/nodeinfomemory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoMemory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L318-L321 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L318-L321 type NodeInfoMemory struct { Total string `json:"total"` TotalInBytes int64 `json:"total_in_bytes"` diff --git a/typedapi/types/nodeinfonetwork.go b/typedapi/types/nodeinfonetwork.go index 0c27a41ca8..da16daea86 100644 --- a/typedapi/types/nodeinfonetwork.go +++ b/typedapi/types/nodeinfonetwork.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoNetwork type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L323-L326 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L323-L326 type NodeInfoNetwork struct { PrimaryInterface NodeInfoNetworkInterface `json:"primary_interface"` RefreshInterval int `json:"refresh_interval"` diff --git a/typedapi/types/nodeinfonetworkinterface.go b/typedapi/types/nodeinfonetworkinterface.go index 010cb45015..401f422e54 100644 --- a/typedapi/types/nodeinfonetworkinterface.go +++ b/typedapi/types/nodeinfonetworkinterface.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoNetworkInterface type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L328-L332 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L328-L332 type NodeInfoNetworkInterface struct { Address string `json:"address"` MacAddress string `json:"mac_address"` diff --git a/typedapi/types/nodeinfooscpu.go b/typedapi/types/nodeinfooscpu.go index 5b7f40e3f5..405b19cbba 100644 --- a/typedapi/types/nodeinfooscpu.go +++ b/typedapi/types/nodeinfooscpu.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoOSCPU type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L334-L343 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L334-L343 type NodeInfoOSCPU struct { CacheSize string `json:"cache_size"` CacheSizeInBytes int `json:"cache_size_in_bytes"` diff --git a/typedapi/types/nodeinfopath.go b/typedapi/types/nodeinfopath.go index b36255b3b8..ed8e4ba7fa 100644 --- a/typedapi/types/nodeinfopath.go +++ b/typedapi/types/nodeinfopath.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoPath type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L157-L162 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L157-L162 type NodeInfoPath struct { Data []string `json:"data,omitempty"` Home string `json:"home"` diff --git a/typedapi/types/nodeinforepositories.go b/typedapi/types/nodeinforepositories.go index b06671e3b6..f18de3dc3e 100644 --- a/typedapi/types/nodeinforepositories.go +++ b/typedapi/types/nodeinforepositories.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoRepositories type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L164-L166 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L164-L166 type NodeInfoRepositories struct { Url NodeInfoRepositoriesUrl `json:"url"` } diff --git a/typedapi/types/nodeinforepositoriesurl.go b/typedapi/types/nodeinforepositoriesurl.go index fbe31f6346..1ed07d8780 100644 --- a/typedapi/types/nodeinforepositoriesurl.go +++ b/typedapi/types/nodeinforepositoriesurl.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoRepositoriesUrl type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L168-L170 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L168-L170 type NodeInfoRepositoriesUrl struct { AllowedUrls string `json:"allowed_urls"` } diff --git a/typedapi/types/nodeinfoscript.go b/typedapi/types/nodeinfoscript.go index 6d5efb7ec0..1b938ed5f3 100644 --- a/typedapi/types/nodeinfoscript.go +++ b/typedapi/types/nodeinfoscript.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoScript type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L276-L279 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L276-L279 type NodeInfoScript struct { AllowedTypes string `json:"allowed_types"` DisableMaxCompilationsRate string `json:"disable_max_compilations_rate"` diff --git a/typedapi/types/nodeinfosearch.go b/typedapi/types/nodeinfosearch.go index 3937a0ff3d..39785b11d4 100644 --- a/typedapi/types/nodeinfosearch.go +++ b/typedapi/types/nodeinfosearch.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoSearch type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L281-L283 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L281-L283 type NodeInfoSearch struct { Remote NodeInfoSearchRemote `json:"remote"` } diff --git a/typedapi/types/nodeinfosearchremote.go b/typedapi/types/nodeinfosearchremote.go index b7b3aa877a..f89d9ef068 100644 --- a/typedapi/types/nodeinfosearchremote.go +++ b/typedapi/types/nodeinfosearchremote.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoSearchRemote type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L285-L287 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L285-L287 type NodeInfoSearchRemote struct { Connect string `json:"connect"` } diff --git a/typedapi/types/nodeinfosettings.go b/typedapi/types/nodeinfosettings.go index 10b51d09e8..72e0f6eb1a 100644 --- a/typedapi/types/nodeinfosettings.go +++ b/typedapi/types/nodeinfosettings.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoSettings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L68-L84 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L68-L84 type NodeInfoSettings struct { Action *NodeInfoAction `json:"action,omitempty"` Bootstrap *NodeInfoBootstrap `json:"bootstrap,omitempty"` diff --git a/typedapi/types/nodeinfosettingscluster.go b/typedapi/types/nodeinfosettingscluster.go index c57b846a36..061fe677e5 100644 --- a/typedapi/types/nodeinfosettingscluster.go +++ b/typedapi/types/nodeinfosettingscluster.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoSettingsCluster type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L131-L141 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L131-L141 type NodeInfoSettingsCluster struct { DeprecationIndexing *DeprecationIndexing `json:"deprecation_indexing,omitempty"` Election NodeInfoSettingsClusterElection `json:"election"` diff --git a/typedapi/types/nodeinfosettingsclusterelection.go b/typedapi/types/nodeinfosettingsclusterelection.go index 00a6331db5..0ae771bc76 100644 --- a/typedapi/types/nodeinfosettingsclusterelection.go +++ b/typedapi/types/nodeinfosettingsclusterelection.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // NodeInfoSettingsClusterElection type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L147-L149 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L147-L149 type NodeInfoSettingsClusterElection struct { Strategy string `json:"strategy"` } diff --git a/typedapi/types/nodeinfosettingshttp.go b/typedapi/types/nodeinfosettingshttp.go index d6d465f057..be8c98cdbb 100644 --- a/typedapi/types/nodeinfosettingshttp.go +++ b/typedapi/types/nodeinfosettingshttp.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoSettingsHttp type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L184-L189 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L184-L189 type NodeInfoSettingsHttp struct { Compression string `json:"compression,omitempty"` Port string `json:"port,omitempty"` diff --git a/typedapi/types/nodeinfosettingshttptype.go b/typedapi/types/nodeinfosettingshttptype.go index 83d2b5421e..386b6e6bb6 100644 --- a/typedapi/types/nodeinfosettingshttptype.go +++ b/typedapi/types/nodeinfosettingshttptype.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoSettingsHttpType type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L191-L194 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L191-L194 type NodeInfoSettingsHttpType struct { Default string `json:"default"` } diff --git a/typedapi/types/nodeinfosettingsingest.go b/typedapi/types/nodeinfosettingsingest.go index 242f26fcc6..efedf24711 100644 --- a/typedapi/types/nodeinfosettingsingest.go +++ b/typedapi/types/nodeinfosettingsingest.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoSettingsIngest type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L86-L121 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L86-L121 type NodeInfoSettingsIngest struct { Append *NodeInfoIngestInfo `json:"append,omitempty"` Attachment *NodeInfoIngestInfo `json:"attachment,omitempty"` diff --git a/typedapi/types/nodeinfosettingsnetwork.go b/typedapi/types/nodeinfosettingsnetwork.go index d8de7026e8..f56e9e0d4c 100644 --- a/typedapi/types/nodeinfosettingsnetwork.go +++ b/typedapi/types/nodeinfosettingsnetwork.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // NodeInfoSettingsNetwork type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L215-L217 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L215-L217 type NodeInfoSettingsNetwork struct { Host string `json:"host"` } diff --git a/typedapi/types/nodeinfosettingsnode.go b/typedapi/types/nodeinfosettingsnode.go index 337b497001..b621617413 100644 --- a/typedapi/types/nodeinfosettingsnode.go +++ b/typedapi/types/nodeinfosettingsnode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoSettingsNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L151-L155 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L151-L155 type NodeInfoSettingsNode struct { Attr map[string]json.RawMessage `json:"attr"` MaxLocalStorageNodes *string `json:"max_local_storage_nodes,omitempty"` diff --git a/typedapi/types/nodeinfosettingstransport.go b/typedapi/types/nodeinfosettingstransport.go index 7c9a39c8f4..e8ce9c5129 100644 --- a/typedapi/types/nodeinfosettingstransport.go +++ b/typedapi/types/nodeinfosettingstransport.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoSettingsTransport type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L200-L204 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L200-L204 type NodeInfoSettingsTransport struct { Features *NodeInfoSettingsTransportFeatures `json:"features,omitempty"` Type NodeInfoSettingsTransportType `json:"type"` diff --git a/typedapi/types/nodeinfosettingstransportfeatures.go b/typedapi/types/nodeinfosettingstransportfeatures.go index 974234e0e4..cfd5b68625 100644 --- a/typedapi/types/nodeinfosettingstransportfeatures.go +++ b/typedapi/types/nodeinfosettingstransportfeatures.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoSettingsTransportFeatures type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L211-L213 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L211-L213 type NodeInfoSettingsTransportFeatures struct { XPack string `json:"x-pack"` } diff --git a/typedapi/types/nodeinfosettingstransporttype.go b/typedapi/types/nodeinfosettingstransporttype.go index 96a58c4d0f..576e7bb5d8 100644 --- a/typedapi/types/nodeinfosettingstransporttype.go +++ b/typedapi/types/nodeinfosettingstransporttype.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoSettingsTransportType type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L206-L209 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L206-L209 type NodeInfoSettingsTransportType struct { Default string `json:"default"` } diff --git a/typedapi/types/nodeinfotransport.go b/typedapi/types/nodeinfotransport.go index 24a0eba232..94a45c6a97 100644 --- a/typedapi/types/nodeinfotransport.go +++ b/typedapi/types/nodeinfotransport.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoTransport type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L345-L349 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L345-L349 type NodeInfoTransport struct { BoundAddress []string `json:"bound_address"` Profiles map[string]string `json:"profiles"` diff --git a/typedapi/types/nodeinfoxpack.go b/typedapi/types/nodeinfoxpack.go index 877deef753..973066a3f9 100644 --- a/typedapi/types/nodeinfoxpack.go +++ b/typedapi/types/nodeinfoxpack.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // NodeInfoXpack type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L231-L235 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L231-L235 type NodeInfoXpack struct { License *NodeInfoXpackLicense `json:"license,omitempty"` Notification map[string]json.RawMessage `json:"notification,omitempty"` diff --git a/typedapi/types/nodeinfoxpacklicense.go b/typedapi/types/nodeinfoxpacklicense.go index 209bf20463..8a53eb2885 100644 --- a/typedapi/types/nodeinfoxpacklicense.go +++ b/typedapi/types/nodeinfoxpacklicense.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoXpackLicense type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L268-L270 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L268-L270 type NodeInfoXpackLicense struct { SelfGenerated NodeInfoXpackLicenseType `json:"self_generated"` } diff --git a/typedapi/types/nodeinfoxpacklicensetype.go b/typedapi/types/nodeinfoxpacklicensetype.go index 2401c79e2c..5fe5ea507e 100644 --- a/typedapi/types/nodeinfoxpacklicensetype.go +++ b/typedapi/types/nodeinfoxpacklicensetype.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoXpackLicenseType type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L272-L274 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L272-L274 type NodeInfoXpackLicenseType struct { Type string `json:"type"` } diff --git a/typedapi/types/nodeinfoxpacksecurity.go b/typedapi/types/nodeinfoxpacksecurity.go index ec08b2acac..ee2d70cc3c 100644 --- a/typedapi/types/nodeinfoxpacksecurity.go +++ b/typedapi/types/nodeinfoxpacksecurity.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoXpackSecurity type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L237-L242 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L237-L242 type NodeInfoXpackSecurity struct { Authc *NodeInfoXpackSecurityAuthc `json:"authc,omitempty"` Enabled string `json:"enabled"` diff --git a/typedapi/types/nodeinfoxpacksecurityauthc.go b/typedapi/types/nodeinfoxpacksecurityauthc.go index 5230cf117a..84066e1f4e 100644 --- a/typedapi/types/nodeinfoxpacksecurityauthc.go +++ b/typedapi/types/nodeinfoxpacksecurityauthc.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoXpackSecurityAuthc type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L248-L251 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L248-L251 type NodeInfoXpackSecurityAuthc struct { Realms NodeInfoXpackSecurityAuthcRealms `json:"realms"` Token NodeInfoXpackSecurityAuthcToken `json:"token"` diff --git a/typedapi/types/nodeinfoxpacksecurityauthcrealms.go b/typedapi/types/nodeinfoxpacksecurityauthcrealms.go index f19f75deef..fe2e31a98e 100644 --- a/typedapi/types/nodeinfoxpacksecurityauthcrealms.go +++ b/typedapi/types/nodeinfoxpacksecurityauthcrealms.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoXpackSecurityAuthcRealms type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L253-L257 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L253-L257 type NodeInfoXpackSecurityAuthcRealms struct { File map[string]NodeInfoXpackSecurityAuthcRealmsStatus `json:"file,omitempty"` Native map[string]NodeInfoXpackSecurityAuthcRealmsStatus `json:"native,omitempty"` diff --git a/typedapi/types/nodeinfoxpacksecurityauthcrealmsstatus.go b/typedapi/types/nodeinfoxpacksecurityauthcrealmsstatus.go index 71d47b1c96..3f2bfa5fdc 100644 --- a/typedapi/types/nodeinfoxpacksecurityauthcrealmsstatus.go +++ b/typedapi/types/nodeinfoxpacksecurityauthcrealmsstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoXpackSecurityAuthcRealmsStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L263-L266 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L263-L266 type NodeInfoXpackSecurityAuthcRealmsStatus struct { Enabled *string `json:"enabled,omitempty"` Order string `json:"order"` diff --git a/typedapi/types/nodeinfoxpacksecurityauthctoken.go b/typedapi/types/nodeinfoxpacksecurityauthctoken.go index 4c5b53d88f..c86d739f95 100644 --- a/typedapi/types/nodeinfoxpacksecurityauthctoken.go +++ b/typedapi/types/nodeinfoxpacksecurityauthctoken.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeInfoXpackSecurityAuthcToken type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L259-L261 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L259-L261 type NodeInfoXpackSecurityAuthcToken struct { Enabled string `json:"enabled"` } diff --git a/typedapi/types/nodeinfoxpacksecurityssl.go b/typedapi/types/nodeinfoxpacksecurityssl.go index 257d038767..07f41899ed 100644 --- a/typedapi/types/nodeinfoxpacksecurityssl.go +++ b/typedapi/types/nodeinfoxpacksecurityssl.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodeInfoXpackSecuritySsl type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L244-L246 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L244-L246 type NodeInfoXpackSecuritySsl struct { Ssl map[string]string `json:"ssl"` } diff --git a/typedapi/types/nodejvminfo.go b/typedapi/types/nodejvminfo.go index 47031fa438..b0f34163ed 100644 --- a/typedapi/types/nodejvminfo.go +++ b/typedapi/types/nodejvminfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeJvmInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L351-L365 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L351-L365 type NodeJvmInfo struct { GcCollectors []string `json:"gc_collectors"` InputArguments []string `json:"input_arguments"` diff --git a/typedapi/types/nodeoperatingsysteminfo.go b/typedapi/types/nodeoperatingsysteminfo.go index 38bd36f75c..acabb63047 100644 --- a/typedapi/types/nodeoperatingsysteminfo.go +++ b/typedapi/types/nodeoperatingsysteminfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeOperatingSystemInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L367-L384 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L367-L384 type NodeOperatingSystemInfo struct { // AllocatedProcessors The number of processors actually used to calculate thread pool size. This // number can be set with the node.processors setting of a node and defaults to diff --git a/typedapi/types/nodepackagingtype.go b/typedapi/types/nodepackagingtype.go index c6f7c57283..acf4238253 100644 --- a/typedapi/types/nodepackagingtype.go +++ b/typedapi/types/nodepackagingtype.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodePackagingType type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L526-L539 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L526-L539 type NodePackagingType struct { // Count Number of selected nodes using the distribution flavor and file type. Count int `json:"count"` diff --git a/typedapi/types/nodeprocessinfo.go b/typedapi/types/nodeprocessinfo.go index 1855b05265..d2d2bd36af 100644 --- a/typedapi/types/nodeprocessinfo.go +++ b/typedapi/types/nodeprocessinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeProcessInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L386-L393 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L386-L393 type NodeProcessInfo struct { // Id Process identifier (PID) Id int64 `json:"id"` diff --git a/typedapi/types/nodereloaderror.go b/typedapi/types/nodereloaderror.go index 1fd79bc84f..36ab41c241 100644 --- a/typedapi/types/nodereloaderror.go +++ b/typedapi/types/nodereloaderror.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // NodeReloadError type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/NodeReloadResult.ts#L24-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/NodeReloadResult.ts#L24-L27 type NodeReloadError struct { Name string `json:"name"` ReloadException *ErrorCause `json:"reload_exception,omitempty"` diff --git a/typedapi/types/nodereloadresult.go b/typedapi/types/nodereloadresult.go index cb744d13dd..ffef9c6980 100644 --- a/typedapi/types/nodereloadresult.go +++ b/typedapi/types/nodereloadresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // Stats // NodeReloadError // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/NodeReloadResult.ts#L29-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/NodeReloadResult.ts#L29-L30 type NodeReloadResult interface{} diff --git a/typedapi/types/nodescontext.go b/typedapi/types/nodescontext.go index e4025d0854..92175e2898 100644 --- a/typedapi/types/nodescontext.go +++ b/typedapi/types/nodescontext.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodesContext type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L997-L1002 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L997-L1002 type NodesContext struct { CacheEvictions *int64 `json:"cache_evictions,omitempty"` CompilationLimitTriggered *int64 `json:"compilation_limit_triggered,omitempty"` diff --git a/typedapi/types/nodescredentials.go b/typedapi/types/nodescredentials.go index d532445809..abd6782ecc 100644 --- a/typedapi/types/nodescredentials.go +++ b/typedapi/types/nodescredentials.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodesCredentials type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_service_credentials/types.ts#L23-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_service_credentials/types.ts#L23-L28 type NodesCredentials struct { // FileTokens File-backed tokens collected from all nodes FileTokens map[string]NodesCredentialsFileToken `json:"file_tokens"` diff --git a/typedapi/types/nodescredentialsfiletoken.go b/typedapi/types/nodescredentialsfiletoken.go index 59c9ff65ac..393b5775ff 100644 --- a/typedapi/types/nodescredentialsfiletoken.go +++ b/typedapi/types/nodescredentialsfiletoken.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodesCredentialsFileToken type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_service_credentials/types.ts#L30-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_service_credentials/types.ts#L30-L32 type NodesCredentialsFileToken struct { Nodes []string `json:"nodes"` } diff --git a/typedapi/types/nodeshard.go b/typedapi/types/nodeshard.go index eae117454e..55668c22ac 100644 --- a/typedapi/types/nodeshard.go +++ b/typedapi/types/nodeshard.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NodeShard type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Node.ts#L60-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Node.ts#L60-L71 type NodeShard struct { AllocationId map[string]string `json:"allocation_id,omitempty"` Index string `json:"index"` diff --git a/typedapi/types/nodeshutdownstatus.go b/typedapi/types/nodeshutdownstatus.go index 1416a02306..cfb0f97a5d 100644 --- a/typedapi/types/nodeshutdownstatus.go +++ b/typedapi/types/nodeshutdownstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // NodeShutdownStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L29-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L29-L38 type NodeShutdownStatus struct { NodeId string `json:"node_id"` PersistentTasks PersistentTaskStatus `json:"persistent_tasks"` diff --git a/typedapi/types/nodesindexingpressure.go b/typedapi/types/nodesindexingpressure.go index 75d3ba85d3..fd684397e0 100644 --- a/typedapi/types/nodesindexingpressure.go +++ b/typedapi/types/nodesindexingpressure.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodesIndexingPressure type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L116-L121 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L116-L121 type NodesIndexingPressure struct { // Memory Contains statistics for memory consumption from indexing load. Memory *NodesIndexingPressureMemory `json:"memory,omitempty"` diff --git a/typedapi/types/nodesindexingpressurememory.go b/typedapi/types/nodesindexingpressurememory.go index 7ce34d7d1f..4afff7efbc 100644 --- a/typedapi/types/nodesindexingpressurememory.go +++ b/typedapi/types/nodesindexingpressurememory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodesIndexingPressureMemory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L123-L142 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L123-L142 type NodesIndexingPressureMemory struct { // Current Contains statistics for current indexing load. Current *PressureMemory `json:"current,omitempty"` diff --git a/typedapi/types/nodesingest.go b/typedapi/types/nodesingest.go index 184bc3bae6..e83776ed8e 100644 --- a/typedapi/types/nodesingest.go +++ b/typedapi/types/nodesingest.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // NodesIngest type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L345-L354 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L345-L354 type NodesIngest struct { // Pipelines Contains statistics about ingest pipelines for the node. Pipelines map[string]IngestTotal `json:"pipelines,omitempty"` diff --git a/typedapi/types/nodesrecord.go b/typedapi/types/nodesrecord.go index 0778f415ed..5038479039 100644 --- a/typedapi/types/nodesrecord.go +++ b/typedapi/types/nodesrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodesRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/nodes/types.ts#L23-L542 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/nodes/types.ts#L23-L542 type NodesRecord struct { // Build The Elasticsearch build hash. Build *string `json:"build,omitempty"` diff --git a/typedapi/types/nodestatistics.go b/typedapi/types/nodestatistics.go index 0a40c149a7..6ef10c580e 100644 --- a/typedapi/types/nodestatistics.go +++ b/typedapi/types/nodestatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Node.ts#L28-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Node.ts#L28-L39 type NodeStatistics struct { // Failed Number of nodes that rejected the request or failed to respond. If this value // is not 0, a reason for the rejection or failure is included in the response. diff --git a/typedapi/types/nodetasks.go b/typedapi/types/nodetasks.go index e45ab4ace0..e1a1520ce3 100644 --- a/typedapi/types/nodetasks.go +++ b/typedapi/types/nodetasks.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // NodeTasks type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/tasks/_types/TaskListResponseBase.ts#L49-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/tasks/_types/TaskListResponseBase.ts#L49-L57 type NodeTasks struct { Attributes map[string]string `json:"attributes,omitempty"` Host *string `json:"host,omitempty"` diff --git a/typedapi/types/nodethreadpoolinfo.go b/typedapi/types/nodethreadpoolinfo.go index de4f881a76..f7de9a99d4 100644 --- a/typedapi/types/nodethreadpoolinfo.go +++ b/typedapi/types/nodethreadpoolinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // NodeThreadPoolInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/info/types.ts#L289-L296 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/info/types.ts#L289-L296 type NodeThreadPoolInfo struct { Core *int `json:"core,omitempty"` KeepAlive Duration `json:"keep_alive,omitempty"` diff --git a/typedapi/types/nodeusage.go b/typedapi/types/nodeusage.go index 3f95dcfaed..12d59612ad 100644 --- a/typedapi/types/nodeusage.go +++ b/typedapi/types/nodeusage.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // NodeUsage type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/usage/types.ts#L25-L30 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/usage/types.ts#L25-L30 type NodeUsage struct { Aggregations map[string]json.RawMessage `json:"aggregations"` RestActions map[string]int `json:"rest_actions"` diff --git a/typedapi/types/norianalyzer.go b/typedapi/types/norianalyzer.go index 31c8faabde..cc5ad73cf5 100644 --- a/typedapi/types/norianalyzer.go +++ b/typedapi/types/norianalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NoriAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L66-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L66-L72 type NoriAnalyzer struct { DecompoundMode *noridecompoundmode.NoriDecompoundMode `json:"decompound_mode,omitempty"` Stoptags []string `json:"stoptags,omitempty"` diff --git a/typedapi/types/noripartofspeechtokenfilter.go b/typedapi/types/noripartofspeechtokenfilter.go index 54716cea4e..c4a0a6a60a 100644 --- a/typedapi/types/noripartofspeechtokenfilter.go +++ b/typedapi/types/noripartofspeechtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // NoriPartOfSpeechTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L273-L276 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L273-L276 type NoriPartOfSpeechTokenFilter struct { Stoptags []string `json:"stoptags,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/noritokenizer.go b/typedapi/types/noritokenizer.go index 3eba617f9d..b250828c36 100644 --- a/typedapi/types/noritokenizer.go +++ b/typedapi/types/noritokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NoriTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L81-L87 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L81-L87 type NoriTokenizer struct { DecompoundMode *noridecompoundmode.NoriDecompoundMode `json:"decompound_mode,omitempty"` DiscardPunctuation *bool `json:"discard_punctuation,omitempty"` diff --git a/typedapi/types/normalizeaggregation.go b/typedapi/types/normalizeaggregation.go index 6ef6b988bb..bb76035882 100644 --- a/typedapi/types/normalizeaggregation.go +++ b/typedapi/types/normalizeaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // NormalizeAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L321-L326 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L321-L326 type NormalizeAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/normalizer.go b/typedapi/types/normalizer.go index 64f403f821..33add8eac7 100644 --- a/typedapi/types/normalizer.go +++ b/typedapi/types/normalizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // LowercaseNormalizer // CustomNormalizer // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/normalizers.ts#L20-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/normalizers.ts#L20-L24 type Normalizer interface{} diff --git a/typedapi/types/numberrangequery.go b/typedapi/types/numberrangequery.go index 10ec0010a9..732b9df4bb 100644 --- a/typedapi/types/numberrangequery.go +++ b/typedapi/types/numberrangequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // NumberRangeQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L145-L164 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L145-L164 type NumberRangeQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/numericdecayfunction.go b/typedapi/types/numericdecayfunction.go index cbc2e3558f..ac1f142b4b 100644 --- a/typedapi/types/numericdecayfunction.go +++ b/typedapi/types/numericdecayfunction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // NumericDecayFunction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L182-L184 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L182-L184 type NumericDecayFunction struct { // MultiValueMode Determines how the distance is calculated when a field used for computing the // decay contains multiple values. diff --git a/typedapi/types/numericfielddata.go b/typedapi/types/numericfielddata.go index eaee678e05..cb99c3655a 100644 --- a/typedapi/types/numericfielddata.go +++ b/typedapi/types/numericfielddata.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // NumericFielddata type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/NumericFielddata.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/NumericFielddata.ts#L22-L24 type NumericFielddata struct { Format numericfielddataformat.NumericFielddataFormat `json:"format"` } diff --git a/typedapi/types/objectproperty.go b/typedapi/types/objectproperty.go index 55669a95bc..eb118ed70c 100644 --- a/typedapi/types/objectproperty.go +++ b/typedapi/types/objectproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ObjectProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/complex.ts#L46-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/complex.ts#L46-L49 type ObjectProperty struct { CopyTo []string `json:"copy_to,omitempty"` Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` @@ -215,6 +215,12 @@ func (s *ObjectProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -540,6 +546,12 @@ func (s *ObjectProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/onehotencodingpreprocessor.go b/typedapi/types/onehotencodingpreprocessor.go index 33bc5173fb..5f4ee414a5 100644 --- a/typedapi/types/onehotencodingpreprocessor.go +++ b/typedapi/types/onehotencodingpreprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // OneHotEncodingPreprocessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L44-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L44-L47 type OneHotEncodingPreprocessor struct { Field string `json:"field"` HotMap map[string]string `json:"hot_map"` diff --git a/typedapi/types/operatingsystem.go b/typedapi/types/operatingsystem.go index a4dc52f16c..4f4b506eb1 100644 --- a/typedapi/types/operatingsystem.go +++ b/typedapi/types/operatingsystem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // OperatingSystem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L945-L951 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L945-L951 type OperatingSystem struct { Cgroup *Cgroup `json:"cgroup,omitempty"` Cpu *Cpu `json:"cpu,omitempty"` diff --git a/typedapi/types/operatingsystemmemoryinfo.go b/typedapi/types/operatingsystemmemoryinfo.go index 62e72230c9..5329e17bb9 100644 --- a/typedapi/types/operatingsystemmemoryinfo.go +++ b/typedapi/types/operatingsystemmemoryinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // OperatingSystemMemoryInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/stats/types.ts#L541-L568 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/stats/types.ts#L541-L568 type OperatingSystemMemoryInfo struct { // AdjustedTotalInBytes Total amount, in bytes, of memory across all selected nodes, but using the // value specified using the `es.total_memory_bytes` system property instead of diff --git a/typedapi/types/operationcontainer.go b/typedapi/types/operationcontainer.go index 7ee4d4e452..1a24cf3791 100644 --- a/typedapi/types/operationcontainer.go +++ b/typedapi/types/operationcontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // OperationContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/types.ts#L145-L167 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/types.ts#L145-L167 type OperationContainer struct { // Create Indexes the specified document if it does not already exist. // The following line must contain the source data to be indexed. diff --git a/typedapi/types/outlierdetectionparameters.go b/typedapi/types/outlierdetectionparameters.go index 7ed0250e86..7ec74b03f4 100644 --- a/typedapi/types/outlierdetectionparameters.go +++ b/typedapi/types/outlierdetectionparameters.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // OutlierDetectionParameters type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L527-L561 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L527-L561 type OutlierDetectionParameters struct { // ComputeFeatureInfluence Specifies whether the feature influence calculation is enabled. ComputeFeatureInfluence *bool `json:"compute_feature_influence,omitempty"` diff --git a/typedapi/types/overallbucket.go b/typedapi/types/overallbucket.go index 3fde860abb..83bb7e216b 100644 --- a/typedapi/types/overallbucket.go +++ b/typedapi/types/overallbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // OverallBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Bucket.ts#L130-L145 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Bucket.ts#L130-L145 type OverallBucket struct { // BucketSpan The length of the bucket in seconds. Matches the job with the longest // bucket_span value. diff --git a/typedapi/types/overallbucketjob.go b/typedapi/types/overallbucketjob.go index e69c5e235f..73f826288c 100644 --- a/typedapi/types/overallbucketjob.go +++ b/typedapi/types/overallbucketjob.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // OverallBucketJob type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Bucket.ts#L146-L149 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Bucket.ts#L146-L149 type OverallBucketJob struct { JobId string `json:"job_id"` MaxAnomalyScore Float64 `json:"max_anomaly_score"` diff --git a/typedapi/types/overlapping.go b/typedapi/types/overlapping.go index cebca4f73a..8603c69869 100644 --- a/typedapi/types/overlapping.go +++ b/typedapi/types/overlapping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Overlapping type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/simulate_template/IndicesSimulateTemplateResponse.ts#L39-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/simulate_template/IndicesSimulateTemplateResponse.ts#L39-L42 type Overlapping struct { IndexPatterns []string `json:"index_patterns"` Name string `json:"name"` diff --git a/typedapi/types/page.go b/typedapi/types/page.go index 6918bcbec0..112ed63672 100644 --- a/typedapi/types/page.go +++ b/typedapi/types/page.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Page type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Page.ts#L22-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Page.ts#L22-L33 type Page struct { // From Skips the specified number of items. From *int `json:"from,omitempty"` diff --git a/typedapi/types/pagerdutyaction.go b/typedapi/types/pagerdutyaction.go index 69536deb7b..39a1316a31 100644 --- a/typedapi/types/pagerdutyaction.go +++ b/typedapi/types/pagerdutyaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // PagerDutyAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L54-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L54-L54 type PagerDutyAction struct { Account *string `json:"account,omitempty"` AttachPayload bool `json:"attach_payload"` diff --git a/typedapi/types/pagerdutycontext.go b/typedapi/types/pagerdutycontext.go index 3fad3cbd6e..ba11e8994c 100644 --- a/typedapi/types/pagerdutycontext.go +++ b/typedapi/types/pagerdutycontext.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // PagerDutyContext type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L61-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L61-L65 type PagerDutyContext struct { Href *string `json:"href,omitempty"` Src *string `json:"src,omitempty"` diff --git a/typedapi/types/pagerdutyevent.go b/typedapi/types/pagerdutyevent.go index 946cf0e9ca..7eb01254a5 100644 --- a/typedapi/types/pagerdutyevent.go +++ b/typedapi/types/pagerdutyevent.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // PagerDutyEvent type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L40-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L40-L52 type PagerDutyEvent struct { Account *string `json:"account,omitempty"` AttachPayload bool `json:"attach_payload"` diff --git a/typedapi/types/pagerdutyeventproxy.go b/typedapi/types/pagerdutyeventproxy.go index 53758b967a..252cbb548a 100644 --- a/typedapi/types/pagerdutyeventproxy.go +++ b/typedapi/types/pagerdutyeventproxy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PagerDutyEventProxy type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L56-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L56-L59 type PagerDutyEventProxy struct { Host *string `json:"host,omitempty"` Port *int `json:"port,omitempty"` diff --git a/typedapi/types/pagerdutyresult.go b/typedapi/types/pagerdutyresult.go index 337ac16897..fd252ae230 100644 --- a/typedapi/types/pagerdutyresult.go +++ b/typedapi/types/pagerdutyresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PagerDutyResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L78-L83 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L78-L83 type PagerDutyResult struct { Event PagerDutyEvent `json:"event"` Reason *string `json:"reason,omitempty"` diff --git a/typedapi/types/painlesscontextsetup.go b/typedapi/types/painlesscontextsetup.go index fa1aa30476..258c4151db 100644 --- a/typedapi/types/painlesscontextsetup.go +++ b/typedapi/types/painlesscontextsetup.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // PainlessContextSetup type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/scripts_painless_execute/types.ts#L25-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/scripts_painless_execute/types.ts#L25-L39 type PainlessContextSetup struct { // Document Document that’s temporarily indexed in-memory and accessible from the script. Document json.RawMessage `json:"document,omitempty"` diff --git a/typedapi/types/parentaggregate.go b/typedapi/types/parentaggregate.go index 34589ff60f..eb4cf3cc59 100644 --- a/typedapi/types/parentaggregate.go +++ b/typedapi/types/parentaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ParentAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L779-L780 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L779-L780 type ParentAggregate struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/parentaggregation.go b/typedapi/types/parentaggregation.go index fcb816458d..e9815dedc2 100644 --- a/typedapi/types/parentaggregation.go +++ b/typedapi/types/parentaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ParentAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L643-L648 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L643-L648 type ParentAggregation struct { Meta Metadata `json:"meta,omitempty"` Name *string `json:"name,omitempty"` diff --git a/typedapi/types/parentidquery.go b/typedapi/types/parentidquery.go index da07be5d96..4721ffd85b 100644 --- a/typedapi/types/parentidquery.go +++ b/typedapi/types/parentidquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ParentIdQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/joining.ts#L132-L146 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/joining.ts#L132-L146 type ParentIdQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/parenttaskinfo.go b/typedapi/types/parenttaskinfo.go index 23acc5454b..201f5c08cd 100644 --- a/typedapi/types/parenttaskinfo.go +++ b/typedapi/types/parenttaskinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ParentTaskInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/tasks/_types/TaskListResponseBase.ts#L45-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/tasks/_types/TaskListResponseBase.ts#L45-L47 type ParentTaskInfo struct { Action string `json:"action"` Cancellable bool `json:"cancellable"` diff --git a/typedapi/types/passthroughinferenceoptions.go b/typedapi/types/passthroughinferenceoptions.go index 616414c1a1..8f9270ce3c 100644 --- a/typedapi/types/passthroughinferenceoptions.go +++ b/typedapi/types/passthroughinferenceoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PassThroughInferenceOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L224-L231 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L224-L231 type PassThroughInferenceOptions struct { // ResultsField The field that is added to incoming documents to contain the inference // prediction. Defaults to predicted_value. diff --git a/typedapi/types/passthroughinferenceupdateoptions.go b/typedapi/types/passthroughinferenceupdateoptions.go index 273dc49ce5..a33b186e49 100644 --- a/typedapi/types/passthroughinferenceupdateoptions.go +++ b/typedapi/types/passthroughinferenceupdateoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PassThroughInferenceUpdateOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L385-L390 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L385-L390 type PassThroughInferenceUpdateOptions struct { // ResultsField The field that is added to incoming documents to contain the inference // prediction. Defaults to predicted_value. diff --git a/typedapi/types/pathhierarchytokenizer.go b/typedapi/types/pathhierarchytokenizer.go index fe3e5babe0..10f35ebe3a 100644 --- a/typedapi/types/pathhierarchytokenizer.go +++ b/typedapi/types/pathhierarchytokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,11 +30,11 @@ import ( // PathHierarchyTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L89-L96 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L89-L96 type PathHierarchyTokenizer struct { BufferSize Stringifiedinteger `json:"buffer_size"` Delimiter string `json:"delimiter"` - Replacement string `json:"replacement"` + Replacement *string `json:"replacement,omitempty"` Reverse Stringifiedboolean `json:"reverse"` Skip Stringifiedinteger `json:"skip"` Type string `json:"type,omitempty"` @@ -83,7 +83,7 @@ func (s *PathHierarchyTokenizer) UnmarshalJSON(data []byte) error { if err != nil { o = string(tmp[:]) } - s.Replacement = o + s.Replacement = &o case "reverse": if err := dec.Decode(&s.Reverse); err != nil { diff --git a/typedapi/types/patternanalyzer.go b/typedapi/types/patternanalyzer.go index 7b1288be57..1ad2f2d64a 100644 --- a/typedapi/types/patternanalyzer.go +++ b/typedapi/types/patternanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PatternAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L74-L81 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L74-L81 type PatternAnalyzer struct { Flags *string `json:"flags,omitempty"` Lowercase *bool `json:"lowercase,omitempty"` diff --git a/typedapi/types/patterncapturetokenfilter.go b/typedapi/types/patterncapturetokenfilter.go index ccd15def3a..f4e62d2121 100644 --- a/typedapi/types/patterncapturetokenfilter.go +++ b/typedapi/types/patterncapturetokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // PatternCaptureTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L278-L282 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L278-L282 type PatternCaptureTokenFilter struct { Patterns []string `json:"patterns"` PreserveOriginal Stringifiedboolean `json:"preserve_original,omitempty"` diff --git a/typedapi/types/patternreplacecharfilter.go b/typedapi/types/patternreplacecharfilter.go index 20083fd4e4..009109a007 100644 --- a/typedapi/types/patternreplacecharfilter.go +++ b/typedapi/types/patternreplacecharfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PatternReplaceCharFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/char_filters.ts#L53-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/char_filters.ts#L53-L58 type PatternReplaceCharFilter struct { Flags *string `json:"flags,omitempty"` Pattern string `json:"pattern"` diff --git a/typedapi/types/patternreplacetokenfilter.go b/typedapi/types/patternreplacetokenfilter.go index 5d8d9e3926..8b9780ad24 100644 --- a/typedapi/types/patternreplacetokenfilter.go +++ b/typedapi/types/patternreplacetokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PatternReplaceTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L284-L290 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L284-L290 type PatternReplaceTokenFilter struct { All *bool `json:"all,omitempty"` Flags *string `json:"flags,omitempty"` diff --git a/typedapi/types/patterntokenizer.go b/typedapi/types/patterntokenizer.go index caa61d1dd6..5e1e2a6635 100644 --- a/typedapi/types/patterntokenizer.go +++ b/typedapi/types/patterntokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PatternTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L98-L103 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L98-L103 type PatternTokenizer struct { Flags *string `json:"flags,omitempty"` Group *int `json:"group,omitempty"` diff --git a/typedapi/types/pendingtask.go b/typedapi/types/pendingtask.go index a2084fc89f..e68f073be8 100644 --- a/typedapi/types/pendingtask.go +++ b/typedapi/types/pendingtask.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PendingTask type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/pending_tasks/types.ts#L23-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/pending_tasks/types.ts#L23-L47 type PendingTask struct { // Executing Indicates whether the pending tasks are currently executing or not. Executing bool `json:"executing"` diff --git a/typedapi/types/pendingtasksrecord.go b/typedapi/types/pendingtasksrecord.go index c7ef3d975f..0367d069ed 100644 --- a/typedapi/types/pendingtasksrecord.go +++ b/typedapi/types/pendingtasksrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PendingTasksRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/pending_tasks/types.ts#L20-L41 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/pending_tasks/types.ts#L20-L41 type PendingTasksRecord struct { // InsertOrder The task insertion order. InsertOrder *string `json:"insertOrder,omitempty"` diff --git a/typedapi/types/percentage.go b/typedapi/types/percentage.go index a75a27087b..3a48c8e75f 100644 --- a/typedapi/types/percentage.go +++ b/typedapi/types/percentage.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // float32 // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Numeric.ts#L28-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Numeric.ts#L28-L28 type Percentage interface{} diff --git a/typedapi/types/percentagescoreheuristic.go b/typedapi/types/percentagescoreheuristic.go index 2d21d99ee7..bd4f205e45 100644 --- a/typedapi/types/percentagescoreheuristic.go +++ b/typedapi/types/percentagescoreheuristic.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // PercentageScoreHeuristic type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L764-L764 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L764-L764 type PercentageScoreHeuristic struct { } diff --git a/typedapi/types/percentileranksaggregation.go b/typedapi/types/percentileranksaggregation.go index a5b498a4af..adc378d517 100644 --- a/typedapi/types/percentileranksaggregation.go +++ b/typedapi/types/percentileranksaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PercentileRanksAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L174-L193 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L174-L193 type PercentileRanksAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/percentiles.go b/typedapi/types/percentiles.go index 7c7da903f3..1763e4d6cb 100644 --- a/typedapi/types/percentiles.go +++ b/typedapi/types/percentiles.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // KeyedPercentiles // []ArrayPercentilesItem // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L150-L151 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L150-L151 type Percentiles interface{} diff --git a/typedapi/types/percentilesaggregation.go b/typedapi/types/percentilesaggregation.go index 04f16d7ded..f6912b779c 100644 --- a/typedapi/types/percentilesaggregation.go +++ b/typedapi/types/percentilesaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PercentilesAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L195-L214 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L195-L214 type PercentilesAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/percentilesbucketaggregate.go b/typedapi/types/percentilesbucketaggregate.go index a2aa45cfb5..de406aa4d5 100644 --- a/typedapi/types/percentilesbucketaggregate.go +++ b/typedapi/types/percentilesbucketaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // PercentilesBucketAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L178-L179 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L178-L179 type PercentilesBucketAggregate struct { Meta Metadata `json:"meta,omitempty"` Values Percentiles `json:"values"` diff --git a/typedapi/types/percentilesbucketaggregation.go b/typedapi/types/percentilesbucketaggregation.go index a597e98489..2eb7efbe9b 100644 --- a/typedapi/types/percentilesbucketaggregation.go +++ b/typedapi/types/percentilesbucketaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // PercentilesBucketAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L356-L361 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L356-L361 type PercentilesBucketAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/percolatequery.go b/typedapi/types/percolatequery.go index bb904db1c0..57281195e4 100644 --- a/typedapi/types/percolatequery.go +++ b/typedapi/types/percolatequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PercolateQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L193-L230 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L193-L230 type PercolateQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/percolatorproperty.go b/typedapi/types/percolatorproperty.go index 888a6e57e6..2900060825 100644 --- a/typedapi/types/percolatorproperty.go +++ b/typedapi/types/percolatorproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // PercolatorProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L180-L182 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L180-L182 type PercolatorProperty struct { Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` Fields map[string]Property `json:"fields,omitempty"` @@ -181,6 +181,12 @@ func (s *PercolatorProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -506,6 +512,12 @@ func (s *PercolatorProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/perpartitioncategorization.go b/typedapi/types/perpartitioncategorization.go index f197b157c5..324f8c4dae 100644 --- a/typedapi/types/perpartitioncategorization.go +++ b/typedapi/types/perpartitioncategorization.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PerPartitionCategorization type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Analysis.ts#L150-L159 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Analysis.ts#L150-L159 type PerPartitionCategorization struct { // Enabled To enable this setting, you must also set the `partition_field_name` property // to the same value in every detector that uses the keyword `mlcategory`. diff --git a/typedapi/types/persistenttaskstatus.go b/typedapi/types/persistenttaskstatus.go index 5d3318b764..5f2bf37609 100644 --- a/typedapi/types/persistenttaskstatus.go +++ b/typedapi/types/persistenttaskstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // PersistentTaskStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L56-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L56-L58 type PersistentTaskStatus struct { Status shutdownstatus.ShutdownStatus `json:"status"` } diff --git a/typedapi/types/phase.go b/typedapi/types/phase.go index 328b866ed7..d5588d1d8f 100644 --- a/typedapi/types/phase.go +++ b/typedapi/types/phase.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Phase type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/_types/Phase.ts#L25-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/_types/Phase.ts#L25-L36 type Phase struct { Actions json.RawMessage `json:"actions,omitempty"` Configurations *Configurations `json:"configurations,omitempty"` diff --git a/typedapi/types/phases.go b/typedapi/types/phases.go index 925399699a..e427a65204 100644 --- a/typedapi/types/phases.go +++ b/typedapi/types/phases.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Phases type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/_types/Phase.ts#L38-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/_types/Phase.ts#L38-L44 type Phases struct { Cold *Phase `json:"cold,omitempty"` Delete *Phase `json:"delete,omitempty"` diff --git a/typedapi/types/phonetictokenfilter.go b/typedapi/types/phonetictokenfilter.go index 5c204ffb2c..203a16db13 100644 --- a/typedapi/types/phonetictokenfilter.go +++ b/typedapi/types/phonetictokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -35,7 +35,7 @@ import ( // PhoneticTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/phonetic-plugin.ts#L64-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/phonetic-plugin.ts#L64-L72 type PhoneticTokenFilter struct { Encoder phoneticencoder.PhoneticEncoder `json:"encoder"` Languageset []phoneticlanguage.PhoneticLanguage `json:"languageset"` diff --git a/typedapi/types/phrasesuggest.go b/typedapi/types/phrasesuggest.go index 5a617ba693..5d890c142e 100644 --- a/typedapi/types/phrasesuggest.go +++ b/typedapi/types/phrasesuggest.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PhraseSuggest type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L57-L62 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L57-L62 type PhraseSuggest struct { Length int `json:"length"` Offset int `json:"offset"` diff --git a/typedapi/types/phrasesuggestcollate.go b/typedapi/types/phrasesuggestcollate.go index 3156c8e564..1c3b899249 100644 --- a/typedapi/types/phrasesuggestcollate.go +++ b/typedapi/types/phrasesuggestcollate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PhraseSuggestCollate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L330-L343 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L330-L343 type PhraseSuggestCollate struct { // Params Parameters to use if the query is templated. Params map[string]json.RawMessage `json:"params,omitempty"` diff --git a/typedapi/types/phrasesuggestcollatequery.go b/typedapi/types/phrasesuggestcollatequery.go index 21e259a6cd..ba14a6565e 100644 --- a/typedapi/types/phrasesuggestcollatequery.go +++ b/typedapi/types/phrasesuggestcollatequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PhraseSuggestCollateQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L345-L354 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L345-L354 type PhraseSuggestCollateQuery struct { // Id The search template ID. Id *string `json:"id,omitempty"` diff --git a/typedapi/types/phrasesuggester.go b/typedapi/types/phrasesuggester.go index 7b0d183588..0a5e5264e6 100644 --- a/typedapi/types/phrasesuggester.go +++ b/typedapi/types/phrasesuggester.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PhraseSuggester type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L356-L414 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L356-L414 type PhraseSuggester struct { // Analyzer The analyzer to analyze the suggest text with. // Defaults to the search analyzer of the suggest field. diff --git a/typedapi/types/phrasesuggesthighlight.go b/typedapi/types/phrasesuggesthighlight.go index b894ecbd35..9bcf4cb64a 100644 --- a/typedapi/types/phrasesuggesthighlight.go +++ b/typedapi/types/phrasesuggesthighlight.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PhraseSuggestHighlight type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L416-L425 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L416-L425 type PhraseSuggestHighlight struct { // PostTag Use in conjunction with `pre_tag` to define the HTML tags to use for the // highlighted text. diff --git a/typedapi/types/phrasesuggestoption.go b/typedapi/types/phrasesuggestoption.go index 7e67e183aa..4a4d6d9f47 100644 --- a/typedapi/types/phrasesuggestoption.go +++ b/typedapi/types/phrasesuggestoption.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PhraseSuggestOption type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L86-L91 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L86-L91 type PhraseSuggestOption struct { CollateMatch *bool `json:"collate_match,omitempty"` Highlighted *string `json:"highlighted,omitempty"` diff --git a/typedapi/types/pinneddoc.go b/typedapi/types/pinneddoc.go index 669a2bfe19..763a2da683 100644 --- a/typedapi/types/pinneddoc.go +++ b/typedapi/types/pinneddoc.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // PinnedDoc type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L253-L262 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L253-L262 type PinnedDoc struct { // Id_ The unique document ID. Id_ string `json:"_id"` diff --git a/typedapi/types/pinnedquery.go b/typedapi/types/pinnedquery.go index dd09624c91..9f48d87333 100644 --- a/typedapi/types/pinnedquery.go +++ b/typedapi/types/pinnedquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PinnedQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L232-L251 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L232-L251 type PinnedQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/pipelineconfig.go b/typedapi/types/pipelineconfig.go index e26ea6ad53..8003070b4e 100644 --- a/typedapi/types/pipelineconfig.go +++ b/typedapi/types/pipelineconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PipelineConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Pipeline.ts#L57-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Pipeline.ts#L61-L75 type PipelineConfig struct { // Description Description of the ingest pipeline. Description *string `json:"description,omitempty"` diff --git a/typedapi/types/pipelinemetadata.go b/typedapi/types/pipelinemetadata.go index 30c2afd306..3753a98e64 100644 --- a/typedapi/types/pipelinemetadata.go +++ b/typedapi/types/pipelinemetadata.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PipelineMetadata type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/logstash/_types/Pipeline.ts#L23-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/logstash/_types/Pipeline.ts#L23-L26 type PipelineMetadata struct { Type string `json:"type"` Version string `json:"version"` diff --git a/typedapi/types/pipelineprocessor.go b/typedapi/types/pipelineprocessor.go index c16199bfa6..db4302787a 100644 --- a/typedapi/types/pipelineprocessor.go +++ b/typedapi/types/pipelineprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PipelineProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L917-L928 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L917-L928 type PipelineProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/pipelinesettings.go b/typedapi/types/pipelinesettings.go index 0dd05fd483..95f9ef4d63 100644 --- a/typedapi/types/pipelinesettings.go +++ b/typedapi/types/pipelinesettings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PipelineSettings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/logstash/_types/Pipeline.ts#L28-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/logstash/_types/Pipeline.ts#L28-L59 type PipelineSettings struct { // PipelineBatchDelay When creating pipeline event batches, how long in milliseconds to wait for // each event before dispatching an undersized batch to pipeline workers. diff --git a/typedapi/types/pipelinesimulation.go b/typedapi/types/pipelinesimulation.go index f20b908a0e..79558a83ab 100644 --- a/typedapi/types/pipelinesimulation.go +++ b/typedapi/types/pipelinesimulation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // PipelineSimulation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/simulate/types.ts#L33-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/simulate/types.ts#L33-L39 type PipelineSimulation struct { Doc *DocumentSimulation `json:"doc,omitempty"` ProcessorResults []PipelineSimulation `json:"processor_results,omitempty"` diff --git a/typedapi/types/pipeseparatedflagssimplequerystringflag.go b/typedapi/types/pipeseparatedflagssimplequerystringflag.go index 5b34ce11c3..b99675efe5 100644 --- a/typedapi/types/pipeseparatedflagssimplequerystringflag.go +++ b/typedapi/types/pipeseparatedflagssimplequerystringflag.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // simplequerystringflag.SimpleQueryStringFlag // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_spec_utils/PipeSeparatedFlags.ts#L20-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_spec_utils/PipeSeparatedFlags.ts#L20-L27 type PipeSeparatedFlagsSimpleQueryStringFlag interface{} diff --git a/typedapi/types/pivot.go b/typedapi/types/pivot.go index 4ab778b043..b5e90487f1 100644 --- a/typedapi/types/pivot.go +++ b/typedapi/types/pivot.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Pivot type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/_types/Transform.ts#L54-L68 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/_types/Transform.ts#L54-L68 type Pivot struct { // Aggregations Defines how to aggregate the grouped data. The following aggregations are // currently supported: average, bucket diff --git a/typedapi/types/pivotgroupbycontainer.go b/typedapi/types/pivotgroupbycontainer.go index 190609f7c5..9173e7a697 100644 --- a/typedapi/types/pivotgroupbycontainer.go +++ b/typedapi/types/pivotgroupbycontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // PivotGroupByContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/_types/Transform.ts#L70-L78 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/_types/Transform.ts#L70-L78 type PivotGroupByContainer struct { DateHistogram *DateHistogramAggregation `json:"date_histogram,omitempty"` GeotileGrid *GeoTileGridAggregation `json:"geotile_grid,omitempty"` diff --git a/typedapi/types/pluginsrecord.go b/typedapi/types/pluginsrecord.go index d5e8a0b2e3..adfe0a560b 100644 --- a/typedapi/types/pluginsrecord.go +++ b/typedapi/types/pluginsrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PluginsRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/plugins/types.ts#L22-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/plugins/types.ts#L22-L52 type PluginsRecord struct { // Component The component name. Component *string `json:"component,omitempty"` diff --git a/typedapi/types/pluginsstatus.go b/typedapi/types/pluginsstatus.go index 14e16326f9..241e413c4c 100644 --- a/typedapi/types/pluginsstatus.go +++ b/typedapi/types/pluginsstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // PluginsStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L60-L62 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L60-L62 type PluginsStatus struct { Status shutdownstatus.ShutdownStatus `json:"status"` } diff --git a/typedapi/types/pluginstats.go b/typedapi/types/pluginstats.go index 6b29a7bc8e..e71b3290fe 100644 --- a/typedapi/types/pluginstats.go +++ b/typedapi/types/pluginstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PluginStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L180-L190 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L180-L190 type PluginStats struct { Classname string `json:"classname"` Description string `json:"description"` diff --git a/typedapi/types/pointintimereference.go b/typedapi/types/pointintimereference.go index 92e5e52fb9..325cc95d81 100644 --- a/typedapi/types/pointintimereference.go +++ b/typedapi/types/pointintimereference.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // PointInTimeReference type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/PointInTimeReference.ts#L23-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/PointInTimeReference.ts#L23-L26 type PointInTimeReference struct { Id string `json:"id"` KeepAlive Duration `json:"keep_alive,omitempty"` diff --git a/typedapi/types/pointproperty.go b/typedapi/types/pointproperty.go index 5b1d9f9fc9..ff5715d592 100644 --- a/typedapi/types/pointproperty.go +++ b/typedapi/types/pointproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // PointProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/geo.ts#L62-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/geo.ts#L62-L67 type PointProperty struct { CopyTo []string `json:"copy_to,omitempty"` DocValues *bool `json:"doc_values,omitempty"` @@ -218,6 +218,12 @@ func (s *PointProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -583,6 +589,12 @@ func (s *PointProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/pool.go b/typedapi/types/pool.go index 25b1f5f936..e67005e7b6 100644 --- a/typedapi/types/pool.go +++ b/typedapi/types/pool.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Pool type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L878-L895 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L878-L895 type Pool struct { // MaxInBytes Maximum amount of memory, in bytes, available for use by the heap. MaxInBytes *int64 `json:"max_in_bytes,omitempty"` diff --git a/typedapi/types/porterstemtokenfilter.go b/typedapi/types/porterstemtokenfilter.go index 1f54a662a9..7dca3b098d 100644 --- a/typedapi/types/porterstemtokenfilter.go +++ b/typedapi/types/porterstemtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // PorterStemTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L292-L294 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L292-L294 type PorterStemTokenFilter struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/postmigrationfeature.go b/typedapi/types/postmigrationfeature.go index 01c1e8c167..5621bf4aae 100644 --- a/typedapi/types/postmigrationfeature.go +++ b/typedapi/types/postmigrationfeature.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PostMigrationFeature type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/migration/post_feature_upgrade/PostFeatureUpgradeResponse.ts#L27-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/migration/post_feature_upgrade/PostFeatureUpgradeResponse.ts#L27-L29 type PostMigrationFeature struct { FeatureName string `json:"feature_name"` } diff --git a/typedapi/types/predicatetokenfilter.go b/typedapi/types/predicatetokenfilter.go index 981ce39e02..f6a0a8c22d 100644 --- a/typedapi/types/predicatetokenfilter.go +++ b/typedapi/types/predicatetokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // PredicateTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L296-L299 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L296-L299 type PredicateTokenFilter struct { Script Script `json:"script"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/predictedvalue.go b/typedapi/types/predictedvalue.go index 4990c43f2e..5dda60b1d5 100644 --- a/typedapi/types/predictedvalue.go +++ b/typedapi/types/predictedvalue.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -27,5 +27,5 @@ package types // bool // int // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L457-L457 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L457-L457 type PredictedValue interface{} diff --git a/typedapi/types/prefixquery.go b/typedapi/types/prefixquery.go index 248d7bbc88..237f1c9a42 100644 --- a/typedapi/types/prefixquery.go +++ b/typedapi/types/prefixquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PrefixQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L87-L106 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L87-L106 type PrefixQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/preprocessor.go b/typedapi/types/preprocessor.go index 02404ffcc2..b14c9c6fbd 100644 --- a/typedapi/types/preprocessor.go +++ b/typedapi/types/preprocessor.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Preprocessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L31-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L31-L36 type Preprocessor struct { FrequencyEncoding *FrequencyEncodingPreprocessor `json:"frequency_encoding,omitempty"` OneHotEncoding *OneHotEncodingPreprocessor `json:"one_hot_encoding,omitempty"` diff --git a/typedapi/types/pressurememory.go b/typedapi/types/pressurememory.go index a8ae66642f..8ecb1ea391 100644 --- a/typedapi/types/pressurememory.go +++ b/typedapi/types/pressurememory.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PressureMemory type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L144-L199 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L144-L199 type PressureMemory struct { // All Memory consumed by indexing requests in the coordinating, primary, or replica // stage. diff --git a/typedapi/types/privileges.go b/typedapi/types/privileges.go index c4caa41ed3..e2d6c317a5 100644 --- a/typedapi/types/privileges.go +++ b/typedapi/types/privileges.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Privileges type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges/types.ts#L48-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges/types.ts#L48-L48 type Privileges map[string]bool diff --git a/typedapi/types/privilegesactions.go b/typedapi/types/privilegesactions.go index a6cf2d3ad8..e4cda7691d 100644 --- a/typedapi/types/privilegesactions.go +++ b/typedapi/types/privilegesactions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PrivilegesActions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/put_privileges/types.ts#L22-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/put_privileges/types.ts#L22-L27 type PrivilegesActions struct { Actions []string `json:"actions"` Application *string `json:"application,omitempty"` diff --git a/typedapi/types/privilegescheck.go b/typedapi/types/privilegescheck.go index 4fa4abfd80..2bf308f4f1 100644 --- a/typedapi/types/privilegescheck.go +++ b/typedapi/types/privilegescheck.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // PrivilegesCheck type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges_user_profile/types.ts#L30-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges_user_profile/types.ts#L30-L37 type PrivilegesCheck struct { Application []ApplicationPrivilegesCheck `json:"application,omitempty"` // Cluster A list of the cluster privileges that you want to check. diff --git a/typedapi/types/process.go b/typedapi/types/process.go index 6459bd4682..79db3caffb 100644 --- a/typedapi/types/process.go +++ b/typedapi/types/process.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Process type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L953-L975 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L953-L975 type Process struct { // Cpu Contains CPU statistics for the node. Cpu *Cpu `json:"cpu,omitempty"` diff --git a/typedapi/types/processor.go b/typedapi/types/processor.go index aefcc2ac8f..acc411b140 100644 --- a/typedapi/types/processor.go +++ b/typedapi/types/processor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Processor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L384-L401 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L384-L401 type Processor struct { // Count Number of documents transformed by the processor. Count *int64 `json:"count,omitempty"` diff --git a/typedapi/types/processorcontainer.go b/typedapi/types/processorcontainer.go index 6d78c9f5b9..e14fdca0a5 100644 --- a/typedapi/types/processorcontainer.go +++ b/typedapi/types/processorcontainer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ProcessorContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L28-L233 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L28-L233 type ProcessorContainer struct { // Append Appends one or more values to an existing array if the field already exists // and it is an array. diff --git a/typedapi/types/profile.go b/typedapi/types/profile.go index fe093d80d0..5bfa6d7648 100644 --- a/typedapi/types/profile.go +++ b/typedapi/types/profile.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Profile type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L93-L95 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L93-L95 type Profile struct { Shards []ShardProfile `json:"shards"` } diff --git a/typedapi/types/property.go b/typedapi/types/property.go index bfd098dbb9..2dff77ae7d 100644 --- a/typedapi/types/property.go +++ b/typedapi/types/property.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -39,6 +39,7 @@ package types // DateProperty // AggregateMetricDoubleProperty // DenseVectorProperty +// SparseVectorProperty // FlattenedProperty // NestedProperty // ObjectProperty @@ -69,5 +70,5 @@ package types // IpRangeProperty // LongRangeProperty // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/Property.ts#L93-L156 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/Property.ts#L94-L158 type Property interface{} diff --git a/typedapi/types/publishedclusterstates.go b/typedapi/types/publishedclusterstates.go index 0766eeac47..e635e946df 100644 --- a/typedapi/types/publishedclusterstates.go +++ b/typedapi/types/publishedclusterstates.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // PublishedClusterStates type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L263-L276 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L263-L276 type PublishedClusterStates struct { // CompatibleDiffs Number of compatible differences between published cluster states. CompatibleDiffs *int64 `json:"compatible_diffs,omitempty"` diff --git a/typedapi/types/queries.go b/typedapi/types/queries.go index 8848f888ef..2a20503c2b 100644 --- a/typedapi/types/queries.go +++ b/typedapi/types/queries.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Queries type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L394-L396 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L394-L396 type Queries struct { Cache *CacheQueries `json:"cache,omitempty"` } diff --git a/typedapi/types/query.go b/typedapi/types/query.go index c82e439273..a892959e4f 100644 --- a/typedapi/types/query.go +++ b/typedapi/types/query.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Query type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/abstractions.ts#L98-L391 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/abstractions.ts#L98-L391 type Query struct { // Bool matches documents matching boolean combinations of other queries. Bool *BoolQuery `json:"bool,omitempty"` diff --git a/typedapi/types/querybreakdown.go b/typedapi/types/querybreakdown.go index b3609a6d08..2b18a71664 100644 --- a/typedapi/types/querybreakdown.go +++ b/typedapi/types/querybreakdown.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // QueryBreakdown type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L97-L116 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L97-L116 type QueryBreakdown struct { Advance int64 `json:"advance"` AdvanceCount int64 `json:"advance_count"` diff --git a/typedapi/types/querycachestats.go b/typedapi/types/querycachestats.go index 66666533ad..11cfecbba2 100644 --- a/typedapi/types/querycachestats.go +++ b/typedapi/types/querycachestats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // QueryCacheStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L192-L226 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L192-L226 type QueryCacheStats struct { // CacheCount Total number of entries added to the query cache across all shards assigned // to selected nodes. diff --git a/typedapi/types/queryprofile.go b/typedapi/types/queryprofile.go index 1c7378b942..50ab9031e0 100644 --- a/typedapi/types/queryprofile.go +++ b/typedapi/types/queryprofile.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // QueryProfile type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L118-L124 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L118-L124 type QueryProfile struct { Breakdown QueryBreakdown `json:"breakdown"` Children []QueryProfile `json:"children,omitempty"` diff --git a/typedapi/types/queryrule.go b/typedapi/types/queryrule.go index d9edae0bd4..8637aaa0d5 100644 --- a/typedapi/types/queryrule.go +++ b/typedapi/types/queryrule.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // QueryRule type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/_types/QueryRuleset.ts#L37-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/_types/QueryRuleset.ts#L37-L42 type QueryRule struct { Actions QueryRuleActions `json:"actions"` Criteria []QueryRuleCriteria `json:"criteria"` diff --git a/typedapi/types/queryruleactions.go b/typedapi/types/queryruleactions.go index 99254f6587..2fbc9b914b 100644 --- a/typedapi/types/queryruleactions.go +++ b/typedapi/types/queryruleactions.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // QueryRuleActions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/_types/QueryRuleset.ts#L67-L70 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/_types/QueryRuleset.ts#L67-L70 type QueryRuleActions struct { Docs []PinnedDoc `json:"docs,omitempty"` Ids []string `json:"ids,omitempty"` diff --git a/typedapi/types/queryrulecriteria.go b/typedapi/types/queryrulecriteria.go index e9eb528144..8ae2aa08a3 100644 --- a/typedapi/types/queryrulecriteria.go +++ b/typedapi/types/queryrulecriteria.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // QueryRuleCriteria type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/_types/QueryRuleset.ts#L48-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/_types/QueryRuleset.ts#L48-L52 type QueryRuleCriteria struct { Metadata string `json:"metadata"` Type queryrulecriteriatype.QueryRuleCriteriaType `json:"type"` diff --git a/typedapi/types/queryruleset.go b/typedapi/types/queryruleset.go index 032f2e03af..3cd1169a55 100644 --- a/typedapi/types/queryruleset.go +++ b/typedapi/types/queryruleset.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // QueryRuleset type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/_types/QueryRuleset.ts#L26-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/_types/QueryRuleset.ts#L26-L35 type QueryRuleset struct { // Rules Rules associated with the query ruleset Rules []QueryRule `json:"rules"` diff --git a/typedapi/types/queryrulesetlistitem.go b/typedapi/types/queryrulesetlistitem.go index 97a2def5f5..916c0d9555 100644 --- a/typedapi/types/queryrulesetlistitem.go +++ b/typedapi/types/queryrulesetlistitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // QueryRulesetListItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/query_ruleset/list/types.ts#L22-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/query_ruleset/list/types.ts#L22-L31 type QueryRulesetListItem struct { // RulesCount The number of rules associated with this ruleset RulesCount int `json:"rules_count"` diff --git a/typedapi/types/querystringquery.go b/typedapi/types/querystringquery.go index 449721c8b7..98f9288eaa 100644 --- a/typedapi/types/querystringquery.go +++ b/typedapi/types/querystringquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // QueryStringQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L580-L700 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L580-L700 type QueryStringQuery struct { // AllowLeadingWildcard If `true`, the wildcard characters `*` and `?` are allowed as the first // character of the query string. diff --git a/typedapi/types/queryvectorbuilder.go b/typedapi/types/queryvectorbuilder.go index 8927397b24..d1e590272c 100644 --- a/typedapi/types/queryvectorbuilder.go +++ b/typedapi/types/queryvectorbuilder.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // QueryVectorBuilder type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Knn.ts#L45-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Knn.ts#L45-L48 type QueryVectorBuilder struct { TextEmbedding *TextEmbedding `json:"text_embedding,omitempty"` } diff --git a/typedapi/types/querywatch.go b/typedapi/types/querywatch.go index c2fe83816a..52bacf6e7a 100644 --- a/typedapi/types/querywatch.go +++ b/typedapi/types/querywatch.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // QueryWatch type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Watch.ts#L58-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Watch.ts#L58-L64 type QueryWatch struct { Id_ string `json:"_id"` PrimaryTerm_ *int `json:"_primary_term,omitempty"` diff --git a/typedapi/types/questionansweringinferenceoptions.go b/typedapi/types/questionansweringinferenceoptions.go index a81cff6959..fce6ca617e 100644 --- a/typedapi/types/questionansweringinferenceoptions.go +++ b/typedapi/types/questionansweringinferenceoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // QuestionAnsweringInferenceOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L282-L292 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L282-L292 type QuestionAnsweringInferenceOptions struct { // MaxAnswerLength The maximum answer length to consider MaxAnswerLength *int `json:"max_answer_length,omitempty"` diff --git a/typedapi/types/questionansweringinferenceupdateoptions.go b/typedapi/types/questionansweringinferenceupdateoptions.go index 1e64a2f5b5..472a636b15 100644 --- a/typedapi/types/questionansweringinferenceupdateoptions.go +++ b/typedapi/types/questionansweringinferenceupdateoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // QuestionAnsweringInferenceUpdateOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L420-L431 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L420-L431 type QuestionAnsweringInferenceUpdateOptions struct { // MaxAnswerLength The maximum answer length to consider for extraction MaxAnswerLength *int `json:"max_answer_length,omitempty"` diff --git a/typedapi/types/randomscorefunction.go b/typedapi/types/randomscorefunction.go index 7b9eb86cdf..0ac66bcc29 100644 --- a/typedapi/types/randomscorefunction.go +++ b/typedapi/types/randomscorefunction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RandomScoreFunction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L127-L130 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L127-L130 type RandomScoreFunction struct { Field *string `json:"field,omitempty"` Seed string `json:"seed,omitempty"` diff --git a/typedapi/types/rangeaggregate.go b/typedapi/types/rangeaggregate.go index 0826906548..845fe9f6be 100644 --- a/typedapi/types/rangeaggregate.go +++ b/typedapi/types/rangeaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RangeAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L531-L532 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L531-L532 type RangeAggregate struct { Buckets BucketsRangeBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/rangeaggregation.go b/typedapi/types/rangeaggregation.go index 3c344099b1..dbd376d519 100644 --- a/typedapi/types/rangeaggregation.go +++ b/typedapi/types/rangeaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RangeAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L650-L670 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L650-L670 type RangeAggregation struct { // Field The date field whose values are use to build ranges. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/rangebucket.go b/typedapi/types/rangebucket.go index 63ee9b6825..4fa5a8a8ed 100644 --- a/typedapi/types/rangebucket.go +++ b/typedapi/types/rangebucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // RangeBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L534-L541 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L534-L541 type RangeBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/rangequery.go b/typedapi/types/rangequery.go index f78dad8d97..9be327d731 100644 --- a/typedapi/types/rangequery.go +++ b/typedapi/types/rangequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // DateRangeQuery // NumberRangeQuery // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L166-L168 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L166-L168 type RangeQuery interface{} diff --git a/typedapi/types/rankcontainer.go b/typedapi/types/rankcontainer.go index 92dea53567..bd5e6a5f47 100644 --- a/typedapi/types/rankcontainer.go +++ b/typedapi/types/rankcontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RankContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Rank.ts#L22-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Rank.ts#L22-L28 type RankContainer struct { // Rrf The reciprocal rank fusion parameters Rrf *RrfRank `json:"rrf,omitempty"` diff --git a/typedapi/types/rankevalhit.go b/typedapi/types/rankevalhit.go index 46d8cecbb8..0064f17b2c 100644 --- a/typedapi/types/rankevalhit.go +++ b/typedapi/types/rankevalhit.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankEvalHit type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L141-L145 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L141-L145 type RankEvalHit struct { Id_ string `json:"_id"` Index_ string `json:"_index"` diff --git a/typedapi/types/rankevalhititem.go b/typedapi/types/rankevalhititem.go index d689292436..68857b5631 100644 --- a/typedapi/types/rankevalhititem.go +++ b/typedapi/types/rankevalhititem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RankEvalHitItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L136-L139 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L136-L139 type RankEvalHitItem struct { Hit RankEvalHit `json:"hit"` Rating Float64 `json:"rating,omitempty"` diff --git a/typedapi/types/rankevalmetric.go b/typedapi/types/rankevalmetric.go index 124e98d341..136b10c325 100644 --- a/typedapi/types/rankevalmetric.go +++ b/typedapi/types/rankevalmetric.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RankEvalMetric type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L90-L96 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L90-L96 type RankEvalMetric struct { Dcg *RankEvalMetricDiscountedCumulativeGain `json:"dcg,omitempty"` ExpectedReciprocalRank *RankEvalMetricExpectedReciprocalRank `json:"expected_reciprocal_rank,omitempty"` diff --git a/typedapi/types/rankevalmetricdetail.go b/typedapi/types/rankevalmetricdetail.go index d205736a62..d13a53accc 100644 --- a/typedapi/types/rankevalmetricdetail.go +++ b/typedapi/types/rankevalmetricdetail.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankEvalMetricDetail type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L125-L134 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L125-L134 type RankEvalMetricDetail struct { // Hits The hits section shows a grouping of the search results with their supplied // ratings diff --git a/typedapi/types/rankevalmetricdiscountedcumulativegain.go b/typedapi/types/rankevalmetricdiscountedcumulativegain.go index ac72f72fcb..fc0face108 100644 --- a/typedapi/types/rankevalmetricdiscountedcumulativegain.go +++ b/typedapi/types/rankevalmetricdiscountedcumulativegain.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankEvalMetricDiscountedCumulativeGain type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L66-L77 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L66-L77 type RankEvalMetricDiscountedCumulativeGain struct { // K Sets the maximum number of documents retrieved per query. This value will act // in place of the usual size parameter in the query. diff --git a/typedapi/types/rankevalmetricexpectedreciprocalrank.go b/typedapi/types/rankevalmetricexpectedreciprocalrank.go index fe570a6667..9c9c6cf3e9 100644 --- a/typedapi/types/rankevalmetricexpectedreciprocalrank.go +++ b/typedapi/types/rankevalmetricexpectedreciprocalrank.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankEvalMetricExpectedReciprocalRank type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L79-L88 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L79-L88 type RankEvalMetricExpectedReciprocalRank struct { // K Sets the maximum number of documents retrieved per query. This value will act // in place of the usual size parameter in the query. diff --git a/typedapi/types/rankevalmetricmeanreciprocalrank.go b/typedapi/types/rankevalmetricmeanreciprocalrank.go index 06221b85b9..a1b3ecc5ba 100644 --- a/typedapi/types/rankevalmetricmeanreciprocalrank.go +++ b/typedapi/types/rankevalmetricmeanreciprocalrank.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankEvalMetricMeanReciprocalRank type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L60-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L60-L64 type RankEvalMetricMeanReciprocalRank struct { // K Sets the maximum number of documents retrieved per query. This value will act // in place of the usual size parameter in the query. diff --git a/typedapi/types/rankevalmetricprecision.go b/typedapi/types/rankevalmetricprecision.go index e800db7199..5ddca2885e 100644 --- a/typedapi/types/rankevalmetricprecision.go +++ b/typedapi/types/rankevalmetricprecision.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankEvalMetricPrecision type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L42-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L42-L52 type RankEvalMetricPrecision struct { // IgnoreUnlabeled Controls how unlabeled documents in the search results are counted. If set to // true, unlabeled documents are ignored and neither count as relevant or diff --git a/typedapi/types/rankevalmetricratingtreshold.go b/typedapi/types/rankevalmetricratingtreshold.go index a09c3bfa08..ef3b836083 100644 --- a/typedapi/types/rankevalmetricratingtreshold.go +++ b/typedapi/types/rankevalmetricratingtreshold.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankEvalMetricRatingTreshold type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L34-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L34-L40 type RankEvalMetricRatingTreshold struct { // K Sets the maximum number of documents retrieved per query. This value will act // in place of the usual size parameter in the query. diff --git a/typedapi/types/rankevalmetricrecall.go b/typedapi/types/rankevalmetricrecall.go index 89b1959e71..a2149ea087 100644 --- a/typedapi/types/rankevalmetricrecall.go +++ b/typedapi/types/rankevalmetricrecall.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankEvalMetricRecall type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L54-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L54-L58 type RankEvalMetricRecall struct { // K Sets the maximum number of documents retrieved per query. This value will act // in place of the usual size parameter in the query. diff --git a/typedapi/types/rankevalquery.go b/typedapi/types/rankevalquery.go index c184f7a5a6..e870a06549 100644 --- a/typedapi/types/rankevalquery.go +++ b/typedapi/types/rankevalquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankEvalQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L111-L114 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L111-L114 type RankEvalQuery struct { Query Query `json:"query"` Size *int `json:"size,omitempty"` diff --git a/typedapi/types/rankevalrequestitem.go b/typedapi/types/rankevalrequestitem.go index c005b53b69..d3ac08c4ab 100644 --- a/typedapi/types/rankevalrequestitem.go +++ b/typedapi/types/rankevalrequestitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RankEvalRequestItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L98-L109 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L98-L109 type RankEvalRequestItem struct { // Id The search request’s ID, used to group result details later. Id string `json:"id"` diff --git a/typedapi/types/rankfeaturefunction.go b/typedapi/types/rankfeaturefunction.go index 6ead9b9416..fa4a1d481f 100644 --- a/typedapi/types/rankfeaturefunction.go +++ b/typedapi/types/rankfeaturefunction.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RankFeatureFunction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L264-L264 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L264-L264 type RankFeatureFunction struct { } diff --git a/typedapi/types/rankfeaturefunctionlinear.go b/typedapi/types/rankfeaturefunctionlinear.go index 2b246a280a..2e1c74a2b4 100644 --- a/typedapi/types/rankfeaturefunctionlinear.go +++ b/typedapi/types/rankfeaturefunctionlinear.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RankFeatureFunctionLinear type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L266-L266 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L266-L266 type RankFeatureFunctionLinear struct { } diff --git a/typedapi/types/rankfeaturefunctionlogarithm.go b/typedapi/types/rankfeaturefunctionlogarithm.go index 5ce9555f8b..4e2d02c82d 100644 --- a/typedapi/types/rankfeaturefunctionlogarithm.go +++ b/typedapi/types/rankfeaturefunctionlogarithm.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankFeatureFunctionLogarithm type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L268-L273 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L268-L273 type RankFeatureFunctionLogarithm struct { // ScalingFactor Configurable scaling factor. ScalingFactor float32 `json:"scaling_factor"` diff --git a/typedapi/types/rankfeaturefunctionsaturation.go b/typedapi/types/rankfeaturefunctionsaturation.go index e34a7ed530..b0a5464a6a 100644 --- a/typedapi/types/rankfeaturefunctionsaturation.go +++ b/typedapi/types/rankfeaturefunctionsaturation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankFeatureFunctionSaturation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L275-L280 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L275-L280 type RankFeatureFunctionSaturation struct { // Pivot Configurable pivot value so that the result will be less than 0.5. Pivot *float32 `json:"pivot,omitempty"` diff --git a/typedapi/types/rankfeaturefunctionsigmoid.go b/typedapi/types/rankfeaturefunctionsigmoid.go index 5471ae258c..5228c90de0 100644 --- a/typedapi/types/rankfeaturefunctionsigmoid.go +++ b/typedapi/types/rankfeaturefunctionsigmoid.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankFeatureFunctionSigmoid type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L282-L291 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L282-L291 type RankFeatureFunctionSigmoid struct { // Exponent Configurable Exponent. Exponent float32 `json:"exponent"` diff --git a/typedapi/types/rankfeatureproperty.go b/typedapi/types/rankfeatureproperty.go index e2a73d8bbb..b74098fb32 100644 --- a/typedapi/types/rankfeatureproperty.go +++ b/typedapi/types/rankfeatureproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // RankFeatureProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L184-L187 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L184-L187 type RankFeatureProperty struct { Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` Fields map[string]Property `json:"fields,omitempty"` @@ -182,6 +182,12 @@ func (s *RankFeatureProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -521,6 +527,12 @@ func (s *RankFeatureProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/rankfeaturequery.go b/typedapi/types/rankfeaturequery.go index 0434981cf7..ef935c00b7 100644 --- a/typedapi/types/rankfeaturequery.go +++ b/typedapi/types/rankfeaturequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RankFeatureQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L293-L316 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L293-L316 type RankFeatureQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/rankfeaturesproperty.go b/typedapi/types/rankfeaturesproperty.go index 4407b4c33f..0c40026053 100644 --- a/typedapi/types/rankfeaturesproperty.go +++ b/typedapi/types/rankfeaturesproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // RankFeaturesProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L189-L191 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L189-L191 type RankFeaturesProperty struct { Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` Fields map[string]Property `json:"fields,omitempty"` @@ -181,6 +181,12 @@ func (s *RankFeaturesProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -506,6 +512,12 @@ func (s *RankFeaturesProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/raretermsaggregation.go b/typedapi/types/raretermsaggregation.go index 2ca60d86c8..faf60c2608 100644 --- a/typedapi/types/raretermsaggregation.go +++ b/typedapi/types/raretermsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RareTermsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L687-L717 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L687-L717 type RareTermsAggregation struct { // Exclude Terms that should be excluded from the aggregation. Exclude []string `json:"exclude,omitempty"` diff --git a/typedapi/types/rateaggregate.go b/typedapi/types/rateaggregate.go index 201aa692c5..48f0d721d6 100644 --- a/typedapi/types/rateaggregate.go +++ b/typedapi/types/rateaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RateAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L741-L745 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L741-L745 type RateAggregate struct { Meta Metadata `json:"meta,omitempty"` Value Float64 `json:"value"` diff --git a/typedapi/types/rateaggregation.go b/typedapi/types/rateaggregation.go index 2e5f59e3c9..6976c834c0 100644 --- a/typedapi/types/rateaggregation.go +++ b/typedapi/types/rateaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // RateAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L230-L241 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L230-L241 type RateAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/readexception.go b/typedapi/types/readexception.go index 492012dbff..963a89e774 100644 --- a/typedapi/types/readexception.go +++ b/typedapi/types/readexception.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ReadException type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ccr/_types/FollowIndexStats.ts#L71-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ccr/_types/FollowIndexStats.ts#L71-L75 type ReadException struct { Exception ErrorCause `json:"exception"` FromSeqNo int64 `json:"from_seq_no"` diff --git a/typedapi/types/realmcache.go b/typedapi/types/realmcache.go index 0fbd8ec33b..787e3ccf37 100644 --- a/typedapi/types/realmcache.go +++ b/typedapi/types/realmcache.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RealmCache type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L266-L268 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L266-L268 type RealmCache struct { Size int64 `json:"size"` } diff --git a/typedapi/types/realminfo.go b/typedapi/types/realminfo.go index 708a217987..e82014cc4b 100644 --- a/typedapi/types/realminfo.go +++ b/typedapi/types/realminfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RealmInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/RealmInfo.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/RealmInfo.ts#L22-L25 type RealmInfo struct { Name string `json:"name"` Type string `json:"type"` diff --git a/typedapi/types/recording.go b/typedapi/types/recording.go index 2914794253..70d4d13573 100644 --- a/typedapi/types/recording.go +++ b/typedapi/types/recording.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Recording type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L225-L230 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L225-L230 type Recording struct { CumulativeExecutionCount *int64 `json:"cumulative_execution_count,omitempty"` CumulativeExecutionTime Duration `json:"cumulative_execution_time,omitempty"` diff --git a/typedapi/types/recoverybytes.go b/typedapi/types/recoverybytes.go index 694764c399..2b95132357 100644 --- a/typedapi/types/recoverybytes.go +++ b/typedapi/types/recoverybytes.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RecoveryBytes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/types.ts#L38-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/types.ts#L38-L48 type RecoveryBytes struct { Percent Percentage `json:"percent"` Recovered ByteSize `json:"recovered,omitempty"` diff --git a/typedapi/types/recoveryfiles.go b/typedapi/types/recoveryfiles.go index 0226074e16..66ea93e15d 100644 --- a/typedapi/types/recoveryfiles.go +++ b/typedapi/types/recoveryfiles.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RecoveryFiles type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/types.ts#L56-L62 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/types.ts#L56-L62 type RecoveryFiles struct { Details []FileDetails `json:"details,omitempty"` Percent Percentage `json:"percent"` diff --git a/typedapi/types/recoveryindexstatus.go b/typedapi/types/recoveryindexstatus.go index 975ff0741b..49b266fac8 100644 --- a/typedapi/types/recoveryindexstatus.go +++ b/typedapi/types/recoveryindexstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RecoveryIndexStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/types.ts#L64-L74 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/types.ts#L64-L74 type RecoveryIndexStatus struct { Bytes *RecoveryBytes `json:"bytes,omitempty"` Files RecoveryFiles `json:"files"` diff --git a/typedapi/types/recoveryorigin.go b/typedapi/types/recoveryorigin.go index 67f3c81fcb..67c1df4d93 100644 --- a/typedapi/types/recoveryorigin.go +++ b/typedapi/types/recoveryorigin.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RecoveryOrigin type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/types.ts#L76-L89 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/types.ts#L76-L89 type RecoveryOrigin struct { BootstrapNewHistoryUuid *bool `json:"bootstrap_new_history_uuid,omitempty"` Host *string `json:"host,omitempty"` diff --git a/typedapi/types/recoveryrecord.go b/typedapi/types/recoveryrecord.go index 9008098659..2821b4eb3e 100644 --- a/typedapi/types/recoveryrecord.go +++ b/typedapi/types/recoveryrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RecoveryRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/recovery/types.ts#L24-L155 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/recovery/types.ts#L24-L155 type RecoveryRecord struct { // Bytes The number of bytes to recover. Bytes *string `json:"bytes,omitempty"` diff --git a/typedapi/types/recoverystartstatus.go b/typedapi/types/recoverystartstatus.go index fbfa38efd7..834500f322 100644 --- a/typedapi/types/recoverystartstatus.go +++ b/typedapi/types/recoverystartstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RecoveryStartStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/types.ts#L91-L96 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/types.ts#L91-L96 type RecoveryStartStatus struct { CheckIndexTime Duration `json:"check_index_time,omitempty"` CheckIndexTimeInMillis int64 `json:"check_index_time_in_millis"` diff --git a/typedapi/types/recoverystats.go b/typedapi/types/recoverystats.go index af2e3bb188..24605aae91 100644 --- a/typedapi/types/recoverystats.go +++ b/typedapi/types/recoverystats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RecoveryStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L228-L233 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L228-L233 type RecoveryStats struct { CurrentAsSource int64 `json:"current_as_source"` CurrentAsTarget int64 `json:"current_as_target"` diff --git a/typedapi/types/recoverystatus.go b/typedapi/types/recoverystatus.go index 3f1c87e62a..e9b5dacac8 100644 --- a/typedapi/types/recoverystatus.go +++ b/typedapi/types/recoverystatus.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RecoveryStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/types.ts#L98-L100 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/types.ts#L98-L100 type RecoveryStatus struct { Shards []ShardRecovery `json:"shards"` } diff --git a/typedapi/types/refreshstats.go b/typedapi/types/refreshstats.go index fca892c12c..d3f1181468 100644 --- a/typedapi/types/refreshstats.go +++ b/typedapi/types/refreshstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RefreshStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L235-L242 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L235-L242 type RefreshStats struct { ExternalTotal int64 `json:"external_total"` ExternalTotalTimeInMillis int64 `json:"external_total_time_in_millis"` diff --git a/typedapi/types/regexoptions.go b/typedapi/types/regexoptions.go index 39f8941c89..40d8faa68f 100644 --- a/typedapi/types/regexoptions.go +++ b/typedapi/types/regexoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RegexOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L180-L191 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L180-L191 type RegexOptions struct { // Flags Optional operators for the regular expression. Flags string `json:"flags,omitempty"` diff --git a/typedapi/types/regexpquery.go b/typedapi/types/regexpquery.go index 45c3927db6..3cda86bdb7 100644 --- a/typedapi/types/regexpquery.go +++ b/typedapi/types/regexpquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RegexpQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L185-L215 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L185-L215 type RegexpQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/regressioninferenceoptions.go b/typedapi/types/regressioninferenceoptions.go index bbf1d27edc..2464704098 100644 --- a/typedapi/types/regressioninferenceoptions.go +++ b/typedapi/types/regressioninferenceoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RegressionInferenceOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L82-L91 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L82-L91 type RegressionInferenceOptions struct { // NumTopFeatureImportanceValues Specifies the maximum number of feature importance values per document. NumTopFeatureImportanceValues *int `json:"num_top_feature_importance_values,omitempty"` diff --git a/typedapi/types/reindexdestination.go b/typedapi/types/reindexdestination.go index 339b443406..58955c6d0a 100644 --- a/typedapi/types/reindexdestination.go +++ b/typedapi/types/reindexdestination.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // ReindexDestination type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/reindex/types.ts#L39-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/reindex/types.ts#L39-L64 type ReindexDestination struct { // Index The name of the data stream, index, or index alias you are copying to. Index string `json:"index"` diff --git a/typedapi/types/reindexnode.go b/typedapi/types/reindexnode.go index 9cf025a9fd..b569518330 100644 --- a/typedapi/types/reindexnode.go +++ b/typedapi/types/reindexnode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // ReindexNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/reindex_rethrottle/types.ts#L33-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/reindex_rethrottle/types.ts#L33-L35 type ReindexNode struct { Attributes map[string]string `json:"attributes"` Host string `json:"host"` diff --git a/typedapi/types/reindexsource.go b/typedapi/types/reindexsource.go index 20c11d95e0..886eb2e8a7 100644 --- a/typedapi/types/reindexsource.go +++ b/typedapi/types/reindexsource.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ReindexSource type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/reindex/types.ts#L66-L97 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/reindex/types.ts#L66-L97 type ReindexSource struct { // Index The name of the data stream, index, or alias you are copying from. // Accepts a comma-separated list to reindex from multiple sources. diff --git a/typedapi/types/reindexstatus.go b/typedapi/types/reindexstatus.go index 77f7735e25..1fb140fcb9 100644 --- a/typedapi/types/reindexstatus.go +++ b/typedapi/types/reindexstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ReindexStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/reindex_rethrottle/types.ts#L37-L85 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/reindex_rethrottle/types.ts#L37-L85 type ReindexStatus struct { // Batches The number of scroll responses pulled back by the reindex. Batches int64 `json:"batches"` diff --git a/typedapi/types/reindextask.go b/typedapi/types/reindextask.go index 85f286b097..1dcdb2a7f7 100644 --- a/typedapi/types/reindextask.go +++ b/typedapi/types/reindextask.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ReindexTask type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/reindex_rethrottle/types.ts#L87-L98 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/reindex_rethrottle/types.ts#L87-L98 type ReindexTask struct { Action string `json:"action"` Cancellable bool `json:"cancellable"` diff --git a/typedapi/types/reloaddetails.go b/typedapi/types/reloaddetails.go index ef1dd35226..e8f2dbb64e 100644 --- a/typedapi/types/reloaddetails.go +++ b/typedapi/types/reloaddetails.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ReloadDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/reload_search_analyzers/types.ts#L27-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/reload_search_analyzers/types.ts#L27-L31 type ReloadDetails struct { Index string `json:"index"` ReloadedAnalyzers []string `json:"reloaded_analyzers"` diff --git a/typedapi/types/reloadresult.go b/typedapi/types/reloadresult.go index 2f13ca792a..2701e78a0e 100644 --- a/typedapi/types/reloadresult.go +++ b/typedapi/types/reloadresult.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ReloadResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/reload_search_analyzers/types.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/reload_search_analyzers/types.ts#L22-L25 type ReloadResult struct { ReloadDetails []ReloadDetails `json:"reload_details"` Shards_ ShardStatistics `json:"_shards"` diff --git a/typedapi/types/relocationfailureinfo.go b/typedapi/types/relocationfailureinfo.go index 558b4d32c3..82047d036d 100644 --- a/typedapi/types/relocationfailureinfo.go +++ b/typedapi/types/relocationfailureinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RelocationFailureInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Node.ts#L73-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Node.ts#L73-L75 type RelocationFailureInfo struct { FailedAttempts int `json:"failed_attempts"` } diff --git a/typedapi/types/remotesource.go b/typedapi/types/remotesource.go index b42b3bc5a2..06f975afec 100644 --- a/typedapi/types/remotesource.go +++ b/typedapi/types/remotesource.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RemoteSource type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/reindex/types.ts#L99-L125 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/reindex/types.ts#L99-L125 type RemoteSource struct { // ConnectTimeout The remote connection timeout. // Defaults to 30 seconds. diff --git a/typedapi/types/removeaction.go b/typedapi/types/removeaction.go index 0a769f12d3..62c5c07617 100644 --- a/typedapi/types/removeaction.go +++ b/typedapi/types/removeaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RemoveAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/update_aliases/types.ts#L97-L122 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/update_aliases/types.ts#L97-L122 type RemoveAction struct { // Alias Alias for the action. // Index alias names support date math. diff --git a/typedapi/types/removeduplicatestokenfilter.go b/typedapi/types/removeduplicatestokenfilter.go index fda35aee32..48fd9606b6 100644 --- a/typedapi/types/removeduplicatestokenfilter.go +++ b/typedapi/types/removeduplicatestokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RemoveDuplicatesTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L301-L303 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L301-L303 type RemoveDuplicatesTokenFilter struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/removeindexaction.go b/typedapi/types/removeindexaction.go index bee161f566..8b0d2362b2 100644 --- a/typedapi/types/removeindexaction.go +++ b/typedapi/types/removeindexaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RemoveIndexAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/update_aliases/types.ts#L124-L139 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/update_aliases/types.ts#L124-L139 type RemoveIndexAction struct { // Index Data stream or index for the action. // Supports wildcards (`*`). diff --git a/typedapi/types/removeprocessor.go b/typedapi/types/removeprocessor.go index a8836cacb4..40fc4cdf27 100644 --- a/typedapi/types/removeprocessor.go +++ b/typedapi/types/removeprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RemoveProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L930-L940 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L930-L940 type RemoveProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/renameprocessor.go b/typedapi/types/renameprocessor.go index 011fd2eb98..25e9d94fb3 100644 --- a/typedapi/types/renameprocessor.go +++ b/typedapi/types/renameprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RenameProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L942-L958 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L942-L958 type RenameProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/reportingemailattachment.go b/typedapi/types/reportingemailattachment.go index 0633ef893c..0a5892c2a1 100644 --- a/typedapi/types/reportingemailattachment.go +++ b/typedapi/types/reportingemailattachment.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ReportingEmailAttachment type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L224-L232 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L224-L232 type ReportingEmailAttachment struct { Inline *bool `json:"inline,omitempty"` Interval Duration `json:"interval,omitempty"` diff --git a/typedapi/types/repositoriesrecord.go b/typedapi/types/repositoriesrecord.go index 5346624c1b..1db92a62fc 100644 --- a/typedapi/types/repositoriesrecord.go +++ b/typedapi/types/repositoriesrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RepositoriesRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/repositories/types.ts#L20-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/repositories/types.ts#L20-L31 type RepositoriesRecord struct { // Id The unique repository identifier. Id *string `json:"id,omitempty"` diff --git a/typedapi/types/repository.go b/typedapi/types/repository.go index 880702702f..acb7b26f5d 100644 --- a/typedapi/types/repository.go +++ b/typedapi/types/repository.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Repository type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotRepository.ts#L23-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotRepository.ts#L23-L27 type Repository struct { Settings RepositorySettings `json:"settings"` Type string `json:"type"` diff --git a/typedapi/types/repositoryintegrityindicator.go b/typedapi/types/repositoryintegrityindicator.go index 99ce6b3080..af309111d4 100644 --- a/typedapi/types/repositoryintegrityindicator.go +++ b/typedapi/types/repositoryintegrityindicator.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // RepositoryIntegrityIndicator type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L134-L138 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L134-L138 type RepositoryIntegrityIndicator struct { Details *RepositoryIntegrityIndicatorDetails `json:"details,omitempty"` Diagnosis []Diagnosis `json:"diagnosis,omitempty"` diff --git a/typedapi/types/repositoryintegrityindicatordetails.go b/typedapi/types/repositoryintegrityindicatordetails.go index 23812bb8ab..34b04126bd 100644 --- a/typedapi/types/repositoryintegrityindicatordetails.go +++ b/typedapi/types/repositoryintegrityindicatordetails.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RepositoryIntegrityIndicatorDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L139-L143 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L139-L143 type RepositoryIntegrityIndicatorDetails struct { Corrupted []string `json:"corrupted,omitempty"` CorruptedRepositories *int64 `json:"corrupted_repositories,omitempty"` diff --git a/typedapi/types/repositorylocation.go b/typedapi/types/repositorylocation.go index 8679a654fb..42c449c710 100644 --- a/typedapi/types/repositorylocation.go +++ b/typedapi/types/repositorylocation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RepositoryLocation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/RepositoryMeteringInformation.ts#L68-L74 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/RepositoryMeteringInformation.ts#L68-L74 type RepositoryLocation struct { BasePath string `json:"base_path"` // Bucket Bucket name (GCP, S3) diff --git a/typedapi/types/repositorymeteringinformation.go b/typedapi/types/repositorymeteringinformation.go index f30ef7ee82..d6402088d2 100644 --- a/typedapi/types/repositorymeteringinformation.go +++ b/typedapi/types/repositorymeteringinformation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RepositoryMeteringInformation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/RepositoryMeteringInformation.ts#L24-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/RepositoryMeteringInformation.ts#L24-L66 type RepositoryMeteringInformation struct { // Archived A flag that tells whether or not this object has been archived. When a // repository is closed or updated the diff --git a/typedapi/types/repositorysettings.go b/typedapi/types/repositorysettings.go index d82bdb552a..232367efd2 100644 --- a/typedapi/types/repositorysettings.go +++ b/typedapi/types/repositorysettings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RepositorySettings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotRepository.ts#L29-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotRepository.ts#L29-L38 type RepositorySettings struct { ChunkSize *string `json:"chunk_size,omitempty"` Compress string `json:"compress,omitempty"` diff --git a/typedapi/types/requestcachestats.go b/typedapi/types/requestcachestats.go index a05333487a..4350d2f6e1 100644 --- a/typedapi/types/requestcachestats.go +++ b/typedapi/types/requestcachestats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RequestCacheStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L244-L250 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L244-L250 type RequestCacheStats struct { Evictions int64 `json:"evictions"` HitCount int64 `json:"hit_count"` diff --git a/typedapi/types/requestcounts.go b/typedapi/types/requestcounts.go index a16a643090..88f3a2d66a 100644 --- a/typedapi/types/requestcounts.go +++ b/typedapi/types/requestcounts.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RequestCounts type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/RepositoryMeteringInformation.ts#L76-L103 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/RepositoryMeteringInformation.ts#L76-L103 type RequestCounts struct { // GetBlob Number of Get Blob requests (Azure) GetBlob *int64 `json:"GetBlob,omitempty"` diff --git a/typedapi/types/requestitem.go b/typedapi/types/requestitem.go index d5360ba916..883cc64619 100644 --- a/typedapi/types/requestitem.go +++ b/typedapi/types/requestitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // MultisearchHeader // TemplateConfig // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch_template/types.ts#L25-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch_template/types.ts#L25-L26 type RequestItem interface{} diff --git a/typedapi/types/reroutedecision.go b/typedapi/types/reroutedecision.go index 2e9e496334..feff2ba310 100644 --- a/typedapi/types/reroutedecision.go +++ b/typedapi/types/reroutedecision.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RerouteDecision type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/reroute/types.ts#L86-L90 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/reroute/types.ts#L86-L90 type RerouteDecision struct { Decider string `json:"decider"` Decision string `json:"decision"` diff --git a/typedapi/types/rerouteexplanation.go b/typedapi/types/rerouteexplanation.go index e46ccbb2f5..e45fa430ff 100644 --- a/typedapi/types/rerouteexplanation.go +++ b/typedapi/types/rerouteexplanation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RerouteExplanation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/reroute/types.ts#L92-L96 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/reroute/types.ts#L92-L96 type RerouteExplanation struct { Command string `json:"command"` Decisions []RerouteDecision `json:"decisions"` diff --git a/typedapi/types/rerouteparameters.go b/typedapi/types/rerouteparameters.go index f54405a769..996a8028b1 100644 --- a/typedapi/types/rerouteparameters.go +++ b/typedapi/types/rerouteparameters.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RerouteParameters type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/reroute/types.ts#L98-L105 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/reroute/types.ts#L98-L105 type RerouteParameters struct { AllowPrimary bool `json:"allow_primary"` FromNode *string `json:"from_node,omitempty"` diff --git a/typedapi/types/rescore.go b/typedapi/types/rescore.go index 9fbb0e7467..8e84e9f7d5 100644 --- a/typedapi/types/rescore.go +++ b/typedapi/types/rescore.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Rescore type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/rescoring.ts#L23-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/rescoring.ts#L23-L26 type Rescore struct { Query RescoreQuery `json:"query"` WindowSize *int `json:"window_size,omitempty"` diff --git a/typedapi/types/rescorequery.go b/typedapi/types/rescorequery.go index 427207e963..a29642e901 100644 --- a/typedapi/types/rescorequery.go +++ b/typedapi/types/rescorequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // RescoreQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/rescoring.ts#L28-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/rescoring.ts#L28-L50 type RescoreQuery struct { // Query The query to use for rescoring. // This query is only run on the Top-K results returned by the `query` and diff --git a/typedapi/types/reservedsize.go b/typedapi/types/reservedsize.go index 05675faac6..8feb79b9b7 100644 --- a/typedapi/types/reservedsize.go +++ b/typedapi/types/reservedsize.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ReservedSize type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L71-L76 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L71-L76 type ReservedSize struct { NodeId string `json:"node_id"` Path string `json:"path"` diff --git a/typedapi/types/resolveindexaliasitem.go b/typedapi/types/resolveindexaliasitem.go index 9bfc6268d4..9149d8673d 100644 --- a/typedapi/types/resolveindexaliasitem.go +++ b/typedapi/types/resolveindexaliasitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ResolveIndexAliasItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/resolve_index/ResolveIndexResponse.ts#L37-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/resolve_index/ResolveIndexResponse.ts#L37-L40 type ResolveIndexAliasItem struct { Indices []string `json:"indices"` Name string `json:"name"` diff --git a/typedapi/types/resolveindexdatastreamsitem.go b/typedapi/types/resolveindexdatastreamsitem.go index f75bf4d644..8560976dab 100644 --- a/typedapi/types/resolveindexdatastreamsitem.go +++ b/typedapi/types/resolveindexdatastreamsitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ResolveIndexDataStreamsItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/resolve_index/ResolveIndexResponse.ts#L42-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/resolve_index/ResolveIndexResponse.ts#L42-L46 type ResolveIndexDataStreamsItem struct { BackingIndices []string `json:"backing_indices"` Name string `json:"name"` diff --git a/typedapi/types/resolveindexitem.go b/typedapi/types/resolveindexitem.go index 86f65f9ded..b0f3c0d12f 100644 --- a/typedapi/types/resolveindexitem.go +++ b/typedapi/types/resolveindexitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ResolveIndexItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/resolve_index/ResolveIndexResponse.ts#L30-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/resolve_index/ResolveIndexResponse.ts#L30-L35 type ResolveIndexItem struct { Aliases []string `json:"aliases,omitempty"` Attributes []string `json:"attributes"` diff --git a/typedapi/types/resourceprivileges.go b/typedapi/types/resourceprivileges.go index cfce370cd9..8e1e323639 100644 --- a/typedapi/types/resourceprivileges.go +++ b/typedapi/types/resourceprivileges.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ResourcePrivileges type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/has_privileges/types.ts#L47-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/has_privileges/types.ts#L47-L47 type ResourcePrivileges map[string]Privileges diff --git a/typedapi/types/responsebody.go b/typedapi/types/responsebody.go index 28732c6dc9..ef59de961b 100644 --- a/typedapi/types/responsebody.go +++ b/typedapi/types/responsebody.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // ResponseBody type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/SearchResponse.ts#L38-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/SearchResponse.ts#L38-L54 type ResponseBody struct { Aggregations map[string]Aggregate `json:"aggregations,omitempty"` Clusters_ *ClusterStatistics `json:"_clusters,omitempty"` diff --git a/typedapi/types/responseitem.go b/typedapi/types/responseitem.go index b3fc313e93..10ff91ef21 100644 --- a/typedapi/types/responseitem.go +++ b/typedapi/types/responseitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ResponseItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/types.ts#L37-L81 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/types.ts#L37-L81 type ResponseItem struct { // Error Contains additional information about the failed operation. // The parameter is only returned for failed operations. diff --git a/typedapi/types/retention.go b/typedapi/types/retention.go index ed8e8bb022..c9460887b7 100644 --- a/typedapi/types/retention.go +++ b/typedapi/types/retention.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Retention type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/_types/SnapshotLifecycle.ts#L84-L97 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/_types/SnapshotLifecycle.ts#L84-L97 type Retention struct { // ExpireAfter Time period after which a snapshot is considered expired and eligible for // deletion. SLM deletes expired snapshots based on the slm.retention_schedule. diff --git a/typedapi/types/retentionlease.go b/typedapi/types/retentionlease.go index 8dc8d1dd5f..1fa0b444c7 100644 --- a/typedapi/types/retentionlease.go +++ b/typedapi/types/retentionlease.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RetentionLease type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L65-L67 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L65-L67 type RetentionLease struct { Period Duration `json:"period"` } diff --git a/typedapi/types/retentionpolicy.go b/typedapi/types/retentionpolicy.go index cfcad7af4f..79c8756966 100644 --- a/typedapi/types/retentionpolicy.go +++ b/typedapi/types/retentionpolicy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RetentionPolicy type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/_types/Transform.ts#L88-L96 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/_types/Transform.ts#L88-L96 type RetentionPolicy struct { // Field The date field that is used to calculate the age of the document. Field string `json:"field"` diff --git a/typedapi/types/retentionpolicycontainer.go b/typedapi/types/retentionpolicycontainer.go index 9d928f98c9..0b133f2bd1 100644 --- a/typedapi/types/retentionpolicycontainer.go +++ b/typedapi/types/retentionpolicycontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RetentionPolicyContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/_types/Transform.ts#L80-L86 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/_types/Transform.ts#L80-L86 type RetentionPolicyContainer struct { // Time Specifies that the transform uses a time field to set the retention policy. Time *RetentionPolicy `json:"time,omitempty"` diff --git a/typedapi/types/retries.go b/typedapi/types/retries.go index 2e05fe5afc..7078c8c3d3 100644 --- a/typedapi/types/retries.go +++ b/typedapi/types/retries.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Retries type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Retries.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Retries.ts#L22-L25 type Retries struct { Bulk int64 `json:"bulk"` Search int64 `json:"search"` diff --git a/typedapi/types/reversenestedaggregate.go b/typedapi/types/reversenestedaggregate.go index aa630beb49..7068f0ee55 100644 --- a/typedapi/types/reversenestedaggregate.go +++ b/typedapi/types/reversenestedaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ReverseNestedAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L489-L490 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L489-L490 type ReverseNestedAggregate struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/reversenestedaggregation.go b/typedapi/types/reversenestedaggregation.go index 0ae302b5fe..0d6ef5a320 100644 --- a/typedapi/types/reversenestedaggregation.go +++ b/typedapi/types/reversenestedaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ReverseNestedAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L719-L725 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L719-L725 type ReverseNestedAggregation struct { Meta Metadata `json:"meta,omitempty"` Name *string `json:"name,omitempty"` diff --git a/typedapi/types/reversetokenfilter.go b/typedapi/types/reversetokenfilter.go index 0dadae2ca8..f0986aabcc 100644 --- a/typedapi/types/reversetokenfilter.go +++ b/typedapi/types/reversetokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ReverseTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L305-L307 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L305-L307 type ReverseTokenFilter struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/role.go b/typedapi/types/role.go index 87329d2847..8b8bd4b7d2 100644 --- a/typedapi/types/role.go +++ b/typedapi/types/role.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Role type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_role/types.ts#L29-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_role/types.ts#L29-L42 type Role struct { Applications []ApplicationPrivileges `json:"applications"` Cluster []string `json:"cluster"` diff --git a/typedapi/types/roledescriptor.go b/typedapi/types/roledescriptor.go index 694afcb3b5..8e285a9ad1 100644 --- a/typedapi/types/roledescriptor.go +++ b/typedapi/types/roledescriptor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RoleDescriptor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/RoleDescriptor.ts#L27-L55 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/RoleDescriptor.ts#L27-L55 type RoleDescriptor struct { // Applications A list of application privilege entries Applications []ApplicationPrivileges `json:"applications,omitempty"` diff --git a/typedapi/types/roledescriptorread.go b/typedapi/types/roledescriptorread.go index 05fb3827ea..a74dca0797 100644 --- a/typedapi/types/roledescriptorread.go +++ b/typedapi/types/roledescriptorread.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RoleDescriptorRead type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/RoleDescriptor.ts#L57-L85 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/RoleDescriptor.ts#L57-L85 type RoleDescriptorRead struct { // Applications A list of application privilege entries Applications []ApplicationPrivileges `json:"applications,omitempty"` diff --git a/typedapi/types/roledescriptorwrapper.go b/typedapi/types/roledescriptorwrapper.go index 33743a16d8..9614520911 100644 --- a/typedapi/types/roledescriptorwrapper.go +++ b/typedapi/types/roledescriptorwrapper.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RoleDescriptorWrapper type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_service_accounts/types.ts#L22-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_service_accounts/types.ts#L22-L24 type RoleDescriptorWrapper struct { RoleDescriptor RoleDescriptorRead `json:"role_descriptor"` } diff --git a/typedapi/types/rolemappingrule.go b/typedapi/types/rolemappingrule.go index c4d3bb40b1..b40706c7ed 100644 --- a/typedapi/types/rolemappingrule.go +++ b/typedapi/types/rolemappingrule.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RoleMappingRule type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/RoleMappingRule.ts#L23-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/RoleMappingRule.ts#L23-L31 type RoleMappingRule struct { All []RoleMappingRule `json:"all,omitempty"` Any []RoleMappingRule `json:"any,omitempty"` diff --git a/typedapi/types/roletemplate.go b/typedapi/types/roletemplate.go index 359f722180..2652a6d16f 100644 --- a/typedapi/types/roletemplate.go +++ b/typedapi/types/roletemplate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // RoleTemplate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_role/types.ts#L50-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/RoleTemplate.ts#L28-L31 type RoleTemplate struct { Format *templateformat.TemplateFormat `json:"format,omitempty"` Template Script `json:"template"` diff --git a/typedapi/types/roletemplateinlinequery.go b/typedapi/types/roletemplateinlinequery.go index f8d323744c..c89c5a40c3 100644 --- a/typedapi/types/roletemplateinlinequery.go +++ b/typedapi/types/roletemplateinlinequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // Query // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L160-L161 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L160-L161 type RoleTemplateInlineQuery interface{} diff --git a/typedapi/types/roletemplateinlinescript.go b/typedapi/types/roletemplateinlinescript.go index 110716056b..98f4a222ed 100644 --- a/typedapi/types/roletemplateinlinescript.go +++ b/typedapi/types/roletemplateinlinescript.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // RoleTemplateInlineScript type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L153-L158 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L153-L158 type RoleTemplateInlineScript struct { Lang *scriptlanguage.ScriptLanguage `json:"lang,omitempty"` Options map[string]string `json:"options,omitempty"` diff --git a/typedapi/types/roletemplatequery.go b/typedapi/types/roletemplatequery.go index 1edf508a95..b044d17a2e 100644 --- a/typedapi/types/roletemplatequery.go +++ b/typedapi/types/roletemplatequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RoleTemplateQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L141-L151 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L141-L151 type RoleTemplateQuery struct { // Template When you create a role, you can specify a query that defines the document // level security permissions. You can optionally diff --git a/typedapi/types/roletemplatescript.go b/typedapi/types/roletemplatescript.go index f00ff9a7d0..e25ab93519 100644 --- a/typedapi/types/roletemplatescript.go +++ b/typedapi/types/roletemplatescript.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // RoleTemplateInlineScript // StoredScriptId // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L163-L164 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L163-L164 type RoleTemplateScript interface{} diff --git a/typedapi/types/rolloverconditions.go b/typedapi/types/rolloverconditions.go index 3d38206d07..ba2c9e4b57 100644 --- a/typedapi/types/rolloverconditions.go +++ b/typedapi/types/rolloverconditions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RolloverConditions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/rollover/types.ts#L24-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/rollover/types.ts#L24-L40 type RolloverConditions struct { MaxAge Duration `json:"max_age,omitempty"` MaxAgeMillis *int64 `json:"max_age_millis,omitempty"` diff --git a/typedapi/types/rollupcapabilities.go b/typedapi/types/rollupcapabilities.go index 950c4c0d24..741360ba25 100644 --- a/typedapi/types/rollupcapabilities.go +++ b/typedapi/types/rollupcapabilities.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RollupCapabilities type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_rollup_caps/types.ts#L25-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_rollup_caps/types.ts#L25-L27 type RollupCapabilities struct { RollupJobs []RollupCapabilitySummary `json:"rollup_jobs"` } diff --git a/typedapi/types/rollupcapabilitysummary.go b/typedapi/types/rollupcapabilitysummary.go index 41c3d8f070..23bcd7648e 100644 --- a/typedapi/types/rollupcapabilitysummary.go +++ b/typedapi/types/rollupcapabilitysummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RollupCapabilitySummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_rollup_caps/types.ts#L29-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_rollup_caps/types.ts#L29-L34 type RollupCapabilitySummary struct { Fields map[string][]RollupFieldSummary `json:"fields"` IndexPattern string `json:"index_pattern"` diff --git a/typedapi/types/rollupfieldsummary.go b/typedapi/types/rollupfieldsummary.go index 9bffdedd80..8e5cf288b1 100644 --- a/typedapi/types/rollupfieldsummary.go +++ b/typedapi/types/rollupfieldsummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RollupFieldSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_rollup_caps/types.ts#L36-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_rollup_caps/types.ts#L36-L40 type RollupFieldSummary struct { Agg string `json:"agg"` CalendarInterval Duration `json:"calendar_interval,omitempty"` diff --git a/typedapi/types/rollupjob.go b/typedapi/types/rollupjob.go index df67e81339..009204d3c4 100644 --- a/typedapi/types/rollupjob.go +++ b/typedapi/types/rollupjob.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RollupJob type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_jobs/types.ts#L28-L32 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_jobs/types.ts#L28-L32 type RollupJob struct { Config RollupJobConfiguration `json:"config"` Stats RollupJobStats `json:"stats"` diff --git a/typedapi/types/rollupjobconfiguration.go b/typedapi/types/rollupjobconfiguration.go index 782ba6609a..40297ce1e1 100644 --- a/typedapi/types/rollupjobconfiguration.go +++ b/typedapi/types/rollupjobconfiguration.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RollupJobConfiguration type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_jobs/types.ts#L34-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_jobs/types.ts#L34-L43 type RollupJobConfiguration struct { Cron string `json:"cron"` Groups Groupings `json:"groups"` diff --git a/typedapi/types/rollupjobstats.go b/typedapi/types/rollupjobstats.go index 77eb549e26..ff7a2ab2a8 100644 --- a/typedapi/types/rollupjobstats.go +++ b/typedapi/types/rollupjobstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RollupJobStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_jobs/types.ts#L45-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_jobs/types.ts#L45-L58 type RollupJobStats struct { DocumentsProcessed int64 `json:"documents_processed"` IndexFailures int64 `json:"index_failures"` diff --git a/typedapi/types/rollupjobstatus.go b/typedapi/types/rollupjobstatus.go index 48abf9a417..57a79a7402 100644 --- a/typedapi/types/rollupjobstatus.go +++ b/typedapi/types/rollupjobstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // RollupJobStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_jobs/types.ts#L60-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_jobs/types.ts#L60-L64 type RollupJobStatus struct { CurrentPosition map[string]json.RawMessage `json:"current_position,omitempty"` JobState indexingjobstate.IndexingJobState `json:"job_state"` diff --git a/typedapi/types/rollupjobsummary.go b/typedapi/types/rollupjobsummary.go index 03e46f9dff..271ed54d00 100644 --- a/typedapi/types/rollupjobsummary.go +++ b/typedapi/types/rollupjobsummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RollupJobSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_rollup_index_caps/types.ts#L28-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_rollup_index_caps/types.ts#L28-L33 type RollupJobSummary struct { Fields map[string][]RollupJobSummaryField `json:"fields"` IndexPattern string `json:"index_pattern"` diff --git a/typedapi/types/rollupjobsummaryfield.go b/typedapi/types/rollupjobsummaryfield.go index 0557dddfae..99fef37cb0 100644 --- a/typedapi/types/rollupjobsummaryfield.go +++ b/typedapi/types/rollupjobsummaryfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RollupJobSummaryField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/get_rollup_index_caps/types.ts#L35-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/get_rollup_index_caps/types.ts#L35-L39 type RollupJobSummaryField struct { Agg string `json:"agg"` CalendarInterval Duration `json:"calendar_interval,omitempty"` diff --git a/typedapi/types/routingfield.go b/typedapi/types/routingfield.go index 343c67052d..cf374e51c8 100644 --- a/typedapi/types/routingfield.go +++ b/typedapi/types/routingfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RoutingField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/meta-fields.ts#L50-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/meta-fields.ts#L50-L52 type RoutingField struct { Required bool `json:"required"` } diff --git a/typedapi/types/rrfrank.go b/typedapi/types/rrfrank.go index f774883fda..519f7c6dbd 100644 --- a/typedapi/types/rrfrank.go +++ b/typedapi/types/rrfrank.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RrfRank type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Rank.ts#L32-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Rank.ts#L32-L37 type RrfRank struct { // RankConstant How much influence documents in individual result sets per query have over // the final ranked result set diff --git a/typedapi/types/rulecondition.go b/typedapi/types/rulecondition.go index 5c94ddc549..3a573ce413 100644 --- a/typedapi/types/rulecondition.go +++ b/typedapi/types/rulecondition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // RuleCondition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Rule.ts#L52-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Rule.ts#L52-L65 type RuleCondition struct { // AppliesTo Specifies the result property to which the condition applies. If your // detector uses `lat_long`, `metric`, `rare`, or `freq_rare` functions, you can diff --git a/typedapi/types/rulequery.go b/typedapi/types/rulequery.go index d061d8262c..01f2280c4c 100644 --- a/typedapi/types/rulequery.go +++ b/typedapi/types/rulequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RuleQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L369-L373 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L369-L373 type RuleQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/runningstatesearchinterval.go b/typedapi/types/runningstatesearchinterval.go index 11a56cd22d..cb8fb8f61a 100644 --- a/typedapi/types/runningstatesearchinterval.go +++ b/typedapi/types/runningstatesearchinterval.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // RunningStateSearchInterval type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Datafeed.ts#L214-L231 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Datafeed.ts#L214-L231 type RunningStateSearchInterval struct { // End The end time. End Duration `json:"end,omitempty"` diff --git a/typedapi/types/runtimefield.go b/typedapi/types/runtimefield.go index e7da408f1c..bba85dd26e 100644 --- a/typedapi/types/runtimefield.go +++ b/typedapi/types/runtimefield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // RuntimeField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/RuntimeFields.ts#L26-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/RuntimeFields.ts#L26-L48 type RuntimeField struct { // FetchFields For type `lookup` FetchFields []RuntimeFieldFetchFields `json:"fetch_fields,omitempty"` diff --git a/typedapi/types/runtimefieldfetchfields.go b/typedapi/types/runtimefieldfetchfields.go index 0f44f418c8..b5de38466f 100644 --- a/typedapi/types/runtimefieldfetchfields.go +++ b/typedapi/types/runtimefieldfetchfields.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RuntimeFieldFetchFields type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/RuntimeFields.ts#L50-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/RuntimeFields.ts#L50-L54 type RuntimeFieldFetchFields struct { Field string `json:"field"` Format *string `json:"format,omitempty"` diff --git a/typedapi/types/runtimefields.go b/typedapi/types/runtimefields.go index 5d26884f61..6aa21cbdb2 100644 --- a/typedapi/types/runtimefields.go +++ b/typedapi/types/runtimefields.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // RuntimeFields type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/RuntimeFields.ts#L24-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/RuntimeFields.ts#L24-L24 type RuntimeFields map[string]RuntimeField diff --git a/typedapi/types/runtimefieldstype.go b/typedapi/types/runtimefieldstype.go index d28fe4d588..f6a65e3dc2 100644 --- a/typedapi/types/runtimefieldstype.go +++ b/typedapi/types/runtimefieldstype.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // RuntimeFieldsType type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L279-L294 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L279-L294 type RuntimeFieldsType struct { CharsMax int64 `json:"chars_max"` CharsTotal int64 `json:"chars_total"` diff --git a/typedapi/types/samplediversity.go b/typedapi/types/samplediversity.go index 9c4791f122..9f4ea221da 100644 --- a/typedapi/types/samplediversity.go +++ b/typedapi/types/samplediversity.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SampleDiversity type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/graph/_types/ExploreControls.ts#L51-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/graph/_types/ExploreControls.ts#L51-L54 type SampleDiversity struct { Field string `json:"field"` MaxDocsPerValue int `json:"max_docs_per_value"` diff --git a/typedapi/types/sampleraggregate.go b/typedapi/types/sampleraggregate.go index 2c9ca43ea4..f14a96fc8c 100644 --- a/typedapi/types/sampleraggregate.go +++ b/typedapi/types/sampleraggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SamplerAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L498-L499 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L498-L499 type SamplerAggregate struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/sampleraggregation.go b/typedapi/types/sampleraggregation.go index d8072696df..56fb454229 100644 --- a/typedapi/types/sampleraggregation.go +++ b/typedapi/types/sampleraggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SamplerAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L727-L733 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L727-L733 type SamplerAggregation struct { Meta Metadata `json:"meta,omitempty"` Name *string `json:"name,omitempty"` diff --git a/typedapi/types/scalarvalue.go b/typedapi/types/scalarvalue.go new file mode 100644 index 0000000000..58e80315cc --- /dev/null +++ b/typedapi/types/scalarvalue.go @@ -0,0 +1,32 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package types + +// ScalarValue holds the union for the following types: +// +// int64 +// Float64 +// string +// bool +// nil +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L39-L43 +type ScalarValue interface{} diff --git a/typedapi/types/scaledfloatnumberproperty.go b/typedapi/types/scaledfloatnumberproperty.go index a4fe02b555..36eaa0dcf8 100644 --- a/typedapi/types/scaledfloatnumberproperty.go +++ b/typedapi/types/scaledfloatnumberproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // ScaledFloatNumberProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L174-L178 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L174-L178 type ScaledFloatNumberProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -261,6 +261,12 @@ func (s *ScaledFloatNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -635,6 +641,12 @@ func (s *ScaledFloatNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/schedulecontainer.go b/typedapi/types/schedulecontainer.go index 201a5cf669..35cababa30 100644 --- a/typedapi/types/schedulecontainer.go +++ b/typedapi/types/schedulecontainer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ScheduleContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L85-L96 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L85-L96 type ScheduleContainer struct { Cron *string `json:"cron,omitempty"` Daily *DailySchedule `json:"daily,omitempty"` diff --git a/typedapi/types/scheduletimeofday.go b/typedapi/types/scheduletimeofday.go index 0897767566..8b98fa3421 100644 --- a/typedapi/types/scheduletimeofday.go +++ b/typedapi/types/scheduletimeofday.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // HourAndMinute // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L103-L108 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L103-L108 type ScheduleTimeOfDay interface{} diff --git a/typedapi/types/scheduletriggerevent.go b/typedapi/types/scheduletriggerevent.go index ec654240cd..41ccc46a7b 100644 --- a/typedapi/types/scheduletriggerevent.go +++ b/typedapi/types/scheduletriggerevent.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ScheduleTriggerEvent type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L98-L101 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L98-L101 type ScheduleTriggerEvent struct { ScheduledTime DateTime `json:"scheduled_time"` TriggeredTime DateTime `json:"triggered_time,omitempty"` diff --git a/typedapi/types/scoresort.go b/typedapi/types/scoresort.go index 80c9060f05..91a87b4e77 100644 --- a/typedapi/types/scoresort.go +++ b/typedapi/types/scoresort.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // ScoreSort type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L55-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L55-L57 type ScoreSort struct { Order *sortorder.SortOrder `json:"order,omitempty"` } diff --git a/typedapi/types/script.go b/typedapi/types/script.go index ddae51121f..1c620a423e 100644 --- a/typedapi/types/script.go +++ b/typedapi/types/script.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // InlineScript // StoredScriptId // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Scripting.ts#L88-L89 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Scripting.ts#L88-L89 type Script interface{} diff --git a/typedapi/types/scriptcache.go b/typedapi/types/scriptcache.go index 685a045ecd..feec69bcb2 100644 --- a/typedapi/types/scriptcache.go +++ b/typedapi/types/scriptcache.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ScriptCache type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L1031-L1045 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L1031-L1045 type ScriptCache struct { // CacheEvictions Total number of times the script cache has evicted old data. CacheEvictions *int64 `json:"cache_evictions,omitempty"` diff --git a/typedapi/types/scriptcondition.go b/typedapi/types/scriptcondition.go index 4b25aef43c..7900a1ecbc 100644 --- a/typedapi/types/scriptcondition.go +++ b/typedapi/types/scriptcondition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ScriptCondition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Conditions.ts#L76-L84 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Conditions.ts#L76-L84 type ScriptCondition struct { Id *string `json:"id,omitempty"` Lang *string `json:"lang,omitempty"` diff --git a/typedapi/types/scriptedheuristic.go b/typedapi/types/scriptedheuristic.go index e802586f82..863d4df8af 100644 --- a/typedapi/types/scriptedheuristic.go +++ b/typedapi/types/scriptedheuristic.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ScriptedHeuristic type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L766-L768 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L766-L768 type ScriptedHeuristic struct { Script Script `json:"script"` } diff --git a/typedapi/types/scriptedmetricaggregate.go b/typedapi/types/scriptedmetricaggregate.go index d67644a241..407305e21b 100644 --- a/typedapi/types/scriptedmetricaggregate.go +++ b/typedapi/types/scriptedmetricaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ScriptedMetricAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L649-L652 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L649-L652 type ScriptedMetricAggregate struct { Meta Metadata `json:"meta,omitempty"` Value json.RawMessage `json:"value,omitempty"` diff --git a/typedapi/types/scriptedmetricaggregation.go b/typedapi/types/scriptedmetricaggregation.go index 3f75cef3e6..3272c47e83 100644 --- a/typedapi/types/scriptedmetricaggregation.go +++ b/typedapi/types/scriptedmetricaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ScriptedMetricAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L254-L280 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L254-L280 type ScriptedMetricAggregation struct { // CombineScript Runs once on each shard after document collection is complete. // Allows the aggregation to consolidate the state returned from each shard. diff --git a/typedapi/types/scriptfield.go b/typedapi/types/scriptfield.go index 850b64b8a0..d7281f04ae 100644 --- a/typedapi/types/scriptfield.go +++ b/typedapi/types/scriptfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ScriptField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Scripting.ts#L91-L94 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Scripting.ts#L91-L94 type ScriptField struct { IgnoreFailure *bool `json:"ignore_failure,omitempty"` Script Script `json:"script"` diff --git a/typedapi/types/scripting.go b/typedapi/types/scripting.go index a20858ec5d..b4d0abed08 100644 --- a/typedapi/types/scripting.go +++ b/typedapi/types/scripting.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Scripting type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L977-L995 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L977-L995 type Scripting struct { // CacheEvictions Total number of times the script cache has evicted old data. CacheEvictions *int64 `json:"cache_evictions,omitempty"` diff --git a/typedapi/types/scriptquery.go b/typedapi/types/scriptquery.go index 4480d247a9..45c11780bf 100644 --- a/typedapi/types/scriptquery.go +++ b/typedapi/types/scriptquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ScriptQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L318-L324 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L318-L324 type ScriptQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/scriptscorefunction.go b/typedapi/types/scriptscorefunction.go index 6f5b85a6df..ee016b6416 100644 --- a/typedapi/types/scriptscorefunction.go +++ b/typedapi/types/scriptscorefunction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ScriptScoreFunction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/compound.ts#L120-L125 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/compound.ts#L120-L125 type ScriptScoreFunction struct { // Script A script that computes a score. Script Script `json:"script"` diff --git a/typedapi/types/scriptscorequery.go b/typedapi/types/scriptscorequery.go index bae38c49df..9795c28551 100644 --- a/typedapi/types/scriptscorequery.go +++ b/typedapi/types/scriptscorequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ScriptScoreQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L326-L340 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L326-L340 type ScriptScoreQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/scriptsort.go b/typedapi/types/scriptsort.go index 34819f395c..4afaf03a30 100644 --- a/typedapi/types/scriptsort.go +++ b/typedapi/types/scriptsort.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // ScriptSort type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L68-L74 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L68-L74 type ScriptSort struct { Mode *sortmode.SortMode `json:"mode,omitempty"` Nested *NestedSortValue `json:"nested,omitempty"` diff --git a/typedapi/types/scripttransform.go b/typedapi/types/scripttransform.go index 3655b5c08a..3bd162b233 100644 --- a/typedapi/types/scripttransform.go +++ b/typedapi/types/scripttransform.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ScriptTransform type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Transform.ts#L36-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Transform.ts#L36-L44 type ScriptTransform struct { Id *string `json:"id,omitempty"` Lang *string `json:"lang,omitempty"` diff --git a/typedapi/types/scrollids.go b/typedapi/types/scrollids.go index 3fbed86a8f..ebe9799641 100644 --- a/typedapi/types/scrollids.go +++ b/typedapi/types/scrollids.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ScrollIds type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L50-L50 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L56-L56 type ScrollIds []string diff --git a/typedapi/types/searchablesnapshots.go b/typedapi/types/searchablesnapshots.go index 47cda3acf3..2e25936b65 100644 --- a/typedapi/types/searchablesnapshots.go +++ b/typedapi/types/searchablesnapshots.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SearchableSnapshots type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L428-L432 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L428-L432 type SearchableSnapshots struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/searchapplication.go b/typedapi/types/searchapplication.go index fcd60af517..305879800d 100644 --- a/typedapi/types/searchapplication.go +++ b/typedapi/types/searchapplication.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SearchApplication type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/_types/SearchApplication.ts#L24-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/_types/SearchApplication.ts#L24-L45 type SearchApplication struct { // AnalyticsCollectionName Analytics collection associated to the Search Application. AnalyticsCollectionName *string `json:"analytics_collection_name,omitempty"` diff --git a/typedapi/types/searchapplicationlistitem.go b/typedapi/types/searchapplicationlistitem.go index 634adec5cd..31fcd98d07 100644 --- a/typedapi/types/searchapplicationlistitem.go +++ b/typedapi/types/searchapplicationlistitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SearchApplicationListItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/list/SearchApplicationsListResponse.ts#L31-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/list/SearchApplicationsListResponse.ts#L31-L48 type SearchApplicationListItem struct { // AnalyticsCollectionName Analytics collection associated to the Search Application AnalyticsCollectionName *string `json:"analytics_collection_name,omitempty"` diff --git a/typedapi/types/searchapplicationtemplate.go b/typedapi/types/searchapplicationtemplate.go index 697e5b2298..aae0681516 100644 --- a/typedapi/types/searchapplicationtemplate.go +++ b/typedapi/types/searchapplicationtemplate.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SearchApplicationTemplate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/search_application/_types/SearchApplication.ts#L47-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/search_application/_types/SearchApplication.ts#L47-L52 type SearchApplicationTemplate struct { // Script The associated mustache template. Script InlineScript `json:"script"` diff --git a/typedapi/types/searchasyoutypeproperty.go b/typedapi/types/searchasyoutypeproperty.go index 57d6caa9f2..ab9fe88d77 100644 --- a/typedapi/types/searchasyoutypeproperty.go +++ b/typedapi/types/searchasyoutypeproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // SearchAsYouTypeProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L197-L207 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L197-L207 type SearchAsYouTypeProperty struct { Analyzer *string `json:"analyzer,omitempty"` CopyTo []string `json:"copy_to,omitempty"` @@ -222,6 +222,12 @@ func (s *SearchAsYouTypeProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -596,6 +602,12 @@ func (s *SearchAsYouTypeProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/searchidle.go b/typedapi/types/searchidle.go index 3d34868454..a26a83a2d5 100644 --- a/typedapi/types/searchidle.go +++ b/typedapi/types/searchidle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SearchIdle type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L236-L239 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L236-L239 type SearchIdle struct { After Duration `json:"after,omitempty"` } diff --git a/typedapi/types/searchinput.go b/typedapi/types/searchinput.go index da171f853f..06f966e04a 100644 --- a/typedapi/types/searchinput.go +++ b/typedapi/types/searchinput.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SearchInput type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L112-L116 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L112-L116 type SearchInput struct { Extract []string `json:"extract,omitempty"` Request SearchInputRequestDefinition `json:"request"` diff --git a/typedapi/types/searchinputrequestbody.go b/typedapi/types/searchinputrequestbody.go index b19828de59..884d7fd263 100644 --- a/typedapi/types/searchinputrequestbody.go +++ b/typedapi/types/searchinputrequestbody.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SearchInputRequestBody type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L147-L149 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L147-L149 type SearchInputRequestBody struct { Query Query `json:"query"` } diff --git a/typedapi/types/searchinputrequestdefinition.go b/typedapi/types/searchinputrequestdefinition.go index 0e9e65ea06..f1851aaf47 100644 --- a/typedapi/types/searchinputrequestdefinition.go +++ b/typedapi/types/searchinputrequestdefinition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SearchInputRequestDefinition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L118-L125 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L118-L125 type SearchInputRequestDefinition struct { Body *SearchInputRequestBody `json:"body,omitempty"` Indices []string `json:"indices,omitempty"` diff --git a/typedapi/types/searchprofile.go b/typedapi/types/searchprofile.go index 2bbf2087e9..db4a5c364f 100644 --- a/typedapi/types/searchprofile.go +++ b/typedapi/types/searchprofile.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SearchProfile type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L126-L130 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L126-L130 type SearchProfile struct { Collector []Collector `json:"collector"` Query []QueryProfile `json:"query"` diff --git a/typedapi/types/searchstats.go b/typedapi/types/searchstats.go index fb2d94f59d..33dc4e867d 100644 --- a/typedapi/types/searchstats.go +++ b/typedapi/types/searchstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SearchStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L252-L271 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L252-L271 type SearchStats struct { FetchCurrent int64 `json:"fetch_current"` FetchTime Duration `json:"fetch_time,omitempty"` diff --git a/typedapi/types/searchtemplaterequestbody.go b/typedapi/types/searchtemplaterequestbody.go index a1ac6f28a3..b5f5f2f511 100644 --- a/typedapi/types/searchtemplaterequestbody.go +++ b/typedapi/types/searchtemplaterequestbody.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SearchTemplateRequestBody type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L128-L145 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L128-L145 type SearchTemplateRequestBody struct { Explain *bool `json:"explain,omitempty"` // Id ID of the search template to use. If no source is specified, diff --git a/typedapi/types/searchtransform.go b/typedapi/types/searchtransform.go index 2c14e28bc6..342ec7c60d 100644 --- a/typedapi/types/searchtransform.go +++ b/typedapi/types/searchtransform.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SearchTransform type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Transform.ts#L46-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Transform.ts#L46-L49 type SearchTransform struct { Request SearchInputRequestDefinition `json:"request"` Timeout Duration `json:"timeout"` diff --git a/typedapi/types/security.go b/typedapi/types/security.go index d52993c044..6932d81949 100644 --- a/typedapi/types/security.go +++ b/typedapi/types/security.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Security type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L434-L447 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L434-L447 type Security struct { Anonymous FeatureToggle `json:"anonymous"` ApiKeyService FeatureToggle `json:"api_key_service"` diff --git a/typedapi/types/securityrealm.go b/typedapi/types/securityrealm.go index 5386e3725c..fe1c7e9575 100644 --- a/typedapi/types/securityrealm.go +++ b/typedapi/types/securityrealm.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SecurityRealm type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/RoleMappingRule.ts#L44-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/RoleMappingRule.ts#L44-L46 type SecurityRealm struct { Name string `json:"name"` } diff --git a/typedapi/types/securityrolemapping.go b/typedapi/types/securityrolemapping.go index 2d47cbdced..797b13ee23 100644 --- a/typedapi/types/securityrolemapping.go +++ b/typedapi/types/securityrolemapping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SecurityRoleMapping type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/RoleMapping.ts#L25-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/RoleMapping.ts#L25-L31 type SecurityRoleMapping struct { Enabled bool `json:"enabled"` Metadata Metadata `json:"metadata"` diff --git a/typedapi/types/securityroles.go b/typedapi/types/securityroles.go index d83464caf4..a30558055d 100644 --- a/typedapi/types/securityroles.go +++ b/typedapi/types/securityroles.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SecurityRoles type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L296-L300 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L296-L300 type SecurityRoles struct { Dls SecurityRolesDls `json:"dls"` File SecurityRolesFile `json:"file"` diff --git a/typedapi/types/securityrolesdls.go b/typedapi/types/securityrolesdls.go index e97b1636be..4469c6fd36 100644 --- a/typedapi/types/securityrolesdls.go +++ b/typedapi/types/securityrolesdls.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SecurityRolesDls type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L308-L310 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L308-L310 type SecurityRolesDls struct { BitSetCache SecurityRolesDlsBitSetCache `json:"bit_set_cache"` } diff --git a/typedapi/types/securityrolesdlsbitsetcache.go b/typedapi/types/securityrolesdlsbitsetcache.go index c92efc7857..0bf93982a5 100644 --- a/typedapi/types/securityrolesdlsbitsetcache.go +++ b/typedapi/types/securityrolesdlsbitsetcache.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SecurityRolesDlsBitSetCache type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L312-L316 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L312-L316 type SecurityRolesDlsBitSetCache struct { Count int `json:"count"` Memory ByteSize `json:"memory,omitempty"` diff --git a/typedapi/types/securityrolesfile.go b/typedapi/types/securityrolesfile.go index 0eb58d8094..63c1c21dc1 100644 --- a/typedapi/types/securityrolesfile.go +++ b/typedapi/types/securityrolesfile.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SecurityRolesFile type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L318-L322 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L318-L322 type SecurityRolesFile struct { Dls bool `json:"dls"` Fls bool `json:"fls"` diff --git a/typedapi/types/securityrolesnative.go b/typedapi/types/securityrolesnative.go index ecf808532c..b074ad9844 100644 --- a/typedapi/types/securityrolesnative.go +++ b/typedapi/types/securityrolesnative.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SecurityRolesNative type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L302-L306 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L302-L306 type SecurityRolesNative struct { Dls bool `json:"dls"` Fls bool `json:"fls"` diff --git a/typedapi/types/segment.go b/typedapi/types/segment.go index 20a7973c3c..a6c3d67d24 100644 --- a/typedapi/types/segment.go +++ b/typedapi/types/segment.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Segment type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/segments/types.ts#L28-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/segments/types.ts#L28-L38 type Segment struct { Attributes map[string]string `json:"attributes"` Committed bool `json:"committed"` diff --git a/typedapi/types/segmentsrecord.go b/typedapi/types/segmentsrecord.go index bc43cda37e..4b5311e074 100644 --- a/typedapi/types/segmentsrecord.go +++ b/typedapi/types/segmentsrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SegmentsRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/segments/types.ts#L22-L107 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/segments/types.ts#L22-L107 type SegmentsRecord struct { // Committed If `true`, the segment is synced to disk. // Segments that are synced can survive a hard reboot. diff --git a/typedapi/types/segmentsstats.go b/typedapi/types/segmentsstats.go index 19a94f4031..a3257a5f9d 100644 --- a/typedapi/types/segmentsstats.go +++ b/typedapi/types/segmentsstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SegmentsStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L273-L366 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L273-L366 type SegmentsStats struct { // Count Total number of segments across all shards assigned to selected nodes. Count int `json:"count"` diff --git a/typedapi/types/serialdifferencingaggregation.go b/typedapi/types/serialdifferencingaggregation.go index d61f4c45bb..6154d53722 100644 --- a/typedapi/types/serialdifferencingaggregation.go +++ b/typedapi/types/serialdifferencingaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SerialDifferencingAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L363-L369 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L363-L369 type SerialDifferencingAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/serializedclusterstate.go b/typedapi/types/serializedclusterstate.go index dcdbd8d8ef..0b605fcb59 100644 --- a/typedapi/types/serializedclusterstate.go +++ b/typedapi/types/serializedclusterstate.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SerializedClusterState type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L232-L238 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L232-L238 type SerializedClusterState struct { Diffs *SerializedClusterStateDetail `json:"diffs,omitempty"` // FullStates Number of published cluster states. diff --git a/typedapi/types/serializedclusterstatedetail.go b/typedapi/types/serializedclusterstatedetail.go index cd44932241..3a2c90567b 100644 --- a/typedapi/types/serializedclusterstatedetail.go +++ b/typedapi/types/serializedclusterstatedetail.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SerializedClusterStateDetail type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L240-L246 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L240-L246 type SerializedClusterStateDetail struct { CompressedSize *string `json:"compressed_size,omitempty"` CompressedSizeInBytes *int64 `json:"compressed_size_in_bytes,omitempty"` diff --git a/typedapi/types/servicetoken.go b/typedapi/types/servicetoken.go index 745e2b3af3..389116ca62 100644 --- a/typedapi/types/servicetoken.go +++ b/typedapi/types/servicetoken.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ServiceToken type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/create_service_token/types.ts#L22-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/create_service_token/types.ts#L22-L25 type ServiceToken struct { Name string `json:"name"` Value string `json:"value"` diff --git a/typedapi/types/setprocessor.go b/typedapi/types/setprocessor.go index 619dbc3aab..3d83d693fd 100644 --- a/typedapi/types/setprocessor.go +++ b/typedapi/types/setprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SetProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L982-L1016 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L982-L1016 type SetProcessor struct { // CopyFrom The origin field which will be copied to `field`, cannot set `value` // simultaneously. diff --git a/typedapi/types/setsecurityuserprocessor.go b/typedapi/types/setsecurityuserprocessor.go index 1da3d025c8..7292e59b7d 100644 --- a/typedapi/types/setsecurityuserprocessor.go +++ b/typedapi/types/setsecurityuserprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SetSecurityUserProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L1018-L1027 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L1018-L1027 type SetSecurityUserProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/settings.go b/typedapi/types/settings.go index e6a1c26cd5..7555c5271b 100644 --- a/typedapi/types/settings.go +++ b/typedapi/types/settings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Settings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/_types/Transform.ts#L98-L144 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/_types/Transform.ts#L98-L144 type Settings struct { // AlignCheckpoints Specifies whether the transform checkpoint ranges should be optimized for // performance. Such optimization can align diff --git a/typedapi/types/settingsanalyze.go b/typedapi/types/settingsanalyze.go index 0f8b903940..94e1682ebb 100644 --- a/typedapi/types/settingsanalyze.go +++ b/typedapi/types/settingsanalyze.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SettingsAnalyze type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L226-L229 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L226-L229 type SettingsAnalyze struct { MaxTokenCount Stringifiedinteger `json:"max_token_count,omitempty"` } diff --git a/typedapi/types/settingshighlight.go b/typedapi/types/settingshighlight.go index ce92ba9320..12fccfa1ce 100644 --- a/typedapi/types/settingshighlight.go +++ b/typedapi/types/settingshighlight.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SettingsHighlight type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L221-L224 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L221-L224 type SettingsHighlight struct { MaxAnalyzedOffset *int `json:"max_analyzed_offset,omitempty"` } diff --git a/typedapi/types/settingsquerystring.go b/typedapi/types/settingsquerystring.go index c74752318f..11dda7781a 100644 --- a/typedapi/types/settingsquerystring.go +++ b/typedapi/types/settingsquerystring.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SettingsQueryString type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L241-L243 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L241-L243 type SettingsQueryString struct { Lenient Stringifiedboolean `json:"lenient"` } diff --git a/typedapi/types/settingssearch.go b/typedapi/types/settingssearch.go index 5c002997ab..5844b051e5 100644 --- a/typedapi/types/settingssearch.go +++ b/typedapi/types/settingssearch.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SettingsSearch type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L231-L234 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L231-L234 type SettingsSearch struct { Idle *SearchIdle `json:"idle,omitempty"` Slowlog *SlowlogSettings `json:"slowlog,omitempty"` diff --git a/typedapi/types/settingssimilarity.go b/typedapi/types/settingssimilarity.go index f855fb33cb..f394223607 100644 --- a/typedapi/types/settingssimilarity.go +++ b/typedapi/types/settingssimilarity.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SettingsSimilarity type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L170-L178 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L170-L178 type SettingsSimilarity struct { Bm25 *SettingsSimilarityBm25 `json:"bm25,omitempty"` Dfi *SettingsSimilarityDfi `json:"dfi,omitempty"` diff --git a/typedapi/types/settingssimilaritybm25.go b/typedapi/types/settingssimilaritybm25.go index 0059d5770b..a7adedbfe4 100644 --- a/typedapi/types/settingssimilaritybm25.go +++ b/typedapi/types/settingssimilaritybm25.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SettingsSimilarityBm25 type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L180-L185 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L180-L185 type SettingsSimilarityBm25 struct { B Float64 `json:"b"` DiscountOverlaps bool `json:"discount_overlaps"` diff --git a/typedapi/types/settingssimilaritydfi.go b/typedapi/types/settingssimilaritydfi.go index 4a432e3dde..48d7d1df57 100644 --- a/typedapi/types/settingssimilaritydfi.go +++ b/typedapi/types/settingssimilaritydfi.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -28,7 +28,7 @@ import ( // SettingsSimilarityDfi type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L187-L190 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L187-L190 type SettingsSimilarityDfi struct { IndependenceMeasure dfiindependencemeasure.DFIIndependenceMeasure `json:"independence_measure"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/settingssimilaritydfr.go b/typedapi/types/settingssimilaritydfr.go index b3fd04fb83..55c1fb3cfb 100644 --- a/typedapi/types/settingssimilaritydfr.go +++ b/typedapi/types/settingssimilaritydfr.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SettingsSimilarityDfr type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L192-L197 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L192-L197 type SettingsSimilarityDfr struct { AfterEffect dfraftereffect.DFRAfterEffect `json:"after_effect"` BasicModel dfrbasicmodel.DFRBasicModel `json:"basic_model"` diff --git a/typedapi/types/settingssimilarityib.go b/typedapi/types/settingssimilarityib.go index b86b2a99af..324bd1ce26 100644 --- a/typedapi/types/settingssimilarityib.go +++ b/typedapi/types/settingssimilarityib.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SettingsSimilarityIb type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L199-L204 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L199-L204 type SettingsSimilarityIb struct { Distribution ibdistribution.IBDistribution `json:"distribution"` Lambda iblambda.IBLambda `json:"lambda"` diff --git a/typedapi/types/settingssimilaritylmd.go b/typedapi/types/settingssimilaritylmd.go index 33fa306c51..664fb8a839 100644 --- a/typedapi/types/settingssimilaritylmd.go +++ b/typedapi/types/settingssimilaritylmd.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SettingsSimilarityLmd type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L206-L209 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L206-L209 type SettingsSimilarityLmd struct { Mu int `json:"mu"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/settingssimilaritylmj.go b/typedapi/types/settingssimilaritylmj.go index b20e19541c..a397fc585b 100644 --- a/typedapi/types/settingssimilaritylmj.go +++ b/typedapi/types/settingssimilaritylmj.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SettingsSimilarityLmj type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L211-L214 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L211-L214 type SettingsSimilarityLmj struct { Lambda Float64 `json:"lambda"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/settingssimilarityscriptedtfidf.go b/typedapi/types/settingssimilarityscriptedtfidf.go index ba554625aa..346ddab55e 100644 --- a/typedapi/types/settingssimilarityscriptedtfidf.go +++ b/typedapi/types/settingssimilarityscriptedtfidf.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SettingsSimilarityScriptedTfidf type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L216-L219 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L216-L219 type SettingsSimilarityScriptedTfidf struct { Script Script `json:"script"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/shapefieldquery.go b/typedapi/types/shapefieldquery.go index 73350911e9..5932a92c25 100644 --- a/typedapi/types/shapefieldquery.go +++ b/typedapi/types/shapefieldquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // ShapeFieldQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L354-L367 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L354-L367 type ShapeFieldQuery struct { // IndexedShape Queries using a pre-indexed shape. IndexedShape *FieldLookup `json:"indexed_shape,omitempty"` diff --git a/typedapi/types/shapeproperty.go b/typedapi/types/shapeproperty.go index a930543cec..21e269a780 100644 --- a/typedapi/types/shapeproperty.go +++ b/typedapi/types/shapeproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // ShapeProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/geo.ts#L69-L81 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/geo.ts#L69-L81 type ShapeProperty struct { Coerce *bool `json:"coerce,omitempty"` CopyTo []string `json:"copy_to,omitempty"` @@ -234,6 +234,12 @@ func (s *ShapeProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -592,6 +598,12 @@ func (s *ShapeProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/shapequery.go b/typedapi/types/shapequery.go index 02b8bc6dba..053d8396a0 100644 --- a/typedapi/types/shapequery.go +++ b/typedapi/types/shapequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // ShapeQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/specialized.ts#L344-L352 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/specialized.ts#L344-L352 type ShapeQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/shardcommit.go b/typedapi/types/shardcommit.go index e2f27aadc7..6df45059f8 100644 --- a/typedapi/types/shardcommit.go +++ b/typedapi/types/shardcommit.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardCommit type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L112-L117 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L112-L117 type ShardCommit struct { Generation int `json:"generation"` Id string `json:"id"` diff --git a/typedapi/types/shardfailure.go b/typedapi/types/shardfailure.go index d5e13f6cc4..b35131c20c 100644 --- a/typedapi/types/shardfailure.go +++ b/typedapi/types/shardfailure.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardFailure type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Errors.ts#L50-L56 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Errors.ts#L50-L56 type ShardFailure struct { Index *string `json:"index,omitempty"` Node *string `json:"node,omitempty"` diff --git a/typedapi/types/shardfilesizeinfo.go b/typedapi/types/shardfilesizeinfo.go index 26c8dd4fac..76a2d1b1b3 100644 --- a/typedapi/types/shardfilesizeinfo.go +++ b/typedapi/types/shardfilesizeinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardFileSizeInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L124-L131 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L124-L131 type ShardFileSizeInfo struct { AverageSizeInBytes *int64 `json:"average_size_in_bytes,omitempty"` Count *int64 `json:"count,omitempty"` diff --git a/typedapi/types/shardhealthstats.go b/typedapi/types/shardhealthstats.go index f7ad6daafd..b675f409b9 100644 --- a/typedapi/types/shardhealthstats.go +++ b/typedapi/types/shardhealthstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ShardHealthStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/health/types.ts#L36-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/health/types.ts#L36-L43 type ShardHealthStats struct { ActiveShards int `json:"active_shards"` InitializingShards int `json:"initializing_shards"` diff --git a/typedapi/types/shardlease.go b/typedapi/types/shardlease.go index c732701687..9dfbfbdc50 100644 --- a/typedapi/types/shardlease.go +++ b/typedapi/types/shardlease.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardLease type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L133-L138 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L133-L138 type ShardLease struct { Id string `json:"id"` RetainingSeqNo int64 `json:"retaining_seq_no"` diff --git a/typedapi/types/shardmigrationstatus.go b/typedapi/types/shardmigrationstatus.go index 82c6d5f792..b1398aa183 100644 --- a/typedapi/types/shardmigrationstatus.go +++ b/typedapi/types/shardmigrationstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // ShardMigrationStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L52-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/shutdown/get_node/ShutdownGetNodeResponse.ts#L52-L54 type ShardMigrationStatus struct { Status shutdownstatus.ShutdownStatus `json:"status"` } diff --git a/typedapi/types/shardpath.go b/typedapi/types/shardpath.go index dc9b2b24c3..4be6da5ffe 100644 --- a/typedapi/types/shardpath.go +++ b/typedapi/types/shardpath.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardPath type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L140-L144 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L140-L144 type ShardPath struct { DataPath string `json:"data_path"` IsCustomDataPath bool `json:"is_custom_data_path"` diff --git a/typedapi/types/shardprofile.go b/typedapi/types/shardprofile.go index 2be29983d1..88640a4596 100644 --- a/typedapi/types/shardprofile.go +++ b/typedapi/types/shardprofile.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardProfile type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/profile.ts#L132-L137 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/profile.ts#L132-L137 type ShardProfile struct { Aggregations []AggregationProfile `json:"aggregations"` Fetch *FetchProfile `json:"fetch,omitempty"` diff --git a/typedapi/types/shardquerycache.go b/typedapi/types/shardquerycache.go index 8500087305..4d7288be9f 100644 --- a/typedapi/types/shardquerycache.go +++ b/typedapi/types/shardquerycache.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardQueryCache type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L146-L154 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L146-L154 type ShardQueryCache struct { CacheCount int64 `json:"cache_count"` CacheSize int64 `json:"cache_size"` diff --git a/typedapi/types/shardrecovery.go b/typedapi/types/shardrecovery.go index 3e585ddf10..dde5ad2a01 100644 --- a/typedapi/types/shardrecovery.go +++ b/typedapi/types/shardrecovery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardRecovery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/types.ts#L118-L135 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/types.ts#L118-L135 type ShardRecovery struct { Id int64 `json:"id"` Index RecoveryIndexStatus `json:"index"` diff --git a/typedapi/types/shardretentionleases.go b/typedapi/types/shardretentionleases.go index c8d20991b8..23c8500dd5 100644 --- a/typedapi/types/shardretentionleases.go +++ b/typedapi/types/shardretentionleases.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardRetentionLeases type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L156-L160 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L156-L160 type ShardRetentionLeases struct { Leases []ShardLease `json:"leases"` PrimaryTerm int64 `json:"primary_term"` diff --git a/typedapi/types/shardrouting.go b/typedapi/types/shardrouting.go index e243cee883..562640c64f 100644 --- a/typedapi/types/shardrouting.go +++ b/typedapi/types/shardrouting.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ShardRouting type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L162-L167 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L162-L167 type ShardRouting struct { Node string `json:"node"` Primary bool `json:"primary"` diff --git a/typedapi/types/shardsavailabilityindicator.go b/typedapi/types/shardsavailabilityindicator.go index ebf48771c0..1c88a094c1 100644 --- a/typedapi/types/shardsavailabilityindicator.go +++ b/typedapi/types/shardsavailabilityindicator.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ShardsAvailabilityIndicator type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L104-L108 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L104-L108 type ShardsAvailabilityIndicator struct { Details *ShardsAvailabilityIndicatorDetails `json:"details,omitempty"` Diagnosis []Diagnosis `json:"diagnosis,omitempty"` diff --git a/typedapi/types/shardsavailabilityindicatordetails.go b/typedapi/types/shardsavailabilityindicatordetails.go index 7b9f3ef6b3..da36a6ebca 100644 --- a/typedapi/types/shardsavailabilityindicatordetails.go +++ b/typedapi/types/shardsavailabilityindicatordetails.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardsAvailabilityIndicatorDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L109-L119 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L109-L119 type ShardsAvailabilityIndicatorDetails struct { CreatingPrimaries int64 `json:"creating_primaries"` InitializingPrimaries int64 `json:"initializing_primaries"` diff --git a/typedapi/types/shardscapacityindicator.go b/typedapi/types/shardscapacityindicator.go index 8b2dc3f331..60638f1a01 100644 --- a/typedapi/types/shardscapacityindicator.go +++ b/typedapi/types/shardscapacityindicator.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ShardsCapacityIndicator type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L171-L175 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L171-L175 type ShardsCapacityIndicator struct { Details *ShardsCapacityIndicatorDetails `json:"details,omitempty"` Diagnosis []Diagnosis `json:"diagnosis,omitempty"` diff --git a/typedapi/types/shardscapacityindicatordetails.go b/typedapi/types/shardscapacityindicatordetails.go index e08e683584..131ce94acb 100644 --- a/typedapi/types/shardscapacityindicatordetails.go +++ b/typedapi/types/shardscapacityindicatordetails.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ShardsCapacityIndicatorDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L177-L180 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L177-L180 type ShardsCapacityIndicatorDetails struct { Data ShardsCapacityIndicatorTierDetail `json:"data"` Frozen ShardsCapacityIndicatorTierDetail `json:"frozen"` diff --git a/typedapi/types/shardscapacityindicatortierdetail.go b/typedapi/types/shardscapacityindicatortierdetail.go index 6f3c8d8313..3352252fa1 100644 --- a/typedapi/types/shardscapacityindicatortierdetail.go +++ b/typedapi/types/shardscapacityindicatortierdetail.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardsCapacityIndicatorTierDetail type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L182-L185 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L182-L185 type ShardsCapacityIndicatorTierDetail struct { CurrentUsedShards *int `json:"current_used_shards,omitempty"` MaxShardsInCluster int `json:"max_shards_in_cluster"` diff --git a/typedapi/types/shardsegmentrouting.go b/typedapi/types/shardsegmentrouting.go index e58003ca1a..0bc53ba879 100644 --- a/typedapi/types/shardsegmentrouting.go +++ b/typedapi/types/shardsegmentrouting.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardSegmentRouting type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/segments/types.ts#L40-L44 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/segments/types.ts#L40-L44 type ShardSegmentRouting struct { Node string `json:"node"` Primary bool `json:"primary"` diff --git a/typedapi/types/shardsequencenumber.go b/typedapi/types/shardsequencenumber.go index 521fb6a5be..1fbd333c18 100644 --- a/typedapi/types/shardsequencenumber.go +++ b/typedapi/types/shardsequencenumber.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardSequenceNumber type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L176-L180 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L176-L180 type ShardSequenceNumber struct { GlobalCheckpoint int64 `json:"global_checkpoint"` LocalCheckpoint int64 `json:"local_checkpoint"` diff --git a/typedapi/types/shardsrecord.go b/typedapi/types/shardsrecord.go index 3542318643..632c0bbd4d 100644 --- a/typedapi/types/shardsrecord.go +++ b/typedapi/types/shardsrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardsRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/shards/types.ts#L20-L421 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/shards/types.ts#L20-L421 type ShardsRecord struct { // BulkAvgSizeInBytes The average size in bytes of shard bulk operations. BulkAvgSizeInBytes *string `json:"bulk.avg_size_in_bytes,omitempty"` diff --git a/typedapi/types/shardssegment.go b/typedapi/types/shardssegment.go index 2f77809b8a..aa54195f07 100644 --- a/typedapi/types/shardssegment.go +++ b/typedapi/types/shardssegment.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardsSegment type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/segments/types.ts#L46-L51 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/segments/types.ts#L46-L51 type ShardsSegment struct { NumCommittedSegments int `json:"num_committed_segments"` NumSearchSegments int `json:"num_search_segments"` diff --git a/typedapi/types/shardsstatssummary.go b/typedapi/types/shardsstatssummary.go index 1481dca642..c96407fa96 100644 --- a/typedapi/types/shardsstatssummary.go +++ b/typedapi/types/shardsstatssummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // ShardsStatsSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotShardsStatus.ts#L29-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotShardsStatus.ts#L29-L35 type ShardsStatsSummary struct { Incremental ShardsStatsSummaryItem `json:"incremental"` StartTimeInMillis int64 `json:"start_time_in_millis"` diff --git a/typedapi/types/shardsstatssummaryitem.go b/typedapi/types/shardsstatssummaryitem.go index bf7c510cd6..17d7e4d175 100644 --- a/typedapi/types/shardsstatssummaryitem.go +++ b/typedapi/types/shardsstatssummaryitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardsStatsSummaryItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotShardsStatus.ts#L37-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotShardsStatus.ts#L37-L40 type ShardsStatsSummaryItem struct { FileCount int64 `json:"file_count"` SizeInBytes int64 `json:"size_in_bytes"` diff --git a/typedapi/types/shardstatistics.go b/typedapi/types/shardstatistics.go index 79e51d4e5b..77b30cf5af 100644 --- a/typedapi/types/shardstatistics.go +++ b/typedapi/types/shardstatistics.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ShardStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L54-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L54-L66 type ShardStatistics struct { Failed uint `json:"failed"` Failures []ShardFailure `json:"failures,omitempty"` diff --git a/typedapi/types/shardstore.go b/typedapi/types/shardstore.go index 3d81d80013..7c857d7e62 100644 --- a/typedapi/types/shardstore.go +++ b/typedapi/types/shardstore.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // ShardStore type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/shard_stores/types.ts#L30-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/shard_stores/types.ts#L30-L34 type ShardStore struct { Allocation shardstoreallocation.ShardStoreAllocation `json:"allocation"` AllocationId *string `json:"allocation_id,omitempty"` diff --git a/typedapi/types/shardstoreexception.go b/typedapi/types/shardstoreexception.go index 832ea790bc..06ed560d26 100644 --- a/typedapi/types/shardstoreexception.go +++ b/typedapi/types/shardstoreexception.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardStoreException type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/shard_stores/types.ts#L51-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/shard_stores/types.ts#L51-L54 type ShardStoreException struct { Reason string `json:"reason"` Type string `json:"type"` diff --git a/typedapi/types/shardstoreindex.go b/typedapi/types/shardstoreindex.go index d7b793ee8a..cec4acdfe9 100644 --- a/typedapi/types/shardstoreindex.go +++ b/typedapi/types/shardstoreindex.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ShardStoreIndex type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search_shards/SearchShardsResponse.ts#L33-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search_shards/SearchShardsResponse.ts#L33-L36 type ShardStoreIndex struct { Aliases []string `json:"aliases,omitempty"` Filter *Query `json:"filter,omitempty"` diff --git a/typedapi/types/shardstorenode.go b/typedapi/types/shardstorenode.go index 5d86eea251..06b624eecb 100644 --- a/typedapi/types/shardstorenode.go +++ b/typedapi/types/shardstorenode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardStoreNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/shard_stores/types.ts#L36-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/shard_stores/types.ts#L36-L43 type ShardStoreNode struct { Attributes map[string]string `json:"attributes"` EphemeralId *string `json:"ephemeral_id,omitempty"` diff --git a/typedapi/types/shardstorewrapper.go b/typedapi/types/shardstorewrapper.go index 2b0c63784d..5010a41fae 100644 --- a/typedapi/types/shardstorewrapper.go +++ b/typedapi/types/shardstorewrapper.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // ShardStoreWrapper type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/shard_stores/types.ts#L56-L58 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/shard_stores/types.ts#L56-L58 type ShardStoreWrapper struct { Stores []ShardStore `json:"stores"` } diff --git a/typedapi/types/shardstotalstats.go b/typedapi/types/shardstotalstats.go index 2933b0906c..f07904e045 100644 --- a/typedapi/types/shardstotalstats.go +++ b/typedapi/types/shardstotalstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShardsTotalStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/stats/types.ts#L182-L184 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/stats/types.ts#L182-L184 type ShardsTotalStats struct { TotalCount int64 `json:"total_count"` } diff --git a/typedapi/types/shared.go b/typedapi/types/shared.go index b13d053e78..d8b363dde9 100644 --- a/typedapi/types/shared.go +++ b/typedapi/types/shared.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Shared type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/searchable_snapshots/cache_stats/Response.ts#L34-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/searchable_snapshots/cache_stats/Response.ts#L34-L43 type Shared struct { BytesReadInBytes ByteSize `json:"bytes_read_in_bytes"` BytesWrittenInBytes ByteSize `json:"bytes_written_in_bytes"` diff --git a/typedapi/types/shingletokenfilter.go b/typedapi/types/shingletokenfilter.go index 08a2204f4f..ee155fb5d6 100644 --- a/typedapi/types/shingletokenfilter.go +++ b/typedapi/types/shingletokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShingleTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L87-L95 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L87-L95 type ShingleTokenFilter struct { FillerToken *string `json:"filler_token,omitempty"` MaxShingleSize string `json:"max_shingle_size,omitempty"` diff --git a/typedapi/types/shortnumberproperty.go b/typedapi/types/shortnumberproperty.go index 3d3f877709..dda41b02b0 100644 --- a/typedapi/types/shortnumberproperty.go +++ b/typedapi/types/shortnumberproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // ShortNumberProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L159-L162 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L159-L162 type ShortNumberProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -260,6 +260,12 @@ func (s *ShortNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -623,6 +629,12 @@ func (s *ShortNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/shrinkconfiguration.go b/typedapi/types/shrinkconfiguration.go index c6ecbd5909..2f8171a157 100644 --- a/typedapi/types/shrinkconfiguration.go +++ b/typedapi/types/shrinkconfiguration.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ShrinkConfiguration type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/_types/Phase.ts#L60-L62 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/_types/Phase.ts#L60-L62 type ShrinkConfiguration struct { NumberOfShards int `json:"number_of_shards"` } diff --git a/typedapi/types/significantlongtermsaggregate.go b/typedapi/types/significantlongtermsaggregate.go index 02fc57f656..40e78c739b 100644 --- a/typedapi/types/significantlongtermsaggregate.go +++ b/typedapi/types/significantlongtermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SignificantLongTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L588-L590 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L588-L590 type SignificantLongTermsAggregate struct { BgCount *int64 `json:"bg_count,omitempty"` Buckets BucketsSignificantLongTermsBucket `json:"buckets"` diff --git a/typedapi/types/significantlongtermsbucket.go b/typedapi/types/significantlongtermsbucket.go index f056029d8f..f9b04f7205 100644 --- a/typedapi/types/significantlongtermsbucket.go +++ b/typedapi/types/significantlongtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SignificantLongTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L597-L600 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L597-L600 type SignificantLongTermsBucket struct { Aggregations map[string]Aggregate `json:"-"` BgCount int64 `json:"bg_count"` diff --git a/typedapi/types/significantstringtermsaggregate.go b/typedapi/types/significantstringtermsaggregate.go index 89143931b3..fedb6a6d3d 100644 --- a/typedapi/types/significantstringtermsaggregate.go +++ b/typedapi/types/significantstringtermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SignificantStringTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L602-L604 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L602-L604 type SignificantStringTermsAggregate struct { BgCount *int64 `json:"bg_count,omitempty"` Buckets BucketsSignificantStringTermsBucket `json:"buckets"` diff --git a/typedapi/types/significantstringtermsbucket.go b/typedapi/types/significantstringtermsbucket.go index 9b2ff0d0f0..e1ecc973d3 100644 --- a/typedapi/types/significantstringtermsbucket.go +++ b/typedapi/types/significantstringtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SignificantStringTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L606-L608 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L606-L608 type SignificantStringTermsBucket struct { Aggregations map[string]Aggregate `json:"-"` BgCount int64 `json:"bg_count"` diff --git a/typedapi/types/significanttermsaggregatebasesignificantlongtermsbucket.go b/typedapi/types/significanttermsaggregatebasesignificantlongtermsbucket.go index 8e658f246c..4cd9ea3525 100644 --- a/typedapi/types/significanttermsaggregatebasesignificantlongtermsbucket.go +++ b/typedapi/types/significanttermsaggregatebasesignificantlongtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SignificantTermsAggregateBaseSignificantLongTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L581-L586 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L581-L586 type SignificantTermsAggregateBaseSignificantLongTermsBucket struct { BgCount *int64 `json:"bg_count,omitempty"` Buckets BucketsSignificantLongTermsBucket `json:"buckets"` diff --git a/typedapi/types/significanttermsaggregatebasesignificantstringtermsbucket.go b/typedapi/types/significanttermsaggregatebasesignificantstringtermsbucket.go index 61d895afec..e52cbcbcb2 100644 --- a/typedapi/types/significanttermsaggregatebasesignificantstringtermsbucket.go +++ b/typedapi/types/significanttermsaggregatebasesignificantstringtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SignificantTermsAggregateBaseSignificantStringTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L581-L586 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L581-L586 type SignificantTermsAggregateBaseSignificantStringTermsBucket struct { BgCount *int64 `json:"bg_count,omitempty"` Buckets BucketsSignificantStringTermsBucket `json:"buckets"` diff --git a/typedapi/types/significanttermsaggregatebasevoid.go b/typedapi/types/significanttermsaggregatebasevoid.go index 429f074f49..9fe49361e5 100644 --- a/typedapi/types/significanttermsaggregatebasevoid.go +++ b/typedapi/types/significanttermsaggregatebasevoid.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SignificantTermsAggregateBaseVoid type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L581-L586 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L581-L586 type SignificantTermsAggregateBaseVoid struct { BgCount *int64 `json:"bg_count,omitempty"` Buckets BucketsVoid `json:"buckets"` diff --git a/typedapi/types/significanttermsaggregation.go b/typedapi/types/significanttermsaggregation.go index 2a2a2c24b3..5ccf11888c 100644 --- a/typedapi/types/significanttermsaggregation.go +++ b/typedapi/types/significanttermsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SignificantTermsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L770-L834 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L770-L834 type SignificantTermsAggregation struct { // BackgroundFilter A background filter that can be used to focus in on significant terms within // a narrower context, instead of the entire index. diff --git a/typedapi/types/significanttextaggregation.go b/typedapi/types/significanttextaggregation.go index c88aa8bfa8..ca92e847a3 100644 --- a/typedapi/types/significanttextaggregation.go +++ b/typedapi/types/significanttextaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SignificantTextAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L836-L908 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L836-L908 type SignificantTextAggregation struct { // BackgroundFilter A background filter that can be used to focus in on significant terms within // a narrower context, instead of the entire index. diff --git a/typedapi/types/simpleanalyzer.go b/typedapi/types/simpleanalyzer.go index d017727cd3..836ed243e1 100644 --- a/typedapi/types/simpleanalyzer.go +++ b/typedapi/types/simpleanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SimpleAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L83-L86 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L83-L86 type SimpleAnalyzer struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/simplemovingaverageaggregation.go b/typedapi/types/simplemovingaverageaggregation.go index 0a6bdb1921..e1a0534ea7 100644 --- a/typedapi/types/simplemovingaverageaggregation.go +++ b/typedapi/types/simplemovingaverageaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SimpleMovingAverageAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L247-L250 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L247-L250 type SimpleMovingAverageAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/simplequerystringflags.go b/typedapi/types/simplequerystringflags.go index b6060b8b33..4384575574 100644 --- a/typedapi/types/simplequerystringflags.go +++ b/typedapi/types/simplequerystringflags.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SimpleQueryStringFlags type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L702-L706 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L702-L706 type SimpleQueryStringFlags PipeSeparatedFlagsSimpleQueryStringFlag diff --git a/typedapi/types/simplequerystringquery.go b/typedapi/types/simplequerystringquery.go index 115329fff1..e7c21faabe 100644 --- a/typedapi/types/simplequerystringquery.go +++ b/typedapi/types/simplequerystringquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SimpleQueryStringQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/fulltext.ts#L765-L830 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/fulltext.ts#L765-L830 type SimpleQueryStringQuery struct { // AnalyzeWildcard If `true`, the query attempts to analyze wildcard terms in the query string. AnalyzeWildcard *bool `json:"analyze_wildcard,omitempty"` diff --git a/typedapi/types/simplevalueaggregate.go b/typedapi/types/simplevalueaggregate.go index 2dcbca1696..1f5f53f8c1 100644 --- a/typedapi/types/simplevalueaggregate.go +++ b/typedapi/types/simplevalueaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SimpleValueAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L224-L225 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L224-L225 type SimpleValueAggregate struct { Meta Metadata `json:"meta,omitempty"` // Value The metric value. A missing value generally means that there was no data to diff --git a/typedapi/types/simulatedactions.go b/typedapi/types/simulatedactions.go index 2e7da9334d..ddbccd69d4 100644 --- a/typedapi/types/simulatedactions.go +++ b/typedapi/types/simulatedactions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SimulatedActions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L96-L100 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L96-L100 type SimulatedActions struct { Actions []string `json:"actions"` All *SimulatedActions `json:"all,omitempty"` diff --git a/typedapi/types/simulateingest.go b/typedapi/types/simulateingest.go index 1185affb6a..f80ea19d3c 100644 --- a/typedapi/types/simulateingest.go +++ b/typedapi/types/simulateingest.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SimulateIngest type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/simulate/types.ts#L28-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/simulate/types.ts#L28-L31 type SimulateIngest struct { Pipeline *string `json:"pipeline,omitempty"` Timestamp DateTime `json:"timestamp"` diff --git a/typedapi/types/sizefield.go b/typedapi/types/sizefield.go index 0135108857..b2fe775e15 100644 --- a/typedapi/types/sizefield.go +++ b/typedapi/types/sizefield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SizeField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/meta-fields.ts#L54-L56 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/meta-fields.ts#L54-L56 type SizeField struct { Enabled bool `json:"enabled"` } diff --git a/typedapi/types/slackaction.go b/typedapi/types/slackaction.go index a3a1c51a5f..e24116c3e5 100644 --- a/typedapi/types/slackaction.go +++ b/typedapi/types/slackaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SlackAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L91-L94 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L91-L94 type SlackAction struct { Account *string `json:"account,omitempty"` Message SlackMessage `json:"message"` diff --git a/typedapi/types/slackattachment.go b/typedapi/types/slackattachment.go index c7ebdf9305..566a01192a 100644 --- a/typedapi/types/slackattachment.go +++ b/typedapi/types/slackattachment.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SlackAttachment type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L101-L117 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L101-L117 type SlackAttachment struct { AuthorIcon *string `json:"author_icon,omitempty"` AuthorLink *string `json:"author_link,omitempty"` diff --git a/typedapi/types/slackattachmentfield.go b/typedapi/types/slackattachmentfield.go index dbd011deda..94d0256695 100644 --- a/typedapi/types/slackattachmentfield.go +++ b/typedapi/types/slackattachmentfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SlackAttachmentField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L119-L123 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L119-L123 type SlackAttachmentField struct { Int bool `json:"short"` Title string `json:"title"` diff --git a/typedapi/types/slackdynamicattachment.go b/typedapi/types/slackdynamicattachment.go index e92a672d16..0a3aef2c97 100644 --- a/typedapi/types/slackdynamicattachment.go +++ b/typedapi/types/slackdynamicattachment.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SlackDynamicAttachment type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L125-L128 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L125-L128 type SlackDynamicAttachment struct { AttachmentTemplate SlackAttachment `json:"attachment_template"` ListPath string `json:"list_path"` diff --git a/typedapi/types/slackmessage.go b/typedapi/types/slackmessage.go index 8d7fe6ac10..4052b93242 100644 --- a/typedapi/types/slackmessage.go +++ b/typedapi/types/slackmessage.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SlackMessage type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L130-L137 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L130-L137 type SlackMessage struct { Attachments []SlackAttachment `json:"attachments"` DynamicAttachments *SlackDynamicAttachment `json:"dynamic_attachments,omitempty"` diff --git a/typedapi/types/slackresult.go b/typedapi/types/slackresult.go index 2e6f2a4ad3..fd1dc5df32 100644 --- a/typedapi/types/slackresult.go +++ b/typedapi/types/slackresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SlackResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L96-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L96-L99 type SlackResult struct { Account *string `json:"account,omitempty"` Message SlackMessage `json:"message"` diff --git a/typedapi/types/slicedscroll.go b/typedapi/types/slicedscroll.go index b7b96acf38..52b42aaaf9 100644 --- a/typedapi/types/slicedscroll.go +++ b/typedapi/types/slicedscroll.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SlicedScroll type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/SlicedScroll.ts#L23-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/SlicedScroll.ts#L23-L27 type SlicedScroll struct { Field *string `json:"field,omitempty"` Id string `json:"id"` diff --git a/typedapi/types/slices.go b/typedapi/types/slices.go index b64b32dda4..49b9557b0a 100644 --- a/typedapi/types/slices.go +++ b/typedapi/types/slices.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // int // slicescalculation.SlicesCalculation // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L366-L371 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L367-L372 type Slices interface{} diff --git a/typedapi/types/slm.go b/typedapi/types/slm.go index 65f76b7845..57fdb2f5e9 100644 --- a/typedapi/types/slm.go +++ b/typedapi/types/slm.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Slm type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L449-L452 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L449-L452 type Slm struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/slmindicator.go b/typedapi/types/slmindicator.go index a0099e7a34..6381227bcc 100644 --- a/typedapi/types/slmindicator.go +++ b/typedapi/types/slmindicator.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SlmIndicator type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L155-L159 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L155-L159 type SlmIndicator struct { Details *SlmIndicatorDetails `json:"details,omitempty"` Diagnosis []Diagnosis `json:"diagnosis,omitempty"` diff --git a/typedapi/types/slmindicatordetails.go b/typedapi/types/slmindicatordetails.go index 40604267e6..558ede57c2 100644 --- a/typedapi/types/slmindicatordetails.go +++ b/typedapi/types/slmindicatordetails.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SlmIndicatorDetails type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L160-L164 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L160-L164 type SlmIndicatorDetails struct { Policies int64 `json:"policies"` SlmStatus lifecycleoperationmode.LifecycleOperationMode `json:"slm_status"` diff --git a/typedapi/types/slmindicatorunhealthypolicies.go b/typedapi/types/slmindicatorunhealthypolicies.go index e179445085..42de9eb010 100644 --- a/typedapi/types/slmindicatorunhealthypolicies.go +++ b/typedapi/types/slmindicatorunhealthypolicies.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SlmIndicatorUnhealthyPolicies type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/health_report/types.ts#L166-L169 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/health_report/types.ts#L166-L169 type SlmIndicatorUnhealthyPolicies struct { Count int64 `json:"count"` InvocationsSinceLastSuccess map[string]int64 `json:"invocations_since_last_success,omitempty"` diff --git a/typedapi/types/slmpolicy.go b/typedapi/types/slmpolicy.go index effb158291..229ac15c7a 100644 --- a/typedapi/types/slmpolicy.go +++ b/typedapi/types/slmpolicy.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SLMPolicy type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/_types/SnapshotLifecycle.ts#L76-L82 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/_types/SnapshotLifecycle.ts#L76-L82 type SLMPolicy struct { Config *Configuration `json:"config,omitempty"` Name string `json:"name"` diff --git a/typedapi/types/slowlogsettings.go b/typedapi/types/slowlogsettings.go index 2390700945..4bc8fc50fe 100644 --- a/typedapi/types/slowlogsettings.go +++ b/typedapi/types/slowlogsettings.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SlowlogSettings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L472-L477 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L472-L477 type SlowlogSettings struct { Level *string `json:"level,omitempty"` Reformat *bool `json:"reformat,omitempty"` diff --git a/typedapi/types/slowlogtresholdlevels.go b/typedapi/types/slowlogtresholdlevels.go index 147b586fec..e2c143912d 100644 --- a/typedapi/types/slowlogtresholdlevels.go +++ b/typedapi/types/slowlogtresholdlevels.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SlowlogTresholdLevels type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L484-L489 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L484-L489 type SlowlogTresholdLevels struct { Debug Duration `json:"debug,omitempty"` Info Duration `json:"info,omitempty"` diff --git a/typedapi/types/slowlogtresholds.go b/typedapi/types/slowlogtresholds.go index 661f524cf7..0e0a61ba1a 100644 --- a/typedapi/types/slowlogtresholds.go +++ b/typedapi/types/slowlogtresholds.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SlowlogTresholds type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L479-L482 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L479-L482 type SlowlogTresholds struct { Fetch *SlowlogTresholdLevels `json:"fetch,omitempty"` Query *SlowlogTresholdLevels `json:"query,omitempty"` diff --git a/typedapi/types/smoothingmodelcontainer.go b/typedapi/types/smoothingmodelcontainer.go index a42d7c3b25..b89b0a580d 100644 --- a/typedapi/types/smoothingmodelcontainer.go +++ b/typedapi/types/smoothingmodelcontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SmoothingModelContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L442-L458 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L442-L458 type SmoothingModelContainer struct { // Laplace A smoothing model that uses an additive smoothing where a constant (typically // `1.0` or smaller) is added to all counts to balance weights. diff --git a/typedapi/types/snapshotindexstats.go b/typedapi/types/snapshotindexstats.go index cfeb082b7e..bfe04a9bf5 100644 --- a/typedapi/types/snapshotindexstats.go +++ b/typedapi/types/snapshotindexstats.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SnapshotIndexStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotIndexStats.ts#L25-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotIndexStats.ts#L25-L29 type SnapshotIndexStats struct { Shards map[string]SnapshotShardsStatus `json:"shards"` ShardsStats SnapshotShardsStats `json:"shards_stats"` diff --git a/typedapi/types/snapshotinfo.go b/typedapi/types/snapshotinfo.go index 0bac279640..dd37cce691 100644 --- a/typedapi/types/snapshotinfo.go +++ b/typedapi/types/snapshotinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SnapshotInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotInfo.ts#L41-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotInfo.ts#L41-L71 type SnapshotInfo struct { DataStreams []string `json:"data_streams"` Duration Duration `json:"duration,omitempty"` diff --git a/typedapi/types/snapshotlifecycle.go b/typedapi/types/snapshotlifecycle.go index 30a1e844df..836fa54eaf 100644 --- a/typedapi/types/snapshotlifecycle.go +++ b/typedapi/types/snapshotlifecycle.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SnapshotLifecycle type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/_types/SnapshotLifecycle.ts#L38-L49 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/_types/SnapshotLifecycle.ts#L38-L49 type SnapshotLifecycle struct { InProgress *InProgress `json:"in_progress,omitempty"` LastFailure *Invocation `json:"last_failure,omitempty"` diff --git a/typedapi/types/snapshotresponseitem.go b/typedapi/types/snapshotresponseitem.go index e2590a9310..af4da63294 100644 --- a/typedapi/types/snapshotresponseitem.go +++ b/typedapi/types/snapshotresponseitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SnapshotResponseItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/get/SnapshotGetResponse.ts#L44-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/get/SnapshotGetResponse.ts#L44-L48 type SnapshotResponseItem struct { Error *ErrorCause `json:"error,omitempty"` Repository string `json:"repository"` diff --git a/typedapi/types/snapshotrestore.go b/typedapi/types/snapshotrestore.go index d862f3ec28..f07efd130b 100644 --- a/typedapi/types/snapshotrestore.go +++ b/typedapi/types/snapshotrestore.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SnapshotRestore type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/restore/SnapshotRestoreResponse.ts#L27-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/restore/SnapshotRestoreResponse.ts#L27-L31 type SnapshotRestore struct { Indices []string `json:"indices"` Shards ShardStatistics `json:"shards"` diff --git a/typedapi/types/snapshotshardfailure.go b/typedapi/types/snapshotshardfailure.go index 4e0628ee6b..dbfb6510e1 100644 --- a/typedapi/types/snapshotshardfailure.go +++ b/typedapi/types/snapshotshardfailure.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SnapshotShardFailure type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotShardFailure.ts#L22-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotShardFailure.ts#L22-L28 type SnapshotShardFailure struct { Index string `json:"index"` NodeId *string `json:"node_id,omitempty"` diff --git a/typedapi/types/snapshotshardsstats.go b/typedapi/types/snapshotshardsstats.go index 6492f882b3..f66e0c6114 100644 --- a/typedapi/types/snapshotshardsstats.go +++ b/typedapi/types/snapshotshardsstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SnapshotShardsStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotShardsStats.ts#L22-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotShardsStats.ts#L22-L29 type SnapshotShardsStats struct { Done int64 `json:"done"` Failed int64 `json:"failed"` diff --git a/typedapi/types/snapshotshardsstatus.go b/typedapi/types/snapshotshardsstatus.go index 201b1ceac7..1d5fa80df4 100644 --- a/typedapi/types/snapshotshardsstatus.go +++ b/typedapi/types/snapshotshardsstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // SnapshotShardsStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotShardsStatus.ts#L24-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotShardsStatus.ts#L24-L27 type SnapshotShardsStatus struct { Stage shardsstatsstage.ShardsStatsStage `json:"stage"` Stats ShardsStatsSummary `json:"stats"` diff --git a/typedapi/types/snapshotsrecord.go b/typedapi/types/snapshotsrecord.go index e8e460b8d6..2e1f451975 100644 --- a/typedapi/types/snapshotsrecord.go +++ b/typedapi/types/snapshotsrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SnapshotsRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/snapshots/types.ts#L24-L96 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/snapshots/types.ts#L24-L96 type SnapshotsRecord struct { // Duration The time it took the snapshot process to complete, in time units. Duration Duration `json:"duration,omitempty"` diff --git a/typedapi/types/snapshotstats.go b/typedapi/types/snapshotstats.go index 7f20c28d62..c0774d3511 100644 --- a/typedapi/types/snapshotstats.go +++ b/typedapi/types/snapshotstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SnapshotStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotStats.ts#L23-L29 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotStats.ts#L23-L29 type SnapshotStats struct { Incremental FileCountSnapshotStats `json:"incremental"` StartTimeInMillis int64 `json:"start_time_in_millis"` diff --git a/typedapi/types/snowballanalyzer.go b/typedapi/types/snowballanalyzer.go index c90bb71b07..0f04e2e03c 100644 --- a/typedapi/types/snowballanalyzer.go +++ b/typedapi/types/snowballanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // SnowballAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L88-L93 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L88-L93 type SnowballAnalyzer struct { Language snowballlanguage.SnowballLanguage `json:"language"` Stopwords []string `json:"stopwords,omitempty"` diff --git a/typedapi/types/snowballtokenfilter.go b/typedapi/types/snowballtokenfilter.go index 9aae9202ce..be59ee6a67 100644 --- a/typedapi/types/snowballtokenfilter.go +++ b/typedapi/types/snowballtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // SnowballTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L309-L312 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L309-L312 type SnowballTokenFilter struct { Language snowballlanguage.SnowballLanguage `json:"language"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/softdeletes.go b/typedapi/types/softdeletes.go index 0930e81889..09e257cf48 100644 --- a/typedapi/types/softdeletes.go +++ b/typedapi/types/softdeletes.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SoftDeletes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L50-L63 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L50-L63 type SoftDeletes struct { // Enabled Indicates whether soft deletes are enabled on the index. Enabled *bool `json:"enabled,omitempty"` diff --git a/typedapi/types/sort.go b/typedapi/types/sort.go index 918acd5390..a7c0a7bdf9 100644 --- a/typedapi/types/sort.go +++ b/typedapi/types/sort.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Sort type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L99-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L99-L99 type Sort []SortCombinations diff --git a/typedapi/types/sortcombinations.go b/typedapi/types/sortcombinations.go index 8d06d645c7..f67b7968f0 100644 --- a/typedapi/types/sortcombinations.go +++ b/typedapi/types/sortcombinations.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // SortOptions // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L93-L97 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L93-L97 type SortCombinations interface{} diff --git a/typedapi/types/sortoptions.go b/typedapi/types/sortoptions.go index 234b0748d5..f4cce41858 100644 --- a/typedapi/types/sortoptions.go +++ b/typedapi/types/sortoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -27,7 +27,7 @@ import ( // SortOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/sort.ts#L82-L91 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/sort.ts#L82-L91 type SortOptions struct { Doc_ *ScoreSort `json:"_doc,omitempty"` GeoDistance_ *GeoDistanceSort `json:"_geo_distance,omitempty"` diff --git a/typedapi/types/sortprocessor.go b/typedapi/types/sortprocessor.go index 9fe9234ab9..0efe12c55c 100644 --- a/typedapi/types/sortprocessor.go +++ b/typedapi/types/sortprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SortProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L1034-L1050 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L1034-L1050 type SortProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/sourceconfig.go b/typedapi/types/sourceconfig.go index 7d526f06aa..7771aa7437 100644 --- a/typedapi/types/sourceconfig.go +++ b/typedapi/types/sourceconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // bool // SourceFilter // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/SourceFilter.ts#L33-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/SourceFilter.ts#L33-L37 type SourceConfig interface{} diff --git a/typedapi/types/sourceconfigparam.go b/typedapi/types/sourceconfigparam.go index bd83ac4cb6..fbeb49b405 100644 --- a/typedapi/types/sourceconfigparam.go +++ b/typedapi/types/sourceconfigparam.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // bool // []string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/SourceFilter.ts#L39-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/SourceFilter.ts#L39-L45 type SourceConfigParam interface{} diff --git a/typedapi/types/sourcefield.go b/typedapi/types/sourcefield.go index 90d7f6bdcf..65a4211058 100644 --- a/typedapi/types/sourcefield.go +++ b/typedapi/types/sourcefield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SourceField type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/meta-fields.ts#L58-L65 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/meta-fields.ts#L58-L65 type SourceField struct { Compress *bool `json:"compress,omitempty"` CompressThreshold *string `json:"compress_threshold,omitempty"` diff --git a/typedapi/types/sourcefilter.go b/typedapi/types/sourcefilter.go index c5791a2429..96024c663c 100644 --- a/typedapi/types/sourcefilter.go +++ b/typedapi/types/sourcefilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SourceFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/SourceFilter.ts#L23-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/SourceFilter.ts#L23-L31 type SourceFilter struct { Excludes []string `json:"excludes,omitempty"` Includes []string `json:"includes,omitempty"` diff --git a/typedapi/types/spancontainingquery.go b/typedapi/types/spancontainingquery.go index 57808908c5..09f0c4ce83 100644 --- a/typedapi/types/spancontainingquery.go +++ b/typedapi/types/spancontainingquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SpanContainingQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L25-L36 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L25-L36 type SpanContainingQuery struct { // Big Can be any span query. // Matching spans from `big` that contain matches from `little` are returned. diff --git a/typedapi/types/spanfieldmaskingquery.go b/typedapi/types/spanfieldmaskingquery.go index 700679eb08..e25f9abf12 100644 --- a/typedapi/types/spanfieldmaskingquery.go +++ b/typedapi/types/spanfieldmaskingquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SpanFieldMaskingQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L38-L41 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L38-L41 type SpanFieldMaskingQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/spanfirstquery.go b/typedapi/types/spanfirstquery.go index 8ceec799fa..aa81ca26aa 100644 --- a/typedapi/types/spanfirstquery.go +++ b/typedapi/types/spanfirstquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SpanFirstQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L43-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L43-L52 type SpanFirstQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/spangapquery.go b/typedapi/types/spangapquery.go index 28b0bec3be..70c3535e94 100644 --- a/typedapi/types/spangapquery.go +++ b/typedapi/types/spangapquery.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SpanGapQuery type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L54-L56 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L54-L56 type SpanGapQuery map[string]int diff --git a/typedapi/types/spanmultitermquery.go b/typedapi/types/spanmultitermquery.go index a4cddd6903..088f8f2f95 100644 --- a/typedapi/types/spanmultitermquery.go +++ b/typedapi/types/spanmultitermquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SpanMultiTermQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L58-L63 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L58-L63 type SpanMultiTermQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/spannearquery.go b/typedapi/types/spannearquery.go index 650d9be0ad..1462767a83 100644 --- a/typedapi/types/spannearquery.go +++ b/typedapi/types/spannearquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SpanNearQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L65-L78 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L65-L78 type SpanNearQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/spannotquery.go b/typedapi/types/spannotquery.go index 3ba090450f..86ece34dd2 100644 --- a/typedapi/types/spannotquery.go +++ b/typedapi/types/spannotquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SpanNotQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L80-L104 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L80-L104 type SpanNotQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/spanorquery.go b/typedapi/types/spanorquery.go index 1faa5cd9cd..f17a1908a3 100644 --- a/typedapi/types/spanorquery.go +++ b/typedapi/types/spanorquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SpanOrQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L106-L111 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L106-L111 type SpanOrQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/spanquery.go b/typedapi/types/spanquery.go index 225ffffde1..946bf6a130 100644 --- a/typedapi/types/spanquery.go +++ b/typedapi/types/spanquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SpanQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L131-L170 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L131-L170 type SpanQuery struct { // FieldMaskingSpan Allows queries like `span_near` or `span_or` across different fields. FieldMaskingSpan *SpanFieldMaskingQuery `json:"field_masking_span,omitempty"` diff --git a/typedapi/types/spantermquery.go b/typedapi/types/spantermquery.go index 88fd133ab3..323e7f2a26 100644 --- a/typedapi/types/spantermquery.go +++ b/typedapi/types/spantermquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SpanTermQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L113-L116 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L113-L116 type SpanTermQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/spanwithinquery.go b/typedapi/types/spanwithinquery.go index 02e15ad487..8c2c36341a 100644 --- a/typedapi/types/spanwithinquery.go +++ b/typedapi/types/spanwithinquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SpanWithinQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/span.ts#L118-L129 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/span.ts#L118-L129 type SpanWithinQuery struct { // Big Can be any span query. // Matching spans from `little` that are enclosed within `big` are returned. diff --git a/typedapi/types/sparseembeddingresult.go b/typedapi/types/sparseembeddingresult.go new file mode 100644 index 0000000000..761fca7376 --- /dev/null +++ b/typedapi/types/sparseembeddingresult.go @@ -0,0 +1,67 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package types + +import ( + "bytes" + "encoding/json" + "errors" + "io" +) + +// SparseEmbeddingResult type. +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/_types/Results.ts#L35-L37 +type SparseEmbeddingResult struct { + Embedding SparseVector `json:"embedding"` +} + +func (s *SparseEmbeddingResult) UnmarshalJSON(data []byte) error { + + dec := json.NewDecoder(bytes.NewReader(data)) + + for { + t, err := dec.Token() + if err != nil { + if errors.Is(err, io.EOF) { + break + } + return err + } + + switch t { + + case "embedding": + if err := dec.Decode(&s.Embedding); err != nil { + return err + } + + } + } + return nil +} + +// NewSparseEmbeddingResult returns a SparseEmbeddingResult. +func NewSparseEmbeddingResult() *SparseEmbeddingResult { + r := &SparseEmbeddingResult{} + + return r +} diff --git a/typedapi/types/sparsevector.go b/typedapi/types/sparsevector.go new file mode 100644 index 0000000000..20f9761930 --- /dev/null +++ b/typedapi/types/sparsevector.go @@ -0,0 +1,26 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package types + +// SparseVector type alias. +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/_types/Results.ts#L23-L27 +type SparseVector map[string]float32 diff --git a/typedapi/types/sparsevectorproperty.go b/typedapi/types/sparsevectorproperty.go new file mode 100644 index 0000000000..ad12dfd511 --- /dev/null +++ b/typedapi/types/sparsevectorproperty.go @@ -0,0 +1,740 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package types + +import ( + "bytes" + "encoding/json" + "errors" + "io" + "strconv" + + "github.com/elastic/go-elasticsearch/v8/typedapi/types/enums/dynamicmapping" +) + +// SparseVectorProperty type. +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L193-L195 +type SparseVectorProperty struct { + Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"` + Fields map[string]Property `json:"fields,omitempty"` + IgnoreAbove *int `json:"ignore_above,omitempty"` + // Meta Metadata about the field. + Meta map[string]string `json:"meta,omitempty"` + Properties map[string]Property `json:"properties,omitempty"` + Type string `json:"type,omitempty"` +} + +func (s *SparseVectorProperty) UnmarshalJSON(data []byte) error { + + dec := json.NewDecoder(bytes.NewReader(data)) + + for { + t, err := dec.Token() + if err != nil { + if errors.Is(err, io.EOF) { + break + } + return err + } + + switch t { + + case "dynamic": + if err := dec.Decode(&s.Dynamic); err != nil { + return err + } + + case "fields": + if s.Fields == nil { + s.Fields = make(map[string]Property, 0) + } + refs := make(map[string]json.RawMessage, 0) + dec.Decode(&refs) + for key, message := range refs { + kind := make(map[string]interface{}) + buf := bytes.NewReader(message) + localDec := json.NewDecoder(buf) + localDec.Decode(&kind) + buf.Seek(0, io.SeekStart) + if _, ok := kind["type"]; !ok { + kind["type"] = "object" + } + switch kind["type"] { + case "binary": + oo := NewBinaryProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "boolean": + oo := NewBooleanProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "{dynamic_property}": + oo := NewDynamicProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "join": + oo := NewJoinProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "keyword": + oo := NewKeywordProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "match_only_text": + oo := NewMatchOnlyTextProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "percolator": + oo := NewPercolatorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "rank_feature": + oo := NewRankFeatureProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "rank_features": + oo := NewRankFeaturesProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "search_as_you_type": + oo := NewSearchAsYouTypeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "text": + oo := NewTextProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "version": + oo := NewVersionProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "wildcard": + oo := NewWildcardProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "date_nanos": + oo := NewDateNanosProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "date": + oo := NewDateProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "aggregate_metric_double": + oo := NewAggregateMetricDoubleProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "dense_vector": + oo := NewDenseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "flattened": + oo := NewFlattenedProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "nested": + oo := NewNestedProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "object": + oo := NewObjectProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "completion": + oo := NewCompletionProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "constant_keyword": + oo := NewConstantKeywordProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "alias": + oo := NewFieldAliasProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "histogram": + oo := NewHistogramProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "ip": + oo := NewIpProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "murmur3": + oo := NewMurmur3HashProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "token_count": + oo := NewTokenCountProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "geo_point": + oo := NewGeoPointProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "geo_shape": + oo := NewGeoShapeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "point": + oo := NewPointProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "shape": + oo := NewShapeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "byte": + oo := NewByteNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "double": + oo := NewDoubleNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "float": + oo := NewFloatNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "half_float": + oo := NewHalfFloatNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "integer": + oo := NewIntegerNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "long": + oo := NewLongNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "scaled_float": + oo := NewScaledFloatNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "short": + oo := NewShortNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "unsigned_long": + oo := NewUnsignedLongNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "date_range": + oo := NewDateRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "double_range": + oo := NewDoubleRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "float_range": + oo := NewFloatRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "integer_range": + oo := NewIntegerRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "ip_range": + oo := NewIpRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + case "long_range": + oo := NewLongRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + default: + oo := new(Property) + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo + } + } + + case "ignore_above": + + var tmp interface{} + dec.Decode(&tmp) + switch v := tmp.(type) { + case string: + value, err := strconv.Atoi(v) + if err != nil { + return err + } + s.IgnoreAbove = &value + case float64: + f := int(v) + s.IgnoreAbove = &f + } + + case "meta": + if s.Meta == nil { + s.Meta = make(map[string]string, 0) + } + if err := dec.Decode(&s.Meta); err != nil { + return err + } + + case "properties": + if s.Properties == nil { + s.Properties = make(map[string]Property, 0) + } + refs := make(map[string]json.RawMessage, 0) + dec.Decode(&refs) + for key, message := range refs { + kind := make(map[string]interface{}) + buf := bytes.NewReader(message) + localDec := json.NewDecoder(buf) + localDec.Decode(&kind) + buf.Seek(0, io.SeekStart) + if _, ok := kind["type"]; !ok { + kind["type"] = "object" + } + switch kind["type"] { + case "binary": + oo := NewBinaryProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "boolean": + oo := NewBooleanProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "{dynamic_property}": + oo := NewDynamicProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "join": + oo := NewJoinProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "keyword": + oo := NewKeywordProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "match_only_text": + oo := NewMatchOnlyTextProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "percolator": + oo := NewPercolatorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "rank_feature": + oo := NewRankFeatureProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "rank_features": + oo := NewRankFeaturesProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "search_as_you_type": + oo := NewSearchAsYouTypeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "text": + oo := NewTextProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "version": + oo := NewVersionProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "wildcard": + oo := NewWildcardProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "date_nanos": + oo := NewDateNanosProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "date": + oo := NewDateProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "aggregate_metric_double": + oo := NewAggregateMetricDoubleProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "dense_vector": + oo := NewDenseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "flattened": + oo := NewFlattenedProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "nested": + oo := NewNestedProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "object": + oo := NewObjectProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "completion": + oo := NewCompletionProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "constant_keyword": + oo := NewConstantKeywordProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "alias": + oo := NewFieldAliasProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "histogram": + oo := NewHistogramProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "ip": + oo := NewIpProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "murmur3": + oo := NewMurmur3HashProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "token_count": + oo := NewTokenCountProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "geo_point": + oo := NewGeoPointProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "geo_shape": + oo := NewGeoShapeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "point": + oo := NewPointProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "shape": + oo := NewShapeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "byte": + oo := NewByteNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "double": + oo := NewDoubleNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "float": + oo := NewFloatNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "half_float": + oo := NewHalfFloatNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "integer": + oo := NewIntegerNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "long": + oo := NewLongNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "scaled_float": + oo := NewScaledFloatNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "short": + oo := NewShortNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "unsigned_long": + oo := NewUnsignedLongNumberProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "date_range": + oo := NewDateRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "double_range": + oo := NewDoubleRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "float_range": + oo := NewFloatRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "integer_range": + oo := NewIntegerRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "ip_range": + oo := NewIpRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + case "long_range": + oo := NewLongRangeProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + default: + oo := new(Property) + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo + } + } + + case "type": + if err := dec.Decode(&s.Type); err != nil { + return err + } + + } + } + return nil +} + +// MarshalJSON override marshalling to include literal value +func (s SparseVectorProperty) MarshalJSON() ([]byte, error) { + type innerSparseVectorProperty SparseVectorProperty + tmp := innerSparseVectorProperty{ + Dynamic: s.Dynamic, + Fields: s.Fields, + IgnoreAbove: s.IgnoreAbove, + Meta: s.Meta, + Properties: s.Properties, + Type: s.Type, + } + + tmp.Type = "sparse_vector" + + return json.Marshal(tmp) +} + +// NewSparseVectorProperty returns a SparseVectorProperty. +func NewSparseVectorProperty() *SparseVectorProperty { + r := &SparseVectorProperty{ + Fields: make(map[string]Property, 0), + Meta: make(map[string]string, 0), + Properties: make(map[string]Property, 0), + } + + return r +} diff --git a/typedapi/types/splitprocessor.go b/typedapi/types/splitprocessor.go index cfd022f40a..85d94029e4 100644 --- a/typedapi/types/splitprocessor.go +++ b/typedapi/types/splitprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SplitProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L1052-L1077 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L1052-L1077 type SplitProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/sql.go b/typedapi/types/sql.go index 4e5ef9e94f..6626071019 100644 --- a/typedapi/types/sql.go +++ b/typedapi/types/sql.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Sql type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L386-L389 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L386-L389 type Sql struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/ssl.go b/typedapi/types/ssl.go index c4d16b24b9..b4b244df79 100644 --- a/typedapi/types/ssl.go +++ b/typedapi/types/ssl.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Ssl type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L391-L394 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L391-L394 type Ssl struct { Http FeatureToggle `json:"http"` Transport FeatureToggle `json:"transport"` diff --git a/typedapi/types/standardanalyzer.go b/typedapi/types/standardanalyzer.go index 538e52325f..1e6343f704 100644 --- a/typedapi/types/standardanalyzer.go +++ b/typedapi/types/standardanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StandardAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L95-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L95-L99 type StandardAnalyzer struct { MaxTokenLength *int `json:"max_token_length,omitempty"` Stopwords []string `json:"stopwords,omitempty"` diff --git a/typedapi/types/standarddeviationbounds.go b/typedapi/types/standarddeviationbounds.go index 982f1d8695..0a0b4973a6 100644 --- a/typedapi/types/standarddeviationbounds.go +++ b/typedapi/types/standarddeviationbounds.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // StandardDeviationBounds type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L260-L267 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L260-L267 type StandardDeviationBounds struct { Lower Float64 `json:"lower,omitempty"` LowerPopulation Float64 `json:"lower_population,omitempty"` diff --git a/typedapi/types/standarddeviationboundsasstring.go b/typedapi/types/standarddeviationboundsasstring.go index 43bbdfd50d..934db8f25d 100644 --- a/typedapi/types/standarddeviationboundsasstring.go +++ b/typedapi/types/standarddeviationboundsasstring.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StandardDeviationBoundsAsString type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L269-L276 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L269-L276 type StandardDeviationBoundsAsString struct { Lower string `json:"lower"` LowerPopulation string `json:"lower_population"` diff --git a/typedapi/types/standardtokenizer.go b/typedapi/types/standardtokenizer.go index 287a187dc6..100660200c 100644 --- a/typedapi/types/standardtokenizer.go +++ b/typedapi/types/standardtokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StandardTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L105-L108 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L105-L108 type StandardTokenizer struct { MaxTokenLength *int `json:"max_token_length,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/statistics.go b/typedapi/types/statistics.go index 8c5171a86a..690e04caf7 100644 --- a/typedapi/types/statistics.go +++ b/typedapi/types/statistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Statistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/slm/_types/SnapshotLifecycle.ts#L51-L74 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/slm/_types/SnapshotLifecycle.ts#L51-L74 type Statistics struct { Policy *string `json:"policy,omitempty"` RetentionDeletionTime Duration `json:"retention_deletion_time,omitempty"` diff --git a/typedapi/types/stats.go b/typedapi/types/stats.go index e2db2fcddf..9cd0724d3c 100644 --- a/typedapi/types/stats.go +++ b/typedapi/types/stats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // Stats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L30-L114 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L30-L114 type Stats struct { // AdaptiveSelection Statistics about adaptive replica selection. AdaptiveSelection map[string]AdaptiveSelection `json:"adaptive_selection,omitempty"` diff --git a/typedapi/types/statsaggregate.go b/typedapi/types/statsaggregate.go index 079ab6448f..a9ae24dd01 100644 --- a/typedapi/types/statsaggregate.go +++ b/typedapi/types/statsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StatsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L240-L255 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L240-L255 type StatsAggregate struct { Avg Float64 `json:"avg,omitempty"` AvgAsString *string `json:"avg_as_string,omitempty"` diff --git a/typedapi/types/statsaggregation.go b/typedapi/types/statsaggregation.go index 5034a6c8b6..279e408f6e 100644 --- a/typedapi/types/statsaggregation.go +++ b/typedapi/types/statsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StatsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L282-L282 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L282-L282 type StatsAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/statsbucketaggregate.go b/typedapi/types/statsbucketaggregate.go index 8fb3d0d8d4..bee326e135 100644 --- a/typedapi/types/statsbucketaggregate.go +++ b/typedapi/types/statsbucketaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StatsBucketAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L257-L258 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L257-L258 type StatsBucketAggregate struct { Avg Float64 `json:"avg,omitempty"` AvgAsString *string `json:"avg_as_string,omitempty"` diff --git a/typedapi/types/statsbucketaggregation.go b/typedapi/types/statsbucketaggregation.go index 95c717843e..4b47598e04 100644 --- a/typedapi/types/statsbucketaggregation.go +++ b/typedapi/types/statsbucketaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // StatsBucketAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L371-L371 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L371-L371 type StatsBucketAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/status.go b/typedapi/types/status.go index 669f5ba7ac..6a8ea422c5 100644 --- a/typedapi/types/status.go +++ b/typedapi/types/status.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Status type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/snapshot/_types/SnapshotStatus.ts#L26-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/snapshot/_types/SnapshotStatus.ts#L26-L35 type Status struct { IncludeGlobalState bool `json:"include_global_state"` Indices map[string]SnapshotIndexStats `json:"indices"` diff --git a/typedapi/types/stemmeroverridetokenfilter.go b/typedapi/types/stemmeroverridetokenfilter.go index 8f841af80e..8a79f241fd 100644 --- a/typedapi/types/stemmeroverridetokenfilter.go +++ b/typedapi/types/stemmeroverridetokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StemmerOverrideTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L314-L318 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L314-L318 type StemmerOverrideTokenFilter struct { Rules []string `json:"rules,omitempty"` RulesPath *string `json:"rules_path,omitempty"` diff --git a/typedapi/types/stemmertokenfilter.go b/typedapi/types/stemmertokenfilter.go index 8886d89f05..61e98374a4 100644 --- a/typedapi/types/stemmertokenfilter.go +++ b/typedapi/types/stemmertokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StemmerTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L320-L324 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L320-L324 type StemmerTokenFilter struct { Language *string `json:"language,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/stepkey.go b/typedapi/types/stepkey.go index f8c3440dd1..64369425d7 100644 --- a/typedapi/types/stepkey.go +++ b/typedapi/types/stepkey.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StepKey type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ilm/move_to_step/types.ts#L20-L24 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ilm/move_to_step/types.ts#L20-L24 type StepKey struct { Action string `json:"action"` Name string `json:"name"` diff --git a/typedapi/types/stopanalyzer.go b/typedapi/types/stopanalyzer.go index df41d70575..c934494519 100644 --- a/typedapi/types/stopanalyzer.go +++ b/typedapi/types/stopanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StopAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L101-L106 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L101-L106 type StopAnalyzer struct { Stopwords []string `json:"stopwords,omitempty"` StopwordsPath *string `json:"stopwords_path,omitempty"` diff --git a/typedapi/types/stoptokenfilter.go b/typedapi/types/stoptokenfilter.go index 983f84f79f..1f369e81f4 100644 --- a/typedapi/types/stoptokenfilter.go +++ b/typedapi/types/stoptokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StopTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L97-L103 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L97-L103 type StopTokenFilter struct { IgnoreCase *bool `json:"ignore_case,omitempty"` RemoveTrailing *bool `json:"remove_trailing,omitempty"` diff --git a/typedapi/types/stopwords.go b/typedapi/types/stopwords.go index 2f0d08cac9..42493c68f5 100644 --- a/typedapi/types/stopwords.go +++ b/typedapi/types/stopwords.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // StopWords type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/StopWords.ts#L20-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/StopWords.ts#L20-L26 type StopWords []string diff --git a/typedapi/types/storage.go b/typedapi/types/storage.go index a6f2727432..bfb1decd2a 100644 --- a/typedapi/types/storage.go +++ b/typedapi/types/storage.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // Storage type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L491-L500 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L491-L500 type Storage struct { // AllowMmap You can restrict the use of the mmapfs and the related hybridfs store type // via the setting node.store.allow_mmap. diff --git a/typedapi/types/storedscript.go b/typedapi/types/storedscript.go index ea364a476c..16797c41f1 100644 --- a/typedapi/types/storedscript.go +++ b/typedapi/types/storedscript.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // StoredScript type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Scripting.ts#L47-L57 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Scripting.ts#L47-L57 type StoredScript struct { // Lang Specifies the language the script is written in. Lang scriptlanguage.ScriptLanguage `json:"lang"` diff --git a/typedapi/types/storedscriptid.go b/typedapi/types/storedscriptid.go index 04a6c3c91b..5495ca5f2d 100644 --- a/typedapi/types/storedscriptid.go +++ b/typedapi/types/storedscriptid.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // StoredScriptId type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Scripting.ts#L81-L86 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Scripting.ts#L81-L86 type StoredScriptId struct { // Id The `id` for a stored script. Id string `json:"id"` diff --git a/typedapi/types/storestats.go b/typedapi/types/storestats.go index da265b1b6a..15ed553f20 100644 --- a/typedapi/types/storestats.go +++ b/typedapi/types/storestats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StoreStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L368-L395 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L368-L395 type StoreStats struct { // Reserved A prediction of how much larger the shard stores will eventually grow due to // ongoing peer recoveries, restoring snapshots, and similar activities. diff --git a/typedapi/types/stringifiedboolean.go b/typedapi/types/stringifiedboolean.go index bc68e849e0..4371509008 100644 --- a/typedapi/types/stringifiedboolean.go +++ b/typedapi/types/stringifiedboolean.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // bool // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_spec_utils/Stringified.ts#L20-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_spec_utils/Stringified.ts#L20-L27 type Stringifiedboolean interface{} diff --git a/typedapi/types/stringifiedepochtimeunitmillis.go b/typedapi/types/stringifiedepochtimeunitmillis.go index 9a7025862f..ad015fba33 100644 --- a/typedapi/types/stringifiedepochtimeunitmillis.go +++ b/typedapi/types/stringifiedepochtimeunitmillis.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // int64 // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_spec_utils/Stringified.ts#L20-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_spec_utils/Stringified.ts#L20-L27 type StringifiedEpochTimeUnitMillis interface{} diff --git a/typedapi/types/stringifiedepochtimeunitseconds.go b/typedapi/types/stringifiedepochtimeunitseconds.go index 7e16e33a89..f7d6d6288c 100644 --- a/typedapi/types/stringifiedepochtimeunitseconds.go +++ b/typedapi/types/stringifiedepochtimeunitseconds.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // int64 // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_spec_utils/Stringified.ts#L20-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_spec_utils/Stringified.ts#L20-L27 type StringifiedEpochTimeUnitSeconds interface{} diff --git a/typedapi/types/stringifiedinteger.go b/typedapi/types/stringifiedinteger.go index 65ffc49d11..d0e9ca8a9e 100644 --- a/typedapi/types/stringifiedinteger.go +++ b/typedapi/types/stringifiedinteger.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // int // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_spec_utils/Stringified.ts#L20-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_spec_utils/Stringified.ts#L20-L27 type Stringifiedinteger interface{} diff --git a/typedapi/types/stringifiedversionnumber.go b/typedapi/types/stringifiedversionnumber.go index 5aaf731b0c..888d6b3419 100644 --- a/typedapi/types/stringifiedversionnumber.go +++ b/typedapi/types/stringifiedversionnumber.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // int64 // string // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_spec_utils/Stringified.ts#L20-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_spec_utils/Stringified.ts#L20-L27 type StringifiedVersionNumber interface{} diff --git a/typedapi/types/stringraretermsaggregate.go b/typedapi/types/stringraretermsaggregate.go index 3fc53b4744..208717967f 100644 --- a/typedapi/types/stringraretermsaggregate.go +++ b/typedapi/types/stringraretermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // StringRareTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L443-L447 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L443-L447 type StringRareTermsAggregate struct { Buckets BucketsStringRareTermsBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/stringraretermsbucket.go b/typedapi/types/stringraretermsbucket.go index fc6086d97a..a074840f2d 100644 --- a/typedapi/types/stringraretermsbucket.go +++ b/typedapi/types/stringraretermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // StringRareTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L449-L451 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L449-L451 type StringRareTermsBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/stringstatsaggregate.go b/typedapi/types/stringstatsaggregate.go index 447847f48d..d4a9701f75 100644 --- a/typedapi/types/stringstatsaggregate.go +++ b/typedapi/types/stringstatsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StringStatsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L693-L704 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L693-L704 type StringStatsAggregate struct { AvgLength Float64 `json:"avg_length,omitempty"` AvgLengthAsString *string `json:"avg_length_as_string,omitempty"` diff --git a/typedapi/types/stringstatsaggregation.go b/typedapi/types/stringstatsaggregation.go index e083c47430..bb37235dcd 100644 --- a/typedapi/types/stringstatsaggregation.go +++ b/typedapi/types/stringstatsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StringStatsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L284-L290 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L284-L290 type StringStatsAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/stringtermsaggregate.go b/typedapi/types/stringtermsaggregate.go index c7a08516dd..879929d5a3 100644 --- a/typedapi/types/stringtermsaggregate.go +++ b/typedapi/types/stringtermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StringTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L384-L389 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L384-L389 type StringTermsAggregate struct { Buckets BucketsStringTermsBucket `json:"buckets"` DocCountErrorUpperBound *int64 `json:"doc_count_error_upper_bound,omitempty"` diff --git a/typedapi/types/stringtermsbucket.go b/typedapi/types/stringtermsbucket.go index 33a45a34eb..fdad40d1f1 100644 --- a/typedapi/types/stringtermsbucket.go +++ b/typedapi/types/stringtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // StringTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L395-L397 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L395-L397 type StringTermsBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/stupidbackoffsmoothingmodel.go b/typedapi/types/stupidbackoffsmoothingmodel.go index eb3109787b..a85fdee7b3 100644 --- a/typedapi/types/stupidbackoffsmoothingmodel.go +++ b/typedapi/types/stupidbackoffsmoothingmodel.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // StupidBackoffSmoothingModel type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L460-L465 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L460-L465 type StupidBackoffSmoothingModel struct { // Discount A constant factor that the lower order n-gram model is discounted by. Discount Float64 `json:"discount"` diff --git a/typedapi/types/suggest.go b/typedapi/types/suggest.go index 24676b8446..f816fdcd1e 100644 --- a/typedapi/types/suggest.go +++ b/typedapi/types/suggest.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ package types // PhraseSuggest // TermSuggest // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L34-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L34-L40 type Suggest interface{} diff --git a/typedapi/types/suggestcontext.go b/typedapi/types/suggestcontext.go index 520c473c1f..729747c828 100644 --- a/typedapi/types/suggestcontext.go +++ b/typedapi/types/suggestcontext.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SuggestContext type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/specialized.ts#L37-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/specialized.ts#L37-L42 type SuggestContext struct { Name string `json:"name"` Path *string `json:"path,omitempty"` diff --git a/typedapi/types/suggester.go b/typedapi/types/suggester.go index 626fe77ea7..a0d57c97f9 100644 --- a/typedapi/types/suggester.go +++ b/typedapi/types/suggester.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // Suggester type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L101-L104 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L101-L104 type Suggester struct { Suggesters map[string]FieldSuggester `json:"-"` // Text Global suggest text, to avoid repetition when the same text is used in diff --git a/typedapi/types/suggestfuzziness.go b/typedapi/types/suggestfuzziness.go index 1e8d0f7d9d..e91422ff07 100644 --- a/typedapi/types/suggestfuzziness.go +++ b/typedapi/types/suggestfuzziness.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SuggestFuzziness type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L193-L221 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L193-L221 type SuggestFuzziness struct { // Fuzziness The fuzziness factor. Fuzziness Fuzziness `json:"fuzziness,omitempty"` diff --git a/typedapi/types/sumaggregate.go b/typedapi/types/sumaggregate.go index fff727f34e..c5d88681a2 100644 --- a/typedapi/types/sumaggregate.go +++ b/typedapi/types/sumaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SumAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L203-L207 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L203-L207 type SumAggregate struct { Meta Metadata `json:"meta,omitempty"` // Value The metric value. A missing value generally means that there was no data to diff --git a/typedapi/types/sumaggregation.go b/typedapi/types/sumaggregation.go index 4dfcaedfdc..6470b26f6d 100644 --- a/typedapi/types/sumaggregation.go +++ b/typedapi/types/sumaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SumAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L292-L292 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L292-L292 type SumAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/sumbucketaggregation.go b/typedapi/types/sumbucketaggregation.go index 9d974eaa52..c45c0a9b8c 100644 --- a/typedapi/types/sumbucketaggregation.go +++ b/typedapi/types/sumbucketaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SumBucketAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/pipeline.ts#L373-L373 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/pipeline.ts#L373-L373 type SumBucketAggregation struct { // BucketsPath Path to the buckets that contain one set of values to correlate. BucketsPath BucketsPath `json:"buckets_path,omitempty"` diff --git a/typedapi/types/summary.go b/typedapi/types/summary.go index e15b3fcb85..11854c1b68 100644 --- a/typedapi/types/summary.go +++ b/typedapi/types/summary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // Summary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/enrich/_types/Policy.ts#L23-L25 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/enrich/_types/Policy.ts#L24-L26 type Summary struct { Config map[policytype.PolicyType]EnrichPolicy `json:"config"` } diff --git a/typedapi/types/synccontainer.go b/typedapi/types/synccontainer.go index 148abc15d7..fe9b888af2 100644 --- a/typedapi/types/synccontainer.go +++ b/typedapi/types/synccontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // SyncContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/_types/Transform.ts#L169-L175 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/_types/Transform.ts#L169-L175 type SyncContainer struct { // Time Specifies that the transform uses a time field to synchronize the source and // destination indices. diff --git a/typedapi/types/synonymgraphtokenfilter.go b/typedapi/types/synonymgraphtokenfilter.go index ef320964ee..39f72a0e37 100644 --- a/typedapi/types/synonymgraphtokenfilter.go +++ b/typedapi/types/synonymgraphtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SynonymGraphTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L110-L119 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L110-L119 type SynonymGraphTokenFilter struct { Expand *bool `json:"expand,omitempty"` Format *synonymformat.SynonymFormat `json:"format,omitempty"` diff --git a/typedapi/types/synonymrule.go b/typedapi/types/synonymrule.go index 7dc4f7df12..c57bc2c239 100644 --- a/typedapi/types/synonymrule.go +++ b/typedapi/types/synonymrule.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SynonymRule type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/_types/SynonymRule.ts#L26-L35 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/_types/SynonymRule.ts#L26-L35 type SynonymRule struct { // Id Synonym Rule identifier Id *string `json:"id,omitempty"` diff --git a/typedapi/types/synonymruleread.go b/typedapi/types/synonymruleread.go index 5ccebc3131..da4e2cb579 100644 --- a/typedapi/types/synonymruleread.go +++ b/typedapi/types/synonymruleread.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // SynonymRuleRead type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/_types/SynonymRule.ts#L38-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/_types/SynonymRule.ts#L38-L47 type SynonymRuleRead struct { // Id Synonym Rule identifier Id string `json:"id"` diff --git a/typedapi/types/synonymssetitem.go b/typedapi/types/synonymssetitem.go index 5324cc7783..9b7e88eeb8 100644 --- a/typedapi/types/synonymssetitem.go +++ b/typedapi/types/synonymssetitem.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // SynonymsSetItem type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/get_synonyms_sets/SynonymsSetsGetResponse.ts#L30-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/get_synonyms_sets/SynonymsSetsGetResponse.ts#L30-L39 type SynonymsSetItem struct { // Count Number of synonym rules that the synonym set contains Count int `json:"count"` diff --git a/typedapi/types/synonymsupdateresult.go b/typedapi/types/synonymsupdateresult.go index 553b5c0075..40f810d78f 100644 --- a/typedapi/types/synonymsupdateresult.go +++ b/typedapi/types/synonymsupdateresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // SynonymsUpdateResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/synonyms/_types/SynonymsUpdateResult.ts#L23-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/synonyms/_types/SynonymsUpdateResult.ts#L23-L34 type SynonymsUpdateResult struct { // ReloadAnalyzersDetails Updating synonyms in a synonym set reloads the associated analyzers. // This is the analyzers reloading result diff --git a/typedapi/types/synonymtokenfilter.go b/typedapi/types/synonymtokenfilter.go index ca8b7de623..c8610d7350 100644 --- a/typedapi/types/synonymtokenfilter.go +++ b/typedapi/types/synonymtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // SynonymTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L121-L130 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L121-L130 type SynonymTokenFilter struct { Expand *bool `json:"expand,omitempty"` Format *synonymformat.SynonymFormat `json:"format,omitempty"` diff --git a/typedapi/types/targetmeanencodingpreprocessor.go b/typedapi/types/targetmeanencodingpreprocessor.go index 5d48c093c2..ab382abd26 100644 --- a/typedapi/types/targetmeanencodingpreprocessor.go +++ b/typedapi/types/targetmeanencodingpreprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TargetMeanEncodingPreprocessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L49-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L49-L54 type TargetMeanEncodingPreprocessor struct { DefaultValue Float64 `json:"default_value"` FeatureName string `json:"feature_name"` diff --git a/typedapi/types/taskfailure.go b/typedapi/types/taskfailure.go index 2d22c98d94..b9df611b1b 100644 --- a/typedapi/types/taskfailure.go +++ b/typedapi/types/taskfailure.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TaskFailure type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Errors.ts#L66-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Errors.ts#L66-L71 type TaskFailure struct { NodeId string `json:"node_id"` Reason ErrorCause `json:"reason"` diff --git a/typedapi/types/taskid.go b/typedapi/types/taskid.go index b9b93152de..52eb03ecee 100644 --- a/typedapi/types/taskid.go +++ b/typedapi/types/taskid.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // int // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L131-L131 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L132-L132 type TaskId interface{} diff --git a/typedapi/types/taskinfo.go b/typedapi/types/taskinfo.go index 60729f3a0c..07615857fc 100644 --- a/typedapi/types/taskinfo.go +++ b/typedapi/types/taskinfo.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TaskInfo type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/tasks/_types/TaskInfo.ts#L32-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/tasks/_types/TaskInfo.ts#L32-L47 type TaskInfo struct { Action string `json:"action"` Cancellable bool `json:"cancellable"` diff --git a/typedapi/types/taskinfos.go b/typedapi/types/taskinfos.go index b2a2d13413..bbbcbbc1d6 100644 --- a/typedapi/types/taskinfos.go +++ b/typedapi/types/taskinfos.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // []TaskInfo // map[string]ParentTaskInfo // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/tasks/_types/TaskListResponseBase.ts#L40-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/tasks/_types/TaskListResponseBase.ts#L40-L43 type TaskInfos interface{} diff --git a/typedapi/types/tasksrecord.go b/typedapi/types/tasksrecord.go index d3b5a5f599..e3bdba1fb4 100644 --- a/typedapi/types/tasksrecord.go +++ b/typedapi/types/tasksrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TasksRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/tasks/types.ts#L22-L101 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/tasks/types.ts#L22-L101 type TasksRecord struct { // Action The task action. Action *string `json:"action,omitempty"` diff --git a/typedapi/types/tdigest.go b/typedapi/types/tdigest.go index dbb8b443d9..fbcaa14e6d 100644 --- a/typedapi/types/tdigest.go +++ b/typedapi/types/tdigest.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TDigest type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L223-L228 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L223-L228 type TDigest struct { // Compression Limits the maximum number of nodes used by the underlying TDigest algorithm // to `20 * compression`, enabling control of memory usage and approximation diff --git a/typedapi/types/tdigestpercentileranksaggregate.go b/typedapi/types/tdigestpercentileranksaggregate.go index e45690c804..4a45c6cf72 100644 --- a/typedapi/types/tdigestpercentileranksaggregate.go +++ b/typedapi/types/tdigestpercentileranksaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TDigestPercentileRanksAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L175-L176 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L175-L176 type TDigestPercentileRanksAggregate struct { Meta Metadata `json:"meta,omitempty"` Values Percentiles `json:"values"` diff --git a/typedapi/types/tdigestpercentilesaggregate.go b/typedapi/types/tdigestpercentilesaggregate.go index 72c7cb8a01..d9ce487874 100644 --- a/typedapi/types/tdigestpercentilesaggregate.go +++ b/typedapi/types/tdigestpercentilesaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TDigestPercentilesAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L172-L173 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L172-L173 type TDigestPercentilesAggregate struct { Meta Metadata `json:"meta,omitempty"` Values Percentiles `json:"values"` diff --git a/typedapi/types/template.go b/typedapi/types/template.go index 94005c48bb..ed59c75391 100644 --- a/typedapi/types/template.go +++ b/typedapi/types/template.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // Template type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/simulate_template/IndicesSimulateTemplateResponse.ts#L33-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/simulate_template/IndicesSimulateTemplateResponse.ts#L33-L37 type Template struct { Aliases map[string]Alias `json:"aliases"` Mappings TypeMapping `json:"mappings"` diff --git a/typedapi/types/templateconfig.go b/typedapi/types/templateconfig.go index acaee07a1c..70df93b6c6 100644 --- a/typedapi/types/templateconfig.go +++ b/typedapi/types/templateconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TemplateConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/msearch_template/types.ts#L28-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/msearch_template/types.ts#L28-L54 type TemplateConfig struct { // Explain If `true`, returns detailed information about score calculation as part of // each hit. diff --git a/typedapi/types/templatemapping.go b/typedapi/types/templatemapping.go index db4f6aca38..cb05e26304 100644 --- a/typedapi/types/templatemapping.go +++ b/typedapi/types/templatemapping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TemplateMapping type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/TemplateMapping.ts#L27-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/TemplateMapping.ts#L27-L34 type TemplateMapping struct { Aliases map[string]Alias `json:"aliases"` IndexPatterns []string `json:"index_patterns"` diff --git a/typedapi/types/templatesrecord.go b/typedapi/types/templatesrecord.go index 47f557da53..9dce5aa735 100644 --- a/typedapi/types/templatesrecord.go +++ b/typedapi/types/templatesrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TemplatesRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/templates/types.ts#L22-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/templates/types.ts#L22-L48 type TemplatesRecord struct { // ComposedOf The component templates that comprise the index template. ComposedOf *string `json:"composed_of,omitempty"` diff --git a/typedapi/types/term.go b/typedapi/types/term.go index a0cfbbc261..df2d97a8b7 100644 --- a/typedapi/types/term.go +++ b/typedapi/types/term.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Term type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/termvectors/types.ts#L34-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/termvectors/types.ts#L34-L40 type Term struct { DocFreq *int `json:"doc_freq,omitempty"` Score *Float64 `json:"score,omitempty"` diff --git a/typedapi/types/termquery.go b/typedapi/types/termquery.go index 9f43105a4b..1512ea488d 100644 --- a/typedapi/types/termquery.go +++ b/typedapi/types/termquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L217-L231 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L217-L231 type TermQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/termsaggregatebasedoubletermsbucket.go b/typedapi/types/termsaggregatebasedoubletermsbucket.go index 1d65b2e523..a1c3c22493 100644 --- a/typedapi/types/termsaggregatebasedoubletermsbucket.go +++ b/typedapi/types/termsaggregatebasedoubletermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermsAggregateBaseDoubleTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L377-L382 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L377-L382 type TermsAggregateBaseDoubleTermsBucket struct { Buckets BucketsDoubleTermsBucket `json:"buckets"` DocCountErrorUpperBound *int64 `json:"doc_count_error_upper_bound,omitempty"` diff --git a/typedapi/types/termsaggregatebaselongtermsbucket.go b/typedapi/types/termsaggregatebaselongtermsbucket.go index 9100f4fbe3..403f93dab5 100644 --- a/typedapi/types/termsaggregatebaselongtermsbucket.go +++ b/typedapi/types/termsaggregatebaselongtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermsAggregateBaseLongTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L377-L382 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L377-L382 type TermsAggregateBaseLongTermsBucket struct { Buckets BucketsLongTermsBucket `json:"buckets"` DocCountErrorUpperBound *int64 `json:"doc_count_error_upper_bound,omitempty"` diff --git a/typedapi/types/termsaggregatebasemultitermsbucket.go b/typedapi/types/termsaggregatebasemultitermsbucket.go index 53dd0ec323..6c3fc313da 100644 --- a/typedapi/types/termsaggregatebasemultitermsbucket.go +++ b/typedapi/types/termsaggregatebasemultitermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermsAggregateBaseMultiTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L377-L382 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L377-L382 type TermsAggregateBaseMultiTermsBucket struct { Buckets BucketsMultiTermsBucket `json:"buckets"` DocCountErrorUpperBound *int64 `json:"doc_count_error_upper_bound,omitempty"` diff --git a/typedapi/types/termsaggregatebasestringtermsbucket.go b/typedapi/types/termsaggregatebasestringtermsbucket.go index 33f7dd244c..7239f118ed 100644 --- a/typedapi/types/termsaggregatebasestringtermsbucket.go +++ b/typedapi/types/termsaggregatebasestringtermsbucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermsAggregateBaseStringTermsBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L377-L382 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L377-L382 type TermsAggregateBaseStringTermsBucket struct { Buckets BucketsStringTermsBucket `json:"buckets"` DocCountErrorUpperBound *int64 `json:"doc_count_error_upper_bound,omitempty"` diff --git a/typedapi/types/termsaggregatebasevoid.go b/typedapi/types/termsaggregatebasevoid.go index e50a27a1e5..ae391e217a 100644 --- a/typedapi/types/termsaggregatebasevoid.go +++ b/typedapi/types/termsaggregatebasevoid.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermsAggregateBaseVoid type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L377-L382 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L377-L382 type TermsAggregateBaseVoid struct { Buckets BucketsVoid `json:"buckets"` DocCountErrorUpperBound *int64 `json:"doc_count_error_upper_bound,omitempty"` diff --git a/typedapi/types/termsaggregation.go b/typedapi/types/termsaggregation.go index 6997ab2011..f26d3ab42f 100644 --- a/typedapi/types/termsaggregation.go +++ b/typedapi/types/termsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -35,7 +35,7 @@ import ( // TermsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L910-L970 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L910-L970 type TermsAggregation struct { // CollectMode Determines how child aggregations should be calculated: breadth-first or // depth-first. diff --git a/typedapi/types/termsexclude.go b/typedapi/types/termsexclude.go index 96a851ef88..8c7b108e56 100644 --- a/typedapi/types/termsexclude.go +++ b/typedapi/types/termsexclude.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TermsExclude type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L1001-L1002 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L1001-L1002 type TermsExclude []string diff --git a/typedapi/types/termsgrouping.go b/typedapi/types/termsgrouping.go index f07b8de96e..8240dcdc7d 100644 --- a/typedapi/types/termsgrouping.go +++ b/typedapi/types/termsgrouping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TermsGrouping type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/rollup/_types/Groupings.ts#L75-L82 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/rollup/_types/Groupings.ts#L75-L82 type TermsGrouping struct { // Fields The set of fields that you wish to collect terms for. // This array can contain fields that are both keyword and numerics. diff --git a/typedapi/types/termsinclude.go b/typedapi/types/termsinclude.go index 276855ded4..f154eae802 100644 --- a/typedapi/types/termsinclude.go +++ b/typedapi/types/termsinclude.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,5 +26,5 @@ package types // []string // TermsPartition // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L998-L999 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L998-L999 type TermsInclude interface{} diff --git a/typedapi/types/termslookup.go b/typedapi/types/termslookup.go index 915bec5907..eb232baea2 100644 --- a/typedapi/types/termslookup.go +++ b/typedapi/types/termslookup.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TermsLookup type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L242-L247 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L242-L247 type TermsLookup struct { Id string `json:"id"` Index string `json:"index"` diff --git a/typedapi/types/termspartition.go b/typedapi/types/termspartition.go index e217c8bd50..db3f2886f3 100644 --- a/typedapi/types/termspartition.go +++ b/typedapi/types/termspartition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermsPartition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L1004-L1013 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L1004-L1013 type TermsPartition struct { // NumPartitions The number of partitions. NumPartitions int64 `json:"num_partitions"` diff --git a/typedapi/types/termsquery.go b/typedapi/types/termsquery.go index be71e5acb3..f9f484872b 100644 --- a/typedapi/types/termsquery.go +++ b/typedapi/types/termsquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // TermsQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L233-L235 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L233-L235 type TermsQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/termsqueryfield.go b/typedapi/types/termsqueryfield.go index e01a12dd1e..1a1bb791a8 100644 --- a/typedapi/types/termsqueryfield.go +++ b/typedapi/types/termsqueryfield.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // []FieldValue // TermsLookup // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L237-L240 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L237-L240 type TermsQueryField interface{} diff --git a/typedapi/types/termssetquery.go b/typedapi/types/termssetquery.go index 57f1fc878c..b0a1ca5661 100644 --- a/typedapi/types/termssetquery.go +++ b/typedapi/types/termssetquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermsSetQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L249-L262 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L249-L262 type TermsSetQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/termsuggest.go b/typedapi/types/termsuggest.go index 97b21d5cfc..aefa6599a1 100644 --- a/typedapi/types/termsuggest.go +++ b/typedapi/types/termsuggest.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermSuggest type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L64-L69 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L64-L69 type TermSuggest struct { Length int `json:"length"` Offset int `json:"offset"` diff --git a/typedapi/types/termsuggester.go b/typedapi/types/termsuggester.go index 6e7712474a..4dce3f46c8 100644 --- a/typedapi/types/termsuggester.go +++ b/typedapi/types/termsuggester.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // TermSuggester type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L503-L565 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L503-L565 type TermSuggester struct { // Analyzer The analyzer to analyze the suggest text with. // Defaults to the search analyzer of the suggest field. diff --git a/typedapi/types/termsuggestoption.go b/typedapi/types/termsuggestoption.go index 401764ef3c..f650335a15 100644 --- a/typedapi/types/termsuggestoption.go +++ b/typedapi/types/termsuggestoption.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermSuggestOption type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/suggester.ts#L93-L99 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/suggester.ts#L93-L99 type TermSuggestOption struct { CollateMatch *bool `json:"collate_match,omitempty"` Freq int64 `json:"freq"` diff --git a/typedapi/types/termvector.go b/typedapi/types/termvector.go index 0a002f445a..b61aecd371 100644 --- a/typedapi/types/termvector.go +++ b/typedapi/types/termvector.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TermVector type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/termvectors/types.ts#L23-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/termvectors/types.ts#L23-L26 type TermVector struct { FieldStatistics FieldStatistics `json:"field_statistics"` Terms map[string]Term `json:"terms"` diff --git a/typedapi/types/termvectorsfilter.go b/typedapi/types/termvectorsfilter.go index 630d1f73fb..6bb755c452 100644 --- a/typedapi/types/termvectorsfilter.go +++ b/typedapi/types/termvectorsfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermVectorsFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/termvectors/types.ts#L49-L86 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/termvectors/types.ts#L49-L86 type TermVectorsFilter struct { // MaxDocFreq Ignore words which occur in more than this many docs. // Defaults to unbounded. diff --git a/typedapi/types/termvectorsresult.go b/typedapi/types/termvectorsresult.go index 78ee66760f..a98edec0e7 100644 --- a/typedapi/types/termvectorsresult.go +++ b/typedapi/types/termvectorsresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermVectorsResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/mtermvectors/types.ts#L96-L104 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/mtermvectors/types.ts#L96-L104 type TermVectorsResult struct { Error *ErrorCause `json:"error,omitempty"` Found *bool `json:"found,omitempty"` diff --git a/typedapi/types/termvectorstoken.go b/typedapi/types/termvectorstoken.go index 1a94950f17..a470e95c05 100644 --- a/typedapi/types/termvectorstoken.go +++ b/typedapi/types/termvectorstoken.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TermVectorsToken type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/termvectors/types.ts#L42-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/termvectors/types.ts#L42-L47 type TermVectorsToken struct { EndOffset *int `json:"end_offset,omitempty"` Payload *string `json:"payload,omitempty"` diff --git a/typedapi/types/testpopulation.go b/typedapi/types/testpopulation.go index 4a8ab8f0c2..1a113e0ca5 100644 --- a/typedapi/types/testpopulation.go +++ b/typedapi/types/testpopulation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TestPopulation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L310-L320 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L310-L320 type TestPopulation struct { // Field The field to aggregate. Field string `json:"field"` diff --git a/typedapi/types/textclassificationinferenceoptions.go b/typedapi/types/textclassificationinferenceoptions.go index 37560e079b..94e7dcc9a1 100644 --- a/typedapi/types/textclassificationinferenceoptions.go +++ b/typedapi/types/textclassificationinferenceoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TextClassificationInferenceOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L189-L199 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L189-L199 type TextClassificationInferenceOptions struct { // ClassificationLabels Classification labels to apply other than the stored labels. Must have the // same deminsions as the default configured labels diff --git a/typedapi/types/textclassificationinferenceupdateoptions.go b/typedapi/types/textclassificationinferenceupdateoptions.go index 43588f10b3..6c1c116244 100644 --- a/typedapi/types/textclassificationinferenceupdateoptions.go +++ b/typedapi/types/textclassificationinferenceupdateoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TextClassificationInferenceUpdateOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L363-L372 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L363-L372 type TextClassificationInferenceUpdateOptions struct { // ClassificationLabels Classification labels to apply other than the stored labels. Must have the // same deminsions as the default configured labels diff --git a/typedapi/types/textembedding.go b/typedapi/types/textembedding.go index e19d371fc1..bac2da65ba 100644 --- a/typedapi/types/textembedding.go +++ b/typedapi/types/textembedding.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TextEmbedding type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Knn.ts#L50-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Knn.ts#L50-L53 type TextEmbedding struct { ModelId string `json:"model_id"` ModelText string `json:"model_text"` diff --git a/typedapi/types/textembeddinginferenceoptions.go b/typedapi/types/textembeddinginferenceoptions.go index 4feb20b05a..6d4491ba4c 100644 --- a/typedapi/types/textembeddinginferenceoptions.go +++ b/typedapi/types/textembeddinginferenceoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TextEmbeddingInferenceOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L237-L245 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L237-L245 type TextEmbeddingInferenceOptions struct { // EmbeddingSize The number of dimensions in the embedding output EmbeddingSize *int `json:"embedding_size,omitempty"` diff --git a/typedapi/types/textembeddinginferenceupdateoptions.go b/typedapi/types/textembeddinginferenceupdateoptions.go index 418d372f0e..4e7f4e8f97 100644 --- a/typedapi/types/textembeddinginferenceupdateoptions.go +++ b/typedapi/types/textembeddinginferenceupdateoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TextEmbeddingInferenceUpdateOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L392-L396 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L392-L396 type TextEmbeddingInferenceUpdateOptions struct { // ResultsField The field that is added to incoming documents to contain the inference // prediction. Defaults to predicted_value. diff --git a/typedapi/types/textembeddingresult.go b/typedapi/types/textembeddingresult.go new file mode 100644 index 0000000000..aa448d28de --- /dev/null +++ b/typedapi/types/textembeddingresult.go @@ -0,0 +1,67 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated from the elasticsearch-specification DO NOT EDIT. +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe + +package types + +import ( + "bytes" + "encoding/json" + "errors" + "io" +) + +// TextEmbeddingResult type. +// +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/inference/_types/Results.ts#L39-L44 +type TextEmbeddingResult struct { + Embedding []float32 `json:"embedding"` +} + +func (s *TextEmbeddingResult) UnmarshalJSON(data []byte) error { + + dec := json.NewDecoder(bytes.NewReader(data)) + + for { + t, err := dec.Token() + if err != nil { + if errors.Is(err, io.EOF) { + break + } + return err + } + + switch t { + + case "embedding": + if err := dec.Decode(&s.Embedding); err != nil { + return err + } + + } + } + return nil +} + +// NewTextEmbeddingResult returns a TextEmbeddingResult. +func NewTextEmbeddingResult() *TextEmbeddingResult { + r := &TextEmbeddingResult{} + + return r +} diff --git a/typedapi/types/textexpansioninferenceoptions.go b/typedapi/types/textexpansioninferenceoptions.go index ccd7580182..7f3d83cafe 100644 --- a/typedapi/types/textexpansioninferenceoptions.go +++ b/typedapi/types/textexpansioninferenceoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TextExpansionInferenceOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L247-L253 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L247-L253 type TextExpansionInferenceOptions struct { // ResultsField The field that is added to incoming documents to contain the inference // prediction. Defaults to predicted_value. diff --git a/typedapi/types/textexpansioninferenceupdateoptions.go b/typedapi/types/textexpansioninferenceupdateoptions.go index 8525ccf67b..1c41b9c10c 100644 --- a/typedapi/types/textexpansioninferenceupdateoptions.go +++ b/typedapi/types/textexpansioninferenceupdateoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TextExpansionInferenceUpdateOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L398-L402 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L398-L402 type TextExpansionInferenceUpdateOptions struct { // ResultsField The field that is added to incoming documents to contain the inference // prediction. Defaults to predicted_value. diff --git a/typedapi/types/textexpansionquery.go b/typedapi/types/textexpansionquery.go index 93cdf1d47a..830eff4a96 100644 --- a/typedapi/types/textexpansionquery.go +++ b/typedapi/types/textexpansionquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TextExpansionQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/TextExpansionQuery.ts#L22-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/TextExpansionQuery.ts#L22-L27 type TextExpansionQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/textindexprefixes.go b/typedapi/types/textindexprefixes.go index 63e5b496d2..aa25543ba8 100644 --- a/typedapi/types/textindexprefixes.go +++ b/typedapi/types/textindexprefixes.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TextIndexPrefixes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L249-L252 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L249-L252 type TextIndexPrefixes struct { MaxChars int `json:"max_chars"` MinChars int `json:"min_chars"` diff --git a/typedapi/types/textproperty.go b/typedapi/types/textproperty.go index 80be40d568..75052ad3df 100644 --- a/typedapi/types/textproperty.go +++ b/typedapi/types/textproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // TextProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L254-L270 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L254-L270 type TextProperty struct { Analyzer *string `json:"analyzer,omitempty"` Boost *Float64 `json:"boost,omitempty"` @@ -277,6 +277,12 @@ func (s *TextProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -670,6 +676,12 @@ func (s *TextProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/texttoanalyze.go b/typedapi/types/texttoanalyze.go index 64a8475db3..93f700699f 100644 --- a/typedapi/types/texttoanalyze.go +++ b/typedapi/types/texttoanalyze.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TextToAnalyze type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/analyze/types.ts#L66-L66 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/analyze/types.ts#L66-L66 type TextToAnalyze []string diff --git a/typedapi/types/threadcount.go b/typedapi/types/threadcount.go index 5e34ceedb2..c4d718d25d 100644 --- a/typedapi/types/threadcount.go +++ b/typedapi/types/threadcount.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ThreadCount type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L1004-L1029 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L1004-L1029 type ThreadCount struct { // Active Number of active threads in the thread pool. Active *int64 `json:"active,omitempty"` diff --git a/typedapi/types/threadpoolrecord.go b/typedapi/types/threadpoolrecord.go index 2a9d315e6d..ad61891e8f 100644 --- a/typedapi/types/threadpoolrecord.go +++ b/typedapi/types/threadpoolrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ThreadPoolRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/thread_pool/types.ts#L22-L124 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/thread_pool/types.ts#L22-L124 type ThreadPoolRecord struct { // Active The number of active threads in the current thread pool. Active *string `json:"active,omitempty"` diff --git a/typedapi/types/throttlestate.go b/typedapi/types/throttlestate.go index ea1edbacd5..2601eea186 100644 --- a/typedapi/types/throttlestate.go +++ b/typedapi/types/throttlestate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ThrottleState type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L126-L129 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L126-L129 type ThrottleState struct { Reason string `json:"reason"` Timestamp DateTime `json:"timestamp"` diff --git a/typedapi/types/timeofmonth.go b/typedapi/types/timeofmonth.go index 5f08b41c83..66c476498a 100644 --- a/typedapi/types/timeofmonth.go +++ b/typedapi/types/timeofmonth.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TimeOfMonth type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L115-L118 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L115-L118 type TimeOfMonth struct { At []string `json:"at"` On []int `json:"on"` diff --git a/typedapi/types/timeofweek.go b/typedapi/types/timeofweek.go index da1d1c25a3..38d1c89c5b 100644 --- a/typedapi/types/timeofweek.go +++ b/typedapi/types/timeofweek.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // TimeOfWeek type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L120-L123 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L120-L123 type TimeOfWeek struct { At []string `json:"at"` On []day.Day `json:"on"` diff --git a/typedapi/types/timeofyear.go b/typedapi/types/timeofyear.go index 6fb16beea2..d2f58ebf6a 100644 --- a/typedapi/types/timeofyear.go +++ b/typedapi/types/timeofyear.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // TimeOfYear type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Schedule.ts#L125-L129 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Schedule.ts#L125-L129 type TimeOfYear struct { At []string `json:"at"` Int []month.Month `json:"int"` diff --git a/typedapi/types/timesync.go b/typedapi/types/timesync.go index 1df5f39102..ceba65b796 100644 --- a/typedapi/types/timesync.go +++ b/typedapi/types/timesync.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TimeSync type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/_types/Transform.ts#L177-L189 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/_types/Transform.ts#L177-L189 type TimeSync struct { // Delay The time delay between the current time and the latest input data time. Delay Duration `json:"delay,omitempty"` diff --git a/typedapi/types/timingstats.go b/typedapi/types/timingstats.go index bd543c9d09..9cf11c2c62 100644 --- a/typedapi/types/timingstats.go +++ b/typedapi/types/timingstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TimingStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L563-L568 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L563-L568 type TimingStats struct { // ElapsedTime Runtime of the analysis in milliseconds. ElapsedTime int64 `json:"elapsed_time"` diff --git a/typedapi/types/tokencountproperty.go b/typedapi/types/tokencountproperty.go index e091c57a0b..55c57ee953 100644 --- a/typedapi/types/tokencountproperty.go +++ b/typedapi/types/tokencountproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // TokenCountProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/specialized.ts#L79-L86 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/specialized.ts#L79-L86 type TokenCountProperty struct { Analyzer *string `json:"analyzer,omitempty"` Boost *Float64 `json:"boost,omitempty"` @@ -262,6 +262,12 @@ func (s *TokenCountProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -617,6 +623,12 @@ func (s *TokenCountProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/tokendetail.go b/typedapi/types/tokendetail.go index cd25b18ea2..fa0c0dfb1f 100644 --- a/typedapi/types/tokendetail.go +++ b/typedapi/types/tokendetail.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TokenDetail type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/analyze/types.ts#L68-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/analyze/types.ts#L68-L71 type TokenDetail struct { Name string `json:"name"` Tokens []ExplainAnalyzeToken `json:"tokens"` diff --git a/typedapi/types/tokenfilter.go b/typedapi/types/tokenfilter.go index e3a2deb476..7e82fd27e3 100644 --- a/typedapi/types/tokenfilter.go +++ b/typedapi/types/tokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // TokenFilterDefinition // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L344-L346 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L344-L346 type TokenFilter interface{} diff --git a/typedapi/types/tokenfilterdefinition.go b/typedapi/types/tokenfilterdefinition.go index 2fad491950..424102b976 100644 --- a/typedapi/types/tokenfilterdefinition.go +++ b/typedapi/types/tokenfilterdefinition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -71,5 +71,5 @@ package types // PhoneticTokenFilter // DictionaryDecompounderTokenFilter // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L348-L401 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L348-L401 type TokenFilterDefinition interface{} diff --git a/typedapi/types/tokenizationconfigcontainer.go b/typedapi/types/tokenizationconfigcontainer.go index 6fae2b5af1..ca78f8d4cd 100644 --- a/typedapi/types/tokenizationconfigcontainer.go +++ b/typedapi/types/tokenizationconfigcontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TokenizationConfigContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L110-L129 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L110-L129 type TokenizationConfigContainer struct { // Bert Indicates BERT tokenization and its options Bert *NlpBertTokenizationConfig `json:"bert,omitempty"` diff --git a/typedapi/types/tokenizer.go b/typedapi/types/tokenizer.go index 9caee3c96a..f9d7179954 100644 --- a/typedapi/types/tokenizer.go +++ b/typedapi/types/tokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // string // TokenizerDefinition // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L120-L122 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L120-L122 type Tokenizer interface{} diff --git a/typedapi/types/tokenizerdefinition.go b/typedapi/types/tokenizerdefinition.go index 9ddad7320f..534a7e13ce 100644 --- a/typedapi/types/tokenizerdefinition.go +++ b/typedapi/types/tokenizerdefinition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -37,5 +37,5 @@ package types // PatternTokenizer // IcuTokenizer // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L124-L142 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L124-L142 type TokenizerDefinition interface{} diff --git a/typedapi/types/topclassentry.go b/typedapi/types/topclassentry.go index 4006b36fbb..e0aeb459c6 100644 --- a/typedapi/types/topclassentry.go +++ b/typedapi/types/topclassentry.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TopClassEntry type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L440-L444 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L440-L444 type TopClassEntry struct { ClassName string `json:"class_name"` ClassProbability Float64 `json:"class_probability"` diff --git a/typedapi/types/tophit.go b/typedapi/types/tophit.go index 0c2d786d66..78323dd0d8 100644 --- a/typedapi/types/tophit.go +++ b/typedapi/types/tophit.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TopHit type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/text_structure/find_structure/types.ts#L35-L38 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/text_structure/find_structure/types.ts#L35-L38 type TopHit struct { Count int64 `json:"count"` Value json.RawMessage `json:"value,omitempty"` diff --git a/typedapi/types/tophitsaggregate.go b/typedapi/types/tophitsaggregate.go index 2e7a94602d..7127a37da6 100644 --- a/typedapi/types/tophitsaggregate.go +++ b/typedapi/types/tophitsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TopHitsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L654-L657 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L654-L657 type TopHitsAggregate struct { Hits HitsMetadata `json:"hits"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/tophitsaggregation.go b/typedapi/types/tophitsaggregation.go index af0b079477..ac9aa0063a 100644 --- a/typedapi/types/tophitsaggregation.go +++ b/typedapi/types/tophitsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TopHitsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L337-L392 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L337-L392 type TopHitsAggregation struct { // DocvalueFields Fields for which to return doc values. DocvalueFields []string `json:"docvalue_fields,omitempty"` diff --git a/typedapi/types/topleftbottomrightgeobounds.go b/typedapi/types/topleftbottomrightgeobounds.go index 01dbd8b350..066d305cfc 100644 --- a/typedapi/types/topleftbottomrightgeobounds.go +++ b/typedapi/types/topleftbottomrightgeobounds.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TopLeftBottomRightGeoBounds type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L170-L173 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L170-L173 type TopLeftBottomRightGeoBounds struct { BottomRight GeoLocation `json:"bottom_right"` TopLeft GeoLocation `json:"top_left"` diff --git a/typedapi/types/topmetrics.go b/typedapi/types/topmetrics.go index 58734c054f..d3486878ac 100644 --- a/typedapi/types/topmetrics.go +++ b/typedapi/types/topmetrics.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TopMetrics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L729-L733 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L729-L733 type TopMetrics struct { Metrics map[string]FieldValue `json:"metrics"` Sort []FieldValue `json:"sort"` diff --git a/typedapi/types/topmetricsaggregate.go b/typedapi/types/topmetricsaggregate.go index 4f3ca2584c..934b4828f2 100644 --- a/typedapi/types/topmetricsaggregate.go +++ b/typedapi/types/topmetricsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TopMetricsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L724-L727 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L724-L727 type TopMetricsAggregate struct { Meta Metadata `json:"meta,omitempty"` Top []TopMetrics `json:"top"` diff --git a/typedapi/types/topmetricsaggregation.go b/typedapi/types/topmetricsaggregation.go index af4f7443eb..5e1f10a39b 100644 --- a/typedapi/types/topmetricsaggregation.go +++ b/typedapi/types/topmetricsaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TopMetricsAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L394-L408 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L394-L408 type TopMetricsAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/topmetricsvalue.go b/typedapi/types/topmetricsvalue.go index 26a6c2efc5..a978e8f65a 100644 --- a/typedapi/types/topmetricsvalue.go +++ b/typedapi/types/topmetricsvalue.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TopMetricsValue type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L410-L415 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L410-L415 type TopMetricsValue struct { // Field A field to return as a metric. Field string `json:"field"` diff --git a/typedapi/types/toprightbottomleftgeobounds.go b/typedapi/types/toprightbottomleftgeobounds.go index fd12be6eb2..de64e716db 100644 --- a/typedapi/types/toprightbottomleftgeobounds.go +++ b/typedapi/types/toprightbottomleftgeobounds.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TopRightBottomLeftGeoBounds type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L175-L178 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L175-L178 type TopRightBottomLeftGeoBounds struct { BottomLeft GeoLocation `json:"bottom_left"` TopRight GeoLocation `json:"top_right"` diff --git a/typedapi/types/totalfeatureimportance.go b/typedapi/types/totalfeatureimportance.go index b0b2657bb2..819218cad8 100644 --- a/typedapi/types/totalfeatureimportance.go +++ b/typedapi/types/totalfeatureimportance.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TotalFeatureImportance type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L232-L239 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L232-L239 type TotalFeatureImportance struct { // Classes If the trained model is a classification model, feature importance statistics // are gathered per target class value. diff --git a/typedapi/types/totalfeatureimportanceclass.go b/typedapi/types/totalfeatureimportanceclass.go index 608f9c9a0b..be28150451 100644 --- a/typedapi/types/totalfeatureimportanceclass.go +++ b/typedapi/types/totalfeatureimportanceclass.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TotalFeatureImportanceClass type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L241-L246 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L241-L246 type TotalFeatureImportanceClass struct { // ClassName The target class value. Could be a string, boolean, or number. ClassName string `json:"class_name"` diff --git a/typedapi/types/totalfeatureimportancestatistics.go b/typedapi/types/totalfeatureimportancestatistics.go index e6598dc09f..5e377f4f77 100644 --- a/typedapi/types/totalfeatureimportancestatistics.go +++ b/typedapi/types/totalfeatureimportancestatistics.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TotalFeatureImportanceStatistics type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L248-L255 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L248-L255 type TotalFeatureImportanceStatistics struct { // Max The maximum importance value across all the training data for this feature. Max int `json:"max"` diff --git a/typedapi/types/totaluserprofiles.go b/typedapi/types/totaluserprofiles.go index d90d767563..90fc9e8424 100644 --- a/typedapi/types/totaluserprofiles.go +++ b/typedapi/types/totaluserprofiles.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TotalUserProfiles type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/suggest_user_profiles/Response.ts#L24-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/suggest_user_profiles/Response.ts#L24-L27 type TotalUserProfiles struct { Relation string `json:"relation"` Value int64 `json:"value"` diff --git a/typedapi/types/trackhits.go b/typedapi/types/trackhits.go index e093aff7cd..fcc72e6dc1 100644 --- a/typedapi/types/trackhits.go +++ b/typedapi/types/trackhits.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // bool // int // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/search/_types/hits.ts#L142-L150 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/search/_types/hits.ts#L142-L150 type TrackHits interface{} diff --git a/typedapi/types/trainedmodel.go b/typedapi/types/trainedmodel.go index a5673c61aa..153d5038c8 100644 --- a/typedapi/types/trainedmodel.go +++ b/typedapi/types/trainedmodel.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TrainedModel type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L60-L72 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L60-L72 type TrainedModel struct { // Ensemble The definition for an ensemble model Ensemble *Ensemble `json:"ensemble,omitempty"` diff --git a/typedapi/types/trainedmodelassignment.go b/typedapi/types/trainedmodelassignment.go index 4292a445f7..6de46ef4f6 100644 --- a/typedapi/types/trainedmodelassignment.go +++ b/typedapi/types/trainedmodelassignment.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // TrainedModelAssignment type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L402-L417 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L402-L417 type TrainedModelAssignment struct { // AssignmentState The overall assignment state. AssignmentState deploymentassignmentstate.DeploymentAssignmentState `json:"assignment_state"` diff --git a/typedapi/types/trainedmodelassignmentroutingtable.go b/typedapi/types/trainedmodelassignmentroutingtable.go index 5c2c8b77b8..fcdbd6c6ea 100644 --- a/typedapi/types/trainedmodelassignmentroutingtable.go +++ b/typedapi/types/trainedmodelassignmentroutingtable.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // TrainedModelAssignmentRoutingTable type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L373-L391 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L373-L391 type TrainedModelAssignmentRoutingTable struct { // CurrentAllocations Current number of allocations. CurrentAllocations int `json:"current_allocations"` diff --git a/typedapi/types/trainedmodelassignmenttaskparameters.go b/typedapi/types/trainedmodelassignmenttaskparameters.go index db7e1dd51e..5b60f1d70a 100644 --- a/typedapi/types/trainedmodelassignmenttaskparameters.go +++ b/typedapi/types/trainedmodelassignmenttaskparameters.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // TrainedModelAssignmentTaskParameters type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L315-L348 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L315-L348 type TrainedModelAssignmentTaskParameters struct { // CacheSize The size of the trained model cache. CacheSize ByteSize `json:"cache_size"` diff --git a/typedapi/types/trainedmodelconfig.go b/typedapi/types/trainedmodelconfig.go index 9650b24e22..f5cb462d60 100644 --- a/typedapi/types/trainedmodelconfig.go +++ b/typedapi/types/trainedmodelconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // TrainedModelConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L165-L199 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L165-L199 type TrainedModelConfig struct { CompressedDefinition *string `json:"compressed_definition,omitempty"` // CreateTime The time when the trained model was created. diff --git a/typedapi/types/trainedmodelconfiginput.go b/typedapi/types/trainedmodelconfiginput.go index cce658258c..ed920a7ca0 100644 --- a/typedapi/types/trainedmodelconfiginput.go +++ b/typedapi/types/trainedmodelconfiginput.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TrainedModelConfigInput type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L201-L204 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L201-L204 type TrainedModelConfigInput struct { // FieldNames An array of input field names for the model. FieldNames []string `json:"field_names"` diff --git a/typedapi/types/trainedmodelconfigmetadata.go b/typedapi/types/trainedmodelconfigmetadata.go index beb67e0fab..72cc91a751 100644 --- a/typedapi/types/trainedmodelconfigmetadata.go +++ b/typedapi/types/trainedmodelconfigmetadata.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TrainedModelConfigMetadata type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L206-L214 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L206-L214 type TrainedModelConfigMetadata struct { // FeatureImportanceBaseline An object that contains the baseline for feature importance values. For // regression analysis, it is a single value. For classification analysis, there diff --git a/typedapi/types/trainedmodeldeploymentallocationstatus.go b/typedapi/types/trainedmodeldeploymentallocationstatus.go index c12f6f21d7..fe05259143 100644 --- a/typedapi/types/trainedmodeldeploymentallocationstatus.go +++ b/typedapi/types/trainedmodeldeploymentallocationstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // TrainedModelDeploymentAllocationStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L393-L400 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L393-L400 type TrainedModelDeploymentAllocationStatus struct { // AllocationCount The current number of nodes where the model is allocated. AllocationCount int `json:"allocation_count"` diff --git a/typedapi/types/trainedmodeldeploymentnodesstats.go b/typedapi/types/trainedmodeldeploymentnodesstats.go index a73cc17464..fd73505427 100644 --- a/typedapi/types/trainedmodeldeploymentnodesstats.go +++ b/typedapi/types/trainedmodeldeploymentnodesstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrainedModelDeploymentNodesStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L133-L163 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L133-L163 type TrainedModelDeploymentNodesStats struct { // AverageInferenceTimeMs The average time for each inference call to complete on this node. AverageInferenceTimeMs Float64 `json:"average_inference_time_ms"` diff --git a/typedapi/types/trainedmodeldeploymentstats.go b/typedapi/types/trainedmodeldeploymentstats.go index f33fe8db2d..8d6c67f566 100644 --- a/typedapi/types/trainedmodeldeploymentstats.go +++ b/typedapi/types/trainedmodeldeploymentstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // TrainedModelDeploymentStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L62-L102 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L62-L102 type TrainedModelDeploymentStats struct { // AllocationStatus The detailed allocation status for the deployment. AllocationStatus TrainedModelDeploymentAllocationStatus `json:"allocation_status"` diff --git a/typedapi/types/trainedmodelentities.go b/typedapi/types/trainedmodelentities.go index a0532b0357..9233858880 100644 --- a/typedapi/types/trainedmodelentities.go +++ b/typedapi/types/trainedmodelentities.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrainedModelEntities type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L433-L439 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L433-L439 type TrainedModelEntities struct { ClassName string `json:"class_name"` ClassProbability Float64 `json:"class_probability"` diff --git a/typedapi/types/trainedmodelinferenceclassimportance.go b/typedapi/types/trainedmodelinferenceclassimportance.go index b09431e44d..8f11d058fe 100644 --- a/typedapi/types/trainedmodelinferenceclassimportance.go +++ b/typedapi/types/trainedmodelinferenceclassimportance.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrainedModelInferenceClassImportance type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L446-L449 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L446-L449 type TrainedModelInferenceClassImportance struct { ClassName string `json:"class_name"` Importance Float64 `json:"importance"` diff --git a/typedapi/types/trainedmodelinferencefeatureimportance.go b/typedapi/types/trainedmodelinferencefeatureimportance.go index 2319959e1d..cc9fbc1dae 100644 --- a/typedapi/types/trainedmodelinferencefeatureimportance.go +++ b/typedapi/types/trainedmodelinferencefeatureimportance.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrainedModelInferenceFeatureImportance type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L451-L455 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L451-L455 type TrainedModelInferenceFeatureImportance struct { Classes []TrainedModelInferenceClassImportance `json:"classes,omitempty"` FeatureName string `json:"feature_name"` diff --git a/typedapi/types/trainedmodelinferencestats.go b/typedapi/types/trainedmodelinferencestats.go index 856800f91a..951373cdde 100644 --- a/typedapi/types/trainedmodelinferencestats.go +++ b/typedapi/types/trainedmodelinferencestats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrainedModelInferenceStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L104-L124 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L104-L124 type TrainedModelInferenceStats struct { // CacheMissCount The number of times the model was loaded for inference and was not retrieved // from the cache. diff --git a/typedapi/types/trainedmodellocation.go b/typedapi/types/trainedmodellocation.go index 3f3a305942..ab4d4b0620 100644 --- a/typedapi/types/trainedmodellocation.go +++ b/typedapi/types/trainedmodellocation.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TrainedModelLocation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L419-L421 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L419-L421 type TrainedModelLocation struct { Index TrainedModelLocationIndex `json:"index"` } diff --git a/typedapi/types/trainedmodellocationindex.go b/typedapi/types/trainedmodellocationindex.go index 65672a956b..18e1b2f255 100644 --- a/typedapi/types/trainedmodellocationindex.go +++ b/typedapi/types/trainedmodellocationindex.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TrainedModelLocationIndex type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L423-L425 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L423-L425 type TrainedModelLocationIndex struct { Name string `json:"name"` } diff --git a/typedapi/types/trainedmodelsizestats.go b/typedapi/types/trainedmodelsizestats.go index 4120128478..e80e5829b8 100644 --- a/typedapi/types/trainedmodelsizestats.go +++ b/typedapi/types/trainedmodelsizestats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrainedModelSizeStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L126-L131 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L126-L131 type TrainedModelSizeStats struct { // ModelSizeBytes The size of the model in bytes. ModelSizeBytes ByteSize `json:"model_size_bytes"` diff --git a/typedapi/types/trainedmodelsrecord.go b/typedapi/types/trainedmodelsrecord.go index 00d5764d9d..1c54d45981 100644 --- a/typedapi/types/trainedmodelsrecord.go +++ b/typedapi/types/trainedmodelsrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrainedModelsRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/ml_trained_models/types.ts#L23-L115 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/ml_trained_models/types.ts#L23-L115 type TrainedModelsRecord struct { // CreateTime The time the model was created. CreateTime DateTime `json:"create_time,omitempty"` diff --git a/typedapi/types/trainedmodelstats.go b/typedapi/types/trainedmodelstats.go index dfc2ec8435..918d702989 100644 --- a/typedapi/types/trainedmodelstats.go +++ b/typedapi/types/trainedmodelstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrainedModelStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/TrainedModel.ts#L42-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/TrainedModel.ts#L42-L60 type TrainedModelStats struct { // DeploymentStats A collection of deployment stats, which is present when the models are // deployed. diff --git a/typedapi/types/trainedmodeltree.go b/typedapi/types/trainedmodeltree.go index ff25746a24..741ef71a7f 100644 --- a/typedapi/types/trainedmodeltree.go +++ b/typedapi/types/trainedmodeltree.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrainedModelTree type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L74-L79 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L74-L79 type TrainedModelTree struct { ClassificationLabels []string `json:"classification_labels,omitempty"` FeatureNames []string `json:"feature_names"` diff --git a/typedapi/types/trainedmodeltreenode.go b/typedapi/types/trainedmodeltreenode.go index c3e801f19f..b3a3012a09 100644 --- a/typedapi/types/trainedmodeltreenode.go +++ b/typedapi/types/trainedmodeltreenode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrainedModelTreeNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L81-L91 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L81-L91 type TrainedModelTreeNode struct { DecisionType *string `json:"decision_type,omitempty"` DefaultLeft *bool `json:"default_left,omitempty"` diff --git a/typedapi/types/transformauthorization.go b/typedapi/types/transformauthorization.go index d842ac649b..f2100c7c92 100644 --- a/typedapi/types/transformauthorization.go +++ b/typedapi/types/transformauthorization.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TransformAuthorization type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/Authorization.ts#L59-L71 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/Authorization.ts#L59-L71 type TransformAuthorization struct { // ApiKey If an API key was used for the most recent update to the transform, its name // and identifier are listed in the response. diff --git a/typedapi/types/transformcontainer.go b/typedapi/types/transformcontainer.go index 71ff0c9fc7..12ea246634 100644 --- a/typedapi/types/transformcontainer.go +++ b/typedapi/types/transformcontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TransformContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Transform.ts#L27-L34 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Transform.ts#L27-L34 type TransformContainer struct { Chain []TransformContainer `json:"chain,omitempty"` Script *ScriptTransform `json:"script,omitempty"` diff --git a/typedapi/types/transformdestination.go b/typedapi/types/transformdestination.go index 7bf3fc4b2f..6e14277bd0 100644 --- a/typedapi/types/transformdestination.go +++ b/typedapi/types/transformdestination.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TransformDestination type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/_types/Transform.ts#L34-L45 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/_types/Transform.ts#L34-L45 type TransformDestination struct { // Index The destination index for the transform. The mappings of the destination // index are deduced based on the source diff --git a/typedapi/types/transformindexerstats.go b/typedapi/types/transformindexerstats.go index fed509925a..79ba90471b 100644 --- a/typedapi/types/transformindexerstats.go +++ b/typedapi/types/transformindexerstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TransformIndexerStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/get_transform_stats/types.ts#L56-L74 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/get_transform_stats/types.ts#L56-L74 type TransformIndexerStats struct { DeleteTimeInMs *int64 `json:"delete_time_in_ms,omitempty"` DocumentsDeleted *int64 `json:"documents_deleted,omitempty"` diff --git a/typedapi/types/transformprogress.go b/typedapi/types/transformprogress.go index afd4ce811a..7a5584c803 100644 --- a/typedapi/types/transformprogress.go +++ b/typedapi/types/transformprogress.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TransformProgress type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/get_transform_stats/types.ts#L48-L54 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/get_transform_stats/types.ts#L48-L54 type TransformProgress struct { DocsIndexed int64 `json:"docs_indexed"` DocsProcessed int64 `json:"docs_processed"` diff --git a/typedapi/types/transformsource.go b/typedapi/types/transformsource.go index 14e424a2af..5dcf414079 100644 --- a/typedapi/types/transformsource.go +++ b/typedapi/types/transformsource.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TransformSource type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/_types/Transform.ts#L146-L165 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/_types/Transform.ts#L146-L165 type TransformSource struct { // Index The source indices for the transform. It can be a single index, an index // pattern (for example, `"my-index-*""`), an diff --git a/typedapi/types/transformsrecord.go b/typedapi/types/transformsrecord.go index cc52eaca4a..f59f2ea974 100644 --- a/typedapi/types/transformsrecord.go +++ b/typedapi/types/transformsrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TransformsRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cat/transforms/types.ts#L22-L197 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cat/transforms/types.ts#L22-L197 type TransformsRecord struct { // ChangesLastDetectionTime The timestamp when changes were last detected in the source indices. ChangesLastDetectionTime string `json:"changes_last_detection_time,omitempty"` diff --git a/typedapi/types/transformstats.go b/typedapi/types/transformstats.go index 05388396dc..b72eea16cb 100644 --- a/typedapi/types/transformstats.go +++ b/typedapi/types/transformstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TransformStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/get_transform_stats/types.ts#L31-L42 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/get_transform_stats/types.ts#L31-L42 type TransformStats struct { Checkpointing Checkpointing `json:"checkpointing"` Health *TransformStatsHealth `json:"health,omitempty"` diff --git a/typedapi/types/transformstatshealth.go b/typedapi/types/transformstatshealth.go index 52aae2d14a..b21dd2e0dc 100644 --- a/typedapi/types/transformstatshealth.go +++ b/typedapi/types/transformstatshealth.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // TransformStatsHealth type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/get_transform_stats/types.ts#L44-L46 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/get_transform_stats/types.ts#L44-L46 type TransformStatsHealth struct { Status healthstatus.HealthStatus `json:"status"` } diff --git a/typedapi/types/transformsummary.go b/typedapi/types/transformsummary.go index bc0991bf4a..07cf0e181e 100644 --- a/typedapi/types/transformsummary.go +++ b/typedapi/types/transformsummary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TransformSummary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/transform/get_transform/types.ts#L33-L61 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/transform/get_transform/types.ts#L33-L61 type TransformSummary struct { // Authorization The security privileges that the transform uses to run its queries. If // Elastic Stack security features were disabled at the time of the most recent diff --git a/typedapi/types/transientmetadataconfig.go b/typedapi/types/transientmetadataconfig.go index 872355b1bc..c80f1242b7 100644 --- a/typedapi/types/transientmetadataconfig.go +++ b/typedapi/types/transientmetadataconfig.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TransientMetadataConfig type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/TransientMetadataConfig.ts#L20-L22 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/TransientMetadataConfig.ts#L20-L22 type TransientMetadataConfig struct { Enabled bool `json:"enabled"` } diff --git a/typedapi/types/translog.go b/typedapi/types/translog.go index bc227a7a74..523f4f4d77 100644 --- a/typedapi/types/translog.go +++ b/typedapi/types/translog.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // Translog type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L332-L354 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L332-L354 type Translog struct { // Durability Whether or not to `fsync` and commit the translog after every index, delete, // update, or bulk request. diff --git a/typedapi/types/translogretention.go b/typedapi/types/translogretention.go index e9edda07c5..8a2788392e 100644 --- a/typedapi/types/translogretention.go +++ b/typedapi/types/translogretention.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TranslogRetention type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/_types/IndexSettings.ts#L373-L392 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/_types/IndexSettings.ts#L373-L392 type TranslogRetention struct { // Age This controls the maximum duration for which translog files are kept by each // shard. Keeping more diff --git a/typedapi/types/translogstats.go b/typedapi/types/translogstats.go index 7e7839a8e3..03e72c47be 100644 --- a/typedapi/types/translogstats.go +++ b/typedapi/types/translogstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TranslogStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L397-L405 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L397-L405 type TranslogStats struct { EarliestLastModifiedAge int64 `json:"earliest_last_modified_age"` Operations int64 `json:"operations"` diff --git a/typedapi/types/translogstatus.go b/typedapi/types/translogstatus.go index 4b0205572c..aaa13c946c 100644 --- a/typedapi/types/translogstatus.go +++ b/typedapi/types/translogstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TranslogStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/types.ts#L102-L109 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/types.ts#L102-L109 type TranslogStatus struct { Percent Percentage `json:"percent"` Recovered int64 `json:"recovered"` diff --git a/typedapi/types/transport.go b/typedapi/types/transport.go index 9083aebd93..e00b4c862b 100644 --- a/typedapi/types/transport.go +++ b/typedapi/types/transport.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Transport type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L1047-L1090 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L1047-L1090 type Transport struct { // InboundHandlingTimeHistogram The distribution of the time spent handling each inbound message on a // transport thread, represented as a histogram. diff --git a/typedapi/types/transporthistogram.go b/typedapi/types/transporthistogram.go index f836f6bad2..49c4e4c520 100644 --- a/typedapi/types/transporthistogram.go +++ b/typedapi/types/transporthistogram.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TransportHistogram type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/nodes/_types/Stats.ts#L1092-L1106 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/nodes/_types/Stats.ts#L1092-L1106 type TransportHistogram struct { // Count The number of times a transport thread took a period of time within the // bounds of this bucket to handle an inbound message. diff --git a/typedapi/types/triggercontainer.go b/typedapi/types/triggercontainer.go index f4d2bde880..23b3c209d4 100644 --- a/typedapi/types/triggercontainer.go +++ b/typedapi/types/triggercontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TriggerContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Trigger.ts#L23-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Trigger.ts#L23-L28 type TriggerContainer struct { Schedule *ScheduleContainer `json:"schedule,omitempty"` } diff --git a/typedapi/types/triggereventcontainer.go b/typedapi/types/triggereventcontainer.go index 313d8cccad..857c4b7b4c 100644 --- a/typedapi/types/triggereventcontainer.go +++ b/typedapi/types/triggereventcontainer.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TriggerEventContainer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Trigger.ts#L32-L37 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Trigger.ts#L32-L37 type TriggerEventContainer struct { Schedule *ScheduleTriggerEvent `json:"schedule,omitempty"` } diff --git a/typedapi/types/triggereventresult.go b/typedapi/types/triggereventresult.go index 64aa7aa152..0ef6cea0bf 100644 --- a/typedapi/types/triggereventresult.go +++ b/typedapi/types/triggereventresult.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TriggerEventResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Trigger.ts#L39-L43 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Trigger.ts#L39-L43 type TriggerEventResult struct { Manual TriggerEventContainer `json:"manual"` TriggeredTime DateTime `json:"triggered_time"` diff --git a/typedapi/types/trimprocessor.go b/typedapi/types/trimprocessor.go index fd3bb020f1..27237675df 100644 --- a/typedapi/types/trimprocessor.go +++ b/typedapi/types/trimprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TrimProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L1079-L1095 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L1079-L1095 type TrimProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/trimtokenfilter.go b/typedapi/types/trimtokenfilter.go index 280a07c6a4..a2cab01734 100644 --- a/typedapi/types/trimtokenfilter.go +++ b/typedapi/types/trimtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // TrimTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L326-L328 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L326-L328 type TrimTokenFilter struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/truncatetokenfilter.go b/typedapi/types/truncatetokenfilter.go index d08e0f8052..d72cf999ad 100644 --- a/typedapi/types/truncatetokenfilter.go +++ b/typedapi/types/truncatetokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TruncateTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L330-L333 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L330-L333 type TruncateTokenFilter struct { Length *int `json:"length,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/ttestaggregate.go b/typedapi/types/ttestaggregate.go index 8db9bca7c9..e431d52eb1 100644 --- a/typedapi/types/ttestaggregate.go +++ b/typedapi/types/ttestaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TTestAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L735-L739 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L735-L739 type TTestAggregate struct { Meta Metadata `json:"meta,omitempty"` Value Float64 `json:"value,omitempty"` diff --git a/typedapi/types/ttestaggregation.go b/typedapi/types/ttestaggregation.go index 1deed975ee..9f85d01e70 100644 --- a/typedapi/types/ttestaggregation.go +++ b/typedapi/types/ttestaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // TTestAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L294-L308 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L294-L308 type TTestAggregation struct { // A Test population A. A *TestPopulation `json:"a,omitempty"` diff --git a/typedapi/types/typefieldmappings.go b/typedapi/types/typefieldmappings.go index 2274d927fd..433b64a55c 100644 --- a/typedapi/types/typefieldmappings.go +++ b/typedapi/types/typefieldmappings.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // TypeFieldMappings type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/get_field_mapping/types.ts#L24-L26 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/get_field_mapping/types.ts#L24-L26 type TypeFieldMappings struct { Mappings map[string]FieldMapping `json:"mappings"` } diff --git a/typedapi/types/typemapping.go b/typedapi/types/typemapping.go index 79736458e9..62355355e3 100644 --- a/typedapi/types/typemapping.go +++ b/typedapi/types/typemapping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // TypeMapping type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/TypeMapping.ts#L34-L56 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/TypeMapping.ts#L34-L56 type TypeMapping struct { AllField *AllField `json:"all_field,omitempty"` DataStreamTimestamp_ *DataStreamTimestamp `json:"_data_stream_timestamp,omitempty"` @@ -267,6 +267,12 @@ func (s *TypeMapping) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/typequery.go b/typedapi/types/typequery.go index b0763d02e2..c7bfbfcbac 100644 --- a/typedapi/types/typequery.go +++ b/typedapi/types/typequery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // TypeQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L264-L266 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L264-L266 type TypeQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/uaxemailurltokenizer.go b/typedapi/types/uaxemailurltokenizer.go index 279d96771b..a970b6e6ed 100644 --- a/typedapi/types/uaxemailurltokenizer.go +++ b/typedapi/types/uaxemailurltokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UaxEmailUrlTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L110-L113 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L110-L113 type UaxEmailUrlTokenizer struct { MaxTokenLength *int `json:"max_token_length,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/unassignedinformation.go b/typedapi/types/unassignedinformation.go index b5c48e68b3..bf51fe3d0f 100644 --- a/typedapi/types/unassignedinformation.go +++ b/typedapi/types/unassignedinformation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // UnassignedInformation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/cluster/allocation_explain/types.ts#L117-L125 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/cluster/allocation_explain/types.ts#L117-L125 type UnassignedInformation struct { AllocationStatus *string `json:"allocation_status,omitempty"` At DateTime `json:"at"` diff --git a/typedapi/types/uniquetokenfilter.go b/typedapi/types/uniquetokenfilter.go index c321c20655..ce1fb040ec 100644 --- a/typedapi/types/uniquetokenfilter.go +++ b/typedapi/types/uniquetokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UniqueTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L335-L338 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L335-L338 type UniqueTokenFilter struct { OnlyOnSamePosition *bool `json:"only_on_same_position,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/unmappedraretermsaggregate.go b/typedapi/types/unmappedraretermsaggregate.go index 98b6a52862..de32a159b8 100644 --- a/typedapi/types/unmappedraretermsaggregate.go +++ b/typedapi/types/unmappedraretermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // UnmappedRareTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L453-L459 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L453-L459 type UnmappedRareTermsAggregate struct { Buckets BucketsVoid `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/unmappedsampleraggregate.go b/typedapi/types/unmappedsampleraggregate.go index 796e69713b..1faf93c755 100644 --- a/typedapi/types/unmappedsampleraggregate.go +++ b/typedapi/types/unmappedsampleraggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // UnmappedSamplerAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L501-L502 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L501-L502 type UnmappedSamplerAggregate struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/unmappedsignificanttermsaggregate.go b/typedapi/types/unmappedsignificanttermsaggregate.go index 5682a0f999..3db500424f 100644 --- a/typedapi/types/unmappedsignificanttermsaggregate.go +++ b/typedapi/types/unmappedsignificanttermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UnmappedSignificantTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L610-L616 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L610-L616 type UnmappedSignificantTermsAggregate struct { BgCount *int64 `json:"bg_count,omitempty"` Buckets BucketsVoid `json:"buckets"` diff --git a/typedapi/types/unmappedtermsaggregate.go b/typedapi/types/unmappedtermsaggregate.go index 600a4ac036..a2760ededb 100644 --- a/typedapi/types/unmappedtermsaggregate.go +++ b/typedapi/types/unmappedtermsaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UnmappedTermsAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L423-L429 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L423-L429 type UnmappedTermsAggregate struct { Buckets BucketsVoid `json:"buckets"` DocCountErrorUpperBound *int64 `json:"doc_count_error_upper_bound,omitempty"` diff --git a/typedapi/types/unrateddocument.go b/typedapi/types/unrateddocument.go index 64252164bc..8eaf433c1c 100644 --- a/typedapi/types/unrateddocument.go +++ b/typedapi/types/unrateddocument.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // UnratedDocument type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/rank_eval/types.ts#L147-L150 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/rank_eval/types.ts#L147-L150 type UnratedDocument struct { Id_ string `json:"_id"` Index_ string `json:"_index"` diff --git a/typedapi/types/unsignedlongnumberproperty.go b/typedapi/types/unsignedlongnumberproperty.go index 47307bd049..a1429e1ac6 100644 --- a/typedapi/types/unsignedlongnumberproperty.go +++ b/typedapi/types/unsignedlongnumberproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -34,7 +34,7 @@ import ( // UnsignedLongNumberProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L169-L172 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L169-L172 type UnsignedLongNumberProperty struct { Boost *Float64 `json:"boost,omitempty"` Coerce *bool `json:"coerce,omitempty"` @@ -260,6 +260,12 @@ func (s *UnsignedLongNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -623,6 +629,12 @@ func (s *UnsignedLongNumberProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/updateaction.go b/typedapi/types/updateaction.go index 3990d84de7..4459f39eb5 100644 --- a/typedapi/types/updateaction.go +++ b/typedapi/types/updateaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UpdateAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/types.ts#L169-L205 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/types.ts#L169-L205 type UpdateAction struct { // DetectNoop Set to false to disable setting 'result' in the response // to 'noop' if no change to the document occurred. diff --git a/typedapi/types/updatebyqueryrethrottlenode.go b/typedapi/types/updatebyqueryrethrottlenode.go index fce7961e1a..a0ef3be465 100644 --- a/typedapi/types/updatebyqueryrethrottlenode.go +++ b/typedapi/types/updatebyqueryrethrottlenode.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // UpdateByQueryRethrottleNode type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/update_by_query_rethrottle/UpdateByQueryRethrottleNode.ts#L25-L27 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/update_by_query_rethrottle/UpdateByQueryRethrottleNode.ts#L25-L27 type UpdateByQueryRethrottleNode struct { Attributes map[string]string `json:"attributes"` Host string `json:"host"` diff --git a/typedapi/types/updateoperation.go b/typedapi/types/updateoperation.go index dc15990e54..46afe7a466 100644 --- a/typedapi/types/updateoperation.go +++ b/typedapi/types/updateoperation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // UpdateOperation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/types.ts#L136-L143 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/types.ts#L136-L143 type UpdateOperation struct { // Id_ The document ID. Id_ *string `json:"_id,omitempty"` diff --git a/typedapi/types/uppercaseprocessor.go b/typedapi/types/uppercaseprocessor.go index cf10c8d69f..940a9822ba 100644 --- a/typedapi/types/uppercaseprocessor.go +++ b/typedapi/types/uppercaseprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UppercaseProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L1097-L1113 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L1097-L1113 type UppercaseProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/uppercasetokenfilter.go b/typedapi/types/uppercasetokenfilter.go index 65e0a98ebf..715e72089c 100644 --- a/typedapi/types/uppercasetokenfilter.go +++ b/typedapi/types/uppercasetokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // UppercaseTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L340-L342 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L340-L342 type UppercaseTokenFilter struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/urldecodeprocessor.go b/typedapi/types/urldecodeprocessor.go index 44ec6e66d7..82eae96c74 100644 --- a/typedapi/types/urldecodeprocessor.go +++ b/typedapi/types/urldecodeprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UrlDecodeProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L1115-L1131 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L1115-L1131 type UrlDecodeProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/usagestatsindex.go b/typedapi/types/usagestatsindex.go index 8d2b6b163d..055dfb270e 100644 --- a/typedapi/types/usagestatsindex.go +++ b/typedapi/types/usagestatsindex.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // UsageStatsIndex type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L38-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L38-L40 type UsageStatsIndex struct { Shards []UsageStatsShards `json:"shards"` } diff --git a/typedapi/types/usagestatsshards.go b/typedapi/types/usagestatsshards.go index dbd7c6c351..1f51ba6d55 100644 --- a/typedapi/types/usagestatsshards.go +++ b/typedapi/types/usagestatsshards.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UsageStatsShards type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L42-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L42-L47 type UsageStatsShards struct { Routing ShardRouting `json:"routing"` Stats IndicesShardsStats `json:"stats"` diff --git a/typedapi/types/user.go b/typedapi/types/user.go index 84cea46d4f..1f9e20613e 100644 --- a/typedapi/types/user.go +++ b/typedapi/types/user.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // User type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/User.ts#L23-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/User.ts#L23-L31 type User struct { Email string `json:"email,omitempty"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/useragentprocessor.go b/typedapi/types/useragentprocessor.go index de8ad3ea8d..0d6e422653 100644 --- a/typedapi/types/useragentprocessor.go +++ b/typedapi/types/useragentprocessor.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // UserAgentProcessor type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ingest/_types/Processors.ts#L359-L379 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ingest/_types/Processors.ts#L359-L379 type UserAgentProcessor struct { // Description Description of the processor. // Useful for describing the purpose of the processor or its configuration. diff --git a/typedapi/types/userindicesprivileges.go b/typedapi/types/userindicesprivileges.go index ff5c3ef4e2..2f12f86877 100644 --- a/typedapi/types/userindicesprivileges.go +++ b/typedapi/types/userindicesprivileges.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // UserIndicesPrivileges type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/Privileges.ts#L107-L129 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/Privileges.ts#L107-L129 type UserIndicesPrivileges struct { // AllowRestrictedIndices Set to `true` if using wildcard or regular expressions for patterns that // cover restricted indices. Implicitly, restricted indices have limited diff --git a/typedapi/types/userprofile.go b/typedapi/types/userprofile.go index 963454ed02..26b40f6509 100644 --- a/typedapi/types/userprofile.go +++ b/typedapi/types/userprofile.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UserProfile type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/UserProfile.ts#L42-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/UserProfile.ts#L42-L48 type UserProfile struct { Data map[string]json.RawMessage `json:"data"` Enabled *bool `json:"enabled,omitempty"` diff --git a/typedapi/types/userprofilehitmetadata.go b/typedapi/types/userprofilehitmetadata.go index 44fc4af280..61b65f44ce 100644 --- a/typedapi/types/userprofilehitmetadata.go +++ b/typedapi/types/userprofilehitmetadata.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UserProfileHitMetadata type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/UserProfile.ts#L28-L31 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/UserProfile.ts#L28-L31 type UserProfileHitMetadata struct { PrimaryTerm_ int64 `json:"_primary_term"` SeqNo_ int64 `json:"_seq_no"` diff --git a/typedapi/types/userprofileuser.go b/typedapi/types/userprofileuser.go index b47cace9d7..b3413af98a 100644 --- a/typedapi/types/userprofileuser.go +++ b/typedapi/types/userprofileuser.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UserProfileUser type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/UserProfile.ts#L33-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/UserProfile.ts#L33-L40 type UserProfileUser struct { Email string `json:"email,omitempty"` FullName string `json:"full_name,omitempty"` diff --git a/typedapi/types/userprofilewithmetadata.go b/typedapi/types/userprofilewithmetadata.go index 1771469f8b..e0b59b29c9 100644 --- a/typedapi/types/userprofilewithmetadata.go +++ b/typedapi/types/userprofilewithmetadata.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UserProfileWithMetadata type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/_types/UserProfile.ts#L50-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/_types/UserProfile.ts#L50-L53 type UserProfileWithMetadata struct { Data map[string]json.RawMessage `json:"data"` Doc_ UserProfileHitMetadata `json:"_doc"` diff --git a/typedapi/types/userrealm.go b/typedapi/types/userrealm.go index b60812bef5..2026a54256 100644 --- a/typedapi/types/userrealm.go +++ b/typedapi/types/userrealm.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // UserRealm type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/security/get_token/types.ts#L30-L33 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/security/get_token/types.ts#L30-L33 type UserRealm struct { Name string `json:"name"` Type string `json:"type"` diff --git a/typedapi/types/validationloss.go b/typedapi/types/validationloss.go index fb89d3b644..464efe50a8 100644 --- a/typedapi/types/validationloss.go +++ b/typedapi/types/validationloss.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ValidationLoss type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/DataframeAnalytics.ts#L570-L575 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/DataframeAnalytics.ts#L570-L575 type ValidationLoss struct { // FoldValues Validation loss values for every added decision tree during the forest // growing procedure. diff --git a/typedapi/types/valuecountaggregate.go b/typedapi/types/valuecountaggregate.go index 9d5aead00f..ac4b8e6445 100644 --- a/typedapi/types/valuecountaggregate.go +++ b/typedapi/types/valuecountaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ValueCountAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L218-L222 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L218-L222 type ValueCountAggregate struct { Meta Metadata `json:"meta,omitempty"` // Value The metric value. A missing value generally means that there was no data to diff --git a/typedapi/types/valuecountaggregation.go b/typedapi/types/valuecountaggregation.go index 8ea41290f0..c715260d81 100644 --- a/typedapi/types/valuecountaggregation.go +++ b/typedapi/types/valuecountaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ValueCountAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L417-L417 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L417-L417 type ValueCountAggregation struct { // Field The field on which to run the aggregation. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/variablewidthhistogramaggregate.go b/typedapi/types/variablewidthhistogramaggregate.go index 2d0cdb0aaa..79cd5aa50a 100644 --- a/typedapi/types/variablewidthhistogramaggregate.go +++ b/typedapi/types/variablewidthhistogramaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // VariableWidthHistogramAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L362-L364 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L362-L364 type VariableWidthHistogramAggregate struct { Buckets BucketsVariableWidthHistogramBucket `json:"buckets"` Meta Metadata `json:"meta,omitempty"` diff --git a/typedapi/types/variablewidthhistogramaggregation.go b/typedapi/types/variablewidthhistogramaggregation.go index bda086b127..ceffbb50c2 100644 --- a/typedapi/types/variablewidthhistogramaggregation.go +++ b/typedapi/types/variablewidthhistogramaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // VariableWidthHistogramAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/bucket.ts#L1015-L1035 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/bucket.ts#L1015-L1035 type VariableWidthHistogramAggregation struct { // Buckets The target number of buckets. Buckets *int `json:"buckets,omitempty"` diff --git a/typedapi/types/variablewidthhistogrambucket.go b/typedapi/types/variablewidthhistogrambucket.go index 390e52f2cd..ac70372a48 100644 --- a/typedapi/types/variablewidthhistogrambucket.go +++ b/typedapi/types/variablewidthhistogrambucket.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // VariableWidthHistogramBucket type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L366-L373 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L366-L373 type VariableWidthHistogramBucket struct { Aggregations map[string]Aggregate `json:"-"` DocCount int64 `json:"doc_count"` diff --git a/typedapi/types/vector.go b/typedapi/types/vector.go index 7054dc718f..5bd7c98389 100644 --- a/typedapi/types/vector.go +++ b/typedapi/types/vector.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Vector type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L454-L458 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L454-L458 type Vector struct { Available bool `json:"available"` DenseVectorDimsAvgCount int `json:"dense_vector_dims_avg_count"` diff --git a/typedapi/types/verifyindex.go b/typedapi/types/verifyindex.go index 0c853e3bc6..35a5a334e9 100644 --- a/typedapi/types/verifyindex.go +++ b/typedapi/types/verifyindex.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // VerifyIndex type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/indices/recovery/types.ts#L111-L116 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/indices/recovery/types.ts#L111-L116 type VerifyIndex struct { CheckIndexTime Duration `json:"check_index_time,omitempty"` CheckIndexTimeInMillis int64 `json:"check_index_time_in_millis"` diff --git a/typedapi/types/versionproperty.go b/typedapi/types/versionproperty.go index 2dbd03df77..a2323b4258 100644 --- a/typedapi/types/versionproperty.go +++ b/typedapi/types/versionproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // VersionProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L272-L274 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L272-L274 type VersionProperty struct { CopyTo []string `json:"copy_to,omitempty"` DocValues *bool `json:"doc_values,omitempty"` @@ -215,6 +215,12 @@ func (s *VersionProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -540,6 +546,12 @@ func (s *VersionProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/vertex.go b/typedapi/types/vertex.go index 02e091f428..6399979d3a 100644 --- a/typedapi/types/vertex.go +++ b/typedapi/types/vertex.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Vertex type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/graph/_types/Vertex.ts#L23-L28 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/graph/_types/Vertex.ts#L23-L28 type Vertex struct { Depth int64 `json:"depth"` Field string `json:"field"` diff --git a/typedapi/types/vertexdefinition.go b/typedapi/types/vertexdefinition.go index 2466693f65..ea667917fd 100644 --- a/typedapi/types/vertexdefinition.go +++ b/typedapi/types/vertexdefinition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // VertexDefinition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/graph/_types/Vertex.ts#L30-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/graph/_types/Vertex.ts#L30-L59 type VertexDefinition struct { // Exclude Prevents the specified terms from being included in the results. Exclude []string `json:"exclude,omitempty"` diff --git a/typedapi/types/vertexinclude.go b/typedapi/types/vertexinclude.go index 20e2e0ec2d..cfa2da391a 100644 --- a/typedapi/types/vertexinclude.go +++ b/typedapi/types/vertexinclude.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // VertexInclude type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/graph/_types/Vertex.ts#L61-L64 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/graph/_types/Vertex.ts#L61-L64 type VertexInclude struct { Boost Float64 `json:"boost"` Term string `json:"term"` diff --git a/typedapi/types/vocabulary.go b/typedapi/types/vocabulary.go index f4f7c34c95..41cb28056a 100644 --- a/typedapi/types/vocabulary.go +++ b/typedapi/types/vocabulary.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Vocabulary type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L233-L235 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L233-L235 type Vocabulary struct { Index string `json:"index"` } diff --git a/typedapi/types/waitforactiveshards.go b/typedapi/types/waitforactiveshards.go index 90ab386b49..57ba5c01fb 100644 --- a/typedapi/types/waitforactiveshards.go +++ b/typedapi/types/waitforactiveshards.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -25,5 +25,5 @@ package types // int // waitforactiveshardoptions.WaitForActiveShardOptions // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/common.ts#L141-L142 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/common.ts#L142-L143 type WaitForActiveShards interface{} diff --git a/typedapi/types/warmerstats.go b/typedapi/types/warmerstats.go index 7939319970..7c27aa023a 100644 --- a/typedapi/types/warmerstats.go +++ b/typedapi/types/warmerstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WarmerStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Stats.ts#L407-L412 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Stats.ts#L407-L412 type WarmerStats struct { Current int64 `json:"current"` Total int64 `json:"total"` diff --git a/typedapi/types/watch.go b/typedapi/types/watch.go index af3c54676d..27bbc44a13 100644 --- a/typedapi/types/watch.go +++ b/typedapi/types/watch.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // Watch type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Watch.ts#L37-L47 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Watch.ts#L37-L47 type Watch struct { Actions map[string]WatcherAction `json:"actions"` Condition WatcherCondition `json:"condition"` diff --git a/typedapi/types/watcher.go b/typedapi/types/watcher.go index aaf7d9256a..b6c3a49780 100644 --- a/typedapi/types/watcher.go +++ b/typedapi/types/watcher.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Watcher type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L460-L464 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L460-L464 type Watcher struct { Available bool `json:"available"` Count Counter `json:"count"` diff --git a/typedapi/types/watcheraction.go b/typedapi/types/watcheraction.go index a7fdf1c938..e1c3af2d3b 100644 --- a/typedapi/types/watcheraction.go +++ b/typedapi/types/watcheraction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // WatcherAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L41-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L41-L60 type WatcherAction struct { ActionType *actiontype.ActionType `json:"action_type,omitempty"` Condition *WatcherCondition `json:"condition,omitempty"` diff --git a/typedapi/types/watcheractions.go b/typedapi/types/watcheractions.go index 77b78cb958..ec8c2d5f45 100644 --- a/typedapi/types/watcheractions.go +++ b/typedapi/types/watcheractions.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // WatcherActions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L396-L398 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L396-L398 type WatcherActions struct { Actions map[string]WatcherActionTotals `json:"actions"` } diff --git a/typedapi/types/watcheractiontotals.go b/typedapi/types/watcheractiontotals.go index 6779855e20..827dfc6ee6 100644 --- a/typedapi/types/watcheractiontotals.go +++ b/typedapi/types/watcheractiontotals.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // WatcherActionTotals type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L412-L415 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L412-L415 type WatcherActionTotals struct { Total Duration `json:"total"` TotalTimeInMs int64 `json:"total_time_in_ms"` diff --git a/typedapi/types/watchercondition.go b/typedapi/types/watchercondition.go index c13d606363..8165d42d33 100644 --- a/typedapi/types/watchercondition.go +++ b/typedapi/types/watchercondition.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // WatcherCondition type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Conditions.ts#L47-L59 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Conditions.ts#L47-L59 type WatcherCondition struct { Always *AlwaysCondition `json:"always,omitempty"` ArrayCompare map[string]ArrayCompareCondition `json:"array_compare,omitempty"` diff --git a/typedapi/types/watcherinput.go b/typedapi/types/watcherinput.go index dde662b91a..3e3983b614 100644 --- a/typedapi/types/watcherinput.go +++ b/typedapi/types/watcherinput.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -26,7 +26,7 @@ import ( // WatcherInput type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Input.ts#L90-L98 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Input.ts#L90-L98 type WatcherInput struct { Chain *ChainInput `json:"chain,omitempty"` Http *HttpInput `json:"http,omitempty"` diff --git a/typedapi/types/watchernodestats.go b/typedapi/types/watchernodestats.go index 9dc5d9ce47..87ed5a8779 100644 --- a/typedapi/types/watchernodestats.go +++ b/typedapi/types/watchernodestats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // WatcherNodeStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/stats/types.ts#L33-L40 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/stats/types.ts#L33-L40 type WatcherNodeStats struct { CurrentWatches []WatchRecordStats `json:"current_watches,omitempty"` ExecutionThreadPool ExecutionThreadPool `json:"execution_thread_pool"` diff --git a/typedapi/types/watcherstatusactions.go b/typedapi/types/watcherstatusactions.go index 7ab43f6db0..9a75d215d4 100644 --- a/typedapi/types/watcherstatusactions.go +++ b/typedapi/types/watcherstatusactions.go @@ -16,11 +16,11 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // WatcherStatusActions type alias. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Action.ts#L62-L62 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Action.ts#L62-L62 type WatcherStatusActions map[string]ActionStatus diff --git a/typedapi/types/watcherwatch.go b/typedapi/types/watcherwatch.go index b64d4dda84..68beb54bdd 100644 --- a/typedapi/types/watcherwatch.go +++ b/typedapi/types/watcherwatch.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // WatcherWatch type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L400-L405 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L400-L405 type WatcherWatch struct { Action map[string]Counter `json:"action,omitempty"` Condition map[string]Counter `json:"condition,omitempty"` diff --git a/typedapi/types/watcherwatchtrigger.go b/typedapi/types/watcherwatchtrigger.go index 646067daaa..2abf0ba694 100644 --- a/typedapi/types/watcherwatchtrigger.go +++ b/typedapi/types/watcherwatchtrigger.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // WatcherWatchTrigger type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L407-L410 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L407-L410 type WatcherWatchTrigger struct { All_ Counter `json:"_all"` Schedule *WatcherWatchTriggerSchedule `json:"schedule,omitempty"` diff --git a/typedapi/types/watcherwatchtriggerschedule.go b/typedapi/types/watcherwatchtriggerschedule.go index 54e860c3c6..861c16c8e3 100644 --- a/typedapi/types/watcherwatchtriggerschedule.go +++ b/typedapi/types/watcherwatchtriggerschedule.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WatcherWatchTriggerSchedule type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L466-L469 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L466-L469 type WatcherWatchTriggerSchedule struct { Active int64 `json:"active"` All_ Counter `json:"_all"` diff --git a/typedapi/types/watchrecord.go b/typedapi/types/watchrecord.go index c6ad8e65b6..26ae08960f 100644 --- a/typedapi/types/watchrecord.go +++ b/typedapi/types/watchrecord.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // WatchRecord type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/execute_watch/types.ts#L27-L39 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/execute_watch/types.ts#L27-L39 type WatchRecord struct { Condition WatcherCondition `json:"condition"` Input WatcherInput `json:"input"` diff --git a/typedapi/types/watchrecordqueuedstats.go b/typedapi/types/watchrecordqueuedstats.go index 750698c077..c3aedb8f34 100644 --- a/typedapi/types/watchrecordqueuedstats.go +++ b/typedapi/types/watchrecordqueuedstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // WatchRecordQueuedStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/stats/types.ts#L50-L52 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/stats/types.ts#L50-L52 type WatchRecordQueuedStats struct { ExecutionTime DateTime `json:"execution_time"` } diff --git a/typedapi/types/watchrecordstats.go b/typedapi/types/watchrecordstats.go index c1a167ad5c..70cf9f4129 100644 --- a/typedapi/types/watchrecordstats.go +++ b/typedapi/types/watchrecordstats.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -31,7 +31,7 @@ import ( // WatchRecordStats type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/stats/types.ts#L54-L60 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/stats/types.ts#L54-L60 type WatchRecordStats struct { ExecutedActions []string `json:"executed_actions,omitempty"` ExecutionPhase executionphase.ExecutionPhase `json:"execution_phase"` diff --git a/typedapi/types/watchstatus.go b/typedapi/types/watchstatus.go index 81cf26c4e4..c74d0beb1a 100644 --- a/typedapi/types/watchstatus.go +++ b/typedapi/types/watchstatus.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WatchStatus type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Watch.ts#L49-L56 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Watch.ts#L49-L56 type WatchStatus struct { Actions WatcherStatusActions `json:"actions"` ExecutionState *string `json:"execution_state,omitempty"` diff --git a/typedapi/types/webhookaction.go b/typedapi/types/webhookaction.go index bc3f24d38c..42870db32f 100644 --- a/typedapi/types/webhookaction.go +++ b/typedapi/types/webhookaction.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -33,7 +33,7 @@ import ( // WebhookAction type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L293-L293 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L293-L293 type WebhookAction struct { Auth *HttpInputAuthentication `json:"auth,omitempty"` Body *string `json:"body,omitempty"` diff --git a/typedapi/types/webhookresult.go b/typedapi/types/webhookresult.go index 5903f8a1fe..4713ce8558 100644 --- a/typedapi/types/webhookresult.go +++ b/typedapi/types/webhookresult.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // WebhookResult type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/_types/Actions.ts#L295-L298 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/_types/Actions.ts#L295-L298 type WebhookResult struct { Request HttpInputRequestResult `json:"request"` Response *HttpInputResponseResult `json:"response,omitempty"` diff --git a/typedapi/types/weightedaverageaggregation.go b/typedapi/types/weightedaverageaggregation.go index 3deb8afaaa..e0467cad39 100644 --- a/typedapi/types/weightedaverageaggregation.go +++ b/typedapi/types/weightedaverageaggregation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // WeightedAverageAggregation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L432-L446 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L432-L446 type WeightedAverageAggregation struct { // Format A numeric response formatter. Format *string `json:"format,omitempty"` diff --git a/typedapi/types/weightedaveragevalue.go b/typedapi/types/weightedaveragevalue.go index 2170e9d829..111699281d 100644 --- a/typedapi/types/weightedaveragevalue.go +++ b/typedapi/types/weightedaveragevalue.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WeightedAverageValue type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/metric.ts#L448-L458 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/metric.ts#L448-L458 type WeightedAverageValue struct { // Field The field from which to extract the values or weights. Field *string `json:"field,omitempty"` diff --git a/typedapi/types/weightedavgaggregate.go b/typedapi/types/weightedavgaggregate.go index f76bb70419..9dc175074d 100644 --- a/typedapi/types/weightedavgaggregate.go +++ b/typedapi/types/weightedavgaggregate.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WeightedAvgAggregate type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/aggregations/Aggregate.ts#L212-L216 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/aggregations/Aggregate.ts#L212-L216 type WeightedAvgAggregate struct { Meta Metadata `json:"meta,omitempty"` // Value The metric value. A missing value generally means that there was no data to diff --git a/typedapi/types/weights.go b/typedapi/types/weights.go index e310d91290..79d3190964 100644 --- a/typedapi/types/weights.go +++ b/typedapi/types/weights.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // Weights type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/put_trained_model/types.ts#L108-L110 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/put_trained_model/types.ts#L108-L110 type Weights struct { Weights Float64 `json:"weights"` } diff --git a/typedapi/types/whitespaceanalyzer.go b/typedapi/types/whitespaceanalyzer.go index 170b02d0d7..081c8107c2 100644 --- a/typedapi/types/whitespaceanalyzer.go +++ b/typedapi/types/whitespaceanalyzer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -29,7 +29,7 @@ import ( // WhitespaceAnalyzer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/analyzers.ts#L108-L111 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/analyzers.ts#L108-L111 type WhitespaceAnalyzer struct { Type string `json:"type,omitempty"` Version *string `json:"version,omitempty"` diff --git a/typedapi/types/whitespacetokenizer.go b/typedapi/types/whitespacetokenizer.go index 7ac48da94a..1309a7e48f 100644 --- a/typedapi/types/whitespacetokenizer.go +++ b/typedapi/types/whitespacetokenizer.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WhitespaceTokenizer type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/tokenizers.ts#L115-L118 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/tokenizers.ts#L115-L118 type WhitespaceTokenizer struct { MaxTokenLength *int `json:"max_token_length,omitempty"` Type string `json:"type,omitempty"` diff --git a/typedapi/types/wildcardproperty.go b/typedapi/types/wildcardproperty.go index ee121352cc..a3ca66ef46 100644 --- a/typedapi/types/wildcardproperty.go +++ b/typedapi/types/wildcardproperty.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // WildcardProperty type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/mapping/core.ts#L276-L283 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/mapping/core.ts#L276-L283 type WildcardProperty struct { CopyTo []string `json:"copy_to,omitempty"` DocValues *bool `json:"doc_values,omitempty"` @@ -216,6 +216,12 @@ func (s *WildcardProperty) UnmarshalJSON(data []byte) error { return err } s.Fields[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Fields[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { @@ -553,6 +559,12 @@ func (s *WildcardProperty) UnmarshalJSON(data []byte) error { return err } s.Properties[key] = oo + case "sparse_vector": + oo := NewSparseVectorProperty() + if err := localDec.Decode(&oo); err != nil { + return err + } + s.Properties[key] = oo case "flattened": oo := NewFlattenedProperty() if err := localDec.Decode(&oo); err != nil { diff --git a/typedapi/types/wildcardquery.go b/typedapi/types/wildcardquery.go index 83faac9dea..2704152bfa 100644 --- a/typedapi/types/wildcardquery.go +++ b/typedapi/types/wildcardquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WildcardQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/term.ts#L268-L285 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/term.ts#L268-L285 type WildcardQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/wktgeobounds.go b/typedapi/types/wktgeobounds.go index 5a91784ee3..c085a2067e 100644 --- a/typedapi/types/wktgeobounds.go +++ b/typedapi/types/wktgeobounds.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WktGeoBounds type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/Geo.ts#L159-L161 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/Geo.ts#L159-L161 type WktGeoBounds struct { Wkt string `json:"wkt"` } diff --git a/typedapi/types/worddelimitergraphtokenfilter.go b/typedapi/types/worddelimitergraphtokenfilter.go index a90e911567..5ea8daa061 100644 --- a/typedapi/types/worddelimitergraphtokenfilter.go +++ b/typedapi/types/worddelimitergraphtokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WordDelimiterGraphTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L149-L166 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L149-L166 type WordDelimiterGraphTokenFilter struct { AdjustOffsets *bool `json:"adjust_offsets,omitempty"` CatenateAll *bool `json:"catenate_all,omitempty"` diff --git a/typedapi/types/worddelimitertokenfilter.go b/typedapi/types/worddelimitertokenfilter.go index 9cfc0a3f18..119fbe0973 100644 --- a/typedapi/types/worddelimitertokenfilter.go +++ b/typedapi/types/worddelimitertokenfilter.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WordDelimiterTokenFilter type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/analysis/token_filters.ts#L132-L147 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/analysis/token_filters.ts#L132-L147 type WordDelimiterTokenFilter struct { CatenateAll *bool `json:"catenate_all,omitempty"` CatenateNumbers *bool `json:"catenate_numbers,omitempty"` diff --git a/typedapi/types/wrapperquery.go b/typedapi/types/wrapperquery.go index b56e477c79..daf6c63ad9 100644 --- a/typedapi/types/wrapperquery.go +++ b/typedapi/types/wrapperquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // WrapperQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_types/query_dsl/abstractions.ts#L465-L471 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_types/query_dsl/abstractions.ts#L465-L471 type WrapperQuery struct { // Boost Floating point number used to decrease or increase the relevance scores of // the query. diff --git a/typedapi/types/writeoperation.go b/typedapi/types/writeoperation.go index e4a716d5ba..2e8d08f267 100644 --- a/typedapi/types/writeoperation.go +++ b/typedapi/types/writeoperation.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -32,7 +32,7 @@ import ( // WriteOperation type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/_global/bulk/types.ts#L109-L128 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/_global/bulk/types.ts#L109-L128 type WriteOperation struct { // DynamicTemplates A map from the full name of fields to the name of dynamic templates. // Defaults to an empty map. diff --git a/typedapi/types/xpackdatafeed.go b/typedapi/types/xpackdatafeed.go index dd9dbb38d3..899ee5fcab 100644 --- a/typedapi/types/xpackdatafeed.go +++ b/typedapi/types/xpackdatafeed.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // XpackDatafeed type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L77-L79 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L77-L79 type XpackDatafeed struct { Count int64 `json:"count"` } diff --git a/typedapi/types/xpackfeature.go b/typedapi/types/xpackfeature.go index 28e37a74ae..bd801ac09a 100644 --- a/typedapi/types/xpackfeature.go +++ b/typedapi/types/xpackfeature.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // XpackFeature type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/info/types.ts#L77-L82 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/info/types.ts#L77-L82 type XpackFeature struct { Available bool `json:"available"` Description *string `json:"description,omitempty"` diff --git a/typedapi/types/xpackfeatures.go b/typedapi/types/xpackfeatures.go index e0ac44846e..5e764bd88d 100644 --- a/typedapi/types/xpackfeatures.go +++ b/typedapi/types/xpackfeatures.go @@ -16,13 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types // XpackFeatures type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/info/types.ts#L42-L75 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/info/types.ts#L42-L75 type XpackFeatures struct { AggregateMetric XpackFeature `json:"aggregate_metric"` Analytics XpackFeature `json:"analytics"` diff --git a/typedapi/types/xpackquery.go b/typedapi/types/xpackquery.go index 54d5439dca..14b1658024 100644 --- a/typedapi/types/xpackquery.go +++ b/typedapi/types/xpackquery.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // XpackQuery type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L259-L264 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L259-L264 type XpackQuery struct { Count *int `json:"count,omitempty"` Failed *int `json:"failed,omitempty"` diff --git a/typedapi/types/xpackrealm.go b/typedapi/types/xpackrealm.go index c20c95da23..c532546453 100644 --- a/typedapi/types/xpackrealm.go +++ b/typedapi/types/xpackrealm.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // XpackRealm type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L417-L426 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L417-L426 type XpackRealm struct { Available bool `json:"available"` Cache []RealmCache `json:"cache,omitempty"` diff --git a/typedapi/types/xpackrolemapping.go b/typedapi/types/xpackrolemapping.go index 5cbd426394..c008b7d449 100644 --- a/typedapi/types/xpackrolemapping.go +++ b/typedapi/types/xpackrolemapping.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // XpackRoleMapping type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L270-L273 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L270-L273 type XpackRoleMapping struct { Enabled int `json:"enabled"` Size int `json:"size"` diff --git a/typedapi/types/xpackruntimefieldtypes.go b/typedapi/types/xpackruntimefieldtypes.go index fd8076cb1e..2b7bb3b44e 100644 --- a/typedapi/types/xpackruntimefieldtypes.go +++ b/typedapi/types/xpackruntimefieldtypes.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // XpackRuntimeFieldTypes type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/types.ts#L275-L277 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/types.ts#L275-L277 type XpackRuntimeFieldTypes struct { Available bool `json:"available"` Enabled bool `json:"enabled"` diff --git a/typedapi/types/zeroshotclassificationinferenceoptions.go b/typedapi/types/zeroshotclassificationinferenceoptions.go index ddc5322449..71c3bda5e9 100644 --- a/typedapi/types/zeroshotclassificationinferenceoptions.go +++ b/typedapi/types/zeroshotclassificationinferenceoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ZeroShotClassificationInferenceOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L201-L222 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L201-L222 type ZeroShotClassificationInferenceOptions struct { // ClassificationLabels The zero shot classification labels indicating entailment, neutral, and // contradiction diff --git a/typedapi/types/zeroshotclassificationinferenceupdateoptions.go b/typedapi/types/zeroshotclassificationinferenceupdateoptions.go index 7f80210bee..d6419be173 100644 --- a/typedapi/types/zeroshotclassificationinferenceupdateoptions.go +++ b/typedapi/types/zeroshotclassificationinferenceupdateoptions.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package types @@ -30,7 +30,7 @@ import ( // ZeroShotClassificationInferenceUpdateOptions type. // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/ml/_types/inference.ts#L374-L383 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/ml/_types/inference.ts#L374-L383 type ZeroShotClassificationInferenceUpdateOptions struct { // Labels The labels to predict. Labels []string `json:"labels"` diff --git a/typedapi/watcher/ackwatch/ack_watch.go b/typedapi/watcher/ackwatch/ack_watch.go index ed13d36054..2023b355b0 100644 --- a/typedapi/watcher/ackwatch/ack_watch.go +++ b/typedapi/watcher/ackwatch/ack_watch.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Acknowledges a watch, manually throttling the execution of the watch's // actions. package ackwatch import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -54,12 +53,16 @@ type AckWatch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int watchid string actionid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewAckWatch type alias for index. @@ -86,7 +89,12 @@ func New(tp elastictransport.Interface) *AckWatch { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -111,6 +119,9 @@ func (r *AckWatch) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("watch") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "watchid", r.watchid) + } path.WriteString(r.watchid) path.WriteString("/") path.WriteString("_ack") @@ -123,11 +134,17 @@ func (r *AckWatch) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("watch") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "watchid", r.watchid) + } path.WriteString(r.watchid) path.WriteString("/") path.WriteString("_ack") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "actionid", r.actionid) + } path.WriteString(r.actionid) method = http.MethodPut @@ -141,9 +158,9 @@ func (r *AckWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -160,27 +177,66 @@ func (r *AckWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r AckWatch) Perform(ctx context.Context) (*http.Response, error) { +func (r AckWatch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.ack_watch") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.ack_watch") + if reader := instrument.RecordRequestBody(ctx, "watcher.ack_watch", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.ack_watch") + } if err != nil { - return nil, fmt.Errorf("an error happened during the AckWatch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the AckWatch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a ackwatch.Response -func (r AckWatch) Do(ctx context.Context) (*Response, error) { +func (r AckWatch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.ack_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -188,6 +244,9 @@ func (r AckWatch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -197,6 +256,9 @@ func (r AckWatch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -204,12 +266,25 @@ func (r AckWatch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r AckWatch) IsSuccess(ctx context.Context) (bool, error) { +func (r AckWatch) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.ack_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -225,6 +300,14 @@ func (r AckWatch) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the AckWatch query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/watcher/ackwatch/response.go b/typedapi/watcher/ackwatch/response.go index ec5e8d6566..337d7c865d 100644 --- a/typedapi/watcher/ackwatch/response.go +++ b/typedapi/watcher/ackwatch/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package ackwatch @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package ackwatch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/ack_watch/WatcherAckWatchResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/ack_watch/WatcherAckWatchResponse.ts#L22-L24 type Response struct { Status types.WatchStatus `json:"status"` } diff --git a/typedapi/watcher/activatewatch/activate_watch.go b/typedapi/watcher/activatewatch/activate_watch.go index e2d77877f7..e7d2e92da8 100644 --- a/typedapi/watcher/activatewatch/activate_watch.go +++ b/typedapi/watcher/activatewatch/activate_watch.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Activates a currently inactive watch. package activatewatch import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type ActivateWatch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int watchid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewActivateWatch type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *ActivateWatch { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *ActivateWatch) HttpRequest(ctx context.Context) (*http.Request, error) path.WriteString("watch") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "watchid", r.watchid) + } path.WriteString(r.watchid) path.WriteString("/") path.WriteString("_activate") @@ -121,9 +132,9 @@ func (r *ActivateWatch) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *ActivateWatch) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ActivateWatch) Perform(ctx context.Context) (*http.Response, error) { +func (r ActivateWatch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.activate_watch") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.activate_watch") + if reader := instrument.RecordRequestBody(ctx, "watcher.activate_watch", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.activate_watch") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ActivateWatch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ActivateWatch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a activatewatch.Response -func (r ActivateWatch) Do(ctx context.Context) (*Response, error) { +func (r ActivateWatch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.activate_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r ActivateWatch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r ActivateWatch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r ActivateWatch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r ActivateWatch) IsSuccess(ctx context.Context) (bool, error) { +func (r ActivateWatch) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.activate_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r ActivateWatch) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the ActivateWatch query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/watcher/activatewatch/response.go b/typedapi/watcher/activatewatch/response.go index d708a1adc0..c1611dd706 100644 --- a/typedapi/watcher/activatewatch/response.go +++ b/typedapi/watcher/activatewatch/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package activatewatch @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package activatewatch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/activate_watch/WatcherActivateWatchResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/activate_watch/WatcherActivateWatchResponse.ts#L22-L24 type Response struct { Status types.ActivationStatus `json:"status"` } diff --git a/typedapi/watcher/deactivatewatch/deactivate_watch.go b/typedapi/watcher/deactivatewatch/deactivate_watch.go index 6ee19a74ab..cc11f9ed76 100644 --- a/typedapi/watcher/deactivatewatch/deactivate_watch.go +++ b/typedapi/watcher/deactivatewatch/deactivate_watch.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Deactivates a currently active watch. package deactivatewatch import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeactivateWatch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int watchid string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeactivateWatch type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *DeactivateWatch { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeactivateWatch) HttpRequest(ctx context.Context) (*http.Request, error path.WriteString("watch") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "watchid", r.watchid) + } path.WriteString(r.watchid) path.WriteString("/") path.WriteString("_deactivate") @@ -121,9 +132,9 @@ func (r *DeactivateWatch) HttpRequest(ctx context.Context) (*http.Request, error } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -140,27 +151,66 @@ func (r *DeactivateWatch) HttpRequest(ctx context.Context) (*http.Request, error } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeactivateWatch) Perform(ctx context.Context) (*http.Response, error) { +func (r DeactivateWatch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.deactivate_watch") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.deactivate_watch") + if reader := instrument.RecordRequestBody(ctx, "watcher.deactivate_watch", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.deactivate_watch") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeactivateWatch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeactivateWatch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deactivatewatch.Response -func (r DeactivateWatch) Do(ctx context.Context) (*Response, error) { +func (r DeactivateWatch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.deactivate_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -168,6 +218,9 @@ func (r DeactivateWatch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -177,6 +230,9 @@ func (r DeactivateWatch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -184,12 +240,25 @@ func (r DeactivateWatch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeactivateWatch) IsSuccess(ctx context.Context) (bool, error) { +func (r DeactivateWatch) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.deactivate_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -205,6 +274,14 @@ func (r DeactivateWatch) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeactivateWatch query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/watcher/deactivatewatch/response.go b/typedapi/watcher/deactivatewatch/response.go index 970241c6c3..c3ebef11fb 100644 --- a/typedapi/watcher/deactivatewatch/response.go +++ b/typedapi/watcher/deactivatewatch/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deactivatewatch @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package deactivatewatch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/deactivate_watch/DeactivateWatchResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/deactivate_watch/DeactivateWatchResponse.ts#L22-L24 type Response struct { Status types.ActivationStatus `json:"status"` } diff --git a/typedapi/watcher/deletewatch/delete_watch.go b/typedapi/watcher/deletewatch/delete_watch.go index b014e4e8aa..cc3b2e37d5 100644 --- a/typedapi/watcher/deletewatch/delete_watch.go +++ b/typedapi/watcher/deletewatch/delete_watch.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Removes a watch from Watcher. package deletewatch import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type DeleteWatch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewDeleteWatch type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *DeleteWatch { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *DeleteWatch) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("watch") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodDelete @@ -119,9 +130,9 @@ func (r *DeleteWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *DeleteWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r DeleteWatch) Perform(ctx context.Context) (*http.Response, error) { +func (r DeleteWatch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.delete_watch") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.delete_watch") + if reader := instrument.RecordRequestBody(ctx, "watcher.delete_watch", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.delete_watch") + } if err != nil { - return nil, fmt.Errorf("an error happened during the DeleteWatch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the DeleteWatch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a deletewatch.Response -func (r DeleteWatch) Do(ctx context.Context) (*Response, error) { +func (r DeleteWatch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.delete_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r DeleteWatch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r DeleteWatch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r DeleteWatch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r DeleteWatch) IsSuccess(ctx context.Context) (bool, error) { +func (r DeleteWatch) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.delete_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r DeleteWatch) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the DeleteWatch query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/watcher/deletewatch/response.go b/typedapi/watcher/deletewatch/response.go index a55af48fa7..14d24a874f 100644 --- a/typedapi/watcher/deletewatch/response.go +++ b/typedapi/watcher/deletewatch/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package deletewatch // Response holds the response body struct for the package deletewatch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/delete_watch/DeleteWatchResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/delete_watch/DeleteWatchResponse.ts#L22-L24 type Response struct { Found bool `json:"found"` Id_ string `json:"_id"` diff --git a/typedapi/watcher/executewatch/execute_watch.go b/typedapi/watcher/executewatch/execute_watch.go index 63d9d2c3b9..1f7e333070 100644 --- a/typedapi/watcher/executewatch/execute_watch.go +++ b/typedapi/watcher/executewatch/execute_watch.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Forces the execution of a stored watch. package executewatch @@ -52,15 +52,19 @@ type ExecuteWatch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewExecuteWatch type alias for index. @@ -84,11 +88,18 @@ func New(tp elastictransport.Interface) *ExecuteWatch { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -125,9 +136,7 @@ func (r *ExecuteWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -139,6 +148,10 @@ func (r *ExecuteWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -149,6 +162,9 @@ func (r *ExecuteWatch) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("watch") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) path.WriteString("/") path.WriteString("_execute") @@ -173,15 +189,15 @@ func (r *ExecuteWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -198,27 +214,66 @@ func (r *ExecuteWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r ExecuteWatch) Perform(ctx context.Context) (*http.Response, error) { +func (r ExecuteWatch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.execute_watch") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.execute_watch") + if reader := instrument.RecordRequestBody(ctx, "watcher.execute_watch", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.execute_watch") + } if err != nil { - return nil, fmt.Errorf("an error happened during the ExecuteWatch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the ExecuteWatch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a executewatch.Response -func (r ExecuteWatch) Do(ctx context.Context) (*Response, error) { +func (r ExecuteWatch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.execute_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -226,6 +281,9 @@ func (r ExecuteWatch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -235,6 +293,9 @@ func (r ExecuteWatch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -242,6 +303,9 @@ func (r ExecuteWatch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/watcher/executewatch/request.go b/typedapi/watcher/executewatch/request.go index 399e304677..ab91a6ddd6 100644 --- a/typedapi/watcher/executewatch/request.go +++ b/typedapi/watcher/executewatch/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package executewatch @@ -30,7 +30,7 @@ import ( // Request holds the request body struct for the package executewatch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/execute_watch/WatcherExecuteWatchRequest.ts#L28-L79 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/execute_watch/WatcherExecuteWatchRequest.ts#L28-L79 type Request struct { // ActionModes Determines how to handle the watch actions as part of the watch execution. diff --git a/typedapi/watcher/executewatch/response.go b/typedapi/watcher/executewatch/response.go index 3554897f24..400e02408a 100644 --- a/typedapi/watcher/executewatch/response.go +++ b/typedapi/watcher/executewatch/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package executewatch @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package executewatch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/execute_watch/WatcherExecuteWatchResponse.ts#L23-L25 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/execute_watch/WatcherExecuteWatchResponse.ts#L23-L25 type Response struct { Id_ string `json:"_id"` WatchRecord types.WatchRecord `json:"watch_record"` diff --git a/typedapi/watcher/getsettings/get_settings.go b/typedapi/watcher/getsettings/get_settings.go index 9070fbeea0..7f5827cee5 100644 --- a/typedapi/watcher/getsettings/get_settings.go +++ b/typedapi/watcher/getsettings/get_settings.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieve settings for the watcher system index package getsettings import ( - gobytes "bytes" "context" "errors" "fmt" @@ -45,9 +44,13 @@ type GetSettings struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetSettings type alias for index. @@ -71,7 +74,12 @@ func New(tp elastictransport.Interface) *GetSettings { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,15 +114,15 @@ func (r *GetSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -131,15 +139,42 @@ func (r *GetSettings) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetSettings) Perform(ctx context.Context) (*http.Response, error) { +func (r GetSettings) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.get_settings") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.get_settings") + if reader := instrument.RecordRequestBody(ctx, "watcher.get_settings", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.get_settings") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetSettings query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetSettings query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -152,7 +187,17 @@ func (r GetSettings) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetSettings) IsSuccess(ctx context.Context) (bool, error) { +func (r GetSettings) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.get_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -168,6 +213,14 @@ func (r GetSettings) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetSettings query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/watcher/getwatch/get_watch.go b/typedapi/watcher/getwatch/get_watch.go index 870ec3c3ba..ca3c588061 100644 --- a/typedapi/watcher/getwatch/get_watch.go +++ b/typedapi/watcher/getwatch/get_watch.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves a watch by its ID. package getwatch import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -51,11 +50,15 @@ type GetWatch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewGetWatch type alias for index. @@ -81,7 +84,12 @@ func New(tp elastictransport.Interface) *GetWatch { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,6 +114,9 @@ func (r *GetWatch) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("watch") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodGet @@ -119,9 +130,9 @@ func (r *GetWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -138,27 +149,66 @@ func (r *GetWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r GetWatch) Perform(ctx context.Context) (*http.Response, error) { +func (r GetWatch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.get_watch") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.get_watch") + if reader := instrument.RecordRequestBody(ctx, "watcher.get_watch", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.get_watch") + } if err != nil { - return nil, fmt.Errorf("an error happened during the GetWatch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the GetWatch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a getwatch.Response -func (r GetWatch) Do(ctx context.Context) (*Response, error) { +func (r GetWatch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.get_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -166,6 +216,9 @@ func (r GetWatch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -175,6 +228,9 @@ func (r GetWatch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -182,12 +238,25 @@ func (r GetWatch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r GetWatch) IsSuccess(ctx context.Context) (bool, error) { +func (r GetWatch) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.get_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -203,6 +272,14 @@ func (r GetWatch) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the GetWatch query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/watcher/getwatch/response.go b/typedapi/watcher/getwatch/response.go index 7eb1defc66..2cc7f89ff1 100644 --- a/typedapi/watcher/getwatch/response.go +++ b/typedapi/watcher/getwatch/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package getwatch @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package getwatch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/get_watch/GetWatchResponse.ts#L24-L34 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/get_watch/GetWatchResponse.ts#L24-L34 type Response struct { Found bool `json:"found"` Id_ string `json:"_id"` diff --git a/typedapi/watcher/putwatch/put_watch.go b/typedapi/watcher/putwatch/put_watch.go index c065b7240f..efd558ac07 100644 --- a/typedapi/watcher/putwatch/put_watch.go +++ b/typedapi/watcher/putwatch/put_watch.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Creates a new watch, or updates an existing one. package putwatch @@ -51,15 +51,19 @@ type PutWatch struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int id string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewPutWatch type alias for index. @@ -85,11 +89,18 @@ func New(tp elastictransport.Interface) *PutWatch { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -126,9 +137,7 @@ func (r *PutWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -140,6 +149,10 @@ func (r *PutWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -150,6 +163,9 @@ func (r *PutWatch) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("watch") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "id", r.id) + } path.WriteString(r.id) method = http.MethodPut @@ -163,15 +179,15 @@ func (r *PutWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -188,27 +204,66 @@ func (r *PutWatch) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r PutWatch) Perform(ctx context.Context) (*http.Response, error) { +func (r PutWatch) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.put_watch") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.put_watch") + if reader := instrument.RecordRequestBody(ctx, "watcher.put_watch", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.put_watch") + } if err != nil { - return nil, fmt.Errorf("an error happened during the PutWatch query execution: %w", err) + localErr := fmt.Errorf("an error happened during the PutWatch query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a putwatch.Response -func (r PutWatch) Do(ctx context.Context) (*Response, error) { +func (r PutWatch) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.put_watch") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -216,6 +271,9 @@ func (r PutWatch) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -225,6 +283,9 @@ func (r PutWatch) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -232,6 +293,9 @@ func (r PutWatch) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/watcher/putwatch/request.go b/typedapi/watcher/putwatch/request.go index 013292779f..bab0c575d5 100644 --- a/typedapi/watcher/putwatch/request.go +++ b/typedapi/watcher/putwatch/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putwatch @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package putwatch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/put_watch/WatcherPutWatchRequest.ts#L30-L53 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/put_watch/WatcherPutWatchRequest.ts#L30-L53 type Request struct { Actions map[string]types.WatcherAction `json:"actions,omitempty"` Condition *types.WatcherCondition `json:"condition,omitempty"` diff --git a/typedapi/watcher/putwatch/response.go b/typedapi/watcher/putwatch/response.go index f503800aff..2446509e11 100644 --- a/typedapi/watcher/putwatch/response.go +++ b/typedapi/watcher/putwatch/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package putwatch // Response holds the response body struct for the package putwatch // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/put_watch/WatcherPutWatchResponse.ts#L23-L31 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/put_watch/WatcherPutWatchResponse.ts#L23-L31 type Response struct { Created bool `json:"created"` Id_ string `json:"_id"` diff --git a/typedapi/watcher/querywatches/query_watches.go b/typedapi/watcher/querywatches/query_watches.go index 97d00cec06..aae28816fe 100644 --- a/typedapi/watcher/querywatches/query_watches.go +++ b/typedapi/watcher/querywatches/query_watches.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves stored watches. package querywatches @@ -46,13 +46,17 @@ type QueryWatches struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader req *Request deferred []func(request *Request) error - raw io.Reader + buf *gobytes.Buffer paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewQueryWatches type alias for index. @@ -76,11 +80,18 @@ func New(tp elastictransport.Interface) *QueryWatches { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + + buf: gobytes.NewBuffer(nil), req: NewRequest(), } + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } + } + return r } @@ -117,9 +128,7 @@ func (r *QueryWatches) HttpRequest(ctx context.Context) (*http.Request, error) { } } - if r.raw != nil { - r.buf.ReadFrom(r.raw) - } else if r.req != nil { + if r.raw == nil && r.req != nil { data, err := json.Marshal(r.req) @@ -131,6 +140,10 @@ func (r *QueryWatches) HttpRequest(ctx context.Context) (*http.Request, error) { } + if r.buf.Len() > 0 { + r.raw = r.buf + } + r.path.Scheme = "http" switch { @@ -153,15 +166,15 @@ func (r *QueryWatches) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -178,27 +191,66 @@ func (r *QueryWatches) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r QueryWatches) Perform(ctx context.Context) (*http.Response, error) { +func (r QueryWatches) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.query_watches") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.query_watches") + if reader := instrument.RecordRequestBody(ctx, "watcher.query_watches", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.query_watches") + } if err != nil { - return nil, fmt.Errorf("an error happened during the QueryWatches query execution: %w", err) + localErr := fmt.Errorf("an error happened during the QueryWatches query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a querywatches.Response -func (r QueryWatches) Do(ctx context.Context) (*Response, error) { +func (r QueryWatches) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.query_watches") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -206,6 +258,9 @@ func (r QueryWatches) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -215,6 +270,9 @@ func (r QueryWatches) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -222,6 +280,9 @@ func (r QueryWatches) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } diff --git a/typedapi/watcher/querywatches/request.go b/typedapi/watcher/querywatches/request.go index c150725c44..b620557570 100644 --- a/typedapi/watcher/querywatches/request.go +++ b/typedapi/watcher/querywatches/request.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package querywatches @@ -29,7 +29,7 @@ import ( // Request holds the request body struct for the package querywatches // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/query_watches/WatcherQueryWatchesRequest.ts#L25-L48 +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/query_watches/WatcherQueryWatchesRequest.ts#L25-L48 type Request struct { // From The offset from the first result to fetch. Needs to be non-negative. diff --git a/typedapi/watcher/querywatches/response.go b/typedapi/watcher/querywatches/response.go index 37ec5fdaeb..cf31841624 100644 --- a/typedapi/watcher/querywatches/response.go +++ b/typedapi/watcher/querywatches/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package querywatches @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package querywatches // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/query_watches/WatcherQueryWatchesResponse.ts#L23-L28 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/query_watches/WatcherQueryWatchesResponse.ts#L23-L28 type Response struct { Count int `json:"count"` Watches []types.QueryWatch `json:"watches"` diff --git a/typedapi/watcher/start/response.go b/typedapi/watcher/start/response.go index b978fd1faf..a176bf8d3f 100644 --- a/typedapi/watcher/start/response.go +++ b/typedapi/watcher/start/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package start // Response holds the response body struct for the package start // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/start/WatcherStartResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/start/WatcherStartResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/watcher/start/start.go b/typedapi/watcher/start/start.go index 052eb6540f..f07b863da9 100644 --- a/typedapi/watcher/start/start.go +++ b/typedapi/watcher/start/start.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Starts Watcher if it is not already running. package start import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Start struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStart type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *Start { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Start) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Start) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Start) Perform(ctx context.Context) (*http.Response, error) { +func (r Start) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.start") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.start") + if reader := instrument.RecordRequestBody(ctx, "watcher.start", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.start") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Start query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Start query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a start.Response -func (r Start) Do(ctx context.Context) (*Response, error) { +func (r Start) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.start") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Start) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Start) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Start) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Start) IsSuccess(ctx context.Context) (bool, error) { +func (r Start) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.start") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Start) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Start query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/watcher/stats/response.go b/typedapi/watcher/stats/response.go index b2e6fe5163..3df66bda33 100644 --- a/typedapi/watcher/stats/response.go +++ b/typedapi/watcher/stats/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stats @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package stats // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/stats/WatcherStatsResponse.ts#L24-L32 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/stats/WatcherStatsResponse.ts#L24-L32 type Response struct { ClusterName string `json:"cluster_name"` ManuallyStopped bool `json:"manually_stopped"` diff --git a/typedapi/watcher/stats/stats.go b/typedapi/watcher/stats/stats.go index 58d6671796..a8ba513435 100644 --- a/typedapi/watcher/stats/stats.go +++ b/typedapi/watcher/stats/stats.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves the current Watcher metrics. package stats import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -52,11 +51,15 @@ type Stats struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int metric string + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStats type alias for index. @@ -80,7 +83,12 @@ func New(tp elastictransport.Interface) *Stats { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -112,6 +120,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { path.WriteString("stats") path.WriteString("/") + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordPathPart(ctx, "metric", r.metric) + } path.WriteString(r.metric) method = http.MethodGet @@ -125,9 +136,9 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -144,27 +155,66 @@ func (r *Stats) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Stats) Perform(ctx context.Context) (*http.Response, error) { +func (r Stats) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.stats") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.stats") + if reader := instrument.RecordRequestBody(ctx, "watcher.stats", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.stats") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Stats query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Stats query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stats.Response -func (r Stats) Do(ctx context.Context) (*Response, error) { +func (r Stats) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -172,6 +222,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -181,6 +234,9 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -188,12 +244,25 @@ func (r Stats) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Stats) IsSuccess(ctx context.Context) (bool, error) { +func (r Stats) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.stats") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -209,6 +278,14 @@ func (r Stats) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Stats query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/watcher/stop/response.go b/typedapi/watcher/stop/response.go index 40edf9ca24..8b15f3dc45 100644 --- a/typedapi/watcher/stop/response.go +++ b/typedapi/watcher/stop/response.go @@ -16,14 +16,13 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package stop // Response holds the response body struct for the package stop // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/watcher/stop/WatcherStopResponse.ts#L22-L24 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/watcher/stop/WatcherStopResponse.ts#L22-L24 type Response struct { // Acknowledged For a successful response, this value is always true. On failure, an diff --git a/typedapi/watcher/stop/stop.go b/typedapi/watcher/stop/stop.go index 5aa17b0e3b..2902db3dee 100644 --- a/typedapi/watcher/stop/stop.go +++ b/typedapi/watcher/stop/stop.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Stops Watcher if it is running. package stop import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Stop struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewStop type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *Stop { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Stop) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Stop) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Stop) Perform(ctx context.Context) (*http.Response, error) { +func (r Stop) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.stop") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.stop") + if reader := instrument.RecordRequestBody(ctx, "watcher.stop", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.stop") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Stop query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Stop query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a stop.Response -func (r Stop) Do(ctx context.Context) (*Response, error) { +func (r Stop) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.stop") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Stop) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Stop) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Stop) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Stop) IsSuccess(ctx context.Context) (bool, error) { +func (r Stop) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.stop") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Stop) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Stop query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/watcher/updatesettings/update_settings.go b/typedapi/watcher/updatesettings/update_settings.go index c06028f981..e68dd8850a 100644 --- a/typedapi/watcher/updatesettings/update_settings.go +++ b/typedapi/watcher/updatesettings/update_settings.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Update settings for the watcher system index package updatesettings import ( - gobytes "bytes" "context" "errors" "fmt" @@ -45,9 +44,13 @@ type UpdateSettings struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUpdateSettings type alias for index. @@ -71,7 +74,12 @@ func New(tp elastictransport.Interface) *UpdateSettings { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -106,15 +114,15 @@ func (r *UpdateSettings) HttpRequest(ctx context.Context) (*http.Request, error) } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() if req.Header.Get("Content-Type") == "" { - if r.buf.Len() > 0 { + if r.raw != nil { req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=8") } } @@ -131,15 +139,42 @@ func (r *UpdateSettings) HttpRequest(ctx context.Context) (*http.Request, error) } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r UpdateSettings) Perform(ctx context.Context) (*http.Response, error) { +func (r UpdateSettings) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "watcher.update_settings") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "watcher.update_settings") + if reader := instrument.RecordRequestBody(ctx, "watcher.update_settings", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "watcher.update_settings") + } if err != nil { - return nil, fmt.Errorf("an error happened during the UpdateSettings query execution: %w", err) + localErr := fmt.Errorf("an error happened during the UpdateSettings query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil @@ -152,7 +187,17 @@ func (r UpdateSettings) Do(ctx context.Context) (bool, error) { // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r UpdateSettings) IsSuccess(ctx context.Context) (bool, error) { +func (r UpdateSettings) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "watcher.update_settings") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -168,6 +213,14 @@ func (r UpdateSettings) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the UpdateSettings query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/xpack/info/info.go b/typedapi/xpack/info/info.go index 1972bc887d..bfcb86a4f3 100644 --- a/typedapi/xpack/info/info.go +++ b/typedapi/xpack/info/info.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves information about the installed X-Pack features. package info import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -48,9 +47,13 @@ type Info struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewInfo type alias for index. @@ -74,7 +77,12 @@ func New(tp elastictransport.Interface) *Info { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -107,9 +115,9 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -126,27 +134,66 @@ func (r *Info) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Info) Perform(ctx context.Context) (*http.Response, error) { +func (r Info) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "xpack.info") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "xpack.info") + if reader := instrument.RecordRequestBody(ctx, "xpack.info", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "xpack.info") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Info query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Info query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a info.Response -func (r Info) Do(ctx context.Context) (*Response, error) { +func (r Info) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "xpack.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -154,6 +201,9 @@ func (r Info) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -163,6 +213,9 @@ func (r Info) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -170,12 +223,25 @@ func (r Info) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Info) IsSuccess(ctx context.Context) (bool, error) { +func (r Info) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "xpack.info") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -191,6 +257,14 @@ func (r Info) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Info query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil } diff --git a/typedapi/xpack/info/response.go b/typedapi/xpack/info/response.go index 01d2006440..abb75e73df 100644 --- a/typedapi/xpack/info/response.go +++ b/typedapi/xpack/info/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package info @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package info // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/info/XPackInfoResponse.ts#L22-L29 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/info/XPackInfoResponse.ts#L22-L29 type Response struct { Build types.BuildInformation `json:"build"` Features types.XpackFeatures `json:"features"` diff --git a/typedapi/xpack/usage/response.go b/typedapi/xpack/usage/response.go index 39d43e1740..1a6531e50c 100644 --- a/typedapi/xpack/usage/response.go +++ b/typedapi/xpack/usage/response.go @@ -16,7 +16,7 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe package usage @@ -26,8 +26,7 @@ import ( // Response holds the response body struct for the package usage // -// https://github.com/elastic/elasticsearch-specification/blob/e279583a47508af40eb07b84694c5aae7885aa09/specification/xpack/usage/XPackUsageResponse.ts#L43-L79 - +// https://github.com/elastic/elasticsearch-specification/blob/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe/specification/xpack/usage/XPackUsageResponse.ts#L43-L79 type Response struct { AggregateMetric types.Base `json:"aggregate_metric"` Analytics types.Analytics `json:"analytics"` diff --git a/typedapi/xpack/usage/usage.go b/typedapi/xpack/usage/usage.go index 7636a04740..32ef9f961a 100644 --- a/typedapi/xpack/usage/usage.go +++ b/typedapi/xpack/usage/usage.go @@ -16,13 +16,12 @@ // under the License. // Code generated from the elasticsearch-specification DO NOT EDIT. -// https://github.com/elastic/elasticsearch-specification/tree/e279583a47508af40eb07b84694c5aae7885aa09 +// https://github.com/elastic/elasticsearch-specification/tree/5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe // Retrieves usage information about the installed X-Pack features. package usage import ( - gobytes "bytes" "context" "encoding/json" "errors" @@ -47,9 +46,13 @@ type Usage struct { values url.Values path url.URL - buf *gobytes.Buffer + raw io.Reader paramSet int + + spanStarted bool + + instrument elastictransport.Instrumentation } // NewUsage type alias for index. @@ -73,7 +76,12 @@ func New(tp elastictransport.Interface) *Usage { transport: tp, values: make(url.Values), headers: make(http.Header), - buf: gobytes.NewBuffer(nil), + } + + if instrumented, ok := r.transport.(elastictransport.Instrumented); ok { + if instrument := instrumented.InstrumentationEnabled(); instrument != nil { + r.instrument = instrument + } } return r @@ -108,9 +116,9 @@ func (r *Usage) HttpRequest(ctx context.Context) (*http.Request, error) { } if ctx != nil { - req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf) + req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.raw) } else { - req, err = http.NewRequest(method, r.path.String(), r.buf) + req, err = http.NewRequest(method, r.path.String(), r.raw) } req.Header = r.headers.Clone() @@ -127,27 +135,66 @@ func (r *Usage) HttpRequest(ctx context.Context) (*http.Request, error) { } // Perform runs the http.Request through the provided transport and returns an http.Response. -func (r Usage) Perform(ctx context.Context) (*http.Response, error) { +func (r Usage) Perform(providedCtx context.Context) (*http.Response, error) { + var ctx context.Context + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + if r.spanStarted == false { + ctx := instrument.Start(providedCtx, "xpack.usage") + defer instrument.Close(ctx) + } + } + if ctx == nil { + ctx = providedCtx + } + req, err := r.HttpRequest(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.BeforeRequest(req, "xpack.usage") + if reader := instrument.RecordRequestBody(ctx, "xpack.usage", r.raw); reader != nil { + req.Body = reader + } + } res, err := r.transport.Perform(req) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.AfterRequest(req, "elasticsearch", "xpack.usage") + } if err != nil { - return nil, fmt.Errorf("an error happened during the Usage query execution: %w", err) + localErr := fmt.Errorf("an error happened during the Usage query execution: %w", err) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, localErr) + } + return nil, localErr } return res, nil } // Do runs the request through the transport, handle the response and returns a usage.Response -func (r Usage) Do(ctx context.Context) (*Response, error) { +func (r Usage) Do(providedCtx context.Context) (*Response, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "xpack.usage") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } response := NewResponse() res, err := r.Perform(ctx) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } defer res.Body.Close() @@ -155,6 +202,9 @@ func (r Usage) Do(ctx context.Context) (*Response, error) { if res.StatusCode < 299 { err = json.NewDecoder(res.Body).Decode(response) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -164,6 +214,9 @@ func (r Usage) Do(ctx context.Context) (*Response, error) { errorResponse := types.NewElasticsearchError() err = json.NewDecoder(res.Body).Decode(errorResponse) if err != nil { + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } return nil, err } @@ -171,12 +224,25 @@ func (r Usage) Do(ctx context.Context) (*Response, error) { errorResponse.Status = res.StatusCode } + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, errorResponse) + } return nil, errorResponse } // IsSuccess allows to run a query with a context and retrieve the result as a boolean. // This only exists for endpoints without a request payload and allows for quick control flow. -func (r Usage) IsSuccess(ctx context.Context) (bool, error) { +func (r Usage) IsSuccess(providedCtx context.Context) (bool, error) { + var ctx context.Context + r.spanStarted = true + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + ctx = instrument.Start(providedCtx, "xpack.usage") + defer instrument.Close(ctx) + } + if ctx == nil { + ctx = providedCtx + } + res, err := r.Perform(ctx) if err != nil { @@ -192,6 +258,14 @@ func (r Usage) IsSuccess(ctx context.Context) (bool, error) { return true, nil } + if res.StatusCode != 404 { + err := fmt.Errorf("an error happened during the Usage query execution, status code: %d", res.StatusCode) + if instrument, ok := r.instrument.(elastictransport.Instrumentation); ok { + instrument.RecordError(ctx, err) + } + return false, err + } + return false, nil }