Showing preview only (3,175K chars total). Download the full file or copy to clipboard to get everything.
Repository: olivere/elastic
Branch: release-branch.v7
Commit: 4cdb89f6e627
Files: 646
Total size: 2.9 MB
Directory structure:
gitextract_wuqpv25u/
├── .github/
│ └── workflows/
│ ├── codeql-v7.yml
│ └── test-v7.yml
├── .gitignore
├── CHANGELOG-3.0.md
├── CHANGELOG-5.0.md
├── CHANGELOG-6.0.md
├── CHANGELOG-7.0.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── CONTRIBUTORS
├── ISSUE_TEMPLATE.md
├── LICENSE
├── Makefile
├── README.md
├── acknowledged_response.go
├── aws/
│ ├── sign_v4.go
│ ├── sign_v4_test.go
│ └── v4/
│ ├── CREDITS
│ ├── aws_v4.go
│ └── aws_v4_test.go
├── backoff.go
├── backoff_test.go
├── bulk.go
├── bulk_create_request.go
├── bulk_create_request_easyjson.go
├── bulk_create_request_test.go
├── bulk_delete_request.go
├── bulk_delete_request_easyjson.go
├── bulk_delete_request_test.go
├── bulk_index_request.go
├── bulk_index_request_easyjson.go
├── bulk_index_request_test.go
├── bulk_processor.go
├── bulk_processor_test.go
├── bulk_request.go
├── bulk_test.go
├── bulk_update_request.go
├── bulk_update_request_easyjson.go
├── bulk_update_request_test.go
├── canonicalize.go
├── canonicalize_test.go
├── cat_aliases.go
├── cat_aliases_test.go
├── cat_allocation.go
├── cat_allocation_test.go
├── cat_count.go
├── cat_count_integration_test.go
├── cat_count_test.go
├── cat_fielddata.go
├── cat_fielddata_test.go
├── cat_health.go
├── cat_health_test.go
├── cat_indices.go
├── cat_indices_test.go
├── cat_master.go
├── cat_master_test.go
├── cat_shards.go
├── cat_shards_test.go
├── cat_snapshots.go
├── cat_snapshots_integration_test.go
├── cat_snapshots_test.go
├── clear_scroll.go
├── clear_scroll_test.go
├── client.go
├── client_test.go
├── cluster-test/
│ ├── Makefile
│ ├── README.md
│ └── cluster-test.go
├── cluster_health.go
├── cluster_health_test.go
├── cluster_reroute.go
├── cluster_reroute_test.go
├── cluster_state.go
├── cluster_state_test.go
├── cluster_stats.go
├── cluster_stats_integration_test.go
├── cluster_stats_test.go
├── config/
│ ├── config.go
│ ├── config_test.go
│ └── doc.go
├── connection.go
├── count.go
├── count_test.go
├── decoder.go
├── decoder_test.go
├── delete.go
├── delete_by_query.go
├── delete_by_query_test.go
├── delete_test.go
├── doc.go
├── docker-compose.cluster.yml
├── docker-compose.yml
├── docvalue_field.go
├── docvalue_field_test.go
├── errors.go
├── errors_test.go
├── example_test.go
├── exists.go
├── exists_test.go
├── explain.go
├── explain_test.go
├── fetch_source_context.go
├── fetch_source_context_test.go
├── field_caps.go
├── field_caps_test.go
├── geo_point.go
├── geo_point_test.go
├── get.go
├── get_test.go
├── go.mod
├── highlight.go
├── highlight_test.go
├── index.go
├── index_test.go
├── indices_analyze.go
├── indices_analyze_test.go
├── indices_clear_cache.go
├── indices_clear_cache_test.go
├── indices_close.go
├── indices_close_test.go
├── indices_component_templates_test.go
├── indices_create.go
├── indices_create_test.go
├── indices_delete.go
├── indices_delete_component_template.go
├── indices_delete_index_template.go
├── indices_delete_integration_test.go
├── indices_delete_template.go
├── indices_delete_test.go
├── indices_exists.go
├── indices_exists_template.go
├── indices_exists_template_test.go
├── indices_exists_test.go
├── indices_flush.go
├── indices_flush_synced.go
├── indices_flush_synced_test.go
├── indices_flush_test.go
├── indices_forcemerge.go
├── indices_forcemerge_test.go
├── indices_freeze.go
├── indices_freeze_test.go
├── indices_get.go
├── indices_get_aliases.go
├── indices_get_aliases_test.go
├── indices_get_component_template.go
├── indices_get_field_mapping.go
├── indices_get_field_mapping_test.go
├── indices_get_index_template.go
├── indices_get_index_template_test.go
├── indices_get_mapping.go
├── indices_get_mapping_test.go
├── indices_get_settings.go
├── indices_get_settings_test.go
├── indices_get_template.go
├── indices_get_template_test.go
├── indices_get_test.go
├── indices_index_templates_test.go
├── indices_open.go
├── indices_open_test.go
├── indices_put_alias.go
├── indices_put_alias_test.go
├── indices_put_component_template.go
├── indices_put_index_template.go
├── indices_put_mapping.go
├── indices_put_mapping_test.go
├── indices_put_settings.go
├── indices_put_settings_test.go
├── indices_put_template.go
├── indices_refresh.go
├── indices_refresh_test.go
├── indices_rollover.go
├── indices_rollover_test.go
├── indices_segments.go
├── indices_segments_test.go
├── indices_shrink.go
├── indices_shrink_test.go
├── indices_stats.go
├── indices_stats_test.go
├── indices_unfreeze.go
├── indices_unfreeze_test.go
├── ingest_delete_pipeline.go
├── ingest_delete_pipeline_test.go
├── ingest_get_pipeline.go
├── ingest_get_pipeline_test.go
├── ingest_put_pipeline.go
├── ingest_put_pipeline_test.go
├── ingest_simulate_pipeline.go
├── ingest_simulate_pipeline_test.go
├── inner_hit.go
├── inner_hit_test.go
├── logger.go
├── mget.go
├── mget_test.go
├── msearch.go
├── msearch_test.go
├── mtermvectors.go
├── mtermvectors_test.go
├── nodes_info.go
├── nodes_info_test.go
├── nodes_stats.go
├── nodes_stats_test.go
├── percolate_test.go
├── ping.go
├── ping_test.go
├── pit.go
├── pit_close.go
├── pit_open.go
├── pit_test.go
├── plugins.go
├── plugins_test.go
├── query.go
├── recipes/
│ ├── aws-connect/
│ │ ├── .gitignore
│ │ └── main.go
│ ├── aws-connect-v4/
│ │ ├── .gitignore
│ │ └── main.go
│ ├── aws-mapping-v4/
│ │ ├── .gitignore
│ │ └── main.go
│ ├── bulk_insert/
│ │ ├── .gitignore
│ │ └── bulk_insert.go
│ ├── bulk_processor/
│ │ ├── .gitignore
│ │ └── main.go
│ ├── connect/
│ │ ├── .gitignore
│ │ └── connect.go
│ ├── connect_with_config/
│ │ ├── .gitignore
│ │ └── connect_with_config.go
│ ├── go.mod
│ ├── go.sum
│ ├── mapping/
│ │ ├── .gitignore
│ │ └── mapping.go
│ ├── middleware/
│ │ ├── .gitignore
│ │ └── main.go
│ ├── scroll/
│ │ ├── .gitignore
│ │ └── scroll.go
│ ├── search_with_point_in_time/
│ │ ├── .gitignore
│ │ └── search.go
│ ├── sliced_scroll/
│ │ ├── .gitignore
│ │ └── sliced_scroll.go
│ ├── suggesters/
│ │ └── completion/
│ │ ├── .gitignore
│ │ └── main.go
│ ├── text_vs_keyword/
│ │ ├── .gitignore
│ │ └── main.go
│ └── tracing/
│ ├── .gitignore
│ ├── README.md
│ ├── otel/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── run-tracer.sh
│ │ └── tracing.go
│ ├── run-tracer.sh
│ └── tracing.go
├── reindex.go
├── reindex_test.go
├── request.go
├── request_test.go
├── rescore.go
├── rescorer.go
├── response.go
├── response_test.go
├── retrier.go
├── retrier_test.go
├── retry.go
├── retry_test.go
├── runtime_mappings.go
├── runtime_mappings_test.go
├── script.go
├── script_delete.go
├── script_delete_test.go
├── script_get.go
├── script_get_test.go
├── script_put.go
├── script_put_test.go
├── script_test.go
├── scroll.go
├── scroll_test.go
├── search.go
├── search_aggs.go
├── search_aggs_bucket_adjacency_matrix.go
├── search_aggs_bucket_adjacency_matrix_test.go
├── search_aggs_bucket_auto_date_histogram.go
├── search_aggs_bucket_auto_date_histogram_test.go
├── search_aggs_bucket_children.go
├── search_aggs_bucket_children_test.go
├── search_aggs_bucket_composite.go
├── search_aggs_bucket_composite_test.go
├── search_aggs_bucket_count_thresholds.go
├── search_aggs_bucket_date_histogram.go
├── search_aggs_bucket_date_histogram_test.go
├── search_aggs_bucket_date_range.go
├── search_aggs_bucket_date_range_test.go
├── search_aggs_bucket_diversified_sampler.go
├── search_aggs_bucket_diversified_sampler_test.go
├── search_aggs_bucket_filter.go
├── search_aggs_bucket_filter_test.go
├── search_aggs_bucket_filters.go
├── search_aggs_bucket_filters_test.go
├── search_aggs_bucket_geo_distance.go
├── search_aggs_bucket_geo_distance_test.go
├── search_aggs_bucket_geohash_grid.go
├── search_aggs_bucket_geohash_grid_test.go
├── search_aggs_bucket_geotile_grid.go
├── search_aggs_bucket_geotile_grid_test.go
├── search_aggs_bucket_global.go
├── search_aggs_bucket_global_test.go
├── search_aggs_bucket_histogram.go
├── search_aggs_bucket_histogram_test.go
├── search_aggs_bucket_ip_range.go
├── search_aggs_bucket_ip_range_test.go
├── search_aggs_bucket_missing.go
├── search_aggs_bucket_missing_test.go
├── search_aggs_bucket_multi_terms.go
├── search_aggs_bucket_multi_terms_test.go
├── search_aggs_bucket_nested.go
├── search_aggs_bucket_nested_test.go
├── search_aggs_bucket_range.go
├── search_aggs_bucket_range_test.go
├── search_aggs_bucket_rare_terms.go
├── search_aggs_bucket_rare_terms_test.go
├── search_aggs_bucket_reverse_nested.go
├── search_aggs_bucket_reverse_nested_test.go
├── search_aggs_bucket_sampler.go
├── search_aggs_bucket_sampler_test.go
├── search_aggs_bucket_significant_terms.go
├── search_aggs_bucket_significant_terms_test.go
├── search_aggs_bucket_significant_text.go
├── search_aggs_bucket_significant_text_test.go
├── search_aggs_bucket_terms.go
├── search_aggs_bucket_terms_integration_test.go
├── search_aggs_bucket_terms_test.go
├── search_aggs_matrix_stats.go
├── search_aggs_matrix_stats_test.go
├── search_aggs_metrics_avg.go
├── search_aggs_metrics_avg_test.go
├── search_aggs_metrics_cardinality.go
├── search_aggs_metrics_cardinality_test.go
├── search_aggs_metrics_extended_stats.go
├── search_aggs_metrics_extended_stats_test.go
├── search_aggs_metrics_geo_bounds.go
├── search_aggs_metrics_geo_bounds_test.go
├── search_aggs_metrics_geo_centroid.go
├── search_aggs_metrics_geo_centroid_test.go
├── search_aggs_metrics_max.go
├── search_aggs_metrics_max_test.go
├── search_aggs_metrics_median_absolute_deviation.go
├── search_aggs_metrics_median_absolute_deviation_test.go
├── search_aggs_metrics_min.go
├── search_aggs_metrics_min_test.go
├── search_aggs_metrics_percentile_ranks.go
├── search_aggs_metrics_percentile_ranks_test.go
├── search_aggs_metrics_percentiles.go
├── search_aggs_metrics_percentiles_test.go
├── search_aggs_metrics_scripted_metric.go
├── search_aggs_metrics_scripted_metric_test.go
├── search_aggs_metrics_stats.go
├── search_aggs_metrics_stats_test.go
├── search_aggs_metrics_sum.go
├── search_aggs_metrics_sum_test.go
├── search_aggs_metrics_top_hits.go
├── search_aggs_metrics_top_hits_test.go
├── search_aggs_metrics_top_metrics.go
├── search_aggs_metrics_top_metrics_test.go
├── search_aggs_metrics_value_count.go
├── search_aggs_metrics_value_count_test.go
├── search_aggs_metrics_weighted_avg.go
├── search_aggs_metrics_weighted_avg_test.go
├── search_aggs_pipeline_avg_bucket.go
├── search_aggs_pipeline_avg_bucket_test.go
├── search_aggs_pipeline_bucket_script.go
├── search_aggs_pipeline_bucket_script_test.go
├── search_aggs_pipeline_bucket_selector.go
├── search_aggs_pipeline_bucket_selector_test.go
├── search_aggs_pipeline_bucket_sort.go
├── search_aggs_pipeline_bucket_sort_test.go
├── search_aggs_pipeline_cumulative_sum.go
├── search_aggs_pipeline_cumulative_sum_test.go
├── search_aggs_pipeline_derivative.go
├── search_aggs_pipeline_derivative_test.go
├── search_aggs_pipeline_extended_stats_bucket.go
├── search_aggs_pipeline_extended_stats_bucket_test.go
├── search_aggs_pipeline_max_bucket.go
├── search_aggs_pipeline_max_bucket_test.go
├── search_aggs_pipeline_min_bucket.go
├── search_aggs_pipeline_min_bucket_test.go
├── search_aggs_pipeline_mov_avg.go
├── search_aggs_pipeline_mov_avg_test.go
├── search_aggs_pipeline_mov_fn.go
├── search_aggs_pipeline_mov_fn_test.go
├── search_aggs_pipeline_percentiles_bucket.go
├── search_aggs_pipeline_percentiles_bucket_test.go
├── search_aggs_pipeline_serial_diff.go
├── search_aggs_pipeline_serial_diff_test.go
├── search_aggs_pipeline_stats_bucket.go
├── search_aggs_pipeline_stats_bucket_test.go
├── search_aggs_pipeline_sum_bucket.go
├── search_aggs_pipeline_sum_bucket_test.go
├── search_aggs_pipeline_test.go
├── search_aggs_test.go
├── search_collapse_builder.go
├── search_collapse_builder_test.go
├── search_queries_bool.go
├── search_queries_bool_test.go
├── search_queries_boosting.go
├── search_queries_boosting_test.go
├── search_queries_combined_fields.go
├── search_queries_combined_fields_test.go
├── search_queries_common_terms.go
├── search_queries_common_terms_test.go
├── search_queries_constant_score.go
├── search_queries_constant_score_test.go
├── search_queries_dis_max.go
├── search_queries_dis_max_test.go
├── search_queries_distance_feature_query.go
├── search_queries_distance_feature_query_test.go
├── search_queries_exists.go
├── search_queries_exists_test.go
├── search_queries_fsq.go
├── search_queries_fsq_score_funcs.go
├── search_queries_fsq_test.go
├── search_queries_fuzzy.go
├── search_queries_fuzzy_test.go
├── search_queries_geo_bounding_box.go
├── search_queries_geo_bounding_box_test.go
├── search_queries_geo_distance.go
├── search_queries_geo_distance_test.go
├── search_queries_geo_polygon.go
├── search_queries_geo_polygon_test.go
├── search_queries_has_child.go
├── search_queries_has_child_test.go
├── search_queries_has_parent.go
├── search_queries_has_parent_test.go
├── search_queries_ids.go
├── search_queries_ids_test.go
├── search_queries_interval.go
├── search_queries_interval_filter.go
├── search_queries_interval_integration_test.go
├── search_queries_interval_rules_all_of.go
├── search_queries_interval_rules_any_of.go
├── search_queries_interval_rules_fuzzy.go
├── search_queries_interval_rules_match.go
├── search_queries_interval_rules_prefix.go
├── search_queries_interval_rules_wildcard.go
├── search_queries_interval_test.go
├── search_queries_match.go
├── search_queries_match_all.go
├── search_queries_match_all_test.go
├── search_queries_match_bool_prefix.go
├── search_queries_match_bool_prefix_test.go
├── search_queries_match_none.go
├── search_queries_match_none_test.go
├── search_queries_match_phrase.go
├── search_queries_match_phrase_prefix.go
├── search_queries_match_phrase_prefix_test.go
├── search_queries_match_phrase_test.go
├── search_queries_match_test.go
├── search_queries_more_like_this.go
├── search_queries_more_like_this_test.go
├── search_queries_multi_match.go
├── search_queries_multi_match_test.go
├── search_queries_nested.go
├── search_queries_nested_test.go
├── search_queries_parent_id.go
├── search_queries_parent_id_test.go
├── search_queries_percolator.go
├── search_queries_percolator_test.go
├── search_queries_pinned.go
├── search_queries_pinned_test.go
├── search_queries_prefix.go
├── search_queries_prefix_example_test.go
├── search_queries_prefix_test.go
├── search_queries_query_string.go
├── search_queries_query_string_test.go
├── search_queries_range.go
├── search_queries_range_test.go
├── search_queries_rank_feature.go
├── search_queries_rank_feature_test.go
├── search_queries_raw_string.go
├── search_queries_raw_string_test.go
├── search_queries_regexp.go
├── search_queries_regexp_test.go
├── search_queries_script.go
├── search_queries_script_score.go
├── search_queries_script_score_test.go
├── search_queries_script_test.go
├── search_queries_simple_query_string.go
├── search_queries_simple_query_string_test.go
├── search_queries_slice.go
├── search_queries_slice_test.go
├── search_queries_span_first.go
├── search_queries_span_first_integration_test.go
├── search_queries_span_first_test.go
├── search_queries_span_near.go
├── search_queries_span_near_integration_test.go
├── search_queries_span_near_test.go
├── search_queries_span_term.go
├── search_queries_span_term_integration_test.go
├── search_queries_span_term_test.go
├── search_queries_term.go
├── search_queries_term_test.go
├── search_queries_terms.go
├── search_queries_terms_set.go
├── search_queries_terms_set_test.go
├── search_queries_terms_test.go
├── search_queries_type.go
├── search_queries_type_test.go
├── search_queries_wildcard.go
├── search_queries_wildcard_test.go
├── search_queries_wrapper.go
├── search_queries_wrapper_integration_test.go
├── search_queries_wrapper_test.go
├── search_request.go
├── search_request_test.go
├── search_shards.go
├── search_shards_test.go
├── search_source.go
├── search_source_test.go
├── search_suggester_test.go
├── search_terms_lookup.go
├── search_terms_lookup_test.go
├── search_test.go
├── setup_test.go
├── snapshot_create.go
├── snapshot_create_repository.go
├── snapshot_create_repository_test.go
├── snapshot_create_test.go
├── snapshot_delete.go
├── snapshot_delete_repository.go
├── snapshot_delete_repository_test.go
├── snapshot_delete_test.go
├── snapshot_get.go
├── snapshot_get_repository.go
├── snapshot_get_repository_test.go
├── snapshot_get_test.go
├── snapshot_restore.go
├── snapshot_restore_test.go
├── snapshot_status.go
├── snapshot_status_test.go
├── snapshot_verify_repository.go
├── snapshot_verify_repository_test.go
├── sort.go
├── sort_test.go
├── suggest_field.go
├── suggest_field_test.go
├── suggester.go
├── suggester_completion.go
├── suggester_completion_test.go
├── suggester_context.go
├── suggester_context_category.go
├── suggester_context_category_test.go
├── suggester_context_geo.go
├── suggester_context_geo_test.go
├── suggester_context_test.go
├── suggester_phrase.go
├── suggester_phrase_test.go
├── suggester_term.go
├── suggester_term_test.go
├── tasks_cancel.go
├── tasks_cancel_test.go
├── tasks_get_task.go
├── tasks_get_task_test.go
├── tasks_list.go
├── tasks_list_test.go
├── termvectors.go
├── termvectors_test.go
├── trace/
│ ├── opencensus/
│ │ ├── transport.go
│ │ ├── transport_test.go
│ │ └── util.go
│ ├── opentelemetry/
│ │ ├── transport.go
│ │ └── util.go
│ └── opentracing/
│ ├── transport.go
│ ├── transport_integration_test.go
│ ├── transport_test.go
│ └── util.go
├── update.go
├── update_by_query.go
├── update_by_query_test.go
├── update_integration_test.go
├── update_test.go
├── uritemplates/
│ ├── LICENSE
│ ├── uritemplates.go
│ ├── utils.go
│ └── utils_test.go
├── validate.go
├── validate_test.go
├── xpack_async_search_delete.go
├── xpack_async_search_get.go
├── xpack_async_search_submit.go
├── xpack_async_search_test.go
├── xpack_ilm_delete_lifecycle.go
├── xpack_ilm_get_lifecycle.go
├── xpack_ilm_put_lifecycle.go
├── xpack_ilm_test.go
├── xpack_info.go
├── xpack_info_test.go
├── xpack_rollup_delete.go
├── xpack_rollup_delete_test.go
├── xpack_rollup_get.go
├── xpack_rollup_get_test.go
├── xpack_rollup_put.go
├── xpack_rollup_put_test.go
├── xpack_rollup_start.go
├── xpack_rollup_start_test.go
├── xpack_rollup_stop.go
├── xpack_rollup_stop_test.go
├── xpack_security_change_password.go
├── xpack_security_change_password_test.go
├── xpack_security_delete_role.go
├── xpack_security_delete_role_mapping.go
├── xpack_security_delete_role_mapping_test.go
├── xpack_security_delete_role_test.go
├── xpack_security_delete_user.go
├── xpack_security_delete_user_test.go
├── xpack_security_disable_user.go
├── xpack_security_disable_user_test.go
├── xpack_security_enable_user.go
├── xpack_security_enable_user_test.go
├── xpack_security_get_role.go
├── xpack_security_get_role_mapping.go
├── xpack_security_get_role_mapping_test.go
├── xpack_security_get_role_test.go
├── xpack_security_get_user.go
├── xpack_security_get_user_test.go
├── xpack_security_put_role.go
├── xpack_security_put_role_mapping.go
├── xpack_security_put_role_mapping_test.go
├── xpack_security_put_role_test.go
├── xpack_security_put_user.go
├── xpack_security_put_user_test.go
├── xpack_test.go
├── xpack_watcher_ack_watch.go
├── xpack_watcher_ack_watch_test.go
├── xpack_watcher_activate_watch.go
├── xpack_watcher_activate_watch_test.go
├── xpack_watcher_deactivate_watch.go
├── xpack_watcher_deactivate_watch_test.go
├── xpack_watcher_delete_watch.go
├── xpack_watcher_delete_watch_test.go
├── xpack_watcher_execute_watch.go
├── xpack_watcher_execute_watch_test.go
├── xpack_watcher_get_watch.go
├── xpack_watcher_get_watch_test.go
├── xpack_watcher_put_watch.go
├── xpack_watcher_put_watch_test.go
├── xpack_watcher_start.go
├── xpack_watcher_start_test.go
├── xpack_watcher_stats.go
├── xpack_watcher_stats_test.go
├── xpack_watcher_stop.go
└── xpack_watcher_stop_test.go
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/codeql-v7.yml
================================================
name: "Code scanning - action"
on:
push:
branches:
- '*.v7'
pull_request:
branches:
- '*.v7'
schedule:
- cron: '0 19 * * 3'
jobs:
codeql:
strategy:
matrix:
go: [stable]
os: [ubuntu-latest]
name: Run ${{ matrix.go }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Prepare tests
run: |
sudo apt-get install -y netcat
sudo sysctl -w vm.max_map_count=262144
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: go
- name: Run Docker containers
run: docker compose up -d
- name: Check Docker containers
run: docker ps -a
- name: Get dependencies
run: |
go get -u github.com/google/go-cmp/cmp
go get -u github.com/fortytw2/leaktest
go get . ./aws/... ./config/... ./trace/... ./uritemplates/...
- name: Wait for Elasticsearch
run: |
while ! nc -z localhost 9200; do sleep 1; done
while ! nc -z localhost 9210; do sleep 1; done
sleep 5
- name: Run the tests
run: |
go test -race -deprecations -strict-decoder -v . ./aws/... ./config/... ./trace/... ./uritemplates/...
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
================================================
FILE: .github/workflows/test-v7.yml
================================================
on:
push:
branches:
- '*.v7'
pull_request:
branches:
- '*.v7'
name: Test v7
jobs:
test:
strategy:
matrix:
go: [stable]
os: [ubuntu-latest]
name: Run ${{ matrix.go }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Prepare tests
run: |
sudo apt-get install -y netcat
sudo sysctl -w vm.max_map_count=262144
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Docker containers
run: docker compose up -d
- name: Check Docker containers
run: docker ps -a
- name: Get dependencies
run: |
go get -u github.com/google/go-cmp/cmp
go get -u github.com/fortytw2/leaktest
go get . ./aws/... ./config/... ./trace/... ./uritemplates/...
- name: Wait for Elasticsearch
run: |
while ! nc -z localhost 9200; do sleep 1; done
while ! nc -z localhost 9210; do sleep 1; done
- name: Run the tests
run: |
go test -race -deprecations -strict-decoder -v . ./aws/... ./config/... ./trace/... ./uritemplates/...
================================================
FILE: .gitignore
================================================
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
.envrc
/.vscode/
/.idea/
/data
/debug.test
/generator
/cluster-test/cluster-test
/cluster-test/*.log
/cluster-test/es-chaos-monkey
/dist
/go.sum
/spec
/tmp
/CHANGELOG-3.0.html
================================================
FILE: CHANGELOG-3.0.md
================================================
# Elastic 3.0
Elasticsearch 2.0 comes with some [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/breaking-changes-2.0.html). You will probably need to upgrade your application and/or rewrite part of it due to those changes.
We use that window of opportunity to also update Elastic (the Go client) from version 2.0 to 3.0. This will introduce both changes due to the Elasticsearch 2.0 update as well as changes that make Elastic cleaner by removing some old cruft.
So, to summarize:
1. Elastic 2.0 is compatible with Elasticsearch 1.7+ and is still actively maintained.
2. Elastic 3.0 is compatible with Elasticsearch 2.0+ and will soon become the new master branch.
The rest of the document is a list of all changes in Elastic 3.0.
## Pointer types
All types have changed to be pointer types, not value types. This not only is cleaner but also simplifies the API as illustrated by the following example:
Example for Elastic 2.0 (old):
```go
q := elastic.NewMatchAllQuery()
res, err := elastic.Search("one").Query(&q).Do() // notice the & here
```
Example for Elastic 3.0 (new):
```go
q := elastic.NewMatchAllQuery()
res, err := elastic.Search("one").Query(q).Do() // no more &
// ... which can be simplified as:
res, err := elastic.Search("one").Query(elastic.NewMatchAllQuery()).Do()
```
It also helps to prevent [subtle issues](https://github.com/olivere/elastic/issues/115#issuecomment-130753046).
## Query/filter merge
One of the biggest changes in Elasticsearch 2.0 is the [merge of queries and filters](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_query_dsl_changes.html#_queries_and_filters_merged). In Elasticsearch 1.x, you had a whole range of queries and filters that were basically identical (e.g. `term_query` and `term_filter`).
The practical aspect of the merge is that you can now basically use queries where once you had to use filters instead. For Elastic 3.0 this means: We could remove a whole bunch of files. Yay!
Notice that some methods still come by "filter", e.g. `PostFilter`. However, they accept a `Query` now when they used to accept a `Filter` before.
Example for Elastic 2.0 (old):
```go
q := elastic.NewMatchAllQuery()
f := elastic.NewTermFilter("tag", "important")
res, err := elastic.Search().Index("one").Query(&q).PostFilter(f)
```
Example for Elastic 3.0 (new):
```go
q := elastic.NewMatchAllQuery()
f := elastic.NewTermQuery("tag", "important") // it's a query now!
res, err := elastic.Search().Index("one").Query(q).PostFilter(f)
```
## Facets are removed
[Facets have been removed](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_removed_features.html#_facets_have_been_removed) in Elasticsearch 2.0. You need to use aggregations now.
## Errors
Elasticsearch 2.0 returns more information about an error in the HTTP response body. Elastic 3.0 now reads this information and makes it accessible by the consumer.
Errors and all its details are now returned in [`Error`](https://github.com/olivere/elastic/blob/release-branch.v3/errors.go#L59).
### HTTP Status 404 (Not Found)
When Elasticsearch does not find an entity or an index, it generally returns HTTP status code 404. In Elastic 2.0 this was a valid result and didn't raise an error from the `Do` functions. This has now changed in Elastic 3.0.
Starting with Elastic 3.0, there are only two types of responses considered successful. First, responses with HTTP status codes [200..299]. Second, HEAD requests which return HTTP status 404. The latter is used by Elasticsearch to e.g. check for existence of indices or documents. All other responses will return an error.
To check for HTTP Status 404 (with non-HEAD requests), e.g. when trying to get or delete a missing document, you can use the [`IsNotFound`](https://github.com/olivere/elastic/blob/release-branch.v3/errors.go#L84) helper (see below).
The following example illustrates how to check for a missing document in Elastic 2.0 and what has changed in 3.0.
Example for Elastic 2.0 (old):
```go
res, err = client.Get().Index("one").Type("tweet").Id("no-such-id").Do()
if err != nil {
// Something else went wrong (but 404 is NOT an error in Elastic 2.0)
}
if !res.Found {
// Document has not been found
}
```
Example for Elastic 3.0 (new):
```go
res, err = client.Get().Index("one").Type("tweet").Id("no-such-id").Do()
if err != nil {
if elastic.IsNotFound(err) {
// Document has not been found
} else {
// Something else went wrong
}
}
```
### HTTP Status 408 (Timeouts)
Elasticsearch now responds with HTTP status code 408 (Timeout) when a request fails due to a timeout. E.g. if you specify a timeout with the Cluster Health API, the HTTP response status will be 408 if the timeout is raised. See [here](https://github.com/elastic/elasticsearch/commit/fe3179d9cccb569784434b2135ca9ae13d5158d3) for the specific commit to the Cluster Health API.
To check for HTTP Status 408, we introduced the [`IsTimeout`](https://github.com/olivere/elastic/blob/release-branch.v3/errors.go#L101) helper.
Example for Elastic 2.0 (old):
```go
health, err := client.ClusterHealth().WaitForStatus("yellow").Timeout("1s").Do()
if err != nil {
// ...
}
if health.TimedOut {
// We have a timeout
}
```
Example for Elastic 3.0 (new):
```go
health, err := client.ClusterHealth().WaitForStatus("yellow").Timeout("1s").Do()
if elastic.IsTimeout(err) {
// We have a timeout
}
```
### Bulk Errors
The error response of a bulk operation used to be a simple string in Elasticsearch 1.x.
In Elasticsearch 2.0, it returns a structured JSON object with a lot more details about the error.
These errors are now captured in an object of type [`ErrorDetails`](https://github.com/olivere/elastic/blob/release-branch.v3/errors.go#L59) which is used in [`BulkResponseItem`](https://github.com/olivere/elastic/blob/release-branch.v3/bulk.go#L206).
### Removed specific Elastic errors
The specific error types `ErrMissingIndex`, `ErrMissingType`, and `ErrMissingId` have been removed. They were only used by `DeleteService` and are replaced by a generic error message.
## Numeric types
Elastic 3.0 has settled to use `float64` everywhere. It used to be a mix of `float32` and `float64` in Elastic 2.0. E.g. all boostable queries in Elastic 3.0 now have a boost type of `float64` where it used to be `float32`.
## Pluralization
Some services accept zero, one or more indices or types to operate on.
E.g. in the `SearchService` accepts a list of zero, one, or more indices to
search and therefor had a func called `Index(index string)` and a func
called `Indices(indices ...string)`.
Elastic 3.0 now only uses the singular form that, when applicable, accepts a
variadic type. E.g. in the case of the `SearchService`, you now only have
one func with the following signature: `Index(indices ...string)`.
Notice this is only limited to `Index(...)` and `Type(...)`. There are other
services with variadic functions. These have not been changed.
## Multiple calls to variadic functions
Some services with variadic functions have cleared the underlying slice when
called while other services just add to the existing slice. This has now been
normalized to always add to the underlying slice.
Example for Elastic 2.0 (old):
```go
// Would only cleared scroll id "two"
// because ScrollId cleared the values when called multiple times
client.ClearScroll().ScrollId("one").ScrollId("two").Do()
```
Example for Elastic 3.0 (new):
```go
// Now (correctly) clears both scroll id "one" and "two"
// because ScrollId no longer clears the values when called multiple times
client.ClearScroll().ScrollId("one").ScrollId("two").Do()
```
## Ping service requires URL
The `Ping` service raised some issues because it is different from all
other services. If not explicitly given a URL, it always pings `127.0.0.1:9200`.
Users expected to ping the cluster, but that is not possible as the cluster
can be a set of many nodes: So which node do we ping then?
To make it more clear, the `Ping` function on the client now requires users
to explicitly set the URL of the node to ping.
## Meta fields
Many of the meta fields e.g. `_parent` or `_routing` are now
[part of the top-level of a document](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_mapping_changes.html#migration-meta-fields)
and are no longer returned as parts of the `fields` object. We had to change
larger parts of e.g. the `Reindexer` to get it to work seamlessly with Elasticsearch 2.0.
Notice that all stored meta-fields are now [returned by default](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_crud_and_routing_changes.html#_all_stored_meta_fields_returned_by_default).
## HasParentQuery / HasChildQuery
`NewHasParentQuery` and `NewHasChildQuery` must now include both parent/child type and query. It is now in line with the Java API.
Example for Elastic 2.0 (old):
```go
allQ := elastic.NewMatchAllQuery()
q := elastic.NewHasChildFilter("tweet").Query(&allQ)
```
Example for Elastic 3.0 (new):
```go
q := elastic.NewHasChildQuery("tweet", elastic.NewMatchAllQuery())
```
## SetBasicAuth client option
You can now tell Elastic to pass HTTP Basic Auth credentials with each request. In previous versions of Elastic you had to set up your own `http.Transport` to do this. This should make it more convenient to use Elastic in combination with [Shield](https://www.elastic.co/products/shield) in its [basic setup](https://www.elastic.co/guide/en/shield/current/enable-basic-auth.html).
Example:
```go
client, err := elastic.NewClient(elastic.SetBasicAuth("user", "secret"))
if err != nil {
log.Fatal(err)
}
```
## Delete-by-Query API
The Delete-by-Query API is [a plugin now](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_removed_features.html#_delete_by_query_is_now_a_plugin). It is no longer core part of Elasticsearch. You can [install it as a plugin as described here](https://www.elastic.co/guide/en/elasticsearch/plugins/2.0/plugins-delete-by-query.html).
Elastic 3.0 still contains the `DeleteByQueryService`, but you need to install the plugin first. If you don't install it and use `DeleteByQueryService` you will most probably get a 404.
An older version of this document stated the following:
> Elastic 3.0 still contains the `DeleteByQueryService` but it will fail with `ErrPluginNotFound` when the plugin is not installed.
>
> Example for Elastic 3.0 (new):
>
> ```go
> _, err := client.DeleteByQuery().Query(elastic.NewTermQuery("client", "1")).Do()
> if err == elastic.ErrPluginNotFound {
> // Delete By Query API is not available
> }
> ```
I have decided that this is not a good way to handle the case of a missing plugin. The main reason is that with this logic, you'd always have to check if the plugin is missing in case of an error. This is not only slow, but it also puts logic into a service where it should really be just opaque and return the response of Elasticsearch.
If you rely on certain plugins to be installed, you should check on startup. That's where the following two helpers come into play.
## HasPlugin and SetRequiredPlugins
Some of the core functionality of Elasticsearch has now been moved into plugins. E.g. the Delete-by-Query API is [a plugin now](https://www.elastic.co/guide/en/elasticsearch/plugins/2.0/plugins-delete-by-query.html).
You need to make sure to add these plugins to your Elasticsearch installation to still be able to use the `DeleteByQueryService`. You can test this now with the `HasPlugin(name string)` helper in the client.
Example for Elastic 3.0 (new):
```go
err, found := client.HasPlugin("delete-by-query")
if err == nil && found {
// ... Delete By Query API is available
}
```
To simplify this process, there is now a `SetRequiredPlugins` helper that can be passed as an option func when creating a new client. If the plugin is not installed, the client wouldn't be created in the first place.
```go
// Will raise an error if the "delete-by-query" plugin is NOT installed
client, err := elastic.NewClient(elastic.SetRequiredPlugins("delete-by-query"))
if err != nil {
log.Fatal(err)
}
```
Notice that there also is a way to define [mandatory plugins](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-plugins.html#_mandatory_plugins) in the Elasticsearch configuration file.
## Common Query has been renamed to Common Terms Query
The `CommonQuery` has been renamed to `CommonTermsQuery` to be in line with the [Java API](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_java_api_changes.html#_query_filter_refactoring).
## Remove `MoreLikeThis` and `MoreLikeThisField`
The More Like This API and the More Like This Field query [have been removed](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_query_dsl_changes.html#_more_like_this) and replaced with the `MoreLikeThisQuery`.
## Remove Filtered Query
With the merge of queries and filters, the [filtered query became deprecated](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_query_dsl_changes.html#_literal_filtered_literal_query_and_literal_query_literal_filter_deprecated). While it is only deprecated and therefore still available in Elasticsearch 2.0, we have decided to remove it from Elastic 3.0. Why? Because we think that when you're already forced to rewrite many of your application code, it might be a good chance to get rid of things that are deprecated as well. So you might simply change your filtered query with a boolean query as [described here](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_query_dsl_changes.html#_literal_filtered_literal_query_and_literal_query_literal_filter_deprecated).
## Remove FuzzyLikeThis and FuzzyLikeThisField
Both have been removed from Elasticsearch 2.0 as well.
## Remove LimitFilter
The `limit` filter is [deprecated in Elasticsearch 2.0](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_query_dsl_changes.html#_literal_limit_literal_filter_deprecated) and becomes a no-op. Now is a good chance to remove it from your application as well. Use the `terminate_after` parameter in your search [as described here](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-request-body.html) to achieve similar effects.
## Remove `_cache` and `_cache_key` from filters
Both have been [removed from Elasticsearch 2.0 as well](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_query_dsl_changes.html#_filter_auto_caching).
## Partial fields are gone
Partial fields are [removed in Elasticsearch 2.0](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/_search_changes.html#_partial_fields) in favor of [source filtering](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-request-source-filtering.html).
## Scripting
A [`Script`](https://github.com/olivere/elastic/blob/release-branch.v3/script.go) type has been added to Elastic 3.0. In Elastic 2.0, there were various places (e.g. aggregations) where you could just add the script as a string, specify the scripting language, add parameters etc. With Elastic 3.0, you should now always use the `Script` type.
Example for Elastic 2.0 (old):
```go
update, err := client.Update().Index("twitter").Type("tweet").Id("1").
Script("ctx._source.retweets += num").
ScriptParams(map[string]interface{}{"num": 1}).
Upsert(map[string]interface{}{"retweets": 0}).
Do()
```
Example for Elastic 3.0 (new):
```go
update, err := client.Update().Index("twitter").Type("tweet").Id("1").
Script(elastic.NewScript("ctx._source.retweets += num").Param("num", 1)).
Upsert(map[string]interface{}{"retweets": 0}).
Do()
```
## Cluster State
The combination of `Metric(string)` and `Metrics(...string)` has been replaced by a single func with the signature `Metric(...string)`.
## Unexported structs in response
Services generally return a typed response from a `Do` func. Those structs are exported so that they can be passed around in your own application. In Elastic 3.0 however, we changed that (most) sub-structs are now unexported, meaning: You can only pass around the whole response, not sub-structures of it. This makes it easier for restructuring responses according to the Elasticsearch API. See [`ClusterStateResponse`](https://github.com/olivere/elastic/blob/release-branch.v3/cluster_state.go#L182) as an example.
## Add offset to Histogram aggregation
Histogram aggregations now have an [offset](https://github.com/elastic/elasticsearch/pull/9505) option.
## Services
### REST API specification
As you might know, Elasticsearch comes with a REST API specification. The specification describes the endpoints in a JSON structure.
Most services in Elastic predated the REST API specification. We are in the process of bringing all these services in line with the specification. Services can be generated by `go generate` (not 100% automatic though). This is an ongoing process.
This probably doesn't mean a lot to you. However, you can now be more confident that Elastic supports all features that the REST API specification describes.
At the same time, the file names of the services are renamed to match the REST API specification naming.
### REST API Test Suite
The REST API specification of Elasticsearch comes along with a test suite that official clients typically use to test for conformance. Up until now, Elastic didn't run this test suite. However, we are in the process of setting up infrastructure and tests to match this suite as well.
This process in not completed though.
================================================
FILE: CHANGELOG-5.0.md
================================================
# Changes in Elastic 5.0
## Enforce context.Context in PerformRequest and Do
We enforce the usage of `context.Context` everywhere you execute a request.
You need to change all your `Do()` calls to pass a context: `Do(ctx)`.
This enables automatic request cancelation and many other patterns.
If you don't need this, simply pass `context.TODO()` or `context.Background()`.
## Warmers removed
Warmers are no longer necessary and have been [removed in ES 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_index_apis.html#_warmers).
## Optimize removed
Optimize was deprecated in ES 2.0 and has been [removed in ES 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_rest_api_changes.html#_literal__optimize_literal_endpoint_removed).
Use [Force Merge](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html) instead.
## Missing Query removed
The `missing` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-exists-query.html#_literal_missing_literal_query).
Use `exists` query with `must_not` in `bool` query instead.
## And Query removed
The `and` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed).
Use `must` clauses in a `bool` query instead.
## Not Query removed
TODO Is it removed?
## Or Query removed
The `or` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed).
Use `should` clauses in a `bool` query instead.
## Filtered Query removed
The `filtered` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed).
Use `bool` query instead, which supports `filter` clauses too.
## Limit Query removed
The `limit` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed).
Use the `terminate_after` parameter instead.
# Template Query removed
The `template` query has been [deprecated](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/query-dsl-template-query.html). You should use
Search Templates instead.
We remove it from Elastic 5.0 as the 5.0 update is already a good opportunity
to get rid of old stuff.
## `_timestamp` and `_ttl` removed
Both of these fields were deprecated and are now [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_mapping_changes.html#_literal__timestamp_literal_and_literal__ttl_literal).
## Search template Put/Delete API returns `acknowledged` only
The response type for Put/Delete search templates has changed.
It only returns a single `acknowledged` flag now.
## Fields has been renamed to Stored Fields
The `fields` parameter has been renamed to `stored_fields`.
See [here](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/breaking_50_search_changes.html#_literal_fields_literal_parameter).
## Fielddatafields has been renamed to Docvaluefields
The `fielddata_fields` parameter [has been renamed](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/breaking_50_search_changes.html#_literal_fielddata_fields_literal_parameter)
to `docvalue_fields`.
## Type exists endpoint changed
The endpoint for checking whether a type exists has been changed from
`HEAD {index}/{type}` to `HEAD {index}/_mapping/{type}`.
See [here](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking_50_rest_api_changes.html#_literal_head_index_type_literal_replaced_with_literal_head_index__mapping_type_literal).
## Refresh parameter changed
The `?refresh` parameter previously could be a boolean value. It indicated
whether changes made by a request (e.g. by the Bulk API) should be immediately
visible in search, or not. Using `refresh=true` had the positive effect of
immediately seeing the changes when searching; the negative effect is that
it is a rather big performance hit.
With 5.0, you now have the choice between these 3 values.
* `"true"` - Refresh immediately
* `"false"` - Do not refresh (the default value)
* `"wait_for"` - Wait until ES made the document visible in search
See [?refresh](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-refresh.html) in the documentation.
Notice that `true` and `false` (the boolean values) are no longer available
now in Elastic. You must use a string instead, with one of the above values.
## ReindexerService removed
The `ReindexerService` was a custom solution that was started in the ES 1.x era
to automate reindexing data, from one index to another or even between clusters.
ES 2.3 introduced its own [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html)
so we're going to remove our custom solution and ask you to use the native reindexer.
The `ReindexService` is available via `client.Reindex()` (which used to point
to the custom reindexer).
## Delete By Query back in core
The [Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html)
was moved into a plugin in 2.0. Now its back in core with a complete rewrite based on the Bulk API.
It has it's own endpoint at `/_delete_by_query`.
Delete By Query, Reindex, and Update By Query are very similar under the hood.
## Reindex, Delete By Query, and Update By Query response changed
The response from the above APIs changed a bit. E.g. the `retries` value
used to be an `int64` and returns separate values for `bulk` and `search` now:
```
// Old
{
...
"retries": 123,
...
}
```
```
// New
{
...
"retries": {
"bulk": 123,
"search": 0
},
...
}
```
## ScanService removed
The `ScanService` is removed. Use the (new) `ScrollService` instead.
## New ScrollService
There was confusion around `ScanService` and `ScrollService` doing basically
the same. One was returning slices and didn't support all query details, the
other returned one document after another and wasn't safe for concurrent use.
So we merged the two and merged it into a new `ScrollService` that
removes all the problems with the older services.
In other words:
If you used `ScanService`, switch to `ScrollService`.
If you used the old `ScrollService`, you might need to fix some things but
overall it should just work.
Changes:
- We replaced `elastic.EOS` with `io.EOF` to indicate the "end of scroll".
TODO Not implemented yet
## Suggesters
They have been [completely rewritten in ES 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_suggester.html).
Some changes:
- Suggesters no longer have an [output](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_suggester.html#_simpler_completion_indexing).
TODO Fix all structural changes in suggesters
## Percolator
Percolator has [changed considerably](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/breaking_50_percolator.html).
Elastic 5.0 adds the new
[Percolator Query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/query-dsl-percolate-query.html)
which can be used in combination with the new
[Percolator type](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/percolator.html).
The Percolate service is removed from Elastic 5.0.
## Remove Consistency, add WaitForActiveShards
The `consistency` parameter has been removed in a lot of places, e.g. the Bulk,
Index, Delete, Delete-by-Query, Reindex, Update, and Update-by-Query API.
It has been replaced by a somewhat similar `wait_for_active_shards` parameter.
See https://github.com/elastic/elasticsearch/pull/19454.
================================================
FILE: CHANGELOG-6.0.md
================================================
# Changes from 5.0 to 6.0
See [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-6.0.html).
## _all removed
6.0 has removed support for the `_all` field.
## Boolean values coerced
Only use `true` or `false` for boolean values, not `0` or `1` or `on` or `off`.
## Single Type Indices
Notice that 6.0 and future versions will default to single type indices, i.e. you may not use multiple types when e.g. adding an index with a mapping.
See [here for details](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/removal-of-types.html#_what_are_mapping_types).
================================================
FILE: CHANGELOG-7.0.md
================================================
# Changes from 6.0 to 7.0
See [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/breaking-changes-7.0.html).
## SearchHit.Source changed from `*json.RawMessage` to `json.RawMessage`
The `SearchHit` structure changed from
```
// SearchHit is a single hit.
type SearchHit struct {
...
Source *json.RawMessage `json:"_source,omitempty"` // stored document source
...
}
```
to
```
// SearchHit is a single hit.
type SearchHit struct {
...
Source json.RawMessage `json:"_source,omitempty"` // stored document source
...
}
```
As `json.RawMessage` is a `[]byte`, there is no need to specify it
as `*json.RawMessage` as `json.RawMessage` is perfectly ok to represent
a `nil` value.
So when deserializing the search hits, you need to change your code from:
```
for _, hit := range searchResult.Hits.Hits {
var doc Doc
err := json.Unmarshal(*hit.Source, &doc) // notice the * here
if err != nil {
// Deserialization failed
}
}
```
to
```
for _, hit := range searchResult.Hits.Hits {
var doc Doc
err := json.Unmarshal(hit.Source, &doc) // it's missing here
if err != nil {
// Deserialization failed
}
}
```
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at oliver@eilhard.net. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
================================================
FILE: CONTRIBUTING.md
================================================
# How to contribute
Elastic is an open-source project and we are looking forward to each
contribution.
Notice that while the [official Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html) is rather good, it is a high-level
overview of the features of Elasticsearch. However, Elastic tries to resemble
the Java API of Elasticsearch which you can find [on GitHub](https://github.com/elastic/elasticsearch).
This explains why you might think that some options are strange or missing
in Elastic, while often they're just different. Please check the Java API first.
Having said that: Elasticsearch is moving fast and it might be very likely
that we missed some features or changes. Feel free to change that.
## Your Pull Request
To make it easy to review and understand your changes, please keep the
following things in mind before submitting your pull request:
* You compared the existing implementation with the Java API, did you?
* Please work on the latest possible state of `olivere/elastic`.
Use `release-branch.v2` for targeting Elasticsearch 1.x and
`release-branch.v3` for targeting 2.x.
* Create a branch dedicated to your change.
* If possible, write a test case which confirms your change.
* Make sure your changes and your tests work with all recent versions of
Elasticsearch. We currently support Elasticsearch 1.7.x in the
release-branch.v2 and Elasticsearch 2.x in the release-branch.v3.
* Test your changes before creating a pull request (`go test ./...`).
* Don't mix several features or bug fixes in one pull request.
* Create a meaningful commit message.
* Explain your change, e.g. provide a link to the issue you are fixing and
probably a link to the Elasticsearch documentation and/or source code.
* Format your source with `go fmt`.
## Additional Resources
* [GitHub documentation](https://help.github.com/)
* [GitHub pull request documentation](https://help.github.com/en/articles/creating-a-pull-request)
================================================
FILE: CONTRIBUTORS
================================================
# This is a list of people who have contributed code
# to the Elastic repository.
#
# It is just my small "thank you" to all those that helped
# making Elastic what it is.
#
# Please keep this list sorted.
0x6875790d0a [@huydx](https://github.com/huydx)
Aaron Tami [@aarontami](https://github.com/aarontami)
Adam Alix [@adamalix](https://github.com/adamalix)
Adam Weiner [@adamweiner](https://github.com/adamweiner)
Adam Szaraniec [@mimol91](https://github.com/mimol91)
Adrian Lungu [@AdrianLungu](https://github.com/AdrianLungu)
alehano [@alehano](https://github.com/alehano)
Alejandro Carstens [@alejandro-carstens](https://github.com/alejandro-carstens)
Alex [@akotlar](https://github.com/akotlar)
Alexander Sack [@asac](https://github.com/asac)
Alexandre Olivier [@aliphen](https://github.com/aliphen)
Alexey Sharov [@nizsheanez](https://github.com/nizsheanez)
Aman Jain [@amanjain97](https://github.com/amanjain97)
Anders [@ANerd](https://github.com/ANerd)
AndreKR [@AndreKR](https://github.com/AndreKR)
André Bierlein [@ligustah](https://github.com/ligustah)
Andrew Dunham [@andrew-d](https://github.com/andrew-d)
Andrew Gaul [@andrewgaul](https://github.com/andrewgaul)
Andy Walker [@alaska](https://github.com/alaska)
Arpit Agarwal [@arpiagar](https://github.com/arpiagar)
Arquivei [@arquivei](https://github.com/arquivei)
Artemiy Elozhenko [@artezh](https://github.com/artezh)
arthurgustin [@arthurgustin](https://github.com/arthurgustin)
Bas van Dijk [@basvandijk](https://github.com/basvandijk)
Benjamin Fernandes [@LotharSee](https://github.com/LotharSee)
Benjamin Zarzycki [@kf6nux](https://github.com/kf6nux)
bestgopher [@bestgopher](https://github.com/bestgopher)
Björn Gerdau [@kernle32dll](https://github.com/kernle32dll)
Boris Popovschi [@Zyqsempai](https://github.com/Zyqsempai)
Bowei Xu [@vancexu](https://github.com/vancexu)
Braden Bassingthwaite [@bbassingthwaite-va](https://github.com/bbassingthwaite-va)
Brady Love [@bradylove](https://github.com/bradylove)
Bryan Conklin [@bmconklin](https://github.com/bmconklin)
Bruce Zhou [@brucez-isell](https://github.com/brucez-isell)
Carl Dunham [@carldunham](https://github.com/carldunham)
Carl Johan Gustavsson [@cjgu](https://github.com/cjgu)
Carson [@carson0321](https://github.com/carson0321)
Cat [@cat-turner](https://github.com/cat-turner)
César Jiménez [@cesarjimenez](https://github.com/cesarjimenez)
cforbes [@cforbes](https://github.com/cforbes)
張泰瑋(Chang Tai Wei) [@david30907d](https://github.com/david30907d)
cheshire [@NikitaSerenko](https://github.com/NikitaSerenko)
Chris M [@tebriel](https://github.com/tebriel)
Chris Rice [@donutmonger](https://github.com/donutmonger)
Claudiu Olteanu [@claudiuolteanu](https://github.com/claudiuolteanu)
Chris Duncan [@veqryn](https://github.com/veqryn)
Chris Ludden [@cludden](https://github.com/cludden)
Christophe Courtaut [@kri5](https://github.com/kri5)
cmitchell [@cmitchell](https://github.com/cmitchell)
Connor Peet [@connor4312](https://github.com/connor4312)
Conrad Pankoff [@deoxxa](https://github.com/deoxxa)
Corey Scott [@corsc](https://github.com/corsc)
Chris Petersen [@ex-nerd](https://github.com/ex-nerd)
czxichen [@czxichen](https://github.com/czxichen)
Daniel Barrett [@shendaras](https://github.com/shendaras)
Daniel Heckrath [@DanielHeckrath](https://github.com/DanielHeckrath)
Daniel Imfeld [@dimfeld](https://github.com/dimfeld)
Daniel Santos [@danlsgiga](https://github.com/danlsgiga)
David Emanuel Buchmann [@wuurrd](https://github.com/wuurrd)
Devin Christensen [@quixoten](https://github.com/quixoten)
diacone [@diacone](https://github.com/diacone)
Diego Becciolini [@itizir](https://github.com/itizir)
Don Smith III [@cactauz](https://github.com/cactauz)
Dwayne Schultz [@myshkin5](https://github.com/myshkin5)
Elizabeth Jarrett [@mejarrett](https://github.com/mejarrett)
Elliot Williams [@elliotwms](https://github.com/elliotwms)
Ellison Leão [@ellisonleao](https://github.com/ellisonleao)
Emil Gedda [@EmilGedda](https://github.com/EmilGedda)
Erik Grinaker [@erikgrinaker](https://github.com/erikgrinaker)
Erwin [@eticzon](https://github.com/eticzon)
Etienne Lafarge [@elafarge](https://github.com/elafarge)
Eugene Egorov [@EugeneEgorov](https://github.com/EugeneEgorov)
Evan Shaw [@edsrzf](https://github.com/edsrzf)
Fanfan [@wenpos](https://github.com/wenpos)
Faolan C-P [@fcheslack](https://github.com/fcheslack)
Filip Tepper [@filiptepper](https://github.com/filiptepper)
Garrett Kelley [@GarrettKelley](https://github.com/GarrettKelley)
Gaspard Douady [@plopik](https://github.com/plopik)
Gaylord Aulke [@blafasel42](https://github.com/blafasel42)
Gerhard Häring [@ghaering](https://github.com/ghaering)
gregoryfranklin [@gregoryfranklin](https://github.com/gregoryfranklin)
Guilherme Silveira [@guilherme-santos](https://github.com/guilherme-santos)
Guillaume J. Charmes [@creack](https://github.com/creack)
Guiseppe [@gm42](https://github.com/gm42)
Han Yu [@MoonighT](https://github.com/MoonighT)
Harmen [@alicebob](https://github.com/alicebob)
Haroldo Vélez [@Haroldov](https://github.com/Haroldov)
Harrison Wright [@wright8191](https://github.com/wright8191)
Henry Clifford [@hcliff](https://github.com/hcliff)
Henry Stern [@hstern](https://github.com/hstern)
Herbert Lu [@lryong](https://github.com/lryong)
Igor Dubinskiy [@idubinskiy](https://github.com/idubinskiy)
initialcontext [@initialcontext](https://github.com/initialcontext)
Isaac Saldana [@isaldana](https://github.com/isaldana)
Ishan Jain [@ishanjain28](https://github.com/ishanjain28)
J Barkey Wolf [@jjhbw](https://github.com/jjhbw)
Jack Lindamood [@cep21](https://github.com/cep21)
Jacob [@jdelgad](https://github.com/jdelgad)
Jan Düpmeier [@jduepmeier](https://github.com/jduepmeier)
Jayme Rotsaert [@jrots](https://github.com/jrots)
Jean-Alexandre Beaumont [@Enteris](https://github.com/Enteris)
Jean-François Roche [@jfroche](https://github.com/jfroche)
Jeff Rand [@jeffrand](https://github.com/jeffrand)
Jeremy Canady [@jrmycanady](https://github.com/jrmycanady)
Jérémie Vexiau [@texvex](https://github.com/texvex)
Jesper Bränn [@Yopi](https://github.com/Yopi)
Jim Berlage [@jimberlage](https://github.com/jimberlage)
Joe Buck [@four2five](https://github.com/four2five)
John Barker [@j16r](https://github.com/j16r)
John Goodall [@jgoodall](https://github.com/jgoodall)
John Stanford [@jxstanford](https://github.com/jxstanford)
Jonas Groenaas Drange [@semafor](https://github.com/semafor)
Josef Fröhle [@Dexus](https://github.com/Dexus)
José Martínez [@xose](https://github.com/xose)
Josh Chorlton [@jchorl](https://github.com/jchorl)
Jpnock [@Jpnock](https://github.com/Jpnock)
jun [@coseyo](https://github.com/coseyo)
Junpei Tsuji [@jun06t](https://github.com/jun06t)
Karen Yang [@kyangtt](https://github.com/kyangtt)
kartlee [@kartlee](https://github.com/kartlee)
Keith Hatton [@khatton-ft](https://github.com/khatton-ft)
kel [@liketic](https://github.com/liketic)
Kenta SUZUKI [@suzuken](https://github.com/suzuken)
Kevin Mulvey [@kmulvey](https://github.com/kmulvey)
Kyle Brandt [@kylebrandt](https://github.com/kylebrandt)
Larry Cinnabar [@larrycinnabar](https://github.com/larrycinnabar)
Leandro Piccilli [@lpic10](https://github.com/lpic10)
Lee [@leezhm](https://github.com/leezhm)
lechnertech [@lechnertech](https://github.com/lechnertech)
M. Zulfa Achsani [@misterciput](https://github.com/misterciput)
Maciej Lisiewski [@c2h5oh](https://github.com/c2h5oh)
Mara Kim [@autochthe](https://github.com/autochthe)
Marcy Buccellato [@marcybuccellato](https://github.com/marcybuccellato)
Mark Costello [@mcos](https://github.com/mcos)
Martin Häger [@protomouse](https://github.com/protomouse)
Matt Braymer-Hayes [@mattayes](https://github.com/mattayes)
Medhi Bechina [@mdzor](https://github.com/mdzor)
Mike Beshai [@mbesh](https://github.com/mbesh)
Mikhail Balabin [@mablabin](https://github.com/mbalabin)
mmfrb [@mmfrb](https://github.com/mmfrb)
mnpritula [@mnpritula](https://github.com/mnpritula)
mosa [@mosasiru](https://github.com/mosasiru)
Muhammet Çakır [@cakirmuha](https://github.com/cakirmuha)
Munkyu Im [@munkyu](https://github.com/munkyu)
naimulhaider [@naimulhaider](https://github.com/naimulhaider)
Naoya Yoshizawa [@azihsoyn](https://github.com/azihsoyn)
Naoya Tsutsumi [@tutuming](https://github.com/tutuming)
Nathan Macnamara [@nathanmac](https://github.com/nathanmac)
Nathan Lacey [@nlacey](https://github.com/nlacey)
navins [@ishare](https://github.com/ishare)
NeoCN [@NeoCN](https://github.com/NeoCN)
Nguyen Xuan Dung [@dungnx](https://github.com/dungnx)
Nicholas Wolff [@nwolff](https://github.com/nwolff)
Nick K [@utrack](https://github.com/utrack)
Nick Whyte [@nickw444](https://github.com/nickw444)
Nicolae Vartolomei [@nvartolomei](https://github.com/nvartolomei)
okhowang [@okhowang](https://github.com/okhowang)
Orne Brocaar [@brocaar](https://github.com/brocaar)
ottramst [@ottramst](https://github.com/ottramst)
Paul [@eyeamera](https://github.com/eyeamera)
Paul Oldenburg [@lr-paul](https://github.com/lr-paul)
Pedro [@otherview](https://github.com/otherview)
Pete C [@peteclark-ft](https://github.com/peteclark-ft)
Peter Nagy [@nagypeterjob](https://github.com/nagypeterjob)
Paolo [@ppiccolo](https://github.com/ppiccolo)
Phillip Baker [@phillbaker](https://github.com/phillbaker)
QilingZhao [@qilingzhao](https://github.com/qilingzhao)
Igor Panychek [@panychek](https://github.com/panychek)
Radoslaw Wesolowski [@r--w](https://github.com/r--w)
Rafał Gałus [@rgalus](https://github.com/rgalus)
rchicoli [@rchicoli](https://github.com/rchicoli)
Roman Colohanin [@zuzmic](https://github.com/zuzmic)
Ryan Schmukler [@rschmukler](https://github.com/rschmukler)
Ryan Wynn [@rwynn](https://github.com/rwynn)
Sacheendra talluri [@sacheendra](https://github.com/sacheendra)
Sean DuBois [@Sean-Der](https://github.com/Sean-Der)
Sagan Yaroslav [@sgnrslv](https://github.com/sgnrslv)
Shalin LK [@shalinlk](https://github.com/shalinlk)
Simon Schneider [@raynigon](https://github.com/raynigon)
singham [@zhaochenxiao90](https://github.com/zhaochenxiao90)
Slawomir CALUCH [@slawo](https://github.com/slawo)
soarpenguin [@soarpenguin](https://github.com/soarpenguin)
Stephan Krynauw [@skrynauw](https://github.com/skrynauw)
Stephen Kubovic [@stephenkubovic](https://github.com/stephenkubovic)
Stuart Warren [@Woz](https://github.com/stuart-warren)
Sulaiman [@salajlan](https://github.com/salajlan)
Sundar [@sundarv85](https://github.com/sundarv85)
Swarlston [@Swarlston](https://github.com/Swarlston)
Take [ww24](https://github.com/ww24)
Tetsuya Morimoto [@t2y](https://github.com/t2y)
TheZeroSlave [@TheZeroSlave](https://github.com/TheZeroSlave)
Tomasz Elendt [@telendt](https://github.com/telendt)
TimeEmit [@TimeEmit](https://github.com/timeemit)
TusharM [@tusharm](https://github.com/tusharm)
wangtuo [@wangtuo](https://github.com/wangtuo)
Wédney Yuri [@wedneyyuri](https://github.com/wedneyyuri)
Wesley Kim [@wesleyk](https://github.com/wesleyk)
wolfkdy [@wolfkdy](https://github.com/wolfkdy)
Wyndham Blanton [@wyndhblb](https://github.com/wyndhblb)
Yarden Bar [@ayashjorden](https://github.com/ayashjorden)
Yuya Kusakabe [@higebu](https://github.com/higebu)
zakthomas [@zakthomas](https://github.com/zakthomas)
Zach [@snowzach](https://github.com/snowzach)
zhangxin [@visaxin](https://github.com/visaxin)
@林 [@zplzpl](https://github.com/zplzpl)
================================================
FILE: ISSUE_TEMPLATE.md
================================================
Please use the following questions as a guideline to help me answer
your issue/question without further inquiry. Thank you.
### Which version of Elastic are you using?
[ ] elastic.v7 (for Elasticsearch 7.x)
[ ] elastic.v6 (for Elasticsearch 6.x)
[ ] elastic.v5 (for Elasticsearch 5.x)
[ ] elastic.v3 (for Elasticsearch 2.x)
[ ] elastic.v2 (for Elasticsearch 1.x)
### Please describe the expected behavior
### Please describe the actual behavior
### Any steps to reproduce the behavior?
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright © 2012-2015 Oliver Eilhard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
================================================
FILE: Makefile
================================================
.PHONY: test
test:
go test -race -deprecations -strict-decoder -v . ./aws/... ./config/... ./trace/... ./uritemplates/...
================================================
FILE: README.md
================================================
# Elastic
**This is a development branch that is actively being worked on. DO NOT USE IN PRODUCTION! If you want to use stable versions of Elastic, please use Go modules for the 7.x release (or later) or a dependency manager like [dep](https://github.com/golang/dep) for earlier releases.**
Elastic is an [Elasticsearch](http://www.elasticsearch.org/) client for the
[Go](http://www.golang.org/) programming language.
[](https://github.com/olivere/elastic/actions)
[](https://pkg.go.dev/github.com/olivere/elastic/v7?tab=doc)
[](https://raw.githubusercontent.com/olivere/elastic/master/LICENSE)
See the [wiki](https://github.com/olivere/elastic/wiki) for additional information about Elastic.
<a href="https://www.buymeacoffee.com/Bjd96U8fm" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
## Releases
**The release branches (e.g. [`release-branch.v7`](https://github.com/olivere/elastic/tree/release-branch.v7))
are actively being worked on and can break at any time.
If you want to use stable versions of Elastic, please use Go modules.**
Here's the version matrix:
Elasticsearch version | Elastic version | Package URL | Remarks |
----------------------|------------------|-------------|---------|
7.x | 7.0 | [`github.com/olivere/elastic/v7`](https://github.com/olivere/elastic) ([source](https://github.com/olivere/elastic/tree/release-branch.v7) [doc](http://godoc.org/github.com/olivere/elastic)) | Use Go modules.
6.x | 6.0 | [`github.com/olivere/elastic`](https://github.com/olivere/elastic) ([source](https://github.com/olivere/elastic/tree/release-branch.v6) [doc](http://godoc.org/github.com/olivere/elastic)) | Use a dependency manager (see below).
5.x | 5.0 | [`gopkg.in/olivere/elastic.v5`](https://gopkg.in/olivere/elastic.v5) ([source](https://github.com/olivere/elastic/tree/release-branch.v5) [doc](http://godoc.org/gopkg.in/olivere/elastic.v5)) | Actively maintained.
2.x | 3.0 | [`gopkg.in/olivere/elastic.v3`](https://gopkg.in/olivere/elastic.v3) ([source](https://github.com/olivere/elastic/tree/release-branch.v3) [doc](http://godoc.org/gopkg.in/olivere/elastic.v3)) | Deprecated. Please update.
1.x | 2.0 | [`gopkg.in/olivere/elastic.v2`](https://gopkg.in/olivere/elastic.v2) ([source](https://github.com/olivere/elastic/tree/release-branch.v2) [doc](http://godoc.org/gopkg.in/olivere/elastic.v2)) | Deprecated. Please update.
0.9-1.3 | 1.0 | [`gopkg.in/olivere/elastic.v1`](https://gopkg.in/olivere/elastic.v1) ([source](https://github.com/olivere/elastic/tree/release-branch.v1) [doc](http://godoc.org/gopkg.in/olivere/elastic.v1)) | Deprecated. Please update.
**Example:**
You have installed Elasticsearch 7.0.0 and want to use Elastic.
As listed above, you should use Elastic 7.0 (code is in `release-branch.v7`).
To use the required version of Elastic in your application, you
should use [Go modules](https://github.com/golang/go/wiki/Modules)
to manage dependencies. Make sure to use a version such as `7.0.0` or later.
To use Elastic, import:
```go
import "github.com/olivere/elastic/v7"
```
### Elastic 7.0
Elastic 7.0 targets Elasticsearch 7.x which [was released on April 10th 2019](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/release-notes-7.0.0.html).
As always with major version, there are a lot of [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/release-notes-7.0.0.html#breaking-7.0.0).
We will use this as an opportunity to [clean up and refactor Elastic](https://github.com/olivere/elastic/blob/release-branch.v7/CHANGELOG-7.0.md),
as we already did in earlier (major) releases.
### Elastic 6.0
Elastic 6.0 targets Elasticsearch 6.x which was [released on 14th November 2017](https://www.elastic.co/blog/elasticsearch-6-0-0-released).
Notice that there are a lot of [breaking changes in Elasticsearch 6.0](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/breaking-changes-6.0.html)
and we used this as an opportunity to [clean up and refactor Elastic](https://github.com/olivere/elastic/blob/release-branch.v6/CHANGELOG-6.0.md)
as we did in the transition from earlier versions of Elastic.
### Elastic 5.0
Elastic 5.0 targets Elasticsearch 5.0.0 and later. Elasticsearch 5.0.0 was
[released on 26th October 2016](https://www.elastic.co/blog/elasticsearch-5-0-0-released).
Notice that there are will be a lot of [breaking changes in Elasticsearch 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking-changes-5.0.html)
and we used this as an opportunity to [clean up and refactor Elastic](https://github.com/olivere/elastic/blob/release-branch.v5/CHANGELOG-5.0.md)
as we did in the transition from Elastic 2.0 (for Elasticsearch 1.x) to Elastic 3.0 (for Elasticsearch 2.x).
Furthermore, the jump in version numbers will give us a chance to be in sync with the Elastic Stack.
### Elastic 3.0
Elastic 3.0 targets Elasticsearch 2.x and is published via [`gopkg.in/olivere/elastic.v3`](https://gopkg.in/olivere/elastic.v3).
Elastic 3.0 will only get critical bug fixes. You should update to a recent version.
### Elastic 2.0
Elastic 2.0 targets Elasticsearch 1.x and is published via [`gopkg.in/olivere/elastic.v2`](https://gopkg.in/olivere/elastic.v2).
Elastic 2.0 will only get critical bug fixes. You should update to a recent version.
### Elastic 1.0
Elastic 1.0 is deprecated. You should really update Elasticsearch and Elastic
to a recent version.
However, if you cannot update for some reason, don't worry. Version 1.0 is
still available. All you need to do is go-get it and change your import path
as described above.
## Status
We use Elastic in production since 2012. Elastic is stable but the API changes
now and then. We strive for API compatibility.
However, Elasticsearch sometimes introduces [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes.html)
and we sometimes have to adapt.
Having said that, there have been no big API changes that required you
to rewrite your application big time. More often than not it's renaming APIs
and adding/removing features so that Elastic is in sync with Elasticsearch.
Elastic has been used in production starting with Elasticsearch 0.90 up to recent 7.x
versions.
We recently switched to [GitHub Actions for testing](https://github.com/olivere/elastic/actions).
Before that, we used [Travis CI](https://travis-ci.org/olivere/elastic) successfully for years).
Elasticsearch has quite a few features. Most of them are implemented
by Elastic. I add features and APIs as required. It's straightforward
to implement missing pieces. I'm accepting pull requests :-)
Having said that, I hope you find the project useful.
## Getting Started
The first thing you do is to create a [Client](https://github.com/olivere/elastic/blob/master/client.go).
The client connects to Elasticsearch on `http://127.0.0.1:9200` by default.
You typically create one client for your app. Here's a complete example of
creating a client, creating an index, adding a document, executing a search etc.
An example is available [here](https://olivere.github.io/elastic/).
Here's a [link to a complete working example for v6](https://gist.github.com/olivere/e4a376b4783c0914e44ea4f745ce2ebf).
Here are a few tips on how to get used to Elastic:
1. Head over to the [Wiki](https://github.com/olivere/elastic/wiki) for detailed information and
topics like e.g. [how to add a middleware](https://github.com/olivere/elastic/wiki/HttpTransport)
or how to [connect to AWS](https://github.com/olivere/elastic/wiki/Using-with-AWS-Elasticsearch-Service).
2. If you are unsure how to implement something, read the tests (all `_test.go` files).
They not only serve as a guard against changes, but also as a reference.
3. The [recipes](https://github.com/olivere/elastic/tree/release-branch.v6/recipes)
contains small examples on how to implement something, e.g. bulk indexing, scrolling etc.
## API Status
### Document APIs
- [x] Index API
- [x] Get API
- [x] Delete API
- [x] Delete By Query API
- [x] Update API
- [x] Update By Query API
- [x] Multi Get API
- [x] Bulk API
- [x] Reindex API
- [x] Term Vectors
- [x] Multi termvectors API
### Search APIs
- [x] Search
- [x] Search Template
- [ ] Multi Search Template
- [x] Search Shards API
- [x] Suggesters
- [x] Term Suggester
- [x] Phrase Suggester
- [x] Completion Suggester
- [x] Context Suggester
- [x] Multi Search API
- [x] Count API
- [x] Validate API
- [x] Explain API
- [x] Profile API
- [x] Field Capabilities API
### Aggregations
- Metrics Aggregations
- [x] Avg
- [ ] Boxplot (X-pack)
- [x] Cardinality
- [x] Extended Stats
- [x] Geo Bounds
- [x] Geo Centroid
- [x] Matrix stats
- [x] Max
- [x] Median absolute deviation
- [x] Min
- [x] Percentile Ranks
- [x] Percentiles
- [ ] Rate (X-pack)
- [ ] Scripted Metric
- [x] Stats
- [ ] String stats (X-pack)
- [x] Sum
- [ ] T-test (X-pack)
- [x] Top Hits
- [x] Top metrics (X-pack)
- [x] Value Count
- [x] Weighted avg
- Bucket Aggregations
- [x] Adjacency Matrix
- [x] Auto-interval Date Histogram
- [x] Children
- [x] Composite
- [x] Date Histogram
- [x] Date Range
- [x] Diversified Sampler
- [x] Filter
- [x] Filters
- [x] Geo Distance
- [x] Geohash Grid
- [x] Geotile grid
- [x] Global
- [x] Histogram
- [x] IP Range
- [x] Missing
- [x] Nested
- [ ] Parent
- [x] Range
- [ ] Rare terms
- [x] Reverse Nested
- [x] Sampler
- [x] Significant Terms
- [x] Significant Text
- [x] Terms
- [ ] Variable width histogram
- Pipeline Aggregations
- [x] Avg Bucket
- [x] Bucket Script
- [x] Bucket Selector
- [x] Bucket Sort
- [ ] Cumulative cardinality (X-pack)
- [x] Cumulative Sum
- [x] Derivative
- [ ] Extended Stats Bucket
- [ ] Inference bucket (X-pack)
- [x] Max Bucket
- [x] Min Bucket
- [x] Moving Average
- [x] Moving function
- [ ] Moving percentiles (X-pack)
- [ ] Normalize (X-pack)
- [x] Percentiles Bucket
- [x] Serial Differencing
- [x] Stats Bucket
- [x] Sum Bucket
- [x] Aggregation Metadata
### Indices APIs
- [x] Create Index
- [x] Delete Index
- [x] Get Index
- [x] Indices Exists
- [x] Open / Close Index
- [x] Shrink Index
- [x] Rollover Index
- [x] Put Mapping
- [x] Get Mapping
- [x] Get Field Mapping
- [x] Types Exists
- [x] Index Aliases
- [x] Update Indices Settings
- [x] Get Settings
- [x] Analyze
- [x] Explain Analyze
- [x] Index Templates
- [x] Indices Stats
- [x] Indices Segments
- [ ] Indices Recovery
- [ ] Indices Shard Stores
- [x] Clear Cache
- [x] Flush
- [x] Synced Flush
- [x] Refresh
- [x] Force Merge
### Index Lifecycle Management APIs
- [x] Create Policy
- [x] Get Policy
- [x] Delete Policy
- [ ] Move to Step
- [ ] Remove Policy
- [ ] Retry Policy
- [ ] Get Ilm Status
- [ ] Explain Lifecycle
- [ ] Start Ilm
- [ ] Stop Ilm
### cat APIs
- [X] cat aliases
- [X] cat allocation
- [X] cat count
- [X] cat fielddata
- [X] cat health
- [X] cat indices
- [x] cat master
- [ ] cat nodeattrs
- [ ] cat nodes
- [ ] cat pending tasks
- [ ] cat plugins
- [ ] cat recovery
- [ ] cat repositories
- [ ] cat thread pool
- [ ] cat shards
- [ ] cat segments
- [X] cat snapshots
- [ ] cat templates
### Cluster APIs
- [x] Cluster Health
- [x] Cluster State
- [x] Cluster Stats
- [ ] Pending Cluster Tasks
- [x] Cluster Reroute
- [ ] Cluster Update Settings
- [x] Nodes Stats
- [x] Nodes Info
- [ ] Nodes Feature Usage
- [ ] Remote Cluster Info
- [x] Task Management API
- [ ] Nodes hot_threads
- [ ] Cluster Allocation Explain API
### Rollup APIs (XPack)
- [x] Create Job
- [x] Delete Job
- [x] Get Job
- [x] Start Job
- [x] Stop Job
### Query DSL
- [x] Match All Query
- [x] Inner hits
- Full text queries
- [x] Match Query
- [x] Match Boolean Prefix Query
- [x] Match Phrase Query
- [x] Match Phrase Prefix Query
- [x] Multi Match Query
- [x] Common Terms Query
- [x] Query String Query
- [x] Simple Query String Query
- [x] Combined Fields Query
- [x] Intervals Query
- Term level queries
- [x] Term Query
- [x] Terms Query
- [x] Terms Set Query
- [x] Range Query
- [x] Exists Query
- [x] Prefix Query
- [x] Wildcard Query
- [x] Regexp Query
- [x] Fuzzy Query
- [x] Type Query
- [x] Ids Query
- Compound queries
- [x] Constant Score Query
- [x] Bool Query
- [x] Dis Max Query
- [x] Function Score Query
- [x] Boosting Query
- Joining queries
- [x] Nested Query
- [x] Has Child Query
- [x] Has Parent Query
- [x] Parent Id Query
- Geo queries
- [ ] GeoShape Query
- [x] Geo Bounding Box Query
- [x] Geo Distance Query
- [x] Geo Polygon Query
- Specialized queries
- [x] Distance Feature Query
- [x] More Like This Query
- [x] Script Query
- [x] Script Score Query
- [x] Percolate Query
- Span queries
- [x] Span Term Query
- [ ] Span Multi Term Query
- [x] Span First Query
- [x] Span Near Query
- [ ] Span Or Query
- [ ] Span Not Query
- [ ] Span Containing Query
- [ ] Span Within Query
- [ ] Span Field Masking Query
- [ ] Minimum Should Match
- [ ] Multi Term Query Rewrite
### Modules
- Snapshot and Restore
- [x] Repositories
- [x] Snapshot get
- [x] Snapshot create
- [x] Snapshot delete
- [ ] Restore
- [ ] Snapshot status
- [ ] Monitoring snapshot/restore status
- [ ] Stopping currently running snapshot and restore
- Scripting
- [x] GetScript
- [x] PutScript
- [x] DeleteScript
### Sorting
- [x] Sort by score
- [x] Sort by field
- [x] Sort by geo distance
- [x] Sort by script
- [x] Sort by doc
### Scrolling
Scrolling is supported via a `ScrollService`. It supports an iterator-like interface.
The `ClearScroll` API is implemented as well.
A pattern for [efficiently scrolling in parallel](https://github.com/olivere/elastic/wiki/ScrollParallel)
is described in the [Wiki](https://github.com/olivere/elastic/wiki).
## How to contribute
Read [the contribution guidelines](https://github.com/olivere/elastic/blob/master/CONTRIBUTING.md).
## Credits
Thanks a lot for the great folks working hard on
[Elasticsearch](https://www.elastic.co/products/elasticsearch)
and
[Go](https://golang.org/).
Elastic uses portions of the
[uritemplates](https://github.com/jtacoma/uritemplates) library
by Joshua Tacoma,
[backoff](https://github.com/cenkalti/backoff) by Cenk Altı and
[leaktest](https://github.com/fortytw2/leaktest) by Ian Chiles.
## LICENSE
MIT-LICENSE. See [LICENSE](http://olivere.mit-license.org/)
or the LICENSE file provided in the repository for details.
================================================
FILE: acknowledged_response.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
// AcknowledgedResponse is returned from various APIs. It simply indicates
// whether the operation is acknowledged or not.
type AcknowledgedResponse struct {
Acknowledged bool `json:"acknowledged"`
ShardsAcknowledged bool `json:"shards_acknowledged"`
Index string `json:"index,omitempty"`
}
================================================
FILE: aws/sign_v4.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package aws
import (
"net/http"
"github.com/smartystreets/go-aws-auth"
)
// NewV4SigningClient returns an *http.Client that will sign all requests with AWS V4 Signing.
func NewV4SigningClient(credentials awsauth.Credentials) *http.Client {
return NewV4SigningClientWithHTTPClient(credentials, http.DefaultClient)
}
// NewV4SigningClientWithHTTPClient returns an *http.Client that will sign all requests with AWS V4 Signing.
func NewV4SigningClientWithHTTPClient(credentials awsauth.Credentials, httpClient *http.Client) *http.Client {
return &http.Client{
Transport: V4Transport{
HTTPClient: httpClient,
Credentials: credentials,
},
}
}
// V4Transport is a RoundTripper that will sign requests with AWS V4 Signing
type V4Transport struct {
HTTPClient *http.Client
Credentials awsauth.Credentials
}
// RoundTrip uses the underlying RoundTripper transport, but signs request first with AWS V4 Signing
func (st V4Transport) RoundTrip(req *http.Request) (*http.Response, error) {
// Instead of directly modifying the request then calling http.DefaultTransport,
// instead restart the request with the HTTPClient.Do function,
// because the HTTPClient includes safeguards around not forwarding the
// signed Authorization header to untrusted domains.
return st.HTTPClient.Do(awsauth.Sign4(req, st.Credentials))
}
================================================
FILE: aws/sign_v4_test.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package aws
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
"testing"
awsauth "github.com/smartystreets/go-aws-auth"
"github.com/olivere/elastic/v7"
)
func TestSigningClient(t *testing.T) {
var req *http.Request
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/":
req = r // capture the HTTP request
w.WriteHeader(http.StatusOK)
fmt.Fprintln(w, `{
"name" : "Qg28M36",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "rwHa7BBnRC2h8KoDfCbmuQ",
"version" : {
"number" : "6.3.2",
"build_flavor" : "oss",
"build_type" : "tar",
"build_hash" : "053779d",
"build_date" : "2018-07-20T05:20:23.451332Z",
"build_snapshot" : false,
"lucene_version" : "7.3.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}`)
return
default:
w.WriteHeader(http.StatusInternalServerError)
return
}
}))
defer ts.Close()
cred := awsauth.Credentials{
AccessKeyID: "dev",
SecretAccessKey: "secret",
}
signingClient := NewV4SigningClient(cred)
// Create a simple Ping request via Elastic
client, err := elastic.NewClient(
elastic.SetURL(ts.URL),
elastic.SetHttpClient(signingClient),
elastic.SetHealthcheck(false),
elastic.SetSniff(false),
)
if err != nil {
t.Fatal(err)
}
res, code, err := client.Ping(ts.URL).Do(context.Background())
if err != nil {
t.Fatal(err)
}
if want, have := http.StatusOK, code; want != have {
t.Fatalf("want Status=%d, have %d", want, have)
}
if want, have := "You Know, for Search", res.TagLine; want != have {
t.Fatalf("want TagLine=%q, have %q", want, have)
}
// Check the request recorded in the HTTP test server (see above)
if req == nil {
t.Fatal("expected to capture HTTP request")
}
if have := req.Header.Get("Authorization"); have == "" {
t.Fatal("expected Authorization header")
}
if have := req.Header.Get("X-Amz-Date"); have == "" {
t.Fatal("expected X-Amz-Date header")
}
if want, have := `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`, req.Header.Get("X-Amz-Content-Sha256"); want != have {
t.Fatalf("want header of X-Amz-Content-Sha256=%q, have %q", want, have)
}
}
================================================
FILE: aws/v4/CREDITS
================================================
This package contains code that is Copyright (c) 2016 Anthony Atkinson
and licensed under the MIT license.
See https://github.com/sha1sum/aws_signing_client.
================================================
FILE: aws/v4/aws_v4.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package v4
import (
"bytes"
"io"
"io/ioutil"
"net/http"
"net/url"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/credentials"
v4 "github.com/aws/aws-sdk-go/aws/signer/v4"
)
// NewV4SigningClient returns an *http.Client that will sign all requests with AWS V4 Signing.
func NewV4SigningClient(creds *credentials.Credentials, region string) *http.Client {
return NewV4SigningClientWithHTTPClient(creds, region, http.DefaultClient)
}
// NewV4SigningClientWithHTTPClient returns an *http.Client that will sign all requests with AWS V4 Signing.
func NewV4SigningClientWithHTTPClient(creds *credentials.Credentials, region string, httpClient *http.Client) *http.Client {
return &http.Client{
Transport: Transport{
client: httpClient,
creds: creds,
signer: v4.NewSigner(creds),
region: region,
},
}
}
// Transport is a RoundTripper that will sign requests with AWS V4 Signing
type Transport struct {
client *http.Client
creds *credentials.Credentials
signer *v4.Signer
region string
}
// RoundTrip uses the underlying RoundTripper transport, but signs request first with AWS V4 Signing
func (st Transport) RoundTrip(req *http.Request) (*http.Response, error) {
if h, ok := req.Header["Authorization"]; ok && len(h) > 0 && strings.HasPrefix(h[0], "AWS4") {
// Received a signed request, just pass it on.
return st.client.Do(req)
}
if strings.Contains(req.URL.RawPath, "%2C") {
// Escaping path
req.URL.RawPath = url.PathEscape(req.URL.RawPath)
}
now := time.Now().UTC()
req.Header.Set("Date", now.Format(time.RFC3339))
var err error
switch req.Body {
case nil:
_, err = st.signer.Sign(req, nil, "es", st.region, now)
default:
switch body := req.Body.(type) {
case io.ReadSeeker:
_, err = st.signer.Sign(req, body, "es", st.region, now)
default:
buf, err := ioutil.ReadAll(req.Body)
if err != nil {
return nil, err
}
req.Body = ioutil.NopCloser(bytes.NewReader(buf))
_, err = st.signer.Sign(req, bytes.NewReader(buf), "es", st.region, time.Now().UTC())
}
}
if err != nil {
return nil, err
}
return st.client.Do(req)
}
================================================
FILE: aws/v4/aws_v4_test.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package v4
import (
"context"
"crypto/tls"
"fmt"
"net/http"
"net/http/httptest"
"testing"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/olivere/elastic/v7"
)
func TestSigningClient(t *testing.T) {
var req *http.Request
ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/":
req = r // capture the HTTP request
w.WriteHeader(http.StatusOK)
fmt.Fprintln(w, `{
"name" : "Qg28M36",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "rwHa7BBnRC2h8KoDfCbmuQ",
"version" : {
"number" : "6.3.2",
"build_flavor" : "oss",
"build_type" : "tar",
"build_hash" : "053779d",
"build_date" : "2018-07-20T05:20:23.451332Z",
"build_snapshot" : false,
"lucene_version" : "7.3.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}`)
return
default:
w.WriteHeader(http.StatusInternalServerError)
return
}
}))
defer ts.Close()
cred := credentials.NewStaticCredentials("dev", "secret", "")
// Don't do this in production!
insecureHttpClient := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}
signingClient := NewV4SigningClientWithHTTPClient(cred, "us-east-1", insecureHttpClient)
// Create a simple Ping request via Elastic
client, err := elastic.NewClient(
elastic.SetURL(ts.URL),
elastic.SetHttpClient(signingClient),
elastic.SetHealthcheck(false),
elastic.SetSniff(false),
)
if err != nil {
t.Fatal(err)
}
res, code, err := client.Ping(ts.URL).Do(context.Background())
if err != nil {
t.Fatal(err)
}
if want, have := http.StatusOK, code; want != have {
t.Fatalf("want Status=%d, have %d", want, have)
}
if want, have := "You Know, for Search", res.TagLine; want != have {
t.Fatalf("want TagLine=%q, have %q", want, have)
}
// Check the request recorded in the HTTP test server (see above)
if req == nil {
t.Fatal("expected to capture HTTP request")
}
if have := req.Header.Get("Authorization"); have == "" {
t.Fatal("expected Authorization header")
}
if have := req.Header.Get("X-Amz-Date"); have == "" {
t.Fatal("expected X-Amz-Date header")
}
/*
if want, have := `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`, req.Header.Get("X-Amz-Content-Sha256"); want != have {
t.Fatalf("want header of X-Amz-Content-Sha256=%q, have %q", want, have)
}
*/
}
================================================
FILE: backoff.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"math"
"math/rand"
"sync"
"time"
)
// BackoffFunc specifies the signature of a function that returns the
// time to wait before the next call to a resource. To stop retrying
// return false in the 2nd return value.
type BackoffFunc func(retry int) (time.Duration, bool)
// Backoff allows callers to implement their own Backoff strategy.
type Backoff interface {
// Next implements a BackoffFunc.
Next(retry int) (time.Duration, bool)
}
// -- ZeroBackoff --
// ZeroBackoff is a fixed backoff policy whose backoff time is always zero,
// meaning that the operation is retried immediately without waiting,
// indefinitely.
type ZeroBackoff struct{}
// Next implements BackoffFunc for ZeroBackoff.
func (b ZeroBackoff) Next(retry int) (time.Duration, bool) {
return 0, true
}
// -- StopBackoff --
// StopBackoff is a fixed backoff policy that always returns false for
// Next(), meaning that the operation should never be retried.
type StopBackoff struct{}
// Next implements BackoffFunc for StopBackoff.
func (b StopBackoff) Next(retry int) (time.Duration, bool) {
return 0, false
}
// -- ConstantBackoff --
// ConstantBackoff is a backoff policy that always returns the same delay.
type ConstantBackoff struct {
interval time.Duration
}
// NewConstantBackoff returns a new ConstantBackoff.
func NewConstantBackoff(interval time.Duration) *ConstantBackoff {
return &ConstantBackoff{interval: interval}
}
// Next implements BackoffFunc for ConstantBackoff.
func (b *ConstantBackoff) Next(retry int) (time.Duration, bool) {
return b.interval, true
}
// -- Exponential --
// ExponentialBackoff implements the simple exponential backoff described by
// Douglas Thain at http://dthain.blogspot.de/2009/02/exponential-backoff-in-distributed.html.
type ExponentialBackoff struct {
t float64 // initial timeout (in msec)
f float64 // exponential factor (e.g. 2)
m float64 // maximum timeout (in msec)
}
// NewExponentialBackoff returns a ExponentialBackoff backoff policy.
// Use initialTimeout to set the first/minimal interval
// and maxTimeout to set the maximum wait interval.
func NewExponentialBackoff(initialTimeout, maxTimeout time.Duration) *ExponentialBackoff {
return &ExponentialBackoff{
t: float64(int64(initialTimeout / time.Millisecond)),
f: 2.0,
m: float64(int64(maxTimeout / time.Millisecond)),
}
}
// Next implements BackoffFunc for ExponentialBackoff.
func (b *ExponentialBackoff) Next(retry int) (time.Duration, bool) {
r := 1.0 + rand.Float64() // random number in [1..2]
m := math.Min(r*b.t*math.Pow(b.f, float64(retry)), b.m)
if m >= b.m {
return 0, false
}
d := time.Duration(int64(m)) * time.Millisecond
return d, true
}
// -- Simple Backoff --
// SimpleBackoff takes a list of fixed values for backoff intervals.
// Each call to Next returns the next value from that fixed list.
// After each value is returned, subsequent calls to Next will only return
// the last element. The values are optionally "jittered" (off by default).
type SimpleBackoff struct {
sync.Mutex
ticks []int
jitter bool
}
// NewSimpleBackoff creates a SimpleBackoff algorithm with the specified
// list of fixed intervals in milliseconds.
func NewSimpleBackoff(ticks ...int) *SimpleBackoff {
return &SimpleBackoff{
ticks: ticks,
jitter: false,
}
}
// Jitter enables or disables jittering values.
func (b *SimpleBackoff) Jitter(flag bool) *SimpleBackoff {
b.Lock()
b.jitter = flag
b.Unlock()
return b
}
// jitter randomizes the interval to return a value of [0.5*millis .. 1.5*millis].
func jitter(millis int) int {
if millis <= 0 {
return 0
}
return millis/2 + rand.Intn(millis)
}
// Next implements BackoffFunc for SimpleBackoff.
func (b *SimpleBackoff) Next(retry int) (time.Duration, bool) {
b.Lock()
defer b.Unlock()
if retry >= len(b.ticks) {
return 0, false
}
ms := b.ticks[retry]
if b.jitter {
ms = jitter(ms)
}
return time.Duration(ms) * time.Millisecond, true
}
================================================
FILE: backoff_test.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"math/rand"
"testing"
"time"
)
func TestZeroBackoff(t *testing.T) {
b := ZeroBackoff{}
_, ok := b.Next(0)
if !ok {
t.Fatalf("expected %v, got %v", true, ok)
}
}
func TestStopBackoff(t *testing.T) {
b := StopBackoff{}
_, ok := b.Next(0)
if ok {
t.Fatalf("expected %v, got %v", false, ok)
}
}
func TestConstantBackoff(t *testing.T) {
b := NewConstantBackoff(time.Second)
d, ok := b.Next(0)
if !ok {
t.Fatalf("expected %v, got %v", true, ok)
}
if d != time.Second {
t.Fatalf("expected %v, got %v", time.Second, d)
}
}
func TestSimpleBackoff(t *testing.T) {
var tests = []struct {
Duration time.Duration
Continue bool
}{
// #0
{
Duration: 1 * time.Millisecond,
Continue: true,
},
// #1
{
Duration: 2 * time.Millisecond,
Continue: true,
},
// #2
{
Duration: 7 * time.Millisecond,
Continue: true,
},
// #3
{
Duration: 0,
Continue: false,
},
// #4
{
Duration: 0,
Continue: false,
},
}
b := NewSimpleBackoff(1, 2, 7)
for i, tt := range tests {
d, ok := b.Next(i)
if got, want := ok, tt.Continue; got != want {
t.Fatalf("#%d: expected %v, got %v", i, want, got)
}
if got, want := d, tt.Duration; got != want {
t.Fatalf("#%d: expected %v, got %v", i, want, got)
}
}
}
func TestExponentialBackoff(t *testing.T) {
rand.Seed(time.Now().UnixNano())
min := time.Duration(8) * time.Millisecond
max := time.Duration(256) * time.Millisecond
b := NewExponentialBackoff(min, max)
between := func(value time.Duration, a, b int) bool {
x := int(value / time.Millisecond)
return a <= x && x <= b
}
got, ok := b.Next(0)
if !ok {
t.Fatalf("expected %v, got %v", true, ok)
}
if !between(got, 8, 256) {
t.Errorf("expected [%v..%v], got %v", 8, 256, got)
}
got, ok = b.Next(1)
if !ok {
t.Fatalf("expected %v, got %v", true, ok)
}
if !between(got, 8, 256) {
t.Errorf("expected [%v..%v], got %v", 8, 256, got)
}
got, ok = b.Next(2)
if !ok {
t.Fatalf("expected %v, got %v", true, ok)
}
if !between(got, 8, 256) {
t.Errorf("expected [%v..%v], got %v", 8, 256, got)
}
got, ok = b.Next(3)
if !ok {
t.Fatalf("expected %v, got %v", true, ok)
}
if !between(got, 8, 256) {
t.Errorf("expected [%v..%v], got %v", 8, 256, got)
}
got, ok = b.Next(4)
if !ok {
t.Fatalf("expected %v, got %v", true, ok)
}
if !between(got, 8, 256) {
t.Errorf("expected [%v..%v], got %v", 8, 256, got)
}
if _, ok := b.Next(5); ok {
t.Fatalf("expected %v, got %v", false, ok)
}
if _, ok = b.Next(6); ok {
t.Fatalf("expected %v, got %v", false, ok)
}
}
================================================
FILE: bulk.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"strings"
"github.com/olivere/elastic/v7/uritemplates"
)
// BulkService allows for batching bulk requests and sending them to
// Elasticsearch in one roundtrip. Use the Add method with BulkIndexRequest,
// BulkUpdateRequest, and BulkDeleteRequest to add bulk requests to a batch,
// then use Do to send them to Elasticsearch.
//
// BulkService will be reset after each Do call. In other words, you can
// reuse BulkService to send many batches. You do not have to create a new
// BulkService for each batch.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html
// for more details.
type BulkService struct {
client *Client
retrier Retrier
pretty *bool // pretty format the returned JSON response
human *bool // return human readable values for statistics
errorTrace *bool // include the stack trace of returned errors
filterPath []string // list of filters used to reduce the response
headers http.Header // custom request-level HTTP headers
index string
typ string
requests []BulkableRequest
pipeline string
timeout string
refresh string
routing string
waitForActiveShards string
// estimated bulk size in bytes, up to the request index sizeInBytesCursor
sizeInBytes int64
sizeInBytesCursor int
}
// NewBulkService initializes a new BulkService.
func NewBulkService(client *Client) *BulkService {
builder := &BulkService{
client: client,
}
return builder
}
// Pretty tells Elasticsearch whether to return a formatted JSON response.
func (s *BulkService) Pretty(pretty bool) *BulkService {
s.pretty = &pretty
return s
}
// Human specifies whether human readable values should be returned in
// the JSON response, e.g. "7.5mb".
func (s *BulkService) Human(human bool) *BulkService {
s.human = &human
return s
}
// ErrorTrace specifies whether to include the stack trace of returned errors.
func (s *BulkService) ErrorTrace(errorTrace bool) *BulkService {
s.errorTrace = &errorTrace
return s
}
// FilterPath specifies a list of filters used to reduce the response.
func (s *BulkService) FilterPath(filterPath ...string) *BulkService {
s.filterPath = filterPath
return s
}
// Header adds a header to the request.
func (s *BulkService) Header(name string, value string) *BulkService {
if s.headers == nil {
s.headers = http.Header{}
}
s.headers.Add(name, value)
return s
}
// Headers specifies the headers of the request.
func (s *BulkService) Headers(headers http.Header) *BulkService {
s.headers = headers
return s
}
// Reset cleans up the request queue
func (s *BulkService) Reset() {
s.requests = make([]BulkableRequest, 0)
s.sizeInBytes = 0
s.sizeInBytesCursor = 0
}
// Retrier allows to set specific retry logic for this BulkService.
// If not specified, it will use the client's default retrier.
func (s *BulkService) Retrier(retrier Retrier) *BulkService {
s.retrier = retrier
return s
}
// Index specifies the index to use for all batches. You may also leave
// this blank and specify the index in the individual bulk requests.
func (s *BulkService) Index(index string) *BulkService {
s.index = index
return s
}
// Type specifies the type to use for all batches. You may also leave
// this blank and specify the type in the individual bulk requests.
func (s *BulkService) Type(typ string) *BulkService {
s.typ = typ
return s
}
// Timeout is a global timeout for processing bulk requests. This is a
// server-side timeout, i.e. it tells Elasticsearch the time after which
// it should stop processing.
func (s *BulkService) Timeout(timeout string) *BulkService {
s.timeout = timeout
return s
}
// Refresh controls when changes made by this request are made visible
// to search. The allowed values are: "true" (refresh the relevant
// primary and replica shards immediately), "wait_for" (wait for the
// changes to be made visible by a refresh before replying), or "false"
// (no refresh related actions). The default value is "false".
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-refresh.html
// for details.
func (s *BulkService) Refresh(refresh string) *BulkService {
s.refresh = refresh
return s
}
// Routing specifies the routing value.
func (s *BulkService) Routing(routing string) *BulkService {
s.routing = routing
return s
}
// Pipeline specifies the pipeline id to preprocess incoming documents with.
func (s *BulkService) Pipeline(pipeline string) *BulkService {
s.pipeline = pipeline
return s
}
// WaitForActiveShards sets the number of shard copies that must be active
// before proceeding with the bulk operation. Defaults to 1, meaning the
// primary shard only. Set to `all` for all shard copies, otherwise set to
// any non-negative value less than or equal to the total number of copies
// for the shard (number of replicas + 1).
func (s *BulkService) WaitForActiveShards(waitForActiveShards string) *BulkService {
s.waitForActiveShards = waitForActiveShards
return s
}
// Add adds bulkable requests, i.e. BulkIndexRequest, BulkUpdateRequest,
// and/or BulkDeleteRequest.
func (s *BulkService) Add(requests ...BulkableRequest) *BulkService {
s.requests = append(s.requests, requests...)
return s
}
// EstimatedSizeInBytes returns the estimated size of all bulkable
// requests added via Add.
func (s *BulkService) EstimatedSizeInBytes() int64 {
if s.sizeInBytesCursor == len(s.requests) {
return s.sizeInBytes
}
for _, r := range s.requests[s.sizeInBytesCursor:] {
s.sizeInBytes += s.estimateSizeInBytes(r)
s.sizeInBytesCursor++
}
return s.sizeInBytes
}
// estimateSizeInBytes returns the estimates size of the given
// bulkable request, i.e. BulkIndexRequest, BulkUpdateRequest, and
// BulkDeleteRequest.
func (s *BulkService) estimateSizeInBytes(r BulkableRequest) int64 {
lines, _ := r.Source()
size := 0
for _, line := range lines {
// +1 for the \n
size += len(line) + 1
}
return int64(size)
}
// NumberOfActions returns the number of bulkable requests that need to
// be sent to Elasticsearch on the next batch.
func (s *BulkService) NumberOfActions() int {
return len(s.requests)
}
func (s *BulkService) bodyAsString() (string, error) {
// Pre-allocate to reduce allocs
var buf strings.Builder
buf.Grow(int(s.EstimatedSizeInBytes()))
for _, req := range s.requests {
source, err := req.Source()
if err != nil {
return "", err
}
for _, line := range source {
buf.WriteString(line)
buf.WriteByte('\n')
}
}
return buf.String(), nil
}
// Do sends the batched requests to Elasticsearch. Note that, when successful,
// you can reuse the BulkService for the next batch as the list of bulk
// requests is cleared on success.
func (s *BulkService) Do(ctx context.Context) (*BulkResponse, error) {
// No actions?
if s.NumberOfActions() == 0 {
return nil, errors.New("elastic: No bulk actions to commit")
}
// Get body
body, err := s.bodyAsString()
if err != nil {
return nil, err
}
// Build url
path := "/"
if len(s.index) > 0 {
index, err := uritemplates.Expand("{index}", map[string]string{
"index": s.index,
})
if err != nil {
return nil, err
}
path += index + "/"
}
if len(s.typ) > 0 {
typ, err := uritemplates.Expand("{type}", map[string]string{
"type": s.typ,
})
if err != nil {
return nil, err
}
path += typ + "/"
}
path += "_bulk"
// Parameters
params := url.Values{}
if v := s.pretty; v != nil {
params.Set("pretty", fmt.Sprint(*v))
}
if v := s.human; v != nil {
params.Set("human", fmt.Sprint(*v))
}
if v := s.errorTrace; v != nil {
params.Set("error_trace", fmt.Sprint(*v))
}
if len(s.filterPath) > 0 {
params.Set("filter_path", strings.Join(s.filterPath, ","))
}
if s.pipeline != "" {
params.Set("pipeline", s.pipeline)
}
if s.refresh != "" {
params.Set("refresh", s.refresh)
}
if s.routing != "" {
params.Set("routing", s.routing)
}
if s.timeout != "" {
params.Set("timeout", s.timeout)
}
if s.waitForActiveShards != "" {
params.Set("wait_for_active_shards", s.waitForActiveShards)
}
// Get response
res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
Method: "POST",
Path: path,
Params: params,
Body: body,
ContentType: "application/x-ndjson",
Retrier: s.retrier,
Headers: s.headers,
})
if err != nil {
return nil, err
}
// Return results
ret := new(BulkResponse)
if err := s.client.decoder.Decode(res.Body, ret); err != nil {
return nil, err
}
// Reset so the request can be reused
s.Reset()
return ret, nil
}
// BulkResponse is a response to a bulk execution.
//
// Example:
// {
// "took":3,
// "errors":false,
// "items":[{
// "index":{
// "_index":"index1",
// "_type":"tweet",
// "_id":"1",
// "_version":3,
// "status":201
// }
// },{
// "index":{
// "_index":"index2",
// "_type":"tweet",
// "_id":"2",
// "_version":3,
// "status":200
// }
// },{
// "delete":{
// "_index":"index1",
// "_type":"tweet",
// "_id":"1",
// "_version":4,
// "status":200,
// "found":true
// }
// },{
// "update":{
// "_index":"index2",
// "_type":"tweet",
// "_id":"2",
// "_version":4,
// "status":200
// }
// }]
// }
type BulkResponse struct {
Took int `json:"took,omitempty"`
Errors bool `json:"errors,omitempty"`
Items []map[string]*BulkResponseItem `json:"items,omitempty"`
}
// BulkResponseItem is the result of a single bulk request.
type BulkResponseItem struct {
Index string `json:"_index,omitempty"`
Type string `json:"_type,omitempty"`
Id string `json:"_id,omitempty"`
Version int64 `json:"_version,omitempty"`
Result string `json:"result,omitempty"`
Shards *ShardsInfo `json:"_shards,omitempty"`
SeqNo int64 `json:"_seq_no,omitempty"`
PrimaryTerm int64 `json:"_primary_term,omitempty"`
Status int `json:"status,omitempty"`
ForcedRefresh bool `json:"forced_refresh,omitempty"`
Error *ErrorDetails `json:"error,omitempty"`
GetResult *GetResult `json:"get,omitempty"`
}
// Indexed returns all bulk request results of "index" actions.
func (r *BulkResponse) Indexed() []*BulkResponseItem {
return r.ByAction("index")
}
// Created returns all bulk request results of "create" actions.
func (r *BulkResponse) Created() []*BulkResponseItem {
return r.ByAction("create")
}
// Updated returns all bulk request results of "update" actions.
func (r *BulkResponse) Updated() []*BulkResponseItem {
return r.ByAction("update")
}
// Deleted returns all bulk request results of "delete" actions.
func (r *BulkResponse) Deleted() []*BulkResponseItem {
return r.ByAction("delete")
}
// ByAction returns all bulk request results of a certain action,
// e.g. "index" or "delete".
func (r *BulkResponse) ByAction(action string) []*BulkResponseItem {
if r.Items == nil {
return nil
}
var items []*BulkResponseItem
for _, item := range r.Items {
if result, found := item[action]; found {
items = append(items, result)
}
}
return items
}
// ById returns all bulk request results of a given document id,
// regardless of the action ("index", "delete" etc.).
func (r *BulkResponse) ById(id string) []*BulkResponseItem {
if r.Items == nil {
return nil
}
var items []*BulkResponseItem
for _, item := range r.Items {
for _, result := range item {
if result.Id == id {
items = append(items, result)
}
}
}
return items
}
// Failed returns those items of a bulk response that have errors,
// i.e. those that don't have a status code between 200 and 299.
func (r *BulkResponse) Failed() []*BulkResponseItem {
if r.Items == nil {
return nil
}
var errors []*BulkResponseItem
for _, item := range r.Items {
for _, result := range item {
if !(result.Status >= 200 && result.Status <= 299) {
errors = append(errors, result)
}
}
}
return errors
}
// Succeeded returns those items of a bulk response that have no errors,
// i.e. those have a status code between 200 and 299.
func (r *BulkResponse) Succeeded() []*BulkResponseItem {
if r.Items == nil {
return nil
}
var succeeded []*BulkResponseItem
for _, item := range r.Items {
for _, result := range item {
if result.Status >= 200 && result.Status <= 299 {
succeeded = append(succeeded, result)
}
}
}
return succeeded
}
================================================
FILE: bulk_create_request.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
//go:generate easyjson bulk_create_request.go
import (
"encoding/json"
"fmt"
"strings"
)
// BulkCreateRequest is a request to add a new document to Elasticsearch.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html
// for details.
type BulkCreateRequest struct {
BulkableRequest
index string
typ string
id string
opType string
routing string
parent string
version *int64 // default is MATCH_ANY
versionType string // default is "internal"
doc interface{}
pipeline string
retryOnConflict *int
ifSeqNo *int64
ifPrimaryTerm *int64
source []string
useEasyJSON bool
}
//easyjson:json
type bulkCreateRequestCommand map[string]bulkCreateRequestCommandOp
//easyjson:json
type bulkCreateRequestCommandOp struct {
Index string `json:"_index,omitempty"`
Id string `json:"_id,omitempty"`
Type string `json:"_type,omitempty"`
Parent string `json:"parent,omitempty"`
// RetryOnConflict is "_retry_on_conflict" for 6.0 and "retry_on_conflict" for 6.1+.
RetryOnConflict *int `json:"retry_on_conflict,omitempty"`
Routing string `json:"routing,omitempty"`
Version *int64 `json:"version,omitempty"`
VersionType string `json:"version_type,omitempty"`
Pipeline string `json:"pipeline,omitempty"`
IfSeqNo *int64 `json:"if_seq_no,omitempty"`
IfPrimaryTerm *int64 `json:"if_primary_term,omitempty"`
}
// NewBulkCreateRequest returns a new BulkCreateRequest.
// The operation type is "create" by default.
func NewBulkCreateRequest() *BulkCreateRequest {
return &BulkCreateRequest{
opType: "create",
}
}
// UseEasyJSON is an experimental setting that enables serialization
// with github.com/mailru/easyjson, which should in faster serialization
// time and less allocations, but removed compatibility with encoding/json,
// usage of unsafe etc. See https://github.com/mailru/easyjson#issues-notes-and-limitations
// for details. This setting is disabled by default.
func (r *BulkCreateRequest) UseEasyJSON(enable bool) *BulkCreateRequest {
r.useEasyJSON = enable
return r
}
// Index specifies the Elasticsearch index to use for this create request.
// If unspecified, the index set on the BulkService will be used.
func (r *BulkCreateRequest) Index(index string) *BulkCreateRequest {
r.index = index
r.source = nil
return r
}
// Type specifies the Elasticsearch type to use for this create request.
// If unspecified, the type set on the BulkService will be used.
func (r *BulkCreateRequest) Type(typ string) *BulkCreateRequest {
r.typ = typ
r.source = nil
return r
}
// Id specifies the identifier of the document to create.
func (r *BulkCreateRequest) Id(id string) *BulkCreateRequest {
r.id = id
r.source = nil
return r
}
// Routing specifies a routing value for the request.
func (r *BulkCreateRequest) Routing(routing string) *BulkCreateRequest {
r.routing = routing
r.source = nil
return r
}
// Parent specifies the identifier of the parent document (if available).
func (r *BulkCreateRequest) Parent(parent string) *BulkCreateRequest {
r.parent = parent
r.source = nil
return r
}
// Version indicates the version of the document as part of an optimistic
// concurrency model.
func (r *BulkCreateRequest) Version(version int64) *BulkCreateRequest {
v := version
r.version = &v
r.source = nil
return r
}
// VersionType specifies how versions are created. It can be e.g. internal,
// external, external_gte, or force.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-index_.html#index-versioning
// for details.
func (r *BulkCreateRequest) VersionType(versionType string) *BulkCreateRequest {
r.versionType = versionType
r.source = nil
return r
}
// Doc specifies the document to create.
func (r *BulkCreateRequest) Doc(doc interface{}) *BulkCreateRequest {
r.doc = doc
r.source = nil
return r
}
// RetryOnConflict specifies how often to retry in case of a version conflict.
func (r *BulkCreateRequest) RetryOnConflict(retryOnConflict int) *BulkCreateRequest {
r.retryOnConflict = &retryOnConflict
r.source = nil
return r
}
// Pipeline to use while processing the request.
func (r *BulkCreateRequest) Pipeline(pipeline string) *BulkCreateRequest {
r.pipeline = pipeline
r.source = nil
return r
}
// IfSeqNo indicates to only perform the create operation if the last
// operation that has changed the document has the specified sequence number.
func (r *BulkCreateRequest) IfSeqNo(ifSeqNo int64) *BulkCreateRequest {
r.ifSeqNo = &ifSeqNo
return r
}
// IfPrimaryTerm indicates to only perform the create operation if the
// last operation that has changed the document has the specified primary term.
func (r *BulkCreateRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkCreateRequest {
r.ifPrimaryTerm = &ifPrimaryTerm
return r
}
// String returns the on-wire representation of the create request,
// concatenated as a single string.
func (r *BulkCreateRequest) String() string {
lines, err := r.Source()
if err != nil {
return fmt.Sprintf("error: %v", err)
}
return strings.Join(lines, "\n")
}
// Source returns the on-wire representation of the create request,
// split into an action-and-meta-data line and an (optional) source line.
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html
// for details.
func (r *BulkCreateRequest) Source() ([]string, error) {
// { "create" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
// { "field1" : "value1" }
if r.source != nil {
return r.source, nil
}
lines := make([]string, 2)
// "index" ...
indexCommand := bulkCreateRequestCommandOp{
Index: r.index,
Type: r.typ,
Id: r.id,
Routing: r.routing,
Parent: r.parent,
Version: r.version,
VersionType: r.versionType,
RetryOnConflict: r.retryOnConflict,
Pipeline: r.pipeline,
IfSeqNo: r.ifSeqNo,
IfPrimaryTerm: r.ifPrimaryTerm,
}
command := bulkCreateRequestCommand{
r.opType: indexCommand,
}
var err error
var body []byte
if r.useEasyJSON {
// easyjson
body, err = command.MarshalJSON()
} else {
// encoding/json
body, err = json.Marshal(command)
}
if err != nil {
return nil, err
}
lines[0] = string(body)
// "field1" ...
if r.doc != nil {
switch t := r.doc.(type) {
default:
body, err := json.Marshal(r.doc)
if err != nil {
return nil, err
}
lines[1] = string(body)
case json.RawMessage:
lines[1] = string(t)
case *json.RawMessage:
lines[1] = string(*t)
case string:
lines[1] = t
case *string:
lines[1] = *t
}
} else {
lines[1] = "{}"
}
r.source = lines
return lines, nil
}
================================================
FILE: bulk_create_request_easyjson.go
================================================
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package elastic
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
_ *jlexer.Lexer
_ *jwriter.Writer
_ easyjson.Marshaler
)
func easyjson29a8ef77DecodeGithubComOlivereElasticV7(in *jlexer.Lexer, out *bulkCreateRequestCommandOp) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "_index":
out.Index = string(in.String())
case "_id":
out.Id = string(in.String())
case "_type":
out.Type = string(in.String())
case "parent":
out.Parent = string(in.String())
case "retry_on_conflict":
if in.IsNull() {
in.Skip()
out.RetryOnConflict = nil
} else {
if out.RetryOnConflict == nil {
out.RetryOnConflict = new(int)
}
*out.RetryOnConflict = int(in.Int())
}
case "routing":
out.Routing = string(in.String())
case "version":
if in.IsNull() {
in.Skip()
out.Version = nil
} else {
if out.Version == nil {
out.Version = new(int64)
}
*out.Version = int64(in.Int64())
}
case "version_type":
out.VersionType = string(in.String())
case "pipeline":
out.Pipeline = string(in.String())
case "if_seq_no":
if in.IsNull() {
in.Skip()
out.IfSeqNo = nil
} else {
if out.IfSeqNo == nil {
out.IfSeqNo = new(int64)
}
*out.IfSeqNo = int64(in.Int64())
}
case "if_primary_term":
if in.IsNull() {
in.Skip()
out.IfPrimaryTerm = nil
} else {
if out.IfPrimaryTerm == nil {
out.IfPrimaryTerm = new(int64)
}
*out.IfPrimaryTerm = int64(in.Int64())
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjson29a8ef77EncodeGithubComOlivereElasticV7(out *jwriter.Writer, in bulkCreateRequestCommandOp) {
out.RawByte('{')
first := true
_ = first
if in.Index != "" {
const prefix string = ",\"_index\":"
first = false
out.RawString(prefix[1:])
out.String(string(in.Index))
}
if in.Id != "" {
const prefix string = ",\"_id\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Id))
}
if in.Type != "" {
const prefix string = ",\"_type\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Type))
}
if in.Parent != "" {
const prefix string = ",\"parent\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Parent))
}
if in.RetryOnConflict != nil {
const prefix string = ",\"retry_on_conflict\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int(int(*in.RetryOnConflict))
}
if in.Routing != "" {
const prefix string = ",\"routing\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Routing))
}
if in.Version != nil {
const prefix string = ",\"version\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(*in.Version))
}
if in.VersionType != "" {
const prefix string = ",\"version_type\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.VersionType))
}
if in.Pipeline != "" {
const prefix string = ",\"pipeline\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Pipeline))
}
if in.IfSeqNo != nil {
const prefix string = ",\"if_seq_no\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(*in.IfSeqNo))
}
if in.IfPrimaryTerm != nil {
const prefix string = ",\"if_primary_term\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(*in.IfPrimaryTerm))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v bulkCreateRequestCommandOp) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjson29a8ef77EncodeGithubComOlivereElasticV7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v bulkCreateRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) {
easyjson29a8ef77EncodeGithubComOlivereElasticV7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *bulkCreateRequestCommandOp) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjson29a8ef77DecodeGithubComOlivereElasticV7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *bulkCreateRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson29a8ef77DecodeGithubComOlivereElasticV7(l, v)
}
func easyjson29a8ef77DecodeGithubComOlivereElasticV71(in *jlexer.Lexer, out *bulkCreateRequestCommand) {
isTopLevel := in.IsStart()
if in.IsNull() {
in.Skip()
} else {
in.Delim('{')
*out = make(bulkCreateRequestCommand)
for !in.IsDelim('}') {
key := string(in.String())
in.WantColon()
var v1 bulkCreateRequestCommandOp
(v1).UnmarshalEasyJSON(in)
(*out)[key] = v1
in.WantComma()
}
in.Delim('}')
}
if isTopLevel {
in.Consumed()
}
}
func easyjson29a8ef77EncodeGithubComOlivereElasticV71(out *jwriter.Writer, in bulkCreateRequestCommand) {
if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
out.RawString(`null`)
} else {
out.RawByte('{')
v2First := true
for v2Name, v2Value := range in {
if v2First {
v2First = false
} else {
out.RawByte(',')
}
out.String(string(v2Name))
out.RawByte(':')
(v2Value).MarshalEasyJSON(out)
}
out.RawByte('}')
}
}
// MarshalJSON supports json.Marshaler interface
func (v bulkCreateRequestCommand) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjson29a8ef77EncodeGithubComOlivereElasticV71(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v bulkCreateRequestCommand) MarshalEasyJSON(w *jwriter.Writer) {
easyjson29a8ef77EncodeGithubComOlivereElasticV71(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *bulkCreateRequestCommand) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjson29a8ef77DecodeGithubComOlivereElasticV71(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *bulkCreateRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson29a8ef77DecodeGithubComOlivereElasticV71(l, v)
}
================================================
FILE: bulk_create_request_test.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"testing"
"time"
)
func TestBulkCreateRequestSerialization(t *testing.T) {
tests := []struct {
Request BulkableRequest
Expected []string
}{
// #0
{
Request: NewBulkCreateRequest().Index("index1").Id("1").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"create":{"_index":"index1","_id":"1"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #1
{
Request: NewBulkCreateRequest().Index("index1").Id("1").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"create":{"_index":"index1","_id":"1"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #2
{
Request: NewBulkCreateRequest().Index("index1").Id("1").RetryOnConflict(42).
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"create":{"_index":"index1","_id":"1","retry_on_conflict":42}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #3
{
Request: NewBulkCreateRequest().Index("index1").Id("1").Pipeline("my_pipeline").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"create":{"_index":"index1","_id":"1","pipeline":"my_pipeline"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #4
{
Request: NewBulkCreateRequest().Index("index1").Id("1").
Routing("123").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"create":{"_index":"index1","_id":"1","routing":"123"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #5
{
Request: NewBulkCreateRequest().Index("index1").Type("doc").Id("1").
Version(0).
VersionType("external").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"create":{"_index":"index1","_id":"1","_type":"doc","version":0,"version_type":"external"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
}
for i, test := range tests {
lines, err := test.Request.Source()
if err != nil {
t.Fatalf("case #%d: expected no error, got: %v", i, err)
}
if lines == nil {
t.Fatalf("case #%d: expected lines, got nil", i)
}
if len(lines) != len(test.Expected) {
t.Fatalf("case #%d: expected %d lines, got %d", i, len(test.Expected), len(lines))
}
for j, line := range lines {
if line != test.Expected[j] {
t.Errorf("case #%d: expected line #%d to be %s, got: %s", i, j, test.Expected[j], line)
}
}
}
}
var bulkCreateRequestSerializationResult string
func BenchmarkBulkCreateRequestSerialization(b *testing.B) {
b.Run("stdlib", func(b *testing.B) {
r := NewBulkCreateRequest().Index(testIndexName).Id("1").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)})
benchmarkBulkCreateRequestSerialization(b, r.UseEasyJSON(false))
})
b.Run("easyjson", func(b *testing.B) {
r := NewBulkCreateRequest().Index(testIndexName).Id("1").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)})
benchmarkBulkCreateRequestSerialization(b, r.UseEasyJSON(true))
})
}
func benchmarkBulkCreateRequestSerialization(b *testing.B, r *BulkCreateRequest) {
var s string
for n := 0; n < b.N; n++ {
s = r.String()
r.source = nil // Don't let caching spoil the benchmark
}
bulkCreateRequestSerializationResult = s // ensure the compiler doesn't optimize
b.ReportAllocs()
}
================================================
FILE: bulk_delete_request.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
//go:generate easyjson bulk_delete_request.go
import (
"encoding/json"
"fmt"
"strings"
)
// -- Bulk delete request --
// BulkDeleteRequest is a request to remove a document from Elasticsearch.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html
// for details.
type BulkDeleteRequest struct {
BulkableRequest
index string
typ string
id string
parent string
routing string
version int64 // default is MATCH_ANY
versionType string // default is "internal"
ifSeqNo *int64
ifPrimaryTerm *int64
source []string
useEasyJSON bool
}
//easyjson:json
type bulkDeleteRequestCommand map[string]bulkDeleteRequestCommandOp
//easyjson:json
type bulkDeleteRequestCommandOp struct {
Index string `json:"_index,omitempty"`
Type string `json:"_type,omitempty"`
Id string `json:"_id,omitempty"`
Parent string `json:"parent,omitempty"`
Routing string `json:"routing,omitempty"`
Version int64 `json:"version,omitempty"`
VersionType string `json:"version_type,omitempty"`
IfSeqNo *int64 `json:"if_seq_no,omitempty"`
IfPrimaryTerm *int64 `json:"if_primary_term,omitempty"`
}
// NewBulkDeleteRequest returns a new BulkDeleteRequest.
func NewBulkDeleteRequest() *BulkDeleteRequest {
return &BulkDeleteRequest{}
}
// UseEasyJSON is an experimental setting that enables serialization
// with github.com/mailru/easyjson, which should in faster serialization
// time and less allocations, but removed compatibility with encoding/json,
// usage of unsafe etc. See https://github.com/mailru/easyjson#issues-notes-and-limitations
// for details. This setting is disabled by default.
func (r *BulkDeleteRequest) UseEasyJSON(enable bool) *BulkDeleteRequest {
r.useEasyJSON = enable
return r
}
// Index specifies the Elasticsearch index to use for this delete request.
// If unspecified, the index set on the BulkService will be used.
func (r *BulkDeleteRequest) Index(index string) *BulkDeleteRequest {
r.index = index
r.source = nil
return r
}
// Type specifies the Elasticsearch type to use for this delete request.
// If unspecified, the type set on the BulkService will be used.
func (r *BulkDeleteRequest) Type(typ string) *BulkDeleteRequest {
r.typ = typ
r.source = nil
return r
}
// Id specifies the identifier of the document to delete.
func (r *BulkDeleteRequest) Id(id string) *BulkDeleteRequest {
r.id = id
r.source = nil
return r
}
// Parent specifies the parent of the request, which is used in parent/child
// mappings.
func (r *BulkDeleteRequest) Parent(parent string) *BulkDeleteRequest {
r.parent = parent
r.source = nil
return r
}
// Routing specifies a routing value for the request.
func (r *BulkDeleteRequest) Routing(routing string) *BulkDeleteRequest {
r.routing = routing
r.source = nil
return r
}
// Version indicates the version to be deleted as part of an optimistic
// concurrency model.
func (r *BulkDeleteRequest) Version(version int64) *BulkDeleteRequest {
r.version = version
r.source = nil
return r
}
// VersionType can be "internal" (default), "external", "external_gte",
// or "external_gt".
func (r *BulkDeleteRequest) VersionType(versionType string) *BulkDeleteRequest {
r.versionType = versionType
r.source = nil
return r
}
// IfSeqNo indicates to only perform the delete operation if the last
// operation that has changed the document has the specified sequence number.
func (r *BulkDeleteRequest) IfSeqNo(ifSeqNo int64) *BulkDeleteRequest {
r.ifSeqNo = &ifSeqNo
return r
}
// IfPrimaryTerm indicates to only perform the delete operation if the
// last operation that has changed the document has the specified primary term.
func (r *BulkDeleteRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkDeleteRequest {
r.ifPrimaryTerm = &ifPrimaryTerm
return r
}
// String returns the on-wire representation of the delete request,
// concatenated as a single string.
func (r *BulkDeleteRequest) String() string {
lines, err := r.Source()
if err != nil {
return fmt.Sprintf("error: %v", err)
}
return strings.Join(lines, "\n")
}
// Source returns the on-wire representation of the delete request,
// split into an action-and-meta-data line and an (optional) source line.
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html
// for details.
func (r *BulkDeleteRequest) Source() ([]string, error) {
if r.source != nil {
return r.source, nil
}
command := bulkDeleteRequestCommand{
"delete": bulkDeleteRequestCommandOp{
Index: r.index,
Type: r.typ,
Id: r.id,
Routing: r.routing,
Parent: r.parent,
Version: r.version,
VersionType: r.versionType,
IfSeqNo: r.ifSeqNo,
IfPrimaryTerm: r.ifPrimaryTerm,
},
}
var err error
var body []byte
if r.useEasyJSON {
// easyjson
body, err = command.MarshalJSON()
} else {
// encoding/json
body, err = json.Marshal(command)
}
if err != nil {
return nil, err
}
lines := []string{string(body)}
r.source = lines
return lines, nil
}
================================================
FILE: bulk_delete_request_easyjson.go
================================================
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package elastic
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
_ *jlexer.Lexer
_ *jwriter.Writer
_ easyjson.Marshaler
)
func easyjson8092efb6DecodeGithubComOlivereElasticV7(in *jlexer.Lexer, out *bulkDeleteRequestCommandOp) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "_index":
out.Index = string(in.String())
case "_type":
out.Type = string(in.String())
case "_id":
out.Id = string(in.String())
case "parent":
out.Parent = string(in.String())
case "routing":
out.Routing = string(in.String())
case "version":
out.Version = int64(in.Int64())
case "version_type":
out.VersionType = string(in.String())
case "if_seq_no":
if in.IsNull() {
in.Skip()
out.IfSeqNo = nil
} else {
if out.IfSeqNo == nil {
out.IfSeqNo = new(int64)
}
*out.IfSeqNo = int64(in.Int64())
}
case "if_primary_term":
if in.IsNull() {
in.Skip()
out.IfPrimaryTerm = nil
} else {
if out.IfPrimaryTerm == nil {
out.IfPrimaryTerm = new(int64)
}
*out.IfPrimaryTerm = int64(in.Int64())
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjson8092efb6EncodeGithubComOlivereElasticV7(out *jwriter.Writer, in bulkDeleteRequestCommandOp) {
out.RawByte('{')
first := true
_ = first
if in.Index != "" {
const prefix string = ",\"_index\":"
first = false
out.RawString(prefix[1:])
out.String(string(in.Index))
}
if in.Type != "" {
const prefix string = ",\"_type\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Type))
}
if in.Id != "" {
const prefix string = ",\"_id\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Id))
}
if in.Parent != "" {
const prefix string = ",\"parent\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Parent))
}
if in.Routing != "" {
const prefix string = ",\"routing\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Routing))
}
if in.Version != 0 {
const prefix string = ",\"version\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Version))
}
if in.VersionType != "" {
const prefix string = ",\"version_type\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.VersionType))
}
if in.IfSeqNo != nil {
const prefix string = ",\"if_seq_no\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(*in.IfSeqNo))
}
if in.IfPrimaryTerm != nil {
const prefix string = ",\"if_primary_term\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(*in.IfPrimaryTerm))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v bulkDeleteRequestCommandOp) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjson8092efb6EncodeGithubComOlivereElasticV7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v bulkDeleteRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) {
easyjson8092efb6EncodeGithubComOlivereElasticV7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *bulkDeleteRequestCommandOp) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjson8092efb6DecodeGithubComOlivereElasticV7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *bulkDeleteRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson8092efb6DecodeGithubComOlivereElasticV7(l, v)
}
func easyjson8092efb6DecodeGithubComOlivereElasticV71(in *jlexer.Lexer, out *bulkDeleteRequestCommand) {
isTopLevel := in.IsStart()
if in.IsNull() {
in.Skip()
} else {
in.Delim('{')
*out = make(bulkDeleteRequestCommand)
for !in.IsDelim('}') {
key := string(in.String())
in.WantColon()
var v1 bulkDeleteRequestCommandOp
(v1).UnmarshalEasyJSON(in)
(*out)[key] = v1
in.WantComma()
}
in.Delim('}')
}
if isTopLevel {
in.Consumed()
}
}
func easyjson8092efb6EncodeGithubComOlivereElasticV71(out *jwriter.Writer, in bulkDeleteRequestCommand) {
if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
out.RawString(`null`)
} else {
out.RawByte('{')
v2First := true
for v2Name, v2Value := range in {
if v2First {
v2First = false
} else {
out.RawByte(',')
}
out.String(string(v2Name))
out.RawByte(':')
(v2Value).MarshalEasyJSON(out)
}
out.RawByte('}')
}
}
// MarshalJSON supports json.Marshaler interface
func (v bulkDeleteRequestCommand) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjson8092efb6EncodeGithubComOlivereElasticV71(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v bulkDeleteRequestCommand) MarshalEasyJSON(w *jwriter.Writer) {
easyjson8092efb6EncodeGithubComOlivereElasticV71(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *bulkDeleteRequestCommand) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjson8092efb6DecodeGithubComOlivereElasticV71(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *bulkDeleteRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson8092efb6DecodeGithubComOlivereElasticV71(l, v)
}
================================================
FILE: bulk_delete_request_test.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"testing"
)
func TestBulkDeleteRequestSerialization(t *testing.T) {
tests := []struct {
Request BulkableRequest
Expected []string
}{
// #0
{
Request: NewBulkDeleteRequest().Index("index1").Id("1"),
Expected: []string{
`{"delete":{"_index":"index1","_id":"1"}}`,
},
},
// #1
{
Request: NewBulkDeleteRequest().Index("index1").Id("1").Parent("2"),
Expected: []string{
`{"delete":{"_index":"index1","_id":"1","parent":"2"}}`,
},
},
// #2
{
Request: NewBulkDeleteRequest().Index("index1").Id("1").Routing("3"),
Expected: []string{
`{"delete":{"_index":"index1","_id":"1","routing":"3"}}`,
},
},
}
for i, test := range tests {
lines, err := test.Request.Source()
if err != nil {
t.Fatalf("case #%d: expected no error, got: %v", i, err)
}
if lines == nil {
t.Fatalf("case #%d: expected lines, got nil", i)
}
if len(lines) != len(test.Expected) {
t.Fatalf("case #%d: expected %d lines, got %d", i, len(test.Expected), len(lines))
}
for j, line := range lines {
if line != test.Expected[j] {
t.Errorf("case #%d: expected line #%d to be %s, got: %s", i, j, test.Expected[j], line)
}
}
}
}
var bulkDeleteRequestSerializationResult string
func BenchmarkBulkDeleteRequestSerialization(b *testing.B) {
b.Run("stdlib", func(b *testing.B) {
r := NewBulkDeleteRequest().Index(testIndexName).Id("1")
benchmarkBulkDeleteRequestSerialization(b, r.UseEasyJSON(false))
})
b.Run("easyjson", func(b *testing.B) {
r := NewBulkDeleteRequest().Index(testIndexName).Id("1")
benchmarkBulkDeleteRequestSerialization(b, r.UseEasyJSON(true))
})
}
func benchmarkBulkDeleteRequestSerialization(b *testing.B, r *BulkDeleteRequest) {
var s string
for n := 0; n < b.N; n++ {
s = r.String()
r.source = nil // Don't let caching spoil the benchmark
}
bulkDeleteRequestSerializationResult = s // ensure the compiler doesn't optimize
b.ReportAllocs()
}
================================================
FILE: bulk_index_request.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
//go:generate easyjson bulk_index_request.go
import (
"encoding/json"
"fmt"
"strings"
)
// BulkIndexRequest is a request to add or replace a document to Elasticsearch.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html
// for details.
type BulkIndexRequest struct {
BulkableRequest
index string
typ string
id string
opType string
routing string
parent string
version *int64 // default is MATCH_ANY
versionType string // default is "internal"
doc interface{}
pipeline string
retryOnConflict *int
ifSeqNo *int64
ifPrimaryTerm *int64
source []string
useEasyJSON bool
}
//easyjson:json
type bulkIndexRequestCommand map[string]bulkIndexRequestCommandOp
//easyjson:json
type bulkIndexRequestCommandOp struct {
Index string `json:"_index,omitempty"`
Id string `json:"_id,omitempty"`
Type string `json:"_type,omitempty"`
Parent string `json:"parent,omitempty"`
// RetryOnConflict is "_retry_on_conflict" for 6.0 and "retry_on_conflict" for 6.1+.
RetryOnConflict *int `json:"retry_on_conflict,omitempty"`
Routing string `json:"routing,omitempty"`
Version *int64 `json:"version,omitempty"`
VersionType string `json:"version_type,omitempty"`
Pipeline string `json:"pipeline,omitempty"`
IfSeqNo *int64 `json:"if_seq_no,omitempty"`
IfPrimaryTerm *int64 `json:"if_primary_term,omitempty"`
}
// NewBulkIndexRequest returns a new BulkIndexRequest.
// The operation type is "index" by default.
func NewBulkIndexRequest() *BulkIndexRequest {
return &BulkIndexRequest{
opType: "index",
}
}
// UseEasyJSON is an experimental setting that enables serialization
// with github.com/mailru/easyjson, which should in faster serialization
// time and less allocations, but removed compatibility with encoding/json,
// usage of unsafe etc. See https://github.com/mailru/easyjson#issues-notes-and-limitations
// for details. This setting is disabled by default.
func (r *BulkIndexRequest) UseEasyJSON(enable bool) *BulkIndexRequest {
r.useEasyJSON = enable
return r
}
// Index specifies the Elasticsearch index to use for this index request.
// If unspecified, the index set on the BulkService will be used.
func (r *BulkIndexRequest) Index(index string) *BulkIndexRequest {
r.index = index
r.source = nil
return r
}
// Type specifies the Elasticsearch type to use for this index request.
// If unspecified, the type set on the BulkService will be used.
func (r *BulkIndexRequest) Type(typ string) *BulkIndexRequest {
r.typ = typ
r.source = nil
return r
}
// Id specifies the identifier of the document to index.
func (r *BulkIndexRequest) Id(id string) *BulkIndexRequest {
r.id = id
r.source = nil
return r
}
// OpType specifies if this request should follow create-only or upsert
// behavior. This follows the OpType of the standard document index API.
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-index_.html#operation-type
// for details.
func (r *BulkIndexRequest) OpType(opType string) *BulkIndexRequest {
r.opType = opType
r.source = nil
return r
}
// Routing specifies a routing value for the request.
func (r *BulkIndexRequest) Routing(routing string) *BulkIndexRequest {
r.routing = routing
r.source = nil
return r
}
// Parent specifies the identifier of the parent document (if available).
func (r *BulkIndexRequest) Parent(parent string) *BulkIndexRequest {
r.parent = parent
r.source = nil
return r
}
// Version indicates the version of the document as part of an optimistic
// concurrency model.
func (r *BulkIndexRequest) Version(version int64) *BulkIndexRequest {
v := version
r.version = &v
r.source = nil
return r
}
// VersionType specifies how versions are created. It can be e.g. internal,
// external, external_gte, or force.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-index_.html#index-versioning
// for details.
func (r *BulkIndexRequest) VersionType(versionType string) *BulkIndexRequest {
r.versionType = versionType
r.source = nil
return r
}
// Doc specifies the document to index.
func (r *BulkIndexRequest) Doc(doc interface{}) *BulkIndexRequest {
r.doc = doc
r.source = nil
return r
}
// RetryOnConflict specifies how often to retry in case of a version conflict.
func (r *BulkIndexRequest) RetryOnConflict(retryOnConflict int) *BulkIndexRequest {
r.retryOnConflict = &retryOnConflict
r.source = nil
return r
}
// Pipeline to use while processing the request.
func (r *BulkIndexRequest) Pipeline(pipeline string) *BulkIndexRequest {
r.pipeline = pipeline
r.source = nil
return r
}
// IfSeqNo indicates to only perform the index operation if the last
// operation that has changed the document has the specified sequence number.
func (r *BulkIndexRequest) IfSeqNo(ifSeqNo int64) *BulkIndexRequest {
r.ifSeqNo = &ifSeqNo
return r
}
// IfPrimaryTerm indicates to only perform the index operation if the
// last operation that has changed the document has the specified primary term.
func (r *BulkIndexRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkIndexRequest {
r.ifPrimaryTerm = &ifPrimaryTerm
return r
}
// String returns the on-wire representation of the index request,
// concatenated as a single string.
func (r *BulkIndexRequest) String() string {
lines, err := r.Source()
if err != nil {
return fmt.Sprintf("error: %v", err)
}
return strings.Join(lines, "\n")
}
// Source returns the on-wire representation of the index request,
// split into an action-and-meta-data line and an (optional) source line.
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html
// for details.
func (r *BulkIndexRequest) Source() ([]string, error) {
// { "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
// { "field1" : "value1" }
if r.source != nil {
return r.source, nil
}
lines := make([]string, 2)
// "index" ...
indexCommand := bulkIndexRequestCommandOp{
Index: r.index,
Type: r.typ,
Id: r.id,
Routing: r.routing,
Parent: r.parent,
Version: r.version,
VersionType: r.versionType,
RetryOnConflict: r.retryOnConflict,
Pipeline: r.pipeline,
IfSeqNo: r.ifSeqNo,
IfPrimaryTerm: r.ifPrimaryTerm,
}
command := bulkIndexRequestCommand{
r.opType: indexCommand,
}
var err error
var body []byte
if r.useEasyJSON {
// easyjson
body, err = command.MarshalJSON()
} else {
// encoding/json
body, err = json.Marshal(command)
}
if err != nil {
return nil, err
}
lines[0] = string(body)
// "field1" ...
if r.doc != nil {
switch t := r.doc.(type) {
default:
body, err := json.Marshal(r.doc)
if err != nil {
return nil, err
}
lines[1] = string(body)
case json.RawMessage:
lines[1] = string(t)
case *json.RawMessage:
lines[1] = string(*t)
case string:
lines[1] = t
case *string:
lines[1] = *t
}
} else {
lines[1] = "{}"
}
r.source = lines
return lines, nil
}
================================================
FILE: bulk_index_request_easyjson.go
================================================
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package elastic
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
_ *jlexer.Lexer
_ *jwriter.Writer
_ easyjson.Marshaler
)
func easyjson9de0fcbfDecodeGithubComOlivereElasticV7(in *jlexer.Lexer, out *bulkIndexRequestCommandOp) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "_index":
out.Index = string(in.String())
case "_id":
out.Id = string(in.String())
case "_type":
out.Type = string(in.String())
case "parent":
out.Parent = string(in.String())
case "retry_on_conflict":
if in.IsNull() {
in.Skip()
out.RetryOnConflict = nil
} else {
if out.RetryOnConflict == nil {
out.RetryOnConflict = new(int)
}
*out.RetryOnConflict = int(in.Int())
}
case "routing":
out.Routing = string(in.String())
case "version":
if in.IsNull() {
in.Skip()
out.Version = nil
} else {
if out.Version == nil {
out.Version = new(int64)
}
*out.Version = int64(in.Int64())
}
case "version_type":
out.VersionType = string(in.String())
case "pipeline":
out.Pipeline = string(in.String())
case "if_seq_no":
if in.IsNull() {
in.Skip()
out.IfSeqNo = nil
} else {
if out.IfSeqNo == nil {
out.IfSeqNo = new(int64)
}
*out.IfSeqNo = int64(in.Int64())
}
case "if_primary_term":
if in.IsNull() {
in.Skip()
out.IfPrimaryTerm = nil
} else {
if out.IfPrimaryTerm == nil {
out.IfPrimaryTerm = new(int64)
}
*out.IfPrimaryTerm = int64(in.Int64())
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjson9de0fcbfEncodeGithubComOlivereElasticV7(out *jwriter.Writer, in bulkIndexRequestCommandOp) {
out.RawByte('{')
first := true
_ = first
if in.Index != "" {
const prefix string = ",\"_index\":"
first = false
out.RawString(prefix[1:])
out.String(string(in.Index))
}
if in.Id != "" {
const prefix string = ",\"_id\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Id))
}
if in.Type != "" {
const prefix string = ",\"_type\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Type))
}
if in.Parent != "" {
const prefix string = ",\"parent\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Parent))
}
if in.RetryOnConflict != nil {
const prefix string = ",\"retry_on_conflict\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int(int(*in.RetryOnConflict))
}
if in.Routing != "" {
const prefix string = ",\"routing\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Routing))
}
if in.Version != nil {
const prefix string = ",\"version\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(*in.Version))
}
if in.VersionType != "" {
const prefix string = ",\"version_type\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.VersionType))
}
if in.Pipeline != "" {
const prefix string = ",\"pipeline\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Pipeline))
}
if in.IfSeqNo != nil {
const prefix string = ",\"if_seq_no\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(*in.IfSeqNo))
}
if in.IfPrimaryTerm != nil {
const prefix string = ",\"if_primary_term\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(*in.IfPrimaryTerm))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v bulkIndexRequestCommandOp) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjson9de0fcbfEncodeGithubComOlivereElasticV7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v bulkIndexRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) {
easyjson9de0fcbfEncodeGithubComOlivereElasticV7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *bulkIndexRequestCommandOp) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjson9de0fcbfDecodeGithubComOlivereElasticV7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *bulkIndexRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson9de0fcbfDecodeGithubComOlivereElasticV7(l, v)
}
func easyjson9de0fcbfDecodeGithubComOlivereElasticV71(in *jlexer.Lexer, out *bulkIndexRequestCommand) {
isTopLevel := in.IsStart()
if in.IsNull() {
in.Skip()
} else {
in.Delim('{')
*out = make(bulkIndexRequestCommand)
for !in.IsDelim('}') {
key := string(in.String())
in.WantColon()
var v1 bulkIndexRequestCommandOp
(v1).UnmarshalEasyJSON(in)
(*out)[key] = v1
in.WantComma()
}
in.Delim('}')
}
if isTopLevel {
in.Consumed()
}
}
func easyjson9de0fcbfEncodeGithubComOlivereElasticV71(out *jwriter.Writer, in bulkIndexRequestCommand) {
if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
out.RawString(`null`)
} else {
out.RawByte('{')
v2First := true
for v2Name, v2Value := range in {
if v2First {
v2First = false
} else {
out.RawByte(',')
}
out.String(string(v2Name))
out.RawByte(':')
(v2Value).MarshalEasyJSON(out)
}
out.RawByte('}')
}
}
// MarshalJSON supports json.Marshaler interface
func (v bulkIndexRequestCommand) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjson9de0fcbfEncodeGithubComOlivereElasticV71(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v bulkIndexRequestCommand) MarshalEasyJSON(w *jwriter.Writer) {
easyjson9de0fcbfEncodeGithubComOlivereElasticV71(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *bulkIndexRequestCommand) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjson9de0fcbfDecodeGithubComOlivereElasticV71(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *bulkIndexRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson9de0fcbfDecodeGithubComOlivereElasticV71(l, v)
}
================================================
FILE: bulk_index_request_test.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"testing"
"time"
)
func TestBulkIndexRequestSerialization(t *testing.T) {
tests := []struct {
Request BulkableRequest
Expected []string
}{
// #0
{
Request: NewBulkIndexRequest().Index("index1").Id("1").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"index":{"_index":"index1","_id":"1"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #1
{
Request: NewBulkIndexRequest().OpType("create").Index("index1").Id("1").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"create":{"_index":"index1","_id":"1"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #2
{
Request: NewBulkIndexRequest().OpType("index").Index("index1").Id("1").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"index":{"_index":"index1","_id":"1"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #3
{
Request: NewBulkIndexRequest().OpType("index").Index("index1").Id("1").RetryOnConflict(42).
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"index":{"_index":"index1","_id":"1","retry_on_conflict":42}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #4
{
Request: NewBulkIndexRequest().OpType("index").Index("index1").Id("1").Pipeline("my_pipeline").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"index":{"_index":"index1","_id":"1","pipeline":"my_pipeline"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #5
{
Request: NewBulkIndexRequest().OpType("index").Index("index1").Id("1").
Routing("123").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"index":{"_index":"index1","_id":"1","routing":"123"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
// #6
{
Request: NewBulkIndexRequest().OpType("index").Index("index1").Type("doc").Id("1").
Version(0).
VersionType("external").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)}),
Expected: []string{
`{"index":{"_index":"index1","_id":"1","_type":"doc","version":0,"version_type":"external"}}`,
`{"user":"olivere","message":"","retweets":0,"created":"2014-01-18T23:59:58Z"}`,
},
},
}
for i, test := range tests {
lines, err := test.Request.Source()
if err != nil {
t.Fatalf("case #%d: expected no error, got: %v", i, err)
}
if lines == nil {
t.Fatalf("case #%d: expected lines, got nil", i)
}
if len(lines) != len(test.Expected) {
t.Fatalf("case #%d: expected %d lines, got %d", i, len(test.Expected), len(lines))
}
for j, line := range lines {
if line != test.Expected[j] {
t.Errorf("case #%d: expected line #%d to be %s, got: %s", i, j, test.Expected[j], line)
}
}
}
}
var bulkIndexRequestSerializationResult string
func BenchmarkBulkIndexRequestSerialization(b *testing.B) {
b.Run("stdlib", func(b *testing.B) {
r := NewBulkIndexRequest().Index(testIndexName).Id("1").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)})
benchmarkBulkIndexRequestSerialization(b, r.UseEasyJSON(false))
})
b.Run("easyjson", func(b *testing.B) {
r := NewBulkIndexRequest().Index(testIndexName).Id("1").
Doc(tweet{User: "olivere", Created: time.Date(2014, 1, 18, 23, 59, 58, 0, time.UTC)})
benchmarkBulkIndexRequestSerialization(b, r.UseEasyJSON(true))
})
}
func benchmarkBulkIndexRequestSerialization(b *testing.B, r *BulkIndexRequest) {
var s string
for n := 0; n < b.N; n++ {
s = r.String()
r.source = nil // Don't let caching spoil the benchmark
}
bulkIndexRequestSerializationResult = s // ensure the compiler doesn't optimize
b.ReportAllocs()
}
================================================
FILE: bulk_processor.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"context"
"errors"
"net"
"sync"
"sync/atomic"
"time"
)
var (
// ErrBulkItemRetry is returned in BulkProcessor from a worker when
// a response item needs to be retried.
ErrBulkItemRetry = errors.New("elastic: uncommitted bulk response items")
defaultRetryItemStatusCodes = []int{408, 429, 503, 507}
)
// BulkProcessorService allows to easily process bulk requests. It allows setting
// policies when to flush new bulk requests, e.g. based on a number of actions,
// on the size of the actions, and/or to flush periodically. It also allows
// to control the number of concurrent bulk requests allowed to be executed
// in parallel.
//
// BulkProcessorService, by default, commits either every 1000 requests or when the
// (estimated) size of the bulk requests exceeds 5 MB. However, it does not
// commit periodically. BulkProcessorService also does retry by default, using
// an exponential backoff algorithm. It also will automatically re-enqueue items
// returned with a status of 408, 429, 503 or 507. You can change this
// behavior with RetryItemStatusCodes.
//
// The caller is responsible for setting the index and type on every
// bulk request added to BulkProcessorService.
//
// BulkProcessorService takes ideas from the BulkProcessor of the
// Elasticsearch Java API as documented in
// https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-bulk-processor.html.
type BulkProcessorService struct {
c *Client
beforeFn BulkBeforeFunc
afterFn BulkAfterFunc
name string // name of processor
numWorkers int // # of workers (>= 1)
bulkActions int // # of requests after which to commit
bulkSize int // # of bytes after which to commit
flushInterval time.Duration // periodic flush interval
wantStats bool // indicates whether to gather statistics
backoff Backoff // a custom Backoff to use for errors
retryItemStatusCodes []int // array of status codes for bulk response line items that may be retried
}
// NewBulkProcessorService creates a new BulkProcessorService.
func NewBulkProcessorService(client *Client) *BulkProcessorService {
return &BulkProcessorService{
c: client,
numWorkers: 1,
bulkActions: 1000,
bulkSize: 5 << 20, // 5 MB
backoff: NewExponentialBackoff(
time.Duration(200)*time.Millisecond,
time.Duration(10000)*time.Millisecond,
),
retryItemStatusCodes: defaultRetryItemStatusCodes,
}
}
// BulkBeforeFunc defines the signature of callbacks that are executed
// before a commit to Elasticsearch.
type BulkBeforeFunc func(executionId int64, requests []BulkableRequest)
// BulkAfterFunc defines the signature of callbacks that are executed
// after a commit to Elasticsearch. The err parameter signals an error.
type BulkAfterFunc func(executionId int64, requests []BulkableRequest, response *BulkResponse, err error)
// Before specifies a function to be executed before bulk requests get committed
// to Elasticsearch.
func (s *BulkProcessorService) Before(fn BulkBeforeFunc) *BulkProcessorService {
s.beforeFn = fn
return s
}
// After specifies a function to be executed when bulk requests have been
// committed to Elasticsearch. The After callback executes both when the
// commit was successful as well as on failures.
func (s *BulkProcessorService) After(fn BulkAfterFunc) *BulkProcessorService {
s.afterFn = fn
return s
}
// Name is an optional name to identify this bulk processor.
func (s *BulkProcessorService) Name(name string) *BulkProcessorService {
s.name = name
return s
}
// Workers is the number of concurrent workers allowed to be
// executed. Defaults to 1 and must be greater or equal to 1.
func (s *BulkProcessorService) Workers(num int) *BulkProcessorService {
s.numWorkers = num
return s
}
// BulkActions specifies when to flush based on the number of actions
// currently added. Defaults to 1000 and can be set to -1 to be disabled.
func (s *BulkProcessorService) BulkActions(bulkActions int) *BulkProcessorService {
s.bulkActions = bulkActions
return s
}
// BulkSize specifies when to flush based on the size (in bytes) of the actions
// currently added. Defaults to 5 MB and can be set to -1 to be disabled.
func (s *BulkProcessorService) BulkSize(bulkSize int) *BulkProcessorService {
s.bulkSize = bulkSize
return s
}
// FlushInterval specifies when to flush at the end of the given interval.
// This is disabled by default. If you want the bulk processor to
// operate completely asynchronously, set both BulkActions and BulkSize to
// -1 and set the FlushInterval to a meaningful interval.
func (s *BulkProcessorService) FlushInterval(interval time.Duration) *BulkProcessorService {
s.flushInterval = interval
return s
}
// Stats tells bulk processor to gather stats while running.
// Use Stats to return the stats. This is disabled by default.
func (s *BulkProcessorService) Stats(wantStats bool) *BulkProcessorService {
s.wantStats = wantStats
return s
}
// Backoff sets the backoff strategy to use for errors.
func (s *BulkProcessorService) Backoff(backoff Backoff) *BulkProcessorService {
s.backoff = backoff
return s
}
// RetryItemStatusCodes sets an array of status codes that indicate that a bulk
// response line item should be retried.
func (s *BulkProcessorService) RetryItemStatusCodes(retryItemStatusCodes ...int) *BulkProcessorService {
s.retryItemStatusCodes = retryItemStatusCodes
return s
}
// Do creates a new BulkProcessor and starts it.
// Consider the BulkProcessor as a running instance that accepts bulk requests
// and commits them to Elasticsearch, spreading the work across one or more
// workers.
//
// You can interoperate with the BulkProcessor returned by Do, e.g. Start and
// Stop (or Close) it.
//
// Context is an optional context that is passed into the bulk request
// service calls. In contrast to other operations, this context is used in
// a long running process. You could use it to pass e.g. loggers, but you
// shouldn't use it for cancellation.
//
// Calling Do several times returns new BulkProcessors. You probably don't
// want to do this. BulkProcessorService implements just a builder pattern.
func (s *BulkProcessorService) Do(ctx context.Context) (*BulkProcessor, error) {
retryItemStatusCodes := make(map[int]struct{})
for _, code := range s.retryItemStatusCodes {
retryItemStatusCodes[code] = struct{}{}
}
p := newBulkProcessor(
s.c,
s.beforeFn,
s.afterFn,
s.name,
s.numWorkers,
s.bulkActions,
s.bulkSize,
s.flushInterval,
s.wantStats,
s.backoff,
retryItemStatusCodes)
err := p.Start(ctx)
if err != nil {
return nil, err
}
return p, nil
}
// -- Bulk Processor Statistics --
// BulkProcessorStats contains various statistics of a bulk processor
// while it is running. Use the Stats func to return it while running.
type BulkProcessorStats struct {
Flushed int64 // number of times the flush interval has been invoked
Committed int64 // # of times workers committed bulk requests
Indexed int64 // # of requests indexed
Created int64 // # of requests that ES reported as creates (201)
Updated int64 // # of requests that ES reported as updates
Deleted int64 // # of requests that ES reported as deletes
Succeeded int64 // # of requests that ES reported as successful
Failed int64 // # of requests that ES reported as failed
Workers []*BulkProcessorWorkerStats // stats for each worker
}
// BulkProcessorWorkerStats represents per-worker statistics.
type BulkProcessorWorkerStats struct {
Queued int64 // # of requests queued in this worker
LastDuration time.Duration // duration of last commit
}
// newBulkProcessorStats initializes and returns a BulkProcessorStats struct.
func newBulkProcessorStats(workers int) *BulkProcessorStats {
stats := &BulkProcessorStats{
Workers: make([]*BulkProcessorWorkerStats, workers),
}
for i := 0; i < workers; i++ {
stats.Workers[i] = &BulkProcessorWorkerStats{}
}
return stats
}
func (st *BulkProcessorStats) dup() *BulkProcessorStats {
dst := new(BulkProcessorStats)
dst.Flushed = st.Flushed
dst.Committed = st.Committed
dst.Indexed = st.Indexed
dst.Created = st.Created
dst.Updated = st.Updated
dst.Deleted = st.Deleted
dst.Succeeded = st.Succeeded
dst.Failed = st.Failed
for _, src := range st.Workers {
dst.Workers = append(dst.Workers, src.dup())
}
return dst
}
func (st *BulkProcessorWorkerStats) dup() *BulkProcessorWorkerStats {
dst := new(BulkProcessorWorkerStats)
dst.Queued = st.Queued
dst.LastDuration = st.LastDuration
return dst
}
// -- Bulk Processor --
// BulkProcessor encapsulates a task that accepts bulk requests and
// orchestrates committing them to Elasticsearch via one or more workers.
//
// BulkProcessor is returned by setting up a BulkProcessorService and
// calling the Do method.
type BulkProcessor struct {
c *Client
beforeFn BulkBeforeFunc
afterFn BulkAfterFunc
name string
bulkActions int
bulkSize int
numWorkers int
executionId int64
requestsC chan BulkableRequest
workerWg sync.WaitGroup
workers []*bulkWorker
flushInterval time.Duration
flusherStopC chan struct{}
wantStats bool
retryItemStatusCodes map[int]struct{}
backoff Backoff
startedMu sync.Mutex // guards the following block
started bool
statsMu sync.Mutex // guards the following block
stats *BulkProcessorStats
stopReconnC chan struct{} // channel to signal stop reconnection attempts
}
func newBulkProcessor(
client *Client,
beforeFn BulkBeforeFunc,
afterFn BulkAfterFunc,
name string,
numWorkers int,
bulkActions int,
bulkSize int,
flushInterval time.Duration,
wantStats bool,
backoff Backoff,
retryItemStatusCodes map[int]struct{}) *BulkProcessor {
return &BulkProcessor{
c: client,
beforeFn: beforeFn,
afterFn: afterFn,
name: name,
numWorkers: numWorkers,
bulkActions: bulkActions,
bulkSize: bulkSize,
flushInterval: flushInterval,
wantStats: wantStats,
retryItemStatusCodes: retryItemStatusCodes,
backoff: backoff,
}
}
// Start starts the bulk processor. If the processor is already started,
// nil is returned.
func (p *BulkProcessor) Start(ctx context.Context) error {
p.startedMu.Lock()
defer p.startedMu.Unlock()
if p.started {
return nil
}
// We must have at least one worker.
if p.numWorkers < 1 {
p.numWorkers = 1
}
p.requestsC = make(chan BulkableRequest)
p.executionId = 0
p.stats = newBulkProcessorStats(p.numWorkers)
p.stopReconnC = make(chan struct{})
// Create and start up workers.
p.workers = make([]*bulkWorker, p.numWorkers)
for i := 0; i < p.numWorkers; i++ {
p.workerWg.Add(1)
p.workers[i] = newBulkWorker(p, i)
go p.workers[i].work(ctx)
}
// Start the ticker for flush (if enabled)
if int64(p.flushInterval) > 0 {
p.flusherStopC = make(chan struct{})
go p.flusher(p.flushInterval)
}
p.started = true
return nil
}
// Stop is an alias for Close.
func (p *BulkProcessor) Stop() error {
return p.Close()
}
// Close stops the bulk processor previously started with Do.
// If it is already stopped, this is a no-op and nil is returned.
//
// By implementing Close, BulkProcessor implements the io.Closer interface.
func (p *BulkProcessor) Close() error {
p.startedMu.Lock()
defer p.startedMu.Unlock()
// Already stopped? Do nothing.
if !p.started {
return nil
}
// Tell connection checkers to stop
if p.stopReconnC != nil {
close(p.stopReconnC)
p.stopReconnC = nil
}
// Stop flusher (if enabled)
if p.flusherStopC != nil {
p.flusherStopC <- struct{}{}
<-p.flusherStopC
close(p.flusherStopC)
p.flusherStopC = nil
}
// Stop all workers.
close(p.requestsC)
p.workerWg.Wait()
p.started = false
return nil
}
// Stats returns the latest bulk processor statistics.
// Collecting stats must be enabled first by calling Stats(true) on
// the service that created this processor.
func (p *BulkProcessor) Stats() BulkProcessorStats {
p.statsMu.Lock()
defer p.statsMu.Unlock()
return *p.stats.dup()
}
// Add adds a single request to commit by the BulkProcessorService.
//
// The caller is responsible for setting the index and type on the request.
func (p *BulkProcessor) Add(request BulkableRequest) {
p.requestsC <- request
}
// Flush manually asks all workers to commit their outstanding requests.
// It returns only when all workers acknowledge completion.
func (p *BulkProcessor) Flush() error {
p.statsMu.Lock()
p.stats.Flushed++
p.statsMu.Unlock()
for _, w := range p.workers {
w.flushC <- struct{}{}
<-w.flushAckC // wait for completion
}
return nil
}
// flusher is a single goroutine that periodically asks all workers to
// commit their outstanding bulk requests. It is only started if
// FlushInterval is greater than 0.
func (p *BulkProcessor) flusher(interval time.Duration) {
ticker := time.NewTicker(interval)
defer ticker.Stop()
for {
select {
case <-ticker.C: // Periodic flush
p.Flush() // TODO swallow errors here?
case <-p.flusherStopC:
p.flusherStopC <- struct{}{}
return
}
}
}
// -- Bulk Worker --
// bulkWorker encapsulates a single worker, running in a goroutine,
// receiving bulk requests and eventually committing them to Elasticsearch.
// It is strongly bound to a BulkProcessor.
type bulkWorker struct {
p *BulkProcessor
i int
bulkActions int
bulkSize int
service *BulkService
flushC chan struct{}
flushAckC chan struct{}
}
// newBulkWorker creates a new bulkWorker instance.
func newBulkWorker(p *BulkProcessor, i int) *bulkWorker {
return &bulkWorker{
p: p,
i: i,
bulkActions: p.bulkActions,
bulkSize: p.bulkSize,
service: NewBulkService(p.c),
flushC: make(chan struct{}),
flushAckC: make(chan struct{}),
}
}
// work waits for bulk requests and manual flush calls on the respective
// channels and is invoked as a goroutine when the bulk processor is started.
func (w *bulkWorker) work(ctx context.Context) {
defer func() {
w.p.workerWg.Done()
close(w.flushAckC)
close(w.flushC)
}()
var stop bool
for !stop {
var err error
select {
case req, open := <-w.p.requestsC:
if open {
// Received a new request
if _, err = req.Source(); err == nil {
w.service.Add(req)
if w.commitRequired() {
err = w.commit(ctx)
}
}
} else {
// Channel closed: Stop.
stop = true
if w.service.NumberOfActions() > 0 {
err = w.commit(ctx)
}
}
case <-w.flushC:
// Commit outstanding requests
if w.service.NumberOfActions() > 0 {
err = w.commit(ctx)
}
w.flushAckC <- struct{}{}
}
if err != nil {
w.p.c.errorf("elastic: bulk processor %q was unable to perform work: %v", w.p.name, err)
if !stop {
waitForActive := func() {
// Add back pressure to prevent Add calls from filling up the request queue
ready := make(chan struct{})
go w.waitForActiveConnection(ready)
<-ready
}
if _, ok := err.(net.Error); ok {
waitForActive()
} else if IsConnErr(err) {
waitForActive()
}
}
}
}
}
// commit commits the bulk requests in the given service,
// invoking callbacks as specified.
func (w *bulkWorker) commit(ctx context.Context) error {
var res *BulkResponse
// commitFunc will commit bulk requests and, on failure, be retried
// via exponential backoff
commitFunc := func() error {
var err error
// Save requests because they will be reset in service.Do
reqs := w.service.requests
res, err = w.service.Do(ctx)
if err == nil {
// Overall bulk request was OK. But each bulk response item also has a status
if w.p.retryItemStatusCodes != nil && len(w.p.retryItemStatusCodes) > 0 {
// Check res.Items since some might be soft failures
if res.Items != nil && res.Errors {
// res.Items will be 1 to 1 with reqs in same order
for i, item := range res.Items {
for _, result := range item {
if _, found := w.p.retryItemStatusCodes[result.Status]; found {
w.service.Add(reqs[i])
if err == nil {
err = ErrBulkItemRetry
}
}
}
}
}
}
}
return err
}
// notifyFunc will be called if retry fails
notifyFunc := func(err error) {
w.p.c.errorf("elastic: bulk processor %q failed but may retry: %v", w.p.name, err)
}
id := atomic.AddInt64(&w.p.executionId, 1)
// Update # documents in queue before eventual retries
w.p.statsMu.Lock()
if w.p.wantStats {
w.p.stats.Workers[w.i].Queued = int64(len(w.service.requests))
}
w.p.statsMu.Unlock()
// Save requests because they will be reset in commitFunc
reqs := w.service.requests
// Invoke before callback
if w.p.beforeFn != nil {
w.p.beforeFn(id, reqs)
}
// Commit bulk requests
err := RetryNotify(commitFunc, w.p.backoff, notifyFunc)
w.updateStats(res)
if err != nil {
w.p.c.errorf("elastic: bulk processor %q failed: %v", w.p.name, err)
}
// Invoke after callback
if w.p.afterFn != nil {
w.p.afterFn(id, reqs, res, err)
}
return err
}
func (w *bulkWorker) waitForActiveConnection(ready chan<- struct{}) {
defer close(ready)
t := time.NewTicker(5 * time.Second)
defer t.Stop()
client := w.p.c
stopReconnC := w.p.stopReconnC
w.p.c.errorf("elastic: bulk processor %q is waiting for an active connection", w.p.name)
// loop until a health check finds at least 1 active connection or the reconnection channel is closed
for {
select {
case _, ok := <-stopReconnC:
if !ok {
w.p.c.errorf("elastic: bulk processor %q active connection check interrupted", w.p.name)
return
}
case <-t.C:
client.healthcheck(context.Background(), 3*time.Second, true)
if client.mustActiveConn() == nil {
// found an active connection
// exit and signal done to the WaitGroup
return
}
}
}
}
func (w *bulkWorker) updateStats(res *BulkResponse) {
// Update stats
if res != nil {
w.p.statsMu.Lock()
if w.p.wantStats {
w.p.stats.Committed++
if res != nil {
w.p.stats.Indexed += int64(len(res.Indexed()))
w.p.stats.Created += int64(len(res.Created()))
w.p.stats.Updated += int64(len(res.Updated()))
w.p.stats.Deleted += int64(len(res.Deleted()))
w.p.stats.Succeeded += int64(len(res.Succeeded()))
w.p.stats.Failed += int64(len(res.Failed()))
}
w.p.stats.Workers[w.i].Queued = int64(len(w.service.requests))
w.p.stats.Workers[w.i].LastDuration = time.Duration(int64(res.Took)) * time.Millisecond
}
w.p.statsMu.Unlock()
}
}
// commitRequired returns true if the service has to commit its
// bulk requests. This can be either because the number of actions
// or the estimated size in bytes is larger than specified in the
// BulkProcessorService.
func (w *bulkWorker) commitRequired() bool {
if w.bulkActions >= 0 && w.service.NumberOfActions() >= w.bulkActions {
return true
}
if w.bulkSize >= 0 && w.service.EstimatedSizeInBytes() >= int64(w.bulkSize) {
return true
}
return false
}
================================================
FILE: bulk_processor_test.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"context"
"fmt"
"math/rand"
"reflect"
"sync/atomic"
"testing"
"time"
)
func TestBulkProcessorDefaults(t *testing.T) {
client := setupTestClientAndCreateIndex(t, SetHealthcheckTimeoutStartup(15*time.Second), SetSnifferTimeoutStartup(15*time.Second))
p := client.BulkProcessor()
if p == nil {
t.Fatalf("expected BulkProcessorService; got: %v", p)
}
if got, want := p.name, ""; got != want {
t.Errorf("expected %q; got: %q", want, got)
}
if got, want := p.numWorkers, 1; got != want {
t.Errorf("expected %d; got: %d", want, got)
}
if got, want := p.bulkActions, 1000; got != want {
t.Errorf("expected %d; got: %d", want, got)
}
if got, want := p.bulkSize, 5*1024*1024; got != want {
t.Errorf("expected %d; got: %d", want, got)
}
if got, want := p.flushInterval, time.Duration(0); got != want {
t.Errorf("expected %v; got: %v", want, got)
}
if got, want := p.wantStats, false; got != want {
t.Errorf("expected %v; got: %v", want, got)
}
if got, want := p.retryItemStatusCodes, defaultRetryItemStatusCodes; !reflect.DeepEqual(got, want) {
t.Errorf("expected %v; got: %v", want, got)
}
if p.backoff == nil {
t.Fatalf("expected non-nil backoff; got: %v", p.backoff)
}
}
func TestBulkProcessorCommitOnBulkActions(t *testing.T) {
//client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
client := setupTestClientAndCreateIndex(t, SetHealthcheckTimeoutStartup(15*time.Second), SetSnifferTimeoutStartup(15*time.Second))
testBulkProcessor(t,
10000,
client.BulkProcessor().
Name("Actions-1").
Workers(1).
BulkActions(100).
BulkSize(-1),
)
testBulkProcessor(t,
10000,
client.BulkProcessor().
Name("Actions-2").
Workers(2).
BulkActions(100).
BulkSize(-1),
)
}
func TestBulkProcessorCommitOnBulkSize(t *testing.T) {
//client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
client := setupTestClientAndCreateIndex(t, SetHealthcheckTimeoutStartup(15*time.Second), SetSnifferTimeoutStartup(15*time.Second))
testBulkProcessor(t,
10000,
client.BulkProcessor().
Name("Size-1").
Workers(1).
BulkActions(-1).
BulkSize(64*1024),
)
testBulkProcessor(t,
10000,
client.BulkProcessor().
Name("Size-2").
Workers(2).
BulkActions(-1).
BulkSize(64*1024),
)
}
func TestBulkProcessorBasedOnFlushInterval(t *testing.T) {
//client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
client := setupTestClientAndCreateIndex(t, SetHealthcheckTimeoutStartup(15*time.Second), SetSnifferTimeoutStartup(15*time.Second))
var beforeRequests int64
var befores int64
var afters int64
var failures int64
var afterRequests int64
beforeFn := func(executionId int64, requests []BulkableRequest) {
atomic.AddInt64(&beforeRequests, int64(len(requests)))
atomic.AddInt64(&befores, 1)
}
afterFn := func(executionId int64, requests []BulkableRequest, response *BulkResponse, err error) {
atomic.AddInt64(&afters, 1)
if err != nil {
atomic.AddInt64(&failures, 1)
}
atomic.AddInt64(&afterRequests, int64(len(requests)))
}
svc := client.BulkProcessor().
Name("FlushInterval-1").
Workers(2).
BulkActions(-1).
BulkSize(-1).
FlushInterval(1 * time.Second).
Before(beforeFn).
After(afterFn)
p, err := svc.Do(context.Background())
if err != nil {
t.Fatal(err)
}
const numDocs = 1000 // low-enough number that flush should be invoked
for i := 1; i <= numDocs; i++ {
tweet := tweet{User: "olivere", Message: fmt.Sprintf("%d. %s", i, randomString(rand.Intn(64)))}
request := NewBulkIndexRequest().Index(testIndexName).Id(fmt.Sprintf("%d", i)).Doc(tweet)
p.Add(request)
}
// Should flush at least once
time.Sleep(2 * time.Second)
err = p.Close()
if err != nil {
t.Fatal(err)
}
if p.stats.Flushed == 0 {
t.Errorf("expected at least 1 flush; got: %d", p.stats.Flushed)
}
if got, want := beforeRequests, int64(numDocs); got != want {
t.Errorf("expected %d requests to before callback; got: %d", want, got)
}
if got, want := afterRequests, int64(numDocs); got != want {
t.Errorf("expected %d requests to after callback; got: %d", want, got)
}
if befores == 0 {
t.Error("expected at least 1 call to before callback")
}
if afters == 0 {
t.Error("expected at least 1 call to after callback")
}
if failures != 0 {
t.Errorf("expected 0 calls to failure callback; got: %d", failures)
}
// Check number of documents that were bulk indexed
_, err = p.c.Refresh(testIndexName).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
count, err := p.c.Count(testIndexName).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if count != int64(numDocs) {
t.Fatalf("expected %d documents; got: %d", numDocs, count)
}
}
func TestBulkProcessorClose(t *testing.T) {
//client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
client := setupTestClientAndCreateIndex(t, SetHealthcheckTimeoutStartup(15*time.Second), SetSnifferTimeoutStartup(15*time.Second))
var beforeRequests int64
var befores int64
var afters int64
var failures int64
var afterRequests int64
beforeFn := func(executionId int64, requests []BulkableRequest) {
atomic.AddInt64(&beforeRequests, int64(len(requests)))
atomic.AddInt64(&befores, 1)
}
afterFn := func(executionId int64, requests []BulkableRequest, response *BulkResponse, err error) {
atomic.AddInt64(&afters, 1)
if err != nil {
atomic.AddInt64(&failures, 1)
}
atomic.AddInt64(&afterRequests, int64(len(requests)))
}
p, err := client.BulkProcessor().
Name("FlushInterval-1").
Workers(2).
BulkActions(-1).
BulkSize(-1).
FlushInterval(30 * time.Second). // 30 seconds to flush
Before(beforeFn).After(afterFn).
Do(context.Background())
if err != nil {
t.Fatal(err)
}
const numDocs = 1000 // low-enough number that flush should be invoked
for i := 1; i <= numDocs; i++ {
tweet := tweet{User: "olivere", Message: fmt.Sprintf("%d. %s", i, randomString(rand.Intn(64)))}
request := NewBulkIndexRequest().Index(testIndexName).Id(fmt.Sprintf("%d", i)).Doc(tweet)
p.Add(request)
}
// Should not flush because 30s > 1s
time.Sleep(1 * time.Second)
// Close should flush
err = p.Close()
if err != nil {
t.Fatal(err)
}
if p.stats.Flushed != 0 {
t.Errorf("expected no flush; got: %d", p.stats.Flushed)
}
if got, want := beforeRequests, int64(numDocs); got != want {
t.Errorf("expected %d requests to before callback; got: %d", want, got)
}
if got, want := afterRequests, int64(numDocs); got != want {
t.Errorf("expected %d requests to after callback; got: %d", want, got)
}
if befores == 0 {
t.Error("expected at least 1 call to before callback")
}
if afters == 0 {
t.Error("expected at least 1 call to after callback")
}
if failures != 0 {
t.Errorf("expected 0 calls to failure callback; got: %d", failures)
}
// Check number of documents that were bulk indexed
_, err = p.c.Refresh(testIndexName).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
count, err := p.c.Count(testIndexName).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if count != int64(numDocs) {
t.Fatalf("expected %d documents; got: %d", numDocs, count)
}
}
func TestBulkProcessorFlush(t *testing.T) {
//client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
client := setupTestClientAndCreateIndex(t, SetHealthcheckTimeoutStartup(15*time.Second), SetSnifferTimeoutStartup(15*time.Second))
p, err := client.BulkProcessor().
Name("ManualFlush").
Workers(10).
BulkActions(-1).
BulkSize(-1).
FlushInterval(30 * time.Second). // 30 seconds to flush
Stats(true).
Do(context.Background())
if err != nil {
t.Fatal(err)
}
const numDocs = 100
for i := 1; i <= numDocs; i++ {
tweet := tweet{User: "olivere", Message: fmt.Sprintf("%d. %s", i, randomString(rand.Intn(64)))}
request := NewBulkIndexRequest().Index(testIndexName).Id(fmt.Sprintf("%d", i)).Doc(tweet)
p.Add(request)
}
// Should not flush because 30s > 1s
time.Sleep(1 * time.Second)
// No flush yet
stats := p.Stats()
if stats.Flushed != 0 {
t.Errorf("expected no flush; got: %d", p.stats.Flushed)
}
// Manual flush
err = p.Flush()
if err != nil {
t.Fatal(err)
}
time.Sleep(1 * time.Second)
// Now flushed
stats = p.Stats()
if got, want := p.stats.Flushed, int64(1); got != want {
t.Errorf("expected %d flush; got: %d", want, got)
}
// Close should not start another flush
err = p.Close()
if err != nil {
t.Fatal(err)
}
// Still 1 flush
stats = p.Stats()
if got, want := p.stats.Flushed, int64(1); got != want {
t.Errorf("expected %d flush; got: %d", want, got)
}
// Check number of documents that were bulk indexed
_, err = p.c.Refresh(testIndexName).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
count, err := p.c.Count(testIndexName).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if count != int64(numDocs) {
t.Fatalf("expected %d documents; got: %d", numDocs, count)
}
}
// -- Helper --
func testBulkProcessor(t *testing.T, numDocs int, svc *BulkProcessorService) {
var beforeRequests int64
var befores int64
var afters int64
var failures int64
var afterRequests int64
beforeFn := func(executionId int64, requests []BulkableRequest) {
atomic.AddInt64(&beforeRequests, int64(len(requests)))
atomic.AddInt64(&befores, 1)
}
afterFn := func(executionId int64, requests []BulkableRequest, response *BulkResponse, err error) {
atomic.AddInt64(&afters, 1)
if err != nil {
atomic.AddInt64(&failures, 1)
}
atomic.AddInt64(&afterRequests, int64(len(requests)))
}
p, err := svc.Before(beforeFn).After(afterFn).Stats(true).Do(context.Background())
if err != nil {
t.Fatal(err)
}
for i := 1; i <= numDocs; i++ {
tweet := tweet{User: "olivere", Message: fmt.Sprintf("%07d. %s", i, randomString(1+rand.Intn(63)))}
request := NewBulkIndexRequest().Index(testIndexName).Id(fmt.Sprintf("%d", i)).Doc(tweet)
p.Add(request)
}
err = p.Close()
if err != nil {
t.Fatal(err)
}
stats := p.Stats()
if stats.Flushed != 0 {
t.Errorf("expected no flush; got: %d", stats.Flushed)
}
if stats.Committed <= 0 {
t.Errorf("expected committed > %d; got: %d", 0, stats.Committed)
}
if got, want := stats.Indexed, int64(numDocs); got != want {
t.Errorf("expected indexed = %d; got: %d", want, got)
}
if got, want := stats.Created, int64(0); got != want {
t.Errorf("expected created = %d; got: %d", want, got)
}
if got, want := stats.Updated, int64(0); got != want {
t.Errorf("expected updated = %d; got: %d", want, got)
}
if got, want := stats.Deleted, int64(0); got != want {
t.Errorf("expected deleted = %d; got: %d", want, got)
}
if got, want := stats.Succeeded, int64(numDocs); got != want {
t.Errorf("expected succeeded = %d; got: %d", want, got)
}
if got, want := stats.Failed, int64(0); got != want {
t.Errorf("expected failed = %d; got: %d", want, got)
}
if got, want := beforeRequests, int64(numDocs); got != want {
t.Errorf("expected %d requests to before callback; got: %d", want, got)
}
if got, want := afterRequests, int64(numDocs); got != want {
t.Errorf("expected %d requests to after callback; got: %d", want, got)
}
if befores == 0 {
t.Error("expected at least 1 call to before callback")
}
if afters == 0 {
t.Error("expected at least 1 call to after callback")
}
if failures != 0 {
t.Errorf("expected 0 calls to failure callback; got: %d", failures)
}
// Check number of documents that were bulk indexed
_, err = p.c.Refresh(testIndexName).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
count, err := p.c.Count(testIndexName).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if count != int64(numDocs) {
t.Fatalf("expected %d documents; got: %d", numDocs, count)
}
}
================================================
FILE: bulk_request.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"fmt"
)
// -- Bulkable request (index/update/delete) --
// BulkableRequest is a generic interface to bulkable requests.
type BulkableRequest interface {
fmt.Stringer
Source() ([]string, error)
}
================================================
FILE: bulk_test.go
================================================
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"context"
"encoding/json"
"fmt"
"math/rand"
"net/http"
"net/http/httptest"
"testing"
)
func TestBulk(t *testing.T) {
client := setupTestClientAndCreateIndex(t) //, SetTraceLog(log.New(os.Stdout, "", 0)))
tweet1 := tweet{User: "olivere", Message: "Welcome to Golang and Elasticsearch."}
tweet2 := tweet{User: "sandrae", Message: "Dancing all night long. Yeah."}
index1Req := NewBulkIndexRequest().Index(testIndexName).Id("1").Doc(tweet1)
index2Req := NewBulkIndexRequest().Index(testIndexName).Id("2").Doc(tweet2)
delete1Req := NewBulkDeleteRequest().Index(testIndexName).Id("1")
bulkRequest := client.Bulk()
bulkRequest = bulkRequest.Add(index1Req)
bulkRequest = bulkRequest.Add(index2Req)
bulkRequest = bulkRequest.Add(delete1Req)
if bulkRequest.NumberOfActions() != 3 {
t.Errorf("expected bulkRequest.NumberOfActions %d; got %d", 3, bulkRequest.NumberOfActions())
}
bulkResponse, err := bulkRequest.Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if bulkResponse == nil {
t.Errorf("expected bulkResponse to be != nil; got nil")
}
if bulkRequest.NumberOfActions() != 0 {
t.Errorf("expected bulkRequest.NumberOfActions %d; got %d", 0, bulkRequest.NumberOfActions())
}
// Document with Id="1" should not exist
exists, err := client.Exists().Index(testIndexName).Id("1").Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if exists {
t.Errorf("expected exists %v; got %v", false, exists)
}
// Document with Id="2" should exist
exists, err = client.Exists().Index(testIndexName).Id("2").Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if !exists {
t.Errorf("expected exists %v; got %v", true, exists)
}
// Update
updateDoc := struct {
Retweets int `json:"retweets"`
}{
42,
}
update1Req := NewBulkUpdateRequest().Index(testIndexName).Id("2").Doc(&updateDoc)
bulkRequest = client.Bulk()
bulkRequest = bulkRequest.Add(update1Req)
if bulkRequest.NumberOfActions() != 1 {
t.Errorf("expected bulkRequest.NumberOfActions %d; got %d", 1, bulkRequest.NumberOfActions())
}
bulkResponse, err = bulkRequest.Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if bulkResponse == nil {
t.Errorf("expected bulkResponse to be != nil; got nil")
}
if bulkRequest.NumberOfActions() != 0 {
t.Errorf("expected bulkRequest.NumberOfActions %d; got %d", 0, bulkRequest.NumberOfActions())
}
// Document with Id="1" should have a retweets count of 42
doc, err := client.Get().Index(testIndexName).Id("2").Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if doc == nil {
t.Fatal("expected doc to be != nil; got nil")
}
if !doc.Found {
t.Fatalf("expected doc to be found; got found = %v", doc.Found)
}
if doc.Source == nil {
t.Fatal("expected doc source to be != nil; got nil")
}
var updatedTweet tweet
err = json.Unmarshal(doc.Source, &updatedTweet)
if err != nil {
t.Fatal(err)
}
if updatedTweet.Retweets != 42 {
t.Errorf("expected updated tweet retweets = %v; got %v", 42, updatedTweet.Retweets)
}
// Update with script
update2Req := NewBulkUpdateRequest().Index(testIndexName).Id("2").
RetryOnConflict(3).
Script(NewScript("ctx._source.retweets += params.v").Param("v", 1))
bulkRequest = client.Bulk()
bulkRequest = bulkRequest.Add(update2Req)
if bulkRequest.NumberOfActions() != 1 {
t.Errorf("expected bulkRequest.NumberOfActions %d; got %d", 1, bulkRequest.NumberOfActions())
}
bulkResponse, err = bulkRequest.Refresh("wait_for").Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if bulkResponse == nil {
t.Errorf("expected bulkResponse to be != nil; got nil")
}
if bulkRequest.NumberOfActions() != 0 {
t.Errorf("expected bulkRequest.NumberOfActions %d; got %d", 0, bulkRequest.NumberOfActions())
}
// Document with Id="1" should have a retweets count of 43
doc, err = client.Get().Index(testIndexName).Id("2").Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if doc == nil {
t.Fatal("expected doc to be != nil; got nil")
}
if !doc.Found {
t.Fatalf("expected doc to be found; got found = %v", doc.Found)
}
if doc.Source == nil {
t.Fatal("expected doc source to be != nil; got nil")
}
err = json.Unmarshal(doc.Source, &updatedTweet)
if err != nil {
t.Fatal(err)
}
if updatedTweet.Retweets != 43 {
t.Errorf("expected updated tweet retweets = %v; got %v", 43, updatedTweet.Retweets)
}
}
func TestBulkWithIndexSetOnClient(t *testing.T) {
client := setupTestClientAndCreateIndex(t)
tweet1 := tweet{User: "olivere", Message: "Welcome to Golang and Elasticsearch."}
tweet2 := tweet{User: "sandrae", Message: "Dancing all night long. Yeah."}
index1Req := NewBulkIndexRequest().Index(testIndexName).Id("1").Doc(tweet1).Routing("1")
index2Req := NewBulkIndexRequest().Index(testIndexName).Id("2").Doc(tweet2)
delete1Req := NewBulkDeleteRequest().Index(testIndexName).Id("1")
bulkRequest := client.Bulk().Index(testIndexName)
bulkRequest = bulkRequest.Add(index1Req)
bulkRequest = bulkRequest.Add(index2Req)
bulkRequest = bulkRequest.Add(delete1Req)
if bulkRequest.NumberOfActions() != 3 {
t.Errorf("expected bulkRequest.NumberOfActions %d; got %d", 3, bulkRequest.NumberOfActions())
}
bulkResponse, err := bulkRequest.Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if bulkResponse == nil {
t.Errorf("expected bulkResponse to be != nil; got nil")
}
// Document with Id="1" should not exist
exists, err := client.Exists().Index(testIndexName).Id("1").Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if exists {
t.Errorf("expected exists %v; got %v", false, exists)
}
// Document with Id="2" should exist
exists, err = client.Exists().Index(testIndexName).Id("2").Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if !exists {
t.Errorf("expected exists %v; got %v", true, exists)
}
}
func TestBulkIndexDeleteUpdate(t *testing.T) {
client := setupTestClientAndCreateIndex(t)
//client := setupTestClientAndCreateIndexAndLog(t)
tweet1 := tweet{User: "olivere", Message: "Welcome to Golang and Elasticsearch."}
tweet2 := tweet{User: "sandrae", Message: "Dancing all night long. Yeah."}
index1Req := NewBulkIndexRequest().Index(testIndexName).Id("1").Doc(tweet1)
index2Req := NewBulkIndexRequest().OpType("create").Index(testIndexName).Id("2").Doc(tweet2)
delete1Req := NewBulkDeleteRequest().Index(testIndexName).Id("1")
update2Req := NewBulkUpdateRequest().Index(testIndexName).Id("2").
ReturnSource(true).
Doc(struct {
Retweets int `json:"retweets"`
}{
Retweets: 42,
})
bulkRequest := client.Bulk()
bulkRequest = bulkRequest.Add(index1Req)
bulkRequest = bulkRequest.Add(index2Req)
bulkRequest = bulkRequest.Add(delete1Req)
bulkRequest = bulkRequest.Add(update2Req)
if bulkRequest.NumberOfActions() != 4 {
t.Errorf("expected bulkRequest.NumberOfActions %d; got %d", 4, bulkRequest.NumberOfActions())
}
expected := `{"index":{"_index":"` + testIndexName + `","_id":"1"}}
{"user":"olivere","message":"Welcome to Golang and Elasticsearch.","retweets":0,"created":"0001-01-01T00:00:00Z"}
{"create":{"_index":"` + testIndexName + `","_id":"2"}}
{"user":"sandrae","message":"Dancing all night long. Yeah.","retweets":0,"created":"0001-01-01T00:00:00Z"}
{"delete":{"_index":"` + testIndexName + `","_id":"1"}}
{"update":{"_index":"` + testIndexName + `","_id":"2"}}
{"doc":{"retweets":42},"_source":true}
`
got, err := bulkRequest.bodyAsString()
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
if got != expected {
t.Errorf("expected\n%s\ngot:\n%s", expected, got)
}
// Run the bulk request
bulkResponse, err := bulkRequest.Pretty(true).Do(context.TODO())
if err != nil {
t.Fatal(err)
}
if bulkResponse == nil {
t.Fatal("expected bulkResponse to be != nil; got nil")
}
if bulkResponse.Took == 0 {
t.Errorf("expected took to be > 0; got %d", bulkResponse.Took)
}
if bulkResponse.Errors {
t.Errorf("expected errors to be %v; got %v", false, bulkResponse.Errors)
}
if len(bulkResponse.Items) != 4 {
t.Fatalf("expected 4 result items; got %d", len(bulkResponse.Items))
}
// Indexed actions
indexed := bulkResponse.Indexed()
if indexed == nil {
t.Fatal("expected indexed to be != nil; got nil")
}
if len(indexed) != 1 {
t.Fatalf("expected len(indexed) == %d; got %d", 1, len(indexed))
}
if indexed[0].Id != "1" {
t.Errorf("expected indexed[0].Id == %s; got %s", "1", indexed[0].Id)
}
if indexed[0].Status != 201 {
t.Errorf("expected indexed[0].Status == %d; got %d", 201, indexed[0].Status)
}
// Created actions
created := bulkResponse.Created()
if created == nil {
t.Fatal("expected created to be != nil; got nil")
}
if len(created) != 1 {
t.Fatalf("expected len(created) == %d; got %d", 1, len(created))
}
if created[0].Id != "2" {
t.Errorf("expected created[0].Id == %s; got %s", "2", created[0].Id)
}
if created[0].Status != 201 {
t.Errorf("expected created[0].Status == %d; got %d", 201, created[0].Status)
}
if want, have := "created", created[0].Result; want != have {
t.Errorf("expected created[0].Result == %q; got %q", want, have)
}
// Deleted actions
deleted := bulkResponse.Deleted()
if deleted == nil {
t.Fatal("expected deleted to be != nil; got nil")
}
if len(deleted) != 1 {
t.Fatalf("expected len(deleted) == %d; got %d", 1, len(deleted))
}
if deleted[0].Id != "1" {
t.Errorf("expected deleted[0].Id == %s; got %s", "1", deleted[0].Id)
}
if deleted[0].Status != 200 {
t.Errorf("expected deleted[0].Status == %d; got %d", 200, deleted[0].Status)
}
if want, have := "deleted", deleted[0].Result; want != have {
t.Errorf("expected deleted[0].Result == %q; got %q", want, have)
}
// Updated actions
updated := bulkResponse.Updated()
if updated == nil {
t.Fatal("expected updated to be != nil; got nil")
}
if len(updated) != 1 {
t.Fatalf("expected len(updated) == %d; got %d", 1, len(updated))
}
if updated[0].Id != "2" {
t.Errorf("expected updated[0].Id == %s; got %s", "2", updated[0].Id)
}
if updated[0].Status != 200 {
t.Errorf("expected updated[0].Status == %d; got %d", 200, updated[0].Status)
}
if updated[0].Version != 2 {
t.Errorf("expected updated[0].Version == %d; got %d", 2, updated[0].Version)
}
if want, have := "updated", updated[0].Result; want != have {
t.Errorf("expected updated[0].Result == %q; got %q", want, have)
}
if updated[0].GetResult == nil {
t.Fatalf("expected updated[0].GetResult to be != nil; got nil")
}
if updated[0].GetResult.Source == nil {
t.Fatalf("expected updated[0].GetResult.Source to be != nil; got nil")
}
if want, have := true, updated[0].GetResult.Found; want != have {
t.Fatalf("expected updated[0].GetResult.Found to be != %v; got %v", want, have)
}
var doc tweet
if err := json.Unmarshal(updated[0].GetResult.Source, &doc); err != nil {
t.Fatalf("expected to unmarshal updated[0].GetResult.Source; got %v", err)
}
if want, have := 42, doc.Retweets; want != have {
t.Fatalf("expected updated tweet to have Retweets = %v; got %v", want, have)
}
// Succeeded actions
succeeded := bulkResponse.Succeeded()
if succeeded == nil {
t.Fatal("expected succeeded to be != nil; got nil")
}
if len(succeeded) != 4 {
t.Fatalf("expected len(succeeded) == %d; got %d", 4, len(succeeded))
}
// ById
id1Results := bulkResponse.ById("1")
if id1Results == nil {
t.Fatal("expected id1Results to be != nil; got nil")
}
if len(id1Results) != 2 {
t.Fatalf("expected len(id1Results) == %d; got %d", 2, len(id1Results))
}
if id1Results[0].Id != "1" {
t.Errorf("expected id1Results[0].Id == %s; got %s", "1", id1Results[0].Id)
}
if id1Results[0].Status != 201 {
t.Errorf("expected id1Results[0].Status == %d; got %d", 201, id1Results[0].Status)
}
if id1Results[0].Version != 1 {
t.Errorf("expected id1Results[0].Version == %d; got %d", 1, id1Results[0].Version)
}
if id1Results[1].Id != "1" {
t.Errorf("expected id1Results[1].Id == %s; got %s", "1", id1Results[1].Id)
}
if id1Results[1].Status != 200 {
t.Errorf("expected id1Results[1].Status == %d; got %d", 200, id1Results[1].Status)
}
if id1Results[1].Version != 2 {
t.Errorf("expected id1Results[1].Version == %d; got %d", 2, id1Results[1].Version)
}
}
func TestBulkOnReadOnlyIndex(t *testing.T) {
client := setupTestClientAndCreateIndex(t)
//client := setupTestClientAndCreateIndexAndLog(t)
// Change index to read-only
{
_, err := client.IndexPutSettings(testIndexName).
BodyString(`{
"index": {
"blocks": {
"read_only_allow_delete": true
}
}
}`).Pretty(true).Do(context.Background())
if err != nil {
t.Fatalf("unable to set index into read-only mode: %v", err)
}
}
// Index something
tweet := tweet{User: "olivere", Message: "Welcome to Golang and Elasticsearch."}
bulk := client.Bulk().Add(
NewBulkIndexRequest().Index(testIndexName).Id("1").Doc(tweet),
)
resp, err := bulk.Pretty(true).Do(context.Background())
if err != nil {
t.Fatal(err)
}
if resp == nil {
t.Fatal("expected response to be != nil; got nil")
}
if !resp.Errors {
t.Fatal("expected response errors being set to true")
}
if len(resp.Items) != 1 {
t.Fatal("expected response with 1 item")
}
if want, have := http.StatusTooManyRequests, resp.ById("1")[0].Status; want != have {
t.Fatal("expected HTTP status code 200")
}
}
func TestFailedBulkRequests(t *testing.T) {
js := `{
"took" : 2,
"errors" : true,
"items" : [ {
"index" : {
"_index" : "elastic-test",
"_type" : "_doc",
"_id" : "1",
"_version" : 1,
"status" : 201
}
}, {
"create" : {
"_index" : "elastic-test",
"_type" : "_doc",
"_id" : "2",
"_version" : 1,
"status" : 423,
"error" : {
"type":"routing_missing_exception",
"reason":"routing is required for [elastic-test2]/[comment]/[1]"
}
}
}, {
"delete" : {
"_index" : "elastic-test",
"_type" : "_doc",
"_id" : "1",
"_version" : 2,
"status" : 404,
"found" : false
}
}, {
"update" : {
"_index" : "elastic-test",
"_type" : "_doc",
"_id" : "2",
"_version" : 2,
"status" : 200
}
} ]
}`
var resp BulkResponse
err := json.Unmarshal([]byte(js), &resp)
if err != nil {
t.Fatal(err)
}
failed := resp.Failed()
if len(failed) != 2 {
t.Errorf("expected %d failed items; got: %d", 2, len(failed))
}
}
func TestBulkEstimatedSizeInBytes(t *testing.T) {
client := setupTestClientAndCreateIndex(t)
tweet1 := tweet{User: "olivere", Message: "Welcome to Golang and Elasticsearch."}
tweet2 := tweet{User: "sandrae", Message: "Dancing all night long. Yeah."}
index1Req := NewBulkIndexRequest().Index(testIndexName).Id("1").Doc(tweet1)
index2Req := NewBulkIndexRequest().OpType("create").Index(testIndexName).Id("2").Doc(tweet2)
delete1Req := NewBulkDeleteRequest().Index(testIndexName).Id("1")
update2Req := NewBulkUpdateRequest().Index(testIndexName).Id("2").
Doc(struct {
Retweets int `json:"retweets"`
}{
Retweets: 42,
})
bulkRequest := client.Bulk()
bulkRequest = bulkRequest.Add(index1Req)
bulkRequest = bulkRequest.Add(index2Req)
bulkRequest = bulkRequest.Add(delete1Req)
bulkRequest = bulkRequest.Add(update2Req)
if bulkRequest.NumberOfActions() != 4 {
t.Errorf("expected bulkRequest.NumberOfActions %d; got %d", 4, bulkRequest.NumberOfActions())
}
// The estimated size of the bulk request in bytes must be at least
// the length of the body request.
raw, err := bulkRequest.bodyAsString()
if err != nil {
t.Fatal(err)
}
rawlen := int64(len([]byte(raw)))
if got, want := bulkRequest.EstimatedSizeInBytes(), rawlen; got < want {
t.Errorf("expected an EstimatedSizeInBytes = %d; got: %v", want, got)
}
// Reset should also reset the calculated estimated byte size
bulkRequest.Reset()
if got, want := bulkRequest.EstimatedSizeInBytes(), int64(0); got != want {
t.Errorf("expected an EstimatedSizeInBytes = %d; got: %v", want, got)
}
}
func TestBulkEstimateSizeInBytesLength(t *testing.T) {
client := setupTestClientAndCreateIndex(t)
s := client.Bulk()
r := NewBulkDeleteRequest().Index(testIndexName).Id("1")
s = s.Add(r)
if got, want := s.estimateSizeInBytes(r), int64(1+len(r.String())); got != want {
t.Fatalf("expected %d; got: %d", want, got)
}
}
func TestBulkContentType(t *testing.T) {
var header http.Header
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
header = r.Header
fmt.Fprintln(w, `{}`)
}))
defer ts.Close()
client, err := NewSimpleClient(SetURL(ts.URL))
if err != nil {
t.Fatal(err)
}
indexReq := NewBulkIndexRequest().Index(testIndexName).Id("1").Doc(tweet{User: "olivere", Message: "Welcome to Golang and Elasticsearch."})
if _, err := client.Bulk().Add(indexReq).Do(context.Background()); err != nil {
t.Fatal(err)
}
if header == nil {
t.Fatalf("expected header, got %v", header)
}
if want, have := "application/x-ndjson", header.Get("Content-Type"); want != have {
t.Fatalf("Content-Type: want %q, have %q", want, have)
}
}
// -- Benchmarks --
var benchmarkBulkEstimatedSizeInBytes int64
func BenchmarkBulkEstimatedSizeInBytesWith1Request(b *testing.B) {
client := setupTestClientAndCreateIndex(b)
s := client.Bulk()
var result int64
for n := 0; n < b.N; n++ {
s = s.Add(NewBulkIndexRequest().Index(testIndexName).Id("1").Doc(struct{ A string }{"1"}))
s = s.Add(NewBulkUpdateRequest().Index(testIndexName).Id("1").Doc(struct{ A string }{"2"}))
s = s.Add(NewBulkDeleteRequest().Index(testIndexName).Id("1"))
result = s.EstimatedSizeInBytes()
s.Reset()
}
b.ReportAllocs()
benchmarkBulkEstimatedSizeInBytes = result // ensure the compiler doesn't optimize
}
func BenchmarkBulkEstimatedSizeInBytesWith100Requests(b *testing.B) {
client := setupTestClientAndCreateIndex(b)
s := client.Bulk()
var result int64
for n := 0; n < b.N; n++ {
for i := 0; i < 100; i++ {
s = s.Add(NewBulkIndexRequest().Index(testIndexName).Id("1").Doc(struct{ A string }{"1"}))
s = s.Add(NewBulkUpdateRequest().Index(testIndexName).Id("1").Doc(struct{ A string }{"2"}))
s = s.Add(NewBulkDeleteRequest().Index(testIndexName).Id("1"))
}
result = s.EstimatedSizeInBytes()
s.Reset()
}
b.ReportAllocs()
benchmarkBulkEstimatedSizeInBytes = result // ensure the compiler doesn't optimize
}
func BenchmarkBulkAllocs(b *testing.B) {
b.Run("1000 docs with 64 byte", func(b *testing.B) { benchmarkBulkAllocs(b, 64, 1000) })
b.Run("1000 docs with 1 KiB", func(b *testing.B) { benchmarkBulkAllocs(b, 1024, 1000) })
b.Run("1000 docs with 4 KiB", func(b *testing.B) { benchmarkBulkAllocs(b, 4096, 1000) })
b.Run("1000 docs with 16 KiB", func(b *testing.B) { benchmarkBulkAllocs(b, 16*1024, 1000) })
b.Run("1000 docs with 64 KiB", func(b *testing.B) { benchmarkBulkAllocs(b, 64*1024, 1000) })
b.Run("1000 docs with 256 KiB", func(b *testing.B) { benc
gitextract_wuqpv25u/ ├── .github/ │ └── workflows/ │ ├── codeql-v7.yml │ └── test-v7.yml ├── .gitignore ├── CHANGELOG-3.0.md ├── CHANGELOG-5.0.md ├── CHANGELOG-6.0.md ├── CHANGELOG-7.0.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── CONTRIBUTORS ├── ISSUE_TEMPLATE.md ├── LICENSE ├── Makefile ├── README.md ├── acknowledged_response.go ├── aws/ │ ├── sign_v4.go │ ├── sign_v4_test.go │ └── v4/ │ ├── CREDITS │ ├── aws_v4.go │ └── aws_v4_test.go ├── backoff.go ├── backoff_test.go ├── bulk.go ├── bulk_create_request.go ├── bulk_create_request_easyjson.go ├── bulk_create_request_test.go ├── bulk_delete_request.go ├── bulk_delete_request_easyjson.go ├── bulk_delete_request_test.go ├── bulk_index_request.go ├── bulk_index_request_easyjson.go ├── bulk_index_request_test.go ├── bulk_processor.go ├── bulk_processor_test.go ├── bulk_request.go ├── bulk_test.go ├── bulk_update_request.go ├── bulk_update_request_easyjson.go ├── bulk_update_request_test.go ├── canonicalize.go ├── canonicalize_test.go ├── cat_aliases.go ├── cat_aliases_test.go ├── cat_allocation.go ├── cat_allocation_test.go ├── cat_count.go ├── cat_count_integration_test.go ├── cat_count_test.go ├── cat_fielddata.go ├── cat_fielddata_test.go ├── cat_health.go ├── cat_health_test.go ├── cat_indices.go ├── cat_indices_test.go ├── cat_master.go ├── cat_master_test.go ├── cat_shards.go ├── cat_shards_test.go ├── cat_snapshots.go ├── cat_snapshots_integration_test.go ├── cat_snapshots_test.go ├── clear_scroll.go ├── clear_scroll_test.go ├── client.go ├── client_test.go ├── cluster-test/ │ ├── Makefile │ ├── README.md │ └── cluster-test.go ├── cluster_health.go ├── cluster_health_test.go ├── cluster_reroute.go ├── cluster_reroute_test.go ├── cluster_state.go ├── cluster_state_test.go ├── cluster_stats.go ├── cluster_stats_integration_test.go ├── cluster_stats_test.go ├── config/ │ ├── config.go │ ├── config_test.go │ └── doc.go ├── connection.go ├── count.go ├── count_test.go ├── decoder.go ├── decoder_test.go ├── delete.go ├── delete_by_query.go ├── delete_by_query_test.go ├── delete_test.go ├── doc.go ├── docker-compose.cluster.yml ├── docker-compose.yml ├── docvalue_field.go ├── docvalue_field_test.go ├── errors.go ├── errors_test.go ├── example_test.go ├── exists.go ├── exists_test.go ├── explain.go ├── explain_test.go ├── fetch_source_context.go ├── fetch_source_context_test.go ├── field_caps.go ├── field_caps_test.go ├── geo_point.go ├── geo_point_test.go ├── get.go ├── get_test.go ├── go.mod ├── highlight.go ├── highlight_test.go ├── index.go ├── index_test.go ├── indices_analyze.go ├── indices_analyze_test.go ├── indices_clear_cache.go ├── indices_clear_cache_test.go ├── indices_close.go ├── indices_close_test.go ├── indices_component_templates_test.go ├── indices_create.go ├── indices_create_test.go ├── indices_delete.go ├── indices_delete_component_template.go ├── indices_delete_index_template.go ├── indices_delete_integration_test.go ├── indices_delete_template.go ├── indices_delete_test.go ├── indices_exists.go ├── indices_exists_template.go ├── indices_exists_template_test.go ├── indices_exists_test.go ├── indices_flush.go ├── indices_flush_synced.go ├── indices_flush_synced_test.go ├── indices_flush_test.go ├── indices_forcemerge.go ├── indices_forcemerge_test.go ├── indices_freeze.go ├── indices_freeze_test.go ├── indices_get.go ├── indices_get_aliases.go ├── indices_get_aliases_test.go ├── indices_get_component_template.go ├── indices_get_field_mapping.go ├── indices_get_field_mapping_test.go ├── indices_get_index_template.go ├── indices_get_index_template_test.go ├── indices_get_mapping.go ├── indices_get_mapping_test.go ├── indices_get_settings.go ├── indices_get_settings_test.go ├── indices_get_template.go ├── indices_get_template_test.go ├── indices_get_test.go ├── indices_index_templates_test.go ├── indices_open.go ├── indices_open_test.go ├── indices_put_alias.go ├── indices_put_alias_test.go ├── indices_put_component_template.go ├── indices_put_index_template.go ├── indices_put_mapping.go ├── indices_put_mapping_test.go ├── indices_put_settings.go ├── indices_put_settings_test.go ├── indices_put_template.go ├── indices_refresh.go ├── indices_refresh_test.go ├── indices_rollover.go ├── indices_rollover_test.go ├── indices_segments.go ├── indices_segments_test.go ├── indices_shrink.go ├── indices_shrink_test.go ├── indices_stats.go ├── indices_stats_test.go ├── indices_unfreeze.go ├── indices_unfreeze_test.go ├── ingest_delete_pipeline.go ├── ingest_delete_pipeline_test.go ├── ingest_get_pipeline.go ├── ingest_get_pipeline_test.go ├── ingest_put_pipeline.go ├── ingest_put_pipeline_test.go ├── ingest_simulate_pipeline.go ├── ingest_simulate_pipeline_test.go ├── inner_hit.go ├── inner_hit_test.go ├── logger.go ├── mget.go ├── mget_test.go ├── msearch.go ├── msearch_test.go ├── mtermvectors.go ├── mtermvectors_test.go ├── nodes_info.go ├── nodes_info_test.go ├── nodes_stats.go ├── nodes_stats_test.go ├── percolate_test.go ├── ping.go ├── ping_test.go ├── pit.go ├── pit_close.go ├── pit_open.go ├── pit_test.go ├── plugins.go ├── plugins_test.go ├── query.go ├── recipes/ │ ├── aws-connect/ │ │ ├── .gitignore │ │ └── main.go │ ├── aws-connect-v4/ │ │ ├── .gitignore │ │ └── main.go │ ├── aws-mapping-v4/ │ │ ├── .gitignore │ │ └── main.go │ ├── bulk_insert/ │ │ ├── .gitignore │ │ └── bulk_insert.go │ ├── bulk_processor/ │ │ ├── .gitignore │ │ └── main.go │ ├── connect/ │ │ ├── .gitignore │ │ └── connect.go │ ├── connect_with_config/ │ │ ├── .gitignore │ │ └── connect_with_config.go │ ├── go.mod │ ├── go.sum │ ├── mapping/ │ │ ├── .gitignore │ │ └── mapping.go │ ├── middleware/ │ │ ├── .gitignore │ │ └── main.go │ ├── scroll/ │ │ ├── .gitignore │ │ └── scroll.go │ ├── search_with_point_in_time/ │ │ ├── .gitignore │ │ └── search.go │ ├── sliced_scroll/ │ │ ├── .gitignore │ │ └── sliced_scroll.go │ ├── suggesters/ │ │ └── completion/ │ │ ├── .gitignore │ │ └── main.go │ ├── text_vs_keyword/ │ │ ├── .gitignore │ │ └── main.go │ └── tracing/ │ ├── .gitignore │ ├── README.md │ ├── otel/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── run-tracer.sh │ │ └── tracing.go │ ├── run-tracer.sh │ └── tracing.go ├── reindex.go ├── reindex_test.go ├── request.go ├── request_test.go ├── rescore.go ├── rescorer.go ├── response.go ├── response_test.go ├── retrier.go ├── retrier_test.go ├── retry.go ├── retry_test.go ├── runtime_mappings.go ├── runtime_mappings_test.go ├── script.go ├── script_delete.go ├── script_delete_test.go ├── script_get.go ├── script_get_test.go ├── script_put.go ├── script_put_test.go ├── script_test.go ├── scroll.go ├── scroll_test.go ├── search.go ├── search_aggs.go ├── search_aggs_bucket_adjacency_matrix.go ├── search_aggs_bucket_adjacency_matrix_test.go ├── search_aggs_bucket_auto_date_histogram.go ├── search_aggs_bucket_auto_date_histogram_test.go ├── search_aggs_bucket_children.go ├── search_aggs_bucket_children_test.go ├── search_aggs_bucket_composite.go ├── search_aggs_bucket_composite_test.go ├── search_aggs_bucket_count_thresholds.go ├── search_aggs_bucket_date_histogram.go ├── search_aggs_bucket_date_histogram_test.go ├── search_aggs_bucket_date_range.go ├── search_aggs_bucket_date_range_test.go ├── search_aggs_bucket_diversified_sampler.go ├── search_aggs_bucket_diversified_sampler_test.go ├── search_aggs_bucket_filter.go ├── search_aggs_bucket_filter_test.go ├── search_aggs_bucket_filters.go ├── search_aggs_bucket_filters_test.go ├── search_aggs_bucket_geo_distance.go ├── search_aggs_bucket_geo_distance_test.go ├── search_aggs_bucket_geohash_grid.go ├── search_aggs_bucket_geohash_grid_test.go ├── search_aggs_bucket_geotile_grid.go ├── search_aggs_bucket_geotile_grid_test.go ├── search_aggs_bucket_global.go ├── search_aggs_bucket_global_test.go ├── search_aggs_bucket_histogram.go ├── search_aggs_bucket_histogram_test.go ├── search_aggs_bucket_ip_range.go ├── search_aggs_bucket_ip_range_test.go ├── search_aggs_bucket_missing.go ├── search_aggs_bucket_missing_test.go ├── search_aggs_bucket_multi_terms.go ├── search_aggs_bucket_multi_terms_test.go ├── search_aggs_bucket_nested.go ├── search_aggs_bucket_nested_test.go ├── search_aggs_bucket_range.go ├── search_aggs_bucket_range_test.go ├── search_aggs_bucket_rare_terms.go ├── search_aggs_bucket_rare_terms_test.go ├── search_aggs_bucket_reverse_nested.go ├── search_aggs_bucket_reverse_nested_test.go ├── search_aggs_bucket_sampler.go ├── search_aggs_bucket_sampler_test.go ├── search_aggs_bucket_significant_terms.go ├── search_aggs_bucket_significant_terms_test.go ├── search_aggs_bucket_significant_text.go ├── search_aggs_bucket_significant_text_test.go ├── search_aggs_bucket_terms.go ├── search_aggs_bucket_terms_integration_test.go ├── search_aggs_bucket_terms_test.go ├── search_aggs_matrix_stats.go ├── search_aggs_matrix_stats_test.go ├── search_aggs_metrics_avg.go ├── search_aggs_metrics_avg_test.go ├── search_aggs_metrics_cardinality.go ├── search_aggs_metrics_cardinality_test.go ├── search_aggs_metrics_extended_stats.go ├── search_aggs_metrics_extended_stats_test.go ├── search_aggs_metrics_geo_bounds.go ├── search_aggs_metrics_geo_bounds_test.go ├── search_aggs_metrics_geo_centroid.go ├── search_aggs_metrics_geo_centroid_test.go ├── search_aggs_metrics_max.go ├── search_aggs_metrics_max_test.go ├── search_aggs_metrics_median_absolute_deviation.go ├── search_aggs_metrics_median_absolute_deviation_test.go ├── search_aggs_metrics_min.go ├── search_aggs_metrics_min_test.go ├── search_aggs_metrics_percentile_ranks.go ├── search_aggs_metrics_percentile_ranks_test.go ├── search_aggs_metrics_percentiles.go ├── search_aggs_metrics_percentiles_test.go ├── search_aggs_metrics_scripted_metric.go ├── search_aggs_metrics_scripted_metric_test.go ├── search_aggs_metrics_stats.go ├── search_aggs_metrics_stats_test.go ├── search_aggs_metrics_sum.go ├── search_aggs_metrics_sum_test.go ├── search_aggs_metrics_top_hits.go ├── search_aggs_metrics_top_hits_test.go ├── search_aggs_metrics_top_metrics.go ├── search_aggs_metrics_top_metrics_test.go ├── search_aggs_metrics_value_count.go ├── search_aggs_metrics_value_count_test.go ├── search_aggs_metrics_weighted_avg.go ├── search_aggs_metrics_weighted_avg_test.go ├── search_aggs_pipeline_avg_bucket.go ├── search_aggs_pipeline_avg_bucket_test.go ├── search_aggs_pipeline_bucket_script.go ├── search_aggs_pipeline_bucket_script_test.go ├── search_aggs_pipeline_bucket_selector.go ├── search_aggs_pipeline_bucket_selector_test.go ├── search_aggs_pipeline_bucket_sort.go ├── search_aggs_pipeline_bucket_sort_test.go ├── search_aggs_pipeline_cumulative_sum.go ├── search_aggs_pipeline_cumulative_sum_test.go ├── search_aggs_pipeline_derivative.go ├── search_aggs_pipeline_derivative_test.go ├── search_aggs_pipeline_extended_stats_bucket.go ├── search_aggs_pipeline_extended_stats_bucket_test.go ├── search_aggs_pipeline_max_bucket.go ├── search_aggs_pipeline_max_bucket_test.go ├── search_aggs_pipeline_min_bucket.go ├── search_aggs_pipeline_min_bucket_test.go ├── search_aggs_pipeline_mov_avg.go ├── search_aggs_pipeline_mov_avg_test.go ├── search_aggs_pipeline_mov_fn.go ├── search_aggs_pipeline_mov_fn_test.go ├── search_aggs_pipeline_percentiles_bucket.go ├── search_aggs_pipeline_percentiles_bucket_test.go ├── search_aggs_pipeline_serial_diff.go ├── search_aggs_pipeline_serial_diff_test.go ├── search_aggs_pipeline_stats_bucket.go ├── search_aggs_pipeline_stats_bucket_test.go ├── search_aggs_pipeline_sum_bucket.go ├── search_aggs_pipeline_sum_bucket_test.go ├── search_aggs_pipeline_test.go ├── search_aggs_test.go ├── search_collapse_builder.go ├── search_collapse_builder_test.go ├── search_queries_bool.go ├── search_queries_bool_test.go ├── search_queries_boosting.go ├── search_queries_boosting_test.go ├── search_queries_combined_fields.go ├── search_queries_combined_fields_test.go ├── search_queries_common_terms.go ├── search_queries_common_terms_test.go ├── search_queries_constant_score.go ├── search_queries_constant_score_test.go ├── search_queries_dis_max.go ├── search_queries_dis_max_test.go ├── search_queries_distance_feature_query.go ├── search_queries_distance_feature_query_test.go ├── search_queries_exists.go ├── search_queries_exists_test.go ├── search_queries_fsq.go ├── search_queries_fsq_score_funcs.go ├── search_queries_fsq_test.go ├── search_queries_fuzzy.go ├── search_queries_fuzzy_test.go ├── search_queries_geo_bounding_box.go ├── search_queries_geo_bounding_box_test.go ├── search_queries_geo_distance.go ├── search_queries_geo_distance_test.go ├── search_queries_geo_polygon.go ├── search_queries_geo_polygon_test.go ├── search_queries_has_child.go ├── search_queries_has_child_test.go ├── search_queries_has_parent.go ├── search_queries_has_parent_test.go ├── search_queries_ids.go ├── search_queries_ids_test.go ├── search_queries_interval.go ├── search_queries_interval_filter.go ├── search_queries_interval_integration_test.go ├── search_queries_interval_rules_all_of.go ├── search_queries_interval_rules_any_of.go ├── search_queries_interval_rules_fuzzy.go ├── search_queries_interval_rules_match.go ├── search_queries_interval_rules_prefix.go ├── search_queries_interval_rules_wildcard.go ├── search_queries_interval_test.go ├── search_queries_match.go ├── search_queries_match_all.go ├── search_queries_match_all_test.go ├── search_queries_match_bool_prefix.go ├── search_queries_match_bool_prefix_test.go ├── search_queries_match_none.go ├── search_queries_match_none_test.go ├── search_queries_match_phrase.go ├── search_queries_match_phrase_prefix.go ├── search_queries_match_phrase_prefix_test.go ├── search_queries_match_phrase_test.go ├── search_queries_match_test.go ├── search_queries_more_like_this.go ├── search_queries_more_like_this_test.go ├── search_queries_multi_match.go ├── search_queries_multi_match_test.go ├── search_queries_nested.go ├── search_queries_nested_test.go ├── search_queries_parent_id.go ├── search_queries_parent_id_test.go ├── search_queries_percolator.go ├── search_queries_percolator_test.go ├── search_queries_pinned.go ├── search_queries_pinned_test.go ├── search_queries_prefix.go ├── search_queries_prefix_example_test.go ├── search_queries_prefix_test.go ├── search_queries_query_string.go ├── search_queries_query_string_test.go ├── search_queries_range.go ├── search_queries_range_test.go ├── search_queries_rank_feature.go ├── search_queries_rank_feature_test.go ├── search_queries_raw_string.go ├── search_queries_raw_string_test.go ├── search_queries_regexp.go ├── search_queries_regexp_test.go ├── search_queries_script.go ├── search_queries_script_score.go ├── search_queries_script_score_test.go ├── search_queries_script_test.go ├── search_queries_simple_query_string.go ├── search_queries_simple_query_string_test.go ├── search_queries_slice.go ├── search_queries_slice_test.go ├── search_queries_span_first.go ├── search_queries_span_first_integration_test.go ├── search_queries_span_first_test.go ├── search_queries_span_near.go ├── search_queries_span_near_integration_test.go ├── search_queries_span_near_test.go ├── search_queries_span_term.go ├── search_queries_span_term_integration_test.go ├── search_queries_span_term_test.go ├── search_queries_term.go ├── search_queries_term_test.go ├── search_queries_terms.go ├── search_queries_terms_set.go ├── search_queries_terms_set_test.go ├── search_queries_terms_test.go ├── search_queries_type.go ├── search_queries_type_test.go ├── search_queries_wildcard.go ├── search_queries_wildcard_test.go ├── search_queries_wrapper.go ├── search_queries_wrapper_integration_test.go ├── search_queries_wrapper_test.go ├── search_request.go ├── search_request_test.go ├── search_shards.go ├── search_shards_test.go ├── search_source.go ├── search_source_test.go ├── search_suggester_test.go ├── search_terms_lookup.go ├── search_terms_lookup_test.go ├── search_test.go ├── setup_test.go ├── snapshot_create.go ├── snapshot_create_repository.go ├── snapshot_create_repository_test.go ├── snapshot_create_test.go ├── snapshot_delete.go ├── snapshot_delete_repository.go ├── snapshot_delete_repository_test.go ├── snapshot_delete_test.go ├── snapshot_get.go ├── snapshot_get_repository.go ├── snapshot_get_repository_test.go ├── snapshot_get_test.go ├── snapshot_restore.go ├── snapshot_restore_test.go ├── snapshot_status.go ├── snapshot_status_test.go ├── snapshot_verify_repository.go ├── snapshot_verify_repository_test.go ├── sort.go ├── sort_test.go ├── suggest_field.go ├── suggest_field_test.go ├── suggester.go ├── suggester_completion.go ├── suggester_completion_test.go ├── suggester_context.go ├── suggester_context_category.go ├── suggester_context_category_test.go ├── suggester_context_geo.go ├── suggester_context_geo_test.go ├── suggester_context_test.go ├── suggester_phrase.go ├── suggester_phrase_test.go ├── suggester_term.go ├── suggester_term_test.go ├── tasks_cancel.go ├── tasks_cancel_test.go ├── tasks_get_task.go ├── tasks_get_task_test.go ├── tasks_list.go ├── tasks_list_test.go ├── termvectors.go ├── termvectors_test.go ├── trace/ │ ├── opencensus/ │ │ ├── transport.go │ │ ├── transport_test.go │ │ └── util.go │ ├── opentelemetry/ │ │ ├── transport.go │ │ └── util.go │ └── opentracing/ │ ├── transport.go │ ├── transport_integration_test.go │ ├── transport_test.go │ └── util.go ├── update.go ├── update_by_query.go ├── update_by_query_test.go ├── update_integration_test.go ├── update_test.go ├── uritemplates/ │ ├── LICENSE │ ├── uritemplates.go │ ├── utils.go │ └── utils_test.go ├── validate.go ├── validate_test.go ├── xpack_async_search_delete.go ├── xpack_async_search_get.go ├── xpack_async_search_submit.go ├── xpack_async_search_test.go ├── xpack_ilm_delete_lifecycle.go ├── xpack_ilm_get_lifecycle.go ├── xpack_ilm_put_lifecycle.go ├── xpack_ilm_test.go ├── xpack_info.go ├── xpack_info_test.go ├── xpack_rollup_delete.go ├── xpack_rollup_delete_test.go ├── xpack_rollup_get.go ├── xpack_rollup_get_test.go ├── xpack_rollup_put.go ├── xpack_rollup_put_test.go ├── xpack_rollup_start.go ├── xpack_rollup_start_test.go ├── xpack_rollup_stop.go ├── xpack_rollup_stop_test.go ├── xpack_security_change_password.go ├── xpack_security_change_password_test.go ├── xpack_security_delete_role.go ├── xpack_security_delete_role_mapping.go ├── xpack_security_delete_role_mapping_test.go ├── xpack_security_delete_role_test.go ├── xpack_security_delete_user.go ├── xpack_security_delete_user_test.go ├── xpack_security_disable_user.go ├── xpack_security_disable_user_test.go ├── xpack_security_enable_user.go ├── xpack_security_enable_user_test.go ├── xpack_security_get_role.go ├── xpack_security_get_role_mapping.go ├── xpack_security_get_role_mapping_test.go ├── xpack_security_get_role_test.go ├── xpack_security_get_user.go ├── xpack_security_get_user_test.go ├── xpack_security_put_role.go ├── xpack_security_put_role_mapping.go ├── xpack_security_put_role_mapping_test.go ├── xpack_security_put_role_test.go ├── xpack_security_put_user.go ├── xpack_security_put_user_test.go ├── xpack_test.go ├── xpack_watcher_ack_watch.go ├── xpack_watcher_ack_watch_test.go ├── xpack_watcher_activate_watch.go ├── xpack_watcher_activate_watch_test.go ├── xpack_watcher_deactivate_watch.go ├── xpack_watcher_deactivate_watch_test.go ├── xpack_watcher_delete_watch.go ├── xpack_watcher_delete_watch_test.go ├── xpack_watcher_execute_watch.go ├── xpack_watcher_execute_watch_test.go ├── xpack_watcher_get_watch.go ├── xpack_watcher_get_watch_test.go ├── xpack_watcher_put_watch.go ├── xpack_watcher_put_watch_test.go ├── xpack_watcher_start.go ├── xpack_watcher_start_test.go ├── xpack_watcher_stats.go ├── xpack_watcher_stats_test.go ├── xpack_watcher_stop.go └── xpack_watcher_stop_test.go
Showing preview only (656K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (6422 symbols across 601 files)
FILE: acknowledged_response.go
type AcknowledgedResponse (line 9) | type AcknowledgedResponse struct
FILE: aws/sign_v4.go
function NewV4SigningClient (line 14) | func NewV4SigningClient(credentials awsauth.Credentials) *http.Client {
function NewV4SigningClientWithHTTPClient (line 19) | func NewV4SigningClientWithHTTPClient(credentials awsauth.Credentials, h...
type V4Transport (line 29) | type V4Transport struct
method RoundTrip (line 35) | func (st V4Transport) RoundTrip(req *http.Request) (*http.Response, er...
FILE: aws/sign_v4_test.go
function TestSigningClient (line 19) | func TestSigningClient(t *testing.T) {
FILE: aws/v4/aws_v4.go
function NewV4SigningClient (line 21) | func NewV4SigningClient(creds *credentials.Credentials, region string) *...
function NewV4SigningClientWithHTTPClient (line 26) | func NewV4SigningClientWithHTTPClient(creds *credentials.Credentials, re...
type Transport (line 38) | type Transport struct
method RoundTrip (line 46) | func (st Transport) RoundTrip(req *http.Request) (*http.Response, erro...
FILE: aws/v4/aws_v4_test.go
function TestSigningClient (line 20) | func TestSigningClient(t *testing.T) {
FILE: backoff.go
type BackoffFunc (line 17) | type BackoffFunc
type Backoff (line 20) | type Backoff interface
type ZeroBackoff (line 30) | type ZeroBackoff struct
method Next (line 33) | func (b ZeroBackoff) Next(retry int) (time.Duration, bool) {
type StopBackoff (line 41) | type StopBackoff struct
method Next (line 44) | func (b StopBackoff) Next(retry int) (time.Duration, bool) {
type ConstantBackoff (line 51) | type ConstantBackoff struct
method Next (line 61) | func (b *ConstantBackoff) Next(retry int) (time.Duration, bool) {
function NewConstantBackoff (line 56) | func NewConstantBackoff(interval time.Duration) *ConstantBackoff {
type ExponentialBackoff (line 69) | type ExponentialBackoff struct
method Next (line 87) | func (b *ExponentialBackoff) Next(retry int) (time.Duration, bool) {
function NewExponentialBackoff (line 78) | func NewExponentialBackoff(initialTimeout, maxTimeout time.Duration) *Ex...
type SimpleBackoff (line 103) | type SimpleBackoff struct
method Jitter (line 119) | func (b *SimpleBackoff) Jitter(flag bool) *SimpleBackoff {
method Next (line 135) | func (b *SimpleBackoff) Next(retry int) (time.Duration, bool) {
function NewSimpleBackoff (line 111) | func NewSimpleBackoff(ticks ...int) *SimpleBackoff {
function jitter (line 127) | func jitter(millis int) int {
FILE: backoff_test.go
function TestZeroBackoff (line 13) | func TestZeroBackoff(t *testing.T) {
function TestStopBackoff (line 21) | func TestStopBackoff(t *testing.T) {
function TestConstantBackoff (line 29) | func TestConstantBackoff(t *testing.T) {
function TestSimpleBackoff (line 40) | func TestSimpleBackoff(t *testing.T) {
function TestExponentialBackoff (line 85) | func TestExponentialBackoff(t *testing.T) {
FILE: bulk.go
type BulkService (line 29) | type BulkService struct
method Pretty (line 62) | func (s *BulkService) Pretty(pretty bool) *BulkService {
method Human (line 69) | func (s *BulkService) Human(human bool) *BulkService {
method ErrorTrace (line 75) | func (s *BulkService) ErrorTrace(errorTrace bool) *BulkService {
method FilterPath (line 81) | func (s *BulkService) FilterPath(filterPath ...string) *BulkService {
method Header (line 87) | func (s *BulkService) Header(name string, value string) *BulkService {
method Headers (line 96) | func (s *BulkService) Headers(headers http.Header) *BulkService {
method Reset (line 102) | func (s *BulkService) Reset() {
method Retrier (line 110) | func (s *BulkService) Retrier(retrier Retrier) *BulkService {
method Index (line 117) | func (s *BulkService) Index(index string) *BulkService {
method Type (line 124) | func (s *BulkService) Type(typ string) *BulkService {
method Timeout (line 132) | func (s *BulkService) Timeout(timeout string) *BulkService {
method Refresh (line 145) | func (s *BulkService) Refresh(refresh string) *BulkService {
method Routing (line 151) | func (s *BulkService) Routing(routing string) *BulkService {
method Pipeline (line 157) | func (s *BulkService) Pipeline(pipeline string) *BulkService {
method WaitForActiveShards (line 167) | func (s *BulkService) WaitForActiveShards(waitForActiveShards string) ...
method Add (line 174) | func (s *BulkService) Add(requests ...BulkableRequest) *BulkService {
method EstimatedSizeInBytes (line 181) | func (s *BulkService) EstimatedSizeInBytes() int64 {
method estimateSizeInBytes (line 195) | func (s *BulkService) estimateSizeInBytes(r BulkableRequest) int64 {
method NumberOfActions (line 207) | func (s *BulkService) NumberOfActions() int {
method bodyAsString (line 211) | func (s *BulkService) bodyAsString() (string, error) {
method Do (line 233) | func (s *BulkService) Do(ctx context.Context) (*BulkResponse, error) {
function NewBulkService (line 54) | func NewBulkService(client *Client) *BulkService {
type BulkResponse (line 364) | type BulkResponse struct
method Indexed (line 387) | func (r *BulkResponse) Indexed() []*BulkResponseItem {
method Created (line 392) | func (r *BulkResponse) Created() []*BulkResponseItem {
method Updated (line 397) | func (r *BulkResponse) Updated() []*BulkResponseItem {
method Deleted (line 402) | func (r *BulkResponse) Deleted() []*BulkResponseItem {
method ByAction (line 408) | func (r *BulkResponse) ByAction(action string) []*BulkResponseItem {
method ById (line 423) | func (r *BulkResponse) ById(id string) []*BulkResponseItem {
method Failed (line 440) | func (r *BulkResponse) Failed() []*BulkResponseItem {
method Succeeded (line 457) | func (r *BulkResponse) Succeeded() []*BulkResponseItem {
type BulkResponseItem (line 371) | type BulkResponseItem struct
FILE: bulk_create_request.go
type BulkCreateRequest (line 19) | type BulkCreateRequest struct
method UseEasyJSON (line 72) | func (r *BulkCreateRequest) UseEasyJSON(enable bool) *BulkCreateRequest {
method Index (line 79) | func (r *BulkCreateRequest) Index(index string) *BulkCreateRequest {
method Type (line 87) | func (r *BulkCreateRequest) Type(typ string) *BulkCreateRequest {
method Id (line 94) | func (r *BulkCreateRequest) Id(id string) *BulkCreateRequest {
method Routing (line 101) | func (r *BulkCreateRequest) Routing(routing string) *BulkCreateRequest {
method Parent (line 108) | func (r *BulkCreateRequest) Parent(parent string) *BulkCreateRequest {
method Version (line 116) | func (r *BulkCreateRequest) Version(version int64) *BulkCreateRequest {
method VersionType (line 128) | func (r *BulkCreateRequest) VersionType(versionType string) *BulkCreat...
method Doc (line 135) | func (r *BulkCreateRequest) Doc(doc interface{}) *BulkCreateRequest {
method RetryOnConflict (line 142) | func (r *BulkCreateRequest) RetryOnConflict(retryOnConflict int) *Bulk...
method Pipeline (line 149) | func (r *BulkCreateRequest) Pipeline(pipeline string) *BulkCreateReque...
method IfSeqNo (line 157) | func (r *BulkCreateRequest) IfSeqNo(ifSeqNo int64) *BulkCreateRequest {
method IfPrimaryTerm (line 164) | func (r *BulkCreateRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkCr...
method String (line 171) | func (r *BulkCreateRequest) String() string {
method Source (line 183) | func (r *BulkCreateRequest) Source() ([]string, error) {
type bulkCreateRequestCommand (line 41) | type bulkCreateRequestCommand
type bulkCreateRequestCommandOp (line 44) | type bulkCreateRequestCommandOp struct
function NewBulkCreateRequest (line 61) | func NewBulkCreateRequest() *BulkCreateRequest {
FILE: bulk_create_request_easyjson.go
function easyjson29a8ef77DecodeGithubComOlivereElasticV7 (line 20) | func easyjson29a8ef77DecodeGithubComOlivereElasticV7(in *jlexer.Lexer, o...
function easyjson29a8ef77EncodeGithubComOlivereElasticV7 (line 103) | func easyjson29a8ef77EncodeGithubComOlivereElasticV7(out *jwriter.Writer...
method MarshalJSON (line 217) | func (v bulkCreateRequestCommandOp) MarshalJSON() ([]byte, error) {
method MarshalEasyJSON (line 224) | func (v bulkCreateRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) {
method UnmarshalJSON (line 229) | func (v *bulkCreateRequestCommandOp) UnmarshalJSON(data []byte) error {
method UnmarshalEasyJSON (line 236) | func (v *bulkCreateRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) {
function easyjson29a8ef77DecodeGithubComOlivereElasticV71 (line 239) | func easyjson29a8ef77DecodeGithubComOlivereElasticV71(in *jlexer.Lexer, ...
function easyjson29a8ef77EncodeGithubComOlivereElasticV71 (line 260) | func easyjson29a8ef77EncodeGithubComOlivereElasticV71(out *jwriter.Write...
method MarshalJSON (line 281) | func (v bulkCreateRequestCommand) MarshalJSON() ([]byte, error) {
method MarshalEasyJSON (line 288) | func (v bulkCreateRequestCommand) MarshalEasyJSON(w *jwriter.Writer) {
method UnmarshalJSON (line 293) | func (v *bulkCreateRequestCommand) UnmarshalJSON(data []byte) error {
method UnmarshalEasyJSON (line 300) | func (v *bulkCreateRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) {
FILE: bulk_create_request_test.go
function TestBulkCreateRequestSerialization (line 12) | func TestBulkCreateRequestSerialization(t *testing.T) {
function BenchmarkBulkCreateRequestSerialization (line 97) | func BenchmarkBulkCreateRequestSerialization(b *testing.B) {
function benchmarkBulkCreateRequestSerialization (line 110) | func benchmarkBulkCreateRequestSerialization(b *testing.B, r *BulkCreate...
FILE: bulk_delete_request.go
type BulkDeleteRequest (line 21) | type BulkDeleteRequest struct
method UseEasyJSON (line 64) | func (r *BulkDeleteRequest) UseEasyJSON(enable bool) *BulkDeleteRequest {
method Index (line 71) | func (r *BulkDeleteRequest) Index(index string) *BulkDeleteRequest {
method Type (line 79) | func (r *BulkDeleteRequest) Type(typ string) *BulkDeleteRequest {
method Id (line 86) | func (r *BulkDeleteRequest) Id(id string) *BulkDeleteRequest {
method Parent (line 94) | func (r *BulkDeleteRequest) Parent(parent string) *BulkDeleteRequest {
method Routing (line 101) | func (r *BulkDeleteRequest) Routing(routing string) *BulkDeleteRequest {
method Version (line 109) | func (r *BulkDeleteRequest) Version(version int64) *BulkDeleteRequest {
method VersionType (line 117) | func (r *BulkDeleteRequest) VersionType(versionType string) *BulkDelet...
method IfSeqNo (line 125) | func (r *BulkDeleteRequest) IfSeqNo(ifSeqNo int64) *BulkDeleteRequest {
method IfPrimaryTerm (line 132) | func (r *BulkDeleteRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkDe...
method String (line 139) | func (r *BulkDeleteRequest) String() string {
method Source (line 151) | func (r *BulkDeleteRequest) Source() ([]string, error) {
type bulkDeleteRequestCommand (line 39) | type bulkDeleteRequestCommand
type bulkDeleteRequestCommandOp (line 42) | type bulkDeleteRequestCommandOp struct
function NewBulkDeleteRequest (line 55) | func NewBulkDeleteRequest() *BulkDeleteRequest {
FILE: bulk_delete_request_easyjson.go
function easyjson8092efb6DecodeGithubComOlivereElasticV7 (line 20) | func easyjson8092efb6DecodeGithubComOlivereElasticV7(in *jlexer.Lexer, o...
function easyjson8092efb6EncodeGithubComOlivereElasticV7 (line 83) | func easyjson8092efb6EncodeGithubComOlivereElasticV7(out *jwriter.Writer...
method MarshalJSON (line 177) | func (v bulkDeleteRequestCommandOp) MarshalJSON() ([]byte, error) {
method MarshalEasyJSON (line 184) | func (v bulkDeleteRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) {
method UnmarshalJSON (line 189) | func (v *bulkDeleteRequestCommandOp) UnmarshalJSON(data []byte) error {
method UnmarshalEasyJSON (line 196) | func (v *bulkDeleteRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) {
function easyjson8092efb6DecodeGithubComOlivereElasticV71 (line 199) | func easyjson8092efb6DecodeGithubComOlivereElasticV71(in *jlexer.Lexer, ...
function easyjson8092efb6EncodeGithubComOlivereElasticV71 (line 220) | func easyjson8092efb6EncodeGithubComOlivereElasticV71(out *jwriter.Write...
method MarshalJSON (line 241) | func (v bulkDeleteRequestCommand) MarshalJSON() ([]byte, error) {
method MarshalEasyJSON (line 248) | func (v bulkDeleteRequestCommand) MarshalEasyJSON(w *jwriter.Writer) {
method UnmarshalJSON (line 253) | func (v *bulkDeleteRequestCommand) UnmarshalJSON(data []byte) error {
method UnmarshalEasyJSON (line 260) | func (v *bulkDeleteRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) {
FILE: bulk_delete_request_test.go
function TestBulkDeleteRequestSerialization (line 11) | func TestBulkDeleteRequestSerialization(t *testing.T) {
function BenchmarkBulkDeleteRequestSerialization (line 60) | func BenchmarkBulkDeleteRequestSerialization(b *testing.B) {
function benchmarkBulkDeleteRequestSerialization (line 71) | func benchmarkBulkDeleteRequestSerialization(b *testing.B, r *BulkDelete...
FILE: bulk_index_request.go
type BulkIndexRequest (line 19) | type BulkIndexRequest struct
method UseEasyJSON (line 72) | func (r *BulkIndexRequest) UseEasyJSON(enable bool) *BulkIndexRequest {
method Index (line 79) | func (r *BulkIndexRequest) Index(index string) *BulkIndexRequest {
method Type (line 87) | func (r *BulkIndexRequest) Type(typ string) *BulkIndexRequest {
method Id (line 94) | func (r *BulkIndexRequest) Id(id string) *BulkIndexRequest {
method OpType (line 104) | func (r *BulkIndexRequest) OpType(opType string) *BulkIndexRequest {
method Routing (line 111) | func (r *BulkIndexRequest) Routing(routing string) *BulkIndexRequest {
method Parent (line 118) | func (r *BulkIndexRequest) Parent(parent string) *BulkIndexRequest {
method Version (line 126) | func (r *BulkIndexRequest) Version(version int64) *BulkIndexRequest {
method VersionType (line 138) | func (r *BulkIndexRequest) VersionType(versionType string) *BulkIndexR...
method Doc (line 145) | func (r *BulkIndexRequest) Doc(doc interface{}) *BulkIndexRequest {
method RetryOnConflict (line 152) | func (r *BulkIndexRequest) RetryOnConflict(retryOnConflict int) *BulkI...
method Pipeline (line 159) | func (r *BulkIndexRequest) Pipeline(pipeline string) *BulkIndexRequest {
method IfSeqNo (line 167) | func (r *BulkIndexRequest) IfSeqNo(ifSeqNo int64) *BulkIndexRequest {
method IfPrimaryTerm (line 174) | func (r *BulkIndexRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkInd...
method String (line 181) | func (r *BulkIndexRequest) String() string {
method Source (line 193) | func (r *BulkIndexRequest) Source() ([]string, error) {
type bulkIndexRequestCommand (line 41) | type bulkIndexRequestCommand
type bulkIndexRequestCommandOp (line 44) | type bulkIndexRequestCommandOp struct
function NewBulkIndexRequest (line 61) | func NewBulkIndexRequest() *BulkIndexRequest {
FILE: bulk_index_request_easyjson.go
function easyjson9de0fcbfDecodeGithubComOlivereElasticV7 (line 20) | func easyjson9de0fcbfDecodeGithubComOlivereElasticV7(in *jlexer.Lexer, o...
function easyjson9de0fcbfEncodeGithubComOlivereElasticV7 (line 103) | func easyjson9de0fcbfEncodeGithubComOlivereElasticV7(out *jwriter.Writer...
method MarshalJSON (line 217) | func (v bulkIndexRequestCommandOp) MarshalJSON() ([]byte, error) {
method MarshalEasyJSON (line 224) | func (v bulkIndexRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) {
method UnmarshalJSON (line 229) | func (v *bulkIndexRequestCommandOp) UnmarshalJSON(data []byte) error {
method UnmarshalEasyJSON (line 236) | func (v *bulkIndexRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) {
function easyjson9de0fcbfDecodeGithubComOlivereElasticV71 (line 239) | func easyjson9de0fcbfDecodeGithubComOlivereElasticV71(in *jlexer.Lexer, ...
function easyjson9de0fcbfEncodeGithubComOlivereElasticV71 (line 260) | func easyjson9de0fcbfEncodeGithubComOlivereElasticV71(out *jwriter.Write...
method MarshalJSON (line 281) | func (v bulkIndexRequestCommand) MarshalJSON() ([]byte, error) {
method MarshalEasyJSON (line 288) | func (v bulkIndexRequestCommand) MarshalEasyJSON(w *jwriter.Writer) {
method UnmarshalJSON (line 293) | func (v *bulkIndexRequestCommand) UnmarshalJSON(data []byte) error {
method UnmarshalEasyJSON (line 300) | func (v *bulkIndexRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) {
FILE: bulk_index_request_test.go
function TestBulkIndexRequestSerialization (line 12) | func TestBulkIndexRequestSerialization(t *testing.T) {
function BenchmarkBulkIndexRequestSerialization (line 106) | func BenchmarkBulkIndexRequestSerialization(b *testing.B) {
function benchmarkBulkIndexRequestSerialization (line 119) | func benchmarkBulkIndexRequestSerialization(b *testing.B, r *BulkIndexRe...
FILE: bulk_processor.go
type BulkProcessorService (line 43) | type BulkProcessorService struct
method Before (line 82) | func (s *BulkProcessorService) Before(fn BulkBeforeFunc) *BulkProcesso...
method After (line 90) | func (s *BulkProcessorService) After(fn BulkAfterFunc) *BulkProcessorS...
method Name (line 96) | func (s *BulkProcessorService) Name(name string) *BulkProcessorService {
method Workers (line 103) | func (s *BulkProcessorService) Workers(num int) *BulkProcessorService {
method BulkActions (line 110) | func (s *BulkProcessorService) BulkActions(bulkActions int) *BulkProce...
method BulkSize (line 117) | func (s *BulkProcessorService) BulkSize(bulkSize int) *BulkProcessorSe...
method FlushInterval (line 126) | func (s *BulkProcessorService) FlushInterval(interval time.Duration) *...
method Stats (line 133) | func (s *BulkProcessorService) Stats(wantStats bool) *BulkProcessorSer...
method Backoff (line 139) | func (s *BulkProcessorService) Backoff(backoff Backoff) *BulkProcessor...
method RetryItemStatusCodes (line 146) | func (s *BulkProcessorService) RetryItemStatusCodes(retryItemStatusCod...
method Do (line 166) | func (s *BulkProcessorService) Do(ctx context.Context) (*BulkProcessor...
function NewBulkProcessorService (line 58) | func NewBulkProcessorService(client *Client) *BulkProcessorService {
type BulkBeforeFunc (line 74) | type BulkBeforeFunc
type BulkAfterFunc (line 78) | type BulkAfterFunc
type BulkProcessorStats (line 197) | type BulkProcessorStats struct
method dup (line 227) | func (st *BulkProcessorStats) dup() *BulkProcessorStats {
type BulkProcessorWorkerStats (line 211) | type BulkProcessorWorkerStats struct
method dup (line 243) | func (st *BulkProcessorWorkerStats) dup() *BulkProcessorWorkerStats {
function newBulkProcessorStats (line 217) | func newBulkProcessorStats(workers int) *BulkProcessorStats {
type BulkProcessor (line 257) | type BulkProcessor struct
method Start (line 313) | func (p *BulkProcessor) Start(ctx context.Context) error {
method Stop (line 351) | func (p *BulkProcessor) Stop() error {
method Close (line 359) | func (p *BulkProcessor) Close() error {
method Stats (line 394) | func (p *BulkProcessor) Stats() BulkProcessorStats {
method Add (line 403) | func (p *BulkProcessor) Add(request BulkableRequest) {
method Flush (line 409) | func (p *BulkProcessor) Flush() error {
method flusher (line 424) | func (p *BulkProcessor) flusher(interval time.Duration) {
function newBulkProcessor (line 284) | func newBulkProcessor(
type bulkWorker (line 445) | type bulkWorker struct
method work (line 470) | func (w *bulkWorker) work(ctx context.Context) {
method commit (line 526) | func (w *bulkWorker) commit(ctx context.Context) error {
method waitForActiveConnection (line 594) | func (w *bulkWorker) waitForActiveConnection(ready chan<- struct{}) {
method updateStats (line 623) | func (w *bulkWorker) updateStats(res *BulkResponse) {
method commitRequired (line 648) | func (w *bulkWorker) commitRequired() bool {
function newBulkWorker (line 456) | func newBulkWorker(p *BulkProcessor, i int) *bulkWorker {
FILE: bulk_processor_test.go
function TestBulkProcessorDefaults (line 17) | func TestBulkProcessorDefaults(t *testing.T) {
function TestBulkProcessorCommitOnBulkActions (line 50) | func TestBulkProcessorCommitOnBulkActions(t *testing.T) {
function TestBulkProcessorCommitOnBulkSize (line 73) | func TestBulkProcessorCommitOnBulkSize(t *testing.T) {
function TestBulkProcessorBasedOnFlushInterval (line 96) | func TestBulkProcessorBasedOnFlushInterval(t *testing.T) {
function TestBulkProcessorClose (line 181) | func TestBulkProcessorClose(t *testing.T) {
function TestBulkProcessorFlush (line 265) | func TestBulkProcessorFlush(t *testing.T) {
function testBulkProcessor (line 340) | func testBulkProcessor(t *testing.T, numDocs int, svc *BulkProcessorServ...
FILE: bulk_request.go
type BulkableRequest (line 14) | type BulkableRequest interface
FILE: bulk_test.go
function TestBulk (line 17) | func TestBulk(t *testing.T) {
function TestBulkWithIndexSetOnClient (line 159) | func TestBulkWithIndexSetOnClient(t *testing.T) {
function TestBulkIndexDeleteUpdate (line 205) | func TestBulkIndexDeleteUpdate(t *testing.T) {
function TestBulkOnReadOnlyIndex (line 392) | func TestBulkOnReadOnlyIndex(t *testing.T) {
function TestFailedBulkRequests (line 434) | func TestFailedBulkRequests(t *testing.T) {
function TestBulkEstimatedSizeInBytes (line 489) | func TestBulkEstimatedSizeInBytes(t *testing.T) {
function TestBulkEstimateSizeInBytesLength (line 535) | func TestBulkEstimateSizeInBytesLength(t *testing.T) {
function TestBulkContentType (line 545) | func TestBulkContentType(t *testing.T) {
function BenchmarkBulkEstimatedSizeInBytesWith1Request (line 573) | func BenchmarkBulkEstimatedSizeInBytesWith1Request(b *testing.B) {
function BenchmarkBulkEstimatedSizeInBytesWith100Requests (line 588) | func BenchmarkBulkEstimatedSizeInBytesWith100Requests(b *testing.B) {
function BenchmarkBulkAllocs (line 605) | func BenchmarkBulkAllocs(b *testing.B) {
constant charset (line 616) | charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678...
function benchmarkBulkAllocs (line 619) | func benchmarkBulkAllocs(b *testing.B, size, num int) {
FILE: bulk_update_request.go
type BulkUpdateRequest (line 19) | type BulkUpdateRequest struct
method UseEasyJSON (line 84) | func (r *BulkUpdateRequest) UseEasyJSON(enable bool) *BulkUpdateRequest {
method Index (line 91) | func (r *BulkUpdateRequest) Index(index string) *BulkUpdateRequest {
method Type (line 99) | func (r *BulkUpdateRequest) Type(typ string) *BulkUpdateRequest {
method Id (line 106) | func (r *BulkUpdateRequest) Id(id string) *BulkUpdateRequest {
method Routing (line 113) | func (r *BulkUpdateRequest) Routing(routing string) *BulkUpdateRequest {
method Parent (line 120) | func (r *BulkUpdateRequest) Parent(parent string) *BulkUpdateRequest {
method Script (line 130) | func (r *BulkUpdateRequest) Script(script *Script) *BulkUpdateRequest {
method ScriptedUpsert (line 140) | func (r *BulkUpdateRequest) ScriptedUpsert(upsert bool) *BulkUpdateReq...
method RetryOnConflict (line 147) | func (r *BulkUpdateRequest) RetryOnConflict(retryOnConflict int) *Bulk...
method Version (line 155) | func (r *BulkUpdateRequest) Version(version int64) *BulkUpdateRequest {
method VersionType (line 163) | func (r *BulkUpdateRequest) VersionType(versionType string) *BulkUpdat...
method IfSeqNo (line 171) | func (r *BulkUpdateRequest) IfSeqNo(ifSeqNo int64) *BulkUpdateRequest {
method IfPrimaryTerm (line 178) | func (r *BulkUpdateRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkUp...
method Doc (line 184) | func (r *BulkUpdateRequest) Doc(doc interface{}) *BulkUpdateRequest {
method DocAsUpsert (line 195) | func (r *BulkUpdateRequest) DocAsUpsert(docAsUpsert bool) *BulkUpdateR...
method DetectNoop (line 204) | func (r *BulkUpdateRequest) DetectNoop(detectNoop bool) *BulkUpdateReq...
method Upsert (line 212) | func (r *BulkUpdateRequest) Upsert(doc interface{}) *BulkUpdateRequest {
method ReturnSource (line 221) | func (r *BulkUpdateRequest) ReturnSource(source bool) *BulkUpdateReque...
method String (line 229) | func (r *BulkUpdateRequest) String() string {
method Source (line 241) | func (r *BulkUpdateRequest) Source() ([]string, error) {
type bulkUpdateRequestCommand (line 46) | type bulkUpdateRequestCommand
type bulkUpdateRequestCommandOp (line 49) | type bulkUpdateRequestCommandOp struct
type bulkUpdateRequestCommandData (line 64) | type bulkUpdateRequestCommandData struct
function NewBulkUpdateRequest (line 75) | func NewBulkUpdateRequest() *BulkUpdateRequest {
FILE: bulk_update_request_easyjson.go
function easyjson1ed00e60DecodeGithubComOlivereElasticV7 (line 20) | func easyjson1ed00e60DecodeGithubComOlivereElasticV7(in *jlexer.Lexer, o...
function easyjson1ed00e60EncodeGithubComOlivereElasticV7 (line 93) | func easyjson1ed00e60EncodeGithubComOlivereElasticV7(out *jwriter.Writer...
method MarshalJSON (line 197) | func (v bulkUpdateRequestCommandOp) MarshalJSON() ([]byte, error) {
method MarshalEasyJSON (line 204) | func (v bulkUpdateRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) {
method UnmarshalJSON (line 209) | func (v *bulkUpdateRequestCommandOp) UnmarshalJSON(data []byte) error {
method UnmarshalEasyJSON (line 216) | func (v *bulkUpdateRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) {
function easyjson1ed00e60DecodeGithubComOlivereElasticV71 (line 219) | func easyjson1ed00e60DecodeGithubComOlivereElasticV71(in *jlexer.Lexer, ...
function easyjson1ed00e60EncodeGithubComOlivereElasticV71 (line 312) | func easyjson1ed00e60EncodeGithubComOlivereElasticV71(out *jwriter.Write...
method MarshalJSON (line 404) | func (v bulkUpdateRequestCommandData) MarshalJSON() ([]byte, error) {
method MarshalEasyJSON (line 411) | func (v bulkUpdateRequestCommandData) MarshalEasyJSON(w *jwriter.Writer) {
method UnmarshalJSON (line 416) | func (v *bulkUpdateRequestCommandData) UnmarshalJSON(data []byte) error {
method UnmarshalEasyJSON (line 423) | func (v *bulkUpdateRequestCommandData) UnmarshalEasyJSON(l *jlexer.Lexer) {
function easyjson1ed00e60DecodeGithubComOlivereElasticV72 (line 426) | func easyjson1ed00e60DecodeGithubComOlivereElasticV72(in *jlexer.Lexer, ...
function easyjson1ed00e60EncodeGithubComOlivereElasticV72 (line 447) | func easyjson1ed00e60EncodeGithubComOlivereElasticV72(out *jwriter.Write...
method MarshalJSON (line 468) | func (v bulkUpdateRequestCommand) MarshalJSON() ([]byte, error) {
method MarshalEasyJSON (line 475) | func (v bulkUpdateRequestCommand) MarshalEasyJSON(w *jwriter.Writer) {
method UnmarshalJSON (line 480) | func (v *bulkUpdateRequestCommand) UnmarshalJSON(data []byte) error {
method UnmarshalEasyJSON (line 487) | func (v *bulkUpdateRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) {
FILE: bulk_update_request_test.go
function TestBulkUpdateRequestSerialization (line 12) | func TestBulkUpdateRequestSerialization(t *testing.T) {
function BenchmarkBulkUpdateRequestSerialization (line 165) | func BenchmarkBulkUpdateRequestSerialization(b *testing.B) {
function benchmarkBulkUpdateRequestSerialization (line 184) | func benchmarkBulkUpdateRequestSerialization(b *testing.B, r *BulkUpdate...
FILE: canonicalize.go
function canonicalize (line 21) | func canonicalize(rawurls ...string) []string {
FILE: canonicalize_test.go
function TestCanonicalize (line 9) | func TestCanonicalize(t *testing.T) {
FILE: cat_aliases.go
type CatAliasesService (line 22) | type CatAliasesService struct
method Pretty (line 46) | func (s *CatAliasesService) Pretty(pretty bool) *CatAliasesService {
method Human (line 53) | func (s *CatAliasesService) Human(human bool) *CatAliasesService {
method ErrorTrace (line 59) | func (s *CatAliasesService) ErrorTrace(errorTrace bool) *CatAliasesSer...
method FilterPath (line 65) | func (s *CatAliasesService) FilterPath(filterPath ...string) *CatAlias...
method Header (line 71) | func (s *CatAliasesService) Header(name string, value string) *CatAlia...
method Headers (line 80) | func (s *CatAliasesService) Headers(headers http.Header) *CatAliasesSe...
method Alias (line 86) | func (s *CatAliasesService) Alias(alias ...string) *CatAliasesService {
method Local (line 93) | func (s *CatAliasesService) Local(local bool) *CatAliasesService {
method MasterTimeout (line 99) | func (s *CatAliasesService) MasterTimeout(masterTimeout string) *CatAl...
method Columns (line 113) | func (s *CatAliasesService) Columns(columns ...string) *CatAliasesServ...
method Sort (line 119) | func (s *CatAliasesService) Sort(fields ...string) *CatAliasesService {
method buildURL (line 125) | func (s *CatAliasesService) buildURL() (string, url.Values, error) {
method Do (line 175) | func (s *CatAliasesService) Do(ctx context.Context) (CatAliasesRespons...
function NewCatAliasesService (line 39) | func NewCatAliasesService(client *Client) *CatAliasesService {
type CatAliasesResponse (line 204) | type CatAliasesResponse
type CatAliasesResponseRow (line 209) | type CatAliasesResponseRow struct
FILE: cat_aliases_test.go
function TestCatAliases (line 12) | func TestCatAliases(t *testing.T) {
FILE: cat_allocation.go
type CatAllocationService (line 22) | type CatAllocationService struct
method Pretty (line 47) | func (s *CatAllocationService) Pretty(pretty bool) *CatAllocationServi...
method Human (line 54) | func (s *CatAllocationService) Human(human bool) *CatAllocationService {
method ErrorTrace (line 60) | func (s *CatAllocationService) ErrorTrace(errorTrace bool) *CatAllocat...
method FilterPath (line 66) | func (s *CatAllocationService) FilterPath(filterPath ...string) *CatAl...
method Header (line 72) | func (s *CatAllocationService) Header(name string, value string) *CatA...
method Headers (line 81) | func (s *CatAllocationService) Headers(headers http.Header) *CatAlloca...
method NodeID (line 87) | func (s *CatAllocationService) NodeID(nodes ...string) *CatAllocationS...
method Bytes (line 94) | func (s *CatAllocationService) Bytes(bytes string) *CatAllocationServi...
method Local (line 101) | func (s *CatAllocationService) Local(local bool) *CatAllocationService {
method MasterTimeout (line 107) | func (s *CatAllocationService) MasterTimeout(masterTimeout string) *Ca...
method Columns (line 121) | func (s *CatAllocationService) Columns(columns ...string) *CatAllocati...
method Sort (line 127) | func (s *CatAllocationService) Sort(fields ...string) *CatAllocationSe...
method buildURL (line 133) | func (s *CatAllocationService) buildURL() (string, url.Values, error) {
method Do (line 186) | func (s *CatAllocationService) Do(ctx context.Context) (CatAllocationR...
function NewCatAllocationService (line 40) | func NewCatAllocationService(client *Client) *CatAllocationService {
type CatAllocationResponse (line 215) | type CatAllocationResponse
type CatAllocationResponseRow (line 220) | type CatAllocationResponseRow struct
FILE: cat_allocation_test.go
function TestCatAllocation (line 12) | func TestCatAllocation(t *testing.T) {
FILE: cat_count.go
type CatCountService (line 22) | type CatCountService struct
method Pretty (line 46) | func (s *CatCountService) Pretty(pretty bool) *CatCountService {
method Human (line 53) | func (s *CatCountService) Human(human bool) *CatCountService {
method ErrorTrace (line 59) | func (s *CatCountService) ErrorTrace(errorTrace bool) *CatCountService {
method FilterPath (line 65) | func (s *CatCountService) FilterPath(filterPath ...string) *CatCountSe...
method Header (line 71) | func (s *CatCountService) Header(name string, value string) *CatCountS...
method Headers (line 80) | func (s *CatCountService) Headers(headers http.Header) *CatCountService {
method Index (line 87) | func (s *CatCountService) Index(index ...string) *CatCountService {
method Local (line 94) | func (s *CatCountService) Local(local bool) *CatCountService {
method MasterTimeout (line 100) | func (s *CatCountService) MasterTimeout(masterTimeout string) *CatCoun...
method Columns (line 114) | func (s *CatCountService) Columns(columns ...string) *CatCountService {
method Sort (line 120) | func (s *CatCountService) Sort(fields ...string) *CatCountService {
method buildURL (line 126) | func (s *CatCountService) buildURL() (string, url.Values, error) {
method Do (line 176) | func (s *CatCountService) Do(ctx context.Context) (CatCountResponse, e...
function NewCatCountService (line 39) | func NewCatCountService(client *Client) *CatCountService {
type CatCountResponse (line 205) | type CatCountResponse
type CatCountResponseRow (line 211) | type CatCountResponseRow struct
FILE: cat_count_integration_test.go
function TestCatCountIntegration (line 12) | func TestCatCountIntegration(t *testing.T) {
FILE: cat_count_test.go
function TestCatCount (line 12) | func TestCatCount(t *testing.T) {
FILE: cat_fielddata.go
type CatFielddataService (line 22) | type CatFielddataService struct
method Pretty (line 45) | func (s *CatFielddataService) Pretty(pretty bool) *CatFielddataService {
method Human (line 52) | func (s *CatFielddataService) Human(human bool) *CatFielddataService {
method ErrorTrace (line 58) | func (s *CatFielddataService) ErrorTrace(errorTrace bool) *CatFielddat...
method FilterPath (line 64) | func (s *CatFielddataService) FilterPath(filterPath ...string) *CatFie...
method Header (line 70) | func (s *CatFielddataService) Header(name string, value string) *CatFi...
method Headers (line 79) | func (s *CatFielddataService) Headers(headers http.Header) *CatFieldda...
method Field (line 85) | func (s *CatFielddataService) Field(fields ...string) *CatFielddataSer...
method Bytes (line 92) | func (s *CatFielddataService) Bytes(bytes string) *CatFielddataService {
method Columns (line 106) | func (s *CatFielddataService) Columns(columns ...string) *CatFielddata...
method Sort (line 112) | func (s *CatFielddataService) Sort(fields ...string) *CatFielddataServ...
method buildURL (line 117) | func (s *CatFielddataService) buildURL() (string, url.Values, error) {
method Do (line 164) | func (s *CatFielddataService) Do(ctx context.Context) (CatFielddataRes...
function NewCatFielddataService (line 38) | func NewCatFielddataService(client *Client) *CatFielddataService {
type CatFielddataResponse (line 193) | type CatFielddataResponse
type CatFielddataResponseRow (line 198) | type CatFielddataResponseRow struct
FILE: cat_fielddata_test.go
function TestCatFielddata (line 12) | func TestCatFielddata(t *testing.T) {
FILE: cat_health.go
type CatHealthService (line 20) | type CatHealthService struct
method Pretty (line 44) | func (s *CatHealthService) Pretty(pretty bool) *CatHealthService {
method Human (line 51) | func (s *CatHealthService) Human(human bool) *CatHealthService {
method ErrorTrace (line 57) | func (s *CatHealthService) ErrorTrace(errorTrace bool) *CatHealthServi...
method FilterPath (line 63) | func (s *CatHealthService) FilterPath(filterPath ...string) *CatHealth...
method Header (line 69) | func (s *CatHealthService) Header(name string, value string) *CatHealt...
method Headers (line 78) | func (s *CatHealthService) Headers(headers http.Header) *CatHealthServ...
method Local (line 85) | func (s *CatHealthService) Local(local bool) *CatHealthService {
method MasterTimeout (line 91) | func (s *CatHealthService) MasterTimeout(masterTimeout string) *CatHea...
method Columns (line 105) | func (s *CatHealthService) Columns(columns ...string) *CatHealthService {
method Sort (line 111) | func (s *CatHealthService) Sort(fields ...string) *CatHealthService {
method DisableTimestamping (line 117) | func (s *CatHealthService) DisableTimestamping(disable bool) *CatHealt...
method buildURL (line 123) | func (s *CatHealthService) buildURL() (string, url.Values, error) {
method Do (line 162) | func (s *CatHealthService) Do(ctx context.Context) (CatHealthResponse,...
function NewCatHealthService (line 37) | func NewCatHealthService(client *Client) *CatHealthService {
type CatHealthResponse (line 191) | type CatHealthResponse
type CatHealthResponseRow (line 196) | type CatHealthResponseRow struct
FILE: cat_health_test.go
function TestCatHealth (line 12) | func TestCatHealth(t *testing.T) {
FILE: cat_indices.go
type CatIndicesService (line 22) | type CatIndicesService struct
method Pretty (line 49) | func (s *CatIndicesService) Pretty(pretty bool) *CatIndicesService {
method Human (line 56) | func (s *CatIndicesService) Human(human bool) *CatIndicesService {
method ErrorTrace (line 62) | func (s *CatIndicesService) ErrorTrace(errorTrace bool) *CatIndicesSer...
method FilterPath (line 68) | func (s *CatIndicesService) FilterPath(filterPath ...string) *CatIndic...
method Header (line 74) | func (s *CatIndicesService) Header(name string, value string) *CatIndi...
method Headers (line 83) | func (s *CatIndicesService) Headers(headers http.Header) *CatIndicesSe...
method Index (line 89) | func (s *CatIndicesService) Index(index string) *CatIndicesService {
method Bytes (line 96) | func (s *CatIndicesService) Bytes(bytes string) *CatIndicesService {
method Local (line 103) | func (s *CatIndicesService) Local(local bool) *CatIndicesService {
method MasterTimeout (line 109) | func (s *CatIndicesService) MasterTimeout(masterTimeout string) *CatIn...
method Columns (line 123) | func (s *CatIndicesService) Columns(columns ...string) *CatIndicesServ...
method Health (line 130) | func (s *CatIndicesService) Health(healthState string) *CatIndicesServ...
method PrimaryOnly (line 136) | func (s *CatIndicesService) PrimaryOnly(primaryOnly bool) *CatIndicesS...
method Sort (line 142) | func (s *CatIndicesService) Sort(fields ...string) *CatIndicesService {
method buildURL (line 148) | func (s *CatIndicesService) buildURL() (string, url.Values, error) {
method Do (line 223) | func (s *CatIndicesService) Do(ctx context.Context) (CatIndicesRespons...
function NewCatIndicesService (line 42) | func NewCatIndicesService(client *Client) *CatIndicesService {
type CatIndicesResponse (line 252) | type CatIndicesResponse
type CatIndicesResponseRow (line 258) | type CatIndicesResponseRow struct
FILE: cat_indices_test.go
function TestCatIndices (line 12) | func TestCatIndices(t *testing.T) {
function TestCatIndicesResponseRowAliasesMap (line 31) | func TestCatIndicesResponseRowAliasesMap(t *testing.T) {
function TestCatIndicesWithAliases (line 42) | func TestCatIndicesWithAliases(t *testing.T) {
function TestCatIndicesWithAliases_Double (line 62) | func TestCatIndicesWithAliases_Double(t *testing.T) {
FILE: cat_master.go
type CatMasterService (line 20) | type CatMasterService struct
method Pretty (line 43) | func (s *CatMasterService) Pretty(pretty bool) *CatMasterService {
method Human (line 50) | func (s *CatMasterService) Human(human bool) *CatMasterService {
method ErrorTrace (line 56) | func (s *CatMasterService) ErrorTrace(errorTrace bool) *CatMasterServi...
method FilterPath (line 62) | func (s *CatMasterService) FilterPath(filterPath ...string) *CatMaster...
method Header (line 68) | func (s *CatMasterService) Header(name string, value string) *CatMaste...
method Headers (line 77) | func (s *CatMasterService) Headers(headers http.Header) *CatMasterServ...
method Local (line 84) | func (s *CatMasterService) Local(local bool) *CatMasterService {
method MasterTimeout (line 90) | func (s *CatMasterService) MasterTimeout(masterTimeout string) *CatMas...
method Columns (line 104) | func (s *CatMasterService) Columns(columns ...string) *CatMasterService {
method Sort (line 110) | func (s *CatMasterService) Sort(fields ...string) *CatMasterService {
method buildURL (line 116) | func (s *CatMasterService) buildURL() (string, url.Values, error) {
method Do (line 152) | func (s *CatMasterService) Do(ctx context.Context) (CatMasterResponse,...
function NewCatMasterService (line 36) | func NewCatMasterService(client *Client) *CatMasterService {
type CatMasterResponse (line 181) | type CatMasterResponse
type CatMasterResponseRow (line 186) | type CatMasterResponseRow struct
FILE: cat_master_test.go
function TestCatMaster (line 12) | func TestCatMaster(t *testing.T) {
FILE: cat_shards.go
type CatShardsService (line 22) | type CatShardsService struct
method Pretty (line 48) | func (s *CatShardsService) Pretty(pretty bool) *CatShardsService {
method Human (line 55) | func (s *CatShardsService) Human(human bool) *CatShardsService {
method ErrorTrace (line 61) | func (s *CatShardsService) ErrorTrace(errorTrace bool) *CatShardsServi...
method FilterPath (line 67) | func (s *CatShardsService) FilterPath(filterPath ...string) *CatShards...
method Header (line 73) | func (s *CatShardsService) Header(name string, value string) *CatShard...
method Headers (line 82) | func (s *CatShardsService) Headers(headers http.Header) *CatShardsServ...
method Index (line 88) | func (s *CatShardsService) Index(index ...string) *CatShardsService {
method Bytes (line 95) | func (s *CatShardsService) Bytes(bytes string) *CatShardsService {
method Local (line 102) | func (s *CatShardsService) Local(local bool) *CatShardsService {
method MasterTimeout (line 108) | func (s *CatShardsService) MasterTimeout(masterTimeout string) *CatSha...
method Columns (line 123) | func (s *CatShardsService) Columns(columns ...string) *CatShardsService {
method Sort (line 129) | func (s *CatShardsService) Sort(fields ...string) *CatShardsService {
method Time (line 135) | func (s *CatShardsService) Time(time string) *CatShardsService {
method buildURL (line 141) | func (s *CatShardsService) buildURL() (string, url.Values, error) {
method Do (line 212) | func (s *CatShardsService) Do(ctx context.Context) (CatShardsResponse,...
function NewCatShardsService (line 41) | func NewCatShardsService(client *Client) *CatShardsService {
type CatShardsResponse (line 241) | type CatShardsResponse
type CatShardsResponseRow (line 247) | type CatShardsResponseRow struct
FILE: cat_shards_test.go
function TestCatShards (line 12) | func TestCatShards(t *testing.T) {
function TestCatShardsResponseRowAliasesMap (line 31) | func TestCatShardsResponseRowAliasesMap(t *testing.T) {
function TestCatShardsWithSpecificColumns (line 41) | func TestCatShardsWithSpecificColumns(t *testing.T) {
FILE: cat_snapshots.go
type CatSnapshotsService (line 21) | type CatSnapshotsService struct
method Pretty (line 44) | func (s *CatSnapshotsService) Pretty(pretty bool) *CatSnapshotsService {
method Human (line 51) | func (s *CatSnapshotsService) Human(human bool) *CatSnapshotsService {
method ErrorTrace (line 57) | func (s *CatSnapshotsService) ErrorTrace(errorTrace bool) *CatSnapshot...
method FilterPath (line 63) | func (s *CatSnapshotsService) FilterPath(filterPath ...string) *CatSna...
method Header (line 69) | func (s *CatSnapshotsService) Header(name string, value string) *CatSn...
method Headers (line 78) | func (s *CatSnapshotsService) Headers(headers http.Header) *CatSnapsho...
method Repository (line 84) | func (s *CatSnapshotsService) Repository(repository string) *CatSnapsh...
method MasterTimeout (line 90) | func (s *CatSnapshotsService) MasterTimeout(masterTimeout string) *Cat...
method Columns (line 104) | func (s *CatSnapshotsService) Columns(columns ...string) *CatSnapshots...
method Sort (line 110) | func (s *CatSnapshotsService) Sort(fields ...string) *CatSnapshotsServ...
method buildURL (line 116) | func (s *CatSnapshotsService) buildURL() (string, url.Values, error) {
method Do (line 180) | func (s *CatSnapshotsService) Do(ctx context.Context) (CatSnapshotsRes...
function NewCatSnapshotsService (line 37) | func NewCatSnapshotsService(client *Client) *CatSnapshotsService {
type CatSnapshotsResponse (line 209) | type CatSnapshotsResponse
type CatSnapshotsResponseRow (line 215) | type CatSnapshotsResponseRow struct
FILE: cat_snapshots_integration_test.go
function TestCatSnapshotsIntegration (line 13) | func TestCatSnapshotsIntegration(t *testing.T) {
FILE: cat_snapshots_test.go
function TestCatSnapshots (line 11) | func TestCatSnapshots(t *testing.T) {
FILE: clear_scroll.go
type ClearScrollService (line 19) | type ClearScrollService struct
method Pretty (line 40) | func (s *ClearScrollService) Pretty(pretty bool) *ClearScrollService {
method Human (line 47) | func (s *ClearScrollService) Human(human bool) *ClearScrollService {
method ErrorTrace (line 53) | func (s *ClearScrollService) ErrorTrace(errorTrace bool) *ClearScrollS...
method FilterPath (line 59) | func (s *ClearScrollService) FilterPath(filterPath ...string) *ClearSc...
method Header (line 65) | func (s *ClearScrollService) Header(name string, value string) *ClearS...
method Headers (line 74) | func (s *ClearScrollService) Headers(headers http.Header) *ClearScroll...
method ScrollId (line 81) | func (s *ClearScrollService) ScrollId(scrollIds ...string) *ClearScrol...
method buildURL (line 87) | func (s *ClearScrollService) buildURL() (string, url.Values, error) {
method Validate (line 109) | func (s *ClearScrollService) Validate() error {
method Do (line 121) | func (s *ClearScrollService) Do(ctx context.Context) (*ClearScrollResp...
function NewClearScrollService (line 32) | func NewClearScrollService(client *Client) *ClearScrollService {
type ClearScrollResponse (line 159) | type ClearScrollResponse struct
FILE: clear_scroll_test.go
function TestClearScroll (line 13) | func TestClearScroll(t *testing.T) {
function TestClearScrollValidate (line 76) | func TestClearScrollValidate(t *testing.T) {
FILE: client.go
constant Version (line 29) | Version = "7.0.32"
constant DefaultURL (line 33) | DefaultURL = "http://127.0.0.1:9200"
constant DefaultScheme (line 37) | DefaultScheme = "http"
constant DefaultHealthcheckEnabled (line 40) | DefaultHealthcheckEnabled = true
constant DefaultHealthcheckTimeoutStartup (line 46) | DefaultHealthcheckTimeoutStartup = 5 * time.Second
constant DefaultHealthcheckTimeout (line 51) | DefaultHealthcheckTimeout = 1 * time.Second
constant DefaultHealthcheckInterval (line 55) | DefaultHealthcheckInterval = 60 * time.Second
constant DefaultSnifferEnabled (line 58) | DefaultSnifferEnabled = true
constant DefaultSnifferInterval (line 63) | DefaultSnifferInterval = 15 * time.Minute
constant DefaultSnifferTimeoutStartup (line 68) | DefaultSnifferTimeoutStartup = 5 * time.Second
constant DefaultSnifferTimeout (line 73) | DefaultSnifferTimeout = 2 * time.Second
constant DefaultSendGetBodyAs (line 77) | DefaultSendGetBodyAs = "GET"
constant DefaultGzipEnabled (line 80) | DefaultGzipEnabled = false
constant off (line 83) | off = -1 * time.Second
type Doer (line 110) | type Doer interface
type ClientOptionFunc (line 116) | type ClientOptionFunc
type Client (line 119) | type Client struct
method String (line 757) | func (c *Client) String() string {
method IsRunning (line 774) | func (c *Client) IsRunning() bool {
method Start (line 785) | func (c *Client) Start() {
method Stop (line 812) | func (c *Client) Stop() {
method errorf (line 838) | func (c *Client) errorf(format string, args ...interface{}) {
method infof (line 845) | func (c *Client) infof(format string, args ...interface{}) {
method tracef (line 852) | func (c *Client) tracef(format string, args ...interface{}) {
method dumpRequest (line 859) | func (c *Client) dumpRequest(r *http.Request) {
method dumpResponse (line 869) | func (c *Client) dumpResponse(resp *http.Response) {
method sniffer (line 879) | func (c *Client) sniffer() {
method sniff (line 905) | func (c *Client) sniff(parentCtx context.Context, timeout time.Duratio...
method sniffNode (line 975) | func (c *Client) sniffNode(ctx context.Context, url string) []*conn {
method extractHostname (line 1019) | func (c *Client) extractHostname(scheme, address string) string {
method updateConns (line 1040) | func (c *Client) updateConns(conns []*conn) {
method healthchecker (line 1072) | func (c *Client) healthchecker() {
method healthcheck (line 1097) | func (c *Client) healthcheck(parentCtx context.Context, timeout time.D...
method startupHealthcheck (line 1173) | func (c *Client) startupHealthcheck(parentCtx context.Context, timeout...
method next (line 1234) | func (c *Client) next() (*conn, error) {
method mustActiveConn (line 1274) | func (c *Client) mustActiveConn() error {
method PerformRequest (line 1312) | func (c *Client) PerformRequest(ctx context.Context, opt PerformReques...
method Index (line 1515) | func (c *Client) Index() *IndexService {
method Get (line 1520) | func (c *Client) Get() *GetService {
method MultiGet (line 1525) | func (c *Client) MultiGet() *MgetService {
method Mget (line 1530) | func (c *Client) Mget() *MgetService {
method Delete (line 1535) | func (c *Client) Delete() *DeleteService {
method DeleteByQuery (line 1540) | func (c *Client) DeleteByQuery(indices ...string) *DeleteByQueryService {
method Update (line 1545) | func (c *Client) Update() *UpdateService {
method UpdateByQuery (line 1550) | func (c *Client) UpdateByQuery(indices ...string) *UpdateByQueryService {
method Bulk (line 1555) | func (c *Client) Bulk() *BulkService {
method BulkProcessor (line 1560) | func (c *Client) BulkProcessor() *BulkProcessorService {
method Reindex (line 1568) | func (c *Client) Reindex() *ReindexService {
method TermVectors (line 1574) | func (c *Client) TermVectors(index string) *TermvectorsService {
method MultiTermVectors (line 1582) | func (c *Client) MultiTermVectors() *MultiTermvectorService {
method Search (line 1589) | func (c *Client) Search(indices ...string) *SearchService {
method MultiSearch (line 1594) | func (c *Client) MultiSearch() *MultiSearchService {
method Count (line 1599) | func (c *Client) Count(indices ...string) *CountService {
method Explain (line 1604) | func (c *Client) Explain(index, typ, id string) *ExplainService {
method Validate (line 1612) | func (c *Client) Validate(indices ...string) *ValidateService {
method SearchShards (line 1617) | func (c *Client) SearchShards(indices ...string) *SearchShardsService {
method FieldCaps (line 1622) | func (c *Client) FieldCaps(indices ...string) *FieldCapsService {
method Exists (line 1627) | func (c *Client) Exists() *ExistsService {
method Scroll (line 1633) | func (c *Client) Scroll(indices ...string) *ScrollService {
method ClearScroll (line 1638) | func (c *Client) ClearScroll(scrollIds ...string) *ClearScrollService {
method OpenPointInTime (line 1643) | func (c *Client) OpenPointInTime(indices ...string) *OpenPointInTimeSe...
method ClosePointInTime (line 1648) | func (c *Client) ClosePointInTime(id string) *ClosePointInTimeService {
method CreateIndex (line 1655) | func (c *Client) CreateIndex(name string) *IndicesCreateService {
method DeleteIndex (line 1660) | func (c *Client) DeleteIndex(indices ...string) *IndicesDeleteService {
method IndexExists (line 1665) | func (c *Client) IndexExists(indices ...string) *IndicesExistsService {
method ShrinkIndex (line 1670) | func (c *Client) ShrinkIndex(source, target string) *IndicesShrinkServ...
method RolloverIndex (line 1676) | func (c *Client) RolloverIndex(alias string) *IndicesRolloverService {
method IndexStats (line 1682) | func (c *Client) IndexStats(indices ...string) *IndicesStatsService {
method OpenIndex (line 1687) | func (c *Client) OpenIndex(name string) *IndicesOpenService {
method CloseIndex (line 1692) | func (c *Client) CloseIndex(name string) *IndicesCloseService {
method FreezeIndex (line 1700) | func (c *Client) FreezeIndex(name string) *IndicesFreezeService {
method UnfreezeIndex (line 1708) | func (c *Client) UnfreezeIndex(name string) *IndicesUnfreezeService {
method IndexGet (line 1714) | func (c *Client) IndexGet(indices ...string) *IndicesGetService {
method IndexGetSettings (line 1719) | func (c *Client) IndexGetSettings(indices ...string) *IndicesGetSettin...
method IndexPutSettings (line 1724) | func (c *Client) IndexPutSettings(indices ...string) *IndicesPutSettin...
method IndexSegments (line 1729) | func (c *Client) IndexSegments(indices ...string) *IndicesSegmentsServ...
method IndexAnalyze (line 1735) | func (c *Client) IndexAnalyze() *IndicesAnalyzeService {
method Forcemerge (line 1741) | func (c *Client) Forcemerge(indices ...string) *IndicesForcemergeServi...
method Refresh (line 1746) | func (c *Client) Refresh(indices ...string) *RefreshService {
method Flush (line 1752) | func (c *Client) Flush(indices ...string) *IndicesFlushService {
method SyncedFlush (line 1761) | func (c *Client) SyncedFlush(indices ...string) *IndicesSyncedFlushSer...
method ClearCache (line 1766) | func (c *Client) ClearCache(indices ...string) *IndicesClearCacheServi...
method Alias (line 1771) | func (c *Client) Alias() *AliasService {
method Aliases (line 1776) | func (c *Client) Aliases() *AliasesService {
method IndexGetTemplate (line 1790) | func (c *Client) IndexGetTemplate(names ...string) *IndicesGetTemplate...
method IndexTemplateExists (line 1802) | func (c *Client) IndexTemplateExists(name string) *IndicesExistsTempla...
method IndexPutTemplate (line 1814) | func (c *Client) IndexPutTemplate(name string) *IndicesPutTemplateServ...
method IndexDeleteTemplate (line 1826) | func (c *Client) IndexDeleteTemplate(name string) *IndicesDeleteTempla...
method IndexPutIndexTemplate (line 1838) | func (c *Client) IndexPutIndexTemplate(name string) *IndicesPutIndexTe...
method IndexGetIndexTemplate (line 1848) | func (c *Client) IndexGetIndexTemplate(name string) *IndicesGetIndexTe...
method IndexDeleteIndexTemplate (line 1858) | func (c *Client) IndexDeleteIndexTemplate(name string) *IndicesDeleteI...
method IndexPutComponentTemplate (line 1868) | func (c *Client) IndexPutComponentTemplate(name string) *IndicesPutCom...
method IndexGetComponentTemplate (line 1876) | func (c *Client) IndexGetComponentTemplate(name string) *IndicesGetCom...
method IndexDeleteComponentTemplate (line 1884) | func (c *Client) IndexDeleteComponentTemplate(name string) *IndicesDel...
method GetMapping (line 1889) | func (c *Client) GetMapping() *IndicesGetMappingService {
method PutMapping (line 1894) | func (c *Client) PutMapping() *IndicesPutMappingService {
method GetFieldMapping (line 1899) | func (c *Client) GetFieldMapping() *IndicesGetFieldMappingService {
method CatMaster (line 1914) | func (c *Client) CatMaster() *CatMasterService {
method CatFielddata (line 1919) | func (c *Client) CatFielddata() *CatFielddataService {
method CatAliases (line 1924) | func (c *Client) CatAliases() *CatAliasesService {
method CatAllocation (line 1929) | func (c *Client) CatAllocation() *CatAllocationService {
method CatCount (line 1934) | func (c *Client) CatCount() *CatCountService {
method CatHealth (line 1939) | func (c *Client) CatHealth() *CatHealthService {
method CatIndices (line 1944) | func (c *Client) CatIndices() *CatIndicesService {
method CatShards (line 1949) | func (c *Client) CatShards() *CatShardsService {
method CatSnapshots (line 1954) | func (c *Client) CatSnapshots() *CatSnapshotsService {
method IngestPutPipeline (line 1962) | func (c *Client) IngestPutPipeline(id string) *IngestPutPipelineService {
method IngestGetPipeline (line 1967) | func (c *Client) IngestGetPipeline(ids ...string) *IngestGetPipelineSe...
method IngestDeletePipeline (line 1972) | func (c *Client) IngestDeletePipeline(id string) *IngestDeletePipeline...
method IngestSimulatePipeline (line 1978) | func (c *Client) IngestSimulatePipeline() *IngestSimulatePipelineServi...
method ClusterHealth (line 1985) | func (c *Client) ClusterHealth() *ClusterHealthService {
method ClusterReroute (line 1991) | func (c *Client) ClusterReroute() *ClusterRerouteService {
method ClusterState (line 1996) | func (c *Client) ClusterState() *ClusterStateService {
method ClusterStats (line 2001) | func (c *Client) ClusterStats() *ClusterStatsService {
method NodesInfo (line 2006) | func (c *Client) NodesInfo() *NodesInfoService {
method NodesStats (line 2011) | func (c *Client) NodesStats() *NodesStatsService {
method TasksCancel (line 2016) | func (c *Client) TasksCancel() *TasksCancelService {
method TasksList (line 2021) | func (c *Client) TasksList() *TasksListService {
method TasksGetTask (line 2026) | func (c *Client) TasksGetTask() *TasksGetTaskService {
method SnapshotStatus (line 2039) | func (c *Client) SnapshotStatus() *SnapshotStatusService {
method SnapshotCreate (line 2044) | func (c *Client) SnapshotCreate(repository string, snapshot string) *S...
method SnapshotCreateRepository (line 2049) | func (c *Client) SnapshotCreateRepository(repository string) *Snapshot...
method SnapshotDelete (line 2054) | func (c *Client) SnapshotDelete(repository string, snapshot string) *S...
method SnapshotDeleteRepository (line 2059) | func (c *Client) SnapshotDeleteRepository(repositories ...string) *Sna...
method SnapshotGetRepository (line 2064) | func (c *Client) SnapshotGetRepository(repositories ...string) *Snapsh...
method SnapshotGet (line 2069) | func (c *Client) SnapshotGet(repository string) *SnapshotGetService {
method SnapshotVerifyRepository (line 2074) | func (c *Client) SnapshotVerifyRepository(repository string) *Snapshot...
method SnapshotRestore (line 2079) | func (c *Client) SnapshotRestore(repository string, snapshot string) *...
method GetScript (line 2087) | func (c *Client) GetScript() *GetScriptService {
method PutScript (line 2092) | func (c *Client) PutScript() *PutScriptService {
method DeleteScript (line 2097) | func (c *Client) DeleteScript() *DeleteScriptService {
method XPackInfo (line 2105) | func (c *Client) XPackInfo() *XPackInfoService {
method XPackAsyncSearchSubmit (line 2112) | func (c *Client) XPackAsyncSearchSubmit() *XPackAsyncSearchSubmit {
method XPackAsyncSearchGet (line 2117) | func (c *Client) XPackAsyncSearchGet() *XPackAsyncSearchGet {
method XPackAsyncSearchDelete (line 2122) | func (c *Client) XPackAsyncSearchDelete() *XPackAsyncSearchDelete {
method XPackIlmPutLifecycle (line 2129) | func (c *Client) XPackIlmPutLifecycle() *XPackIlmPutLifecycleService {
method XPackIlmGetLifecycle (line 2134) | func (c *Client) XPackIlmGetLifecycle() *XPackIlmGetLifecycleService {
method XPackIlmDeleteLifecycle (line 2139) | func (c *Client) XPackIlmDeleteLifecycle() *XPackIlmDeleteLifecycleSer...
method XPackSecurityGetRoleMapping (line 2146) | func (c *Client) XPackSecurityGetRoleMapping(roleMappingName string) *...
method XPackSecurityPutRoleMapping (line 2151) | func (c *Client) XPackSecurityPutRoleMapping(roleMappingName string) *...
method XPackSecurityDeleteRoleMapping (line 2156) | func (c *Client) XPackSecurityDeleteRoleMapping(roleMappingName string...
method XPackSecurityGetRole (line 2161) | func (c *Client) XPackSecurityGetRole(roleName string) *XPackSecurityG...
method XPackSecurityPutRole (line 2166) | func (c *Client) XPackSecurityPutRole(roleName string) *XPackSecurityP...
method XPackSecurityDeleteRole (line 2171) | func (c *Client) XPackSecurityDeleteRole(roleName string) *XPackSecuri...
method XPackSecurityChangePassword (line 2179) | func (c *Client) XPackSecurityChangePassword(username string) *XPackSe...
method XPackSecurityGetUser (line 2184) | func (c *Client) XPackSecurityGetUser(usernames ...string) *XPackSecur...
method XPackSecurityPutUser (line 2189) | func (c *Client) XPackSecurityPutUser(username string) *XPackSecurityP...
method XPackSecurityEnableUser (line 2194) | func (c *Client) XPackSecurityEnableUser(username string) *XPackSecuri...
method XPackSecurityDisableUser (line 2199) | func (c *Client) XPackSecurityDisableUser(username string) *XPackSecur...
method XPackSecurityDeleteUser (line 2204) | func (c *Client) XPackSecurityDeleteUser(username string) *XPackSecuri...
method XPackRollupPut (line 2211) | func (c *Client) XPackRollupPut(jobId string) *XPackRollupPutService {
method XPackRollupGet (line 2216) | func (c *Client) XPackRollupGet(jobId string) *XPackRollupGetService {
method XPackRollupDelete (line 2221) | func (c *Client) XPackRollupDelete(jobId string) *XPackRollupDeleteSer...
method XPackRollupStart (line 2226) | func (c *Client) XPackRollupStart(jobId string) *XPackRollupStartServi...
method XPackRollupStop (line 2231) | func (c *Client) XPackRollupStop(jobId string) *XPackRollupStopService {
method XPackWatchPut (line 2238) | func (c *Client) XPackWatchPut(watchId string) *XPackWatcherPutWatchSe...
method XPackWatchGet (line 2243) | func (c *Client) XPackWatchGet(watchId string) *XPackWatcherGetWatchSe...
method XPackWatchDelete (line 2248) | func (c *Client) XPackWatchDelete(watchId string) *XPackWatcherDeleteW...
method XPackWatchExecute (line 2253) | func (c *Client) XPackWatchExecute() *XPackWatcherExecuteWatchService {
method XPackWatchAck (line 2258) | func (c *Client) XPackWatchAck(watchId string) *XPackWatcherAckWatchSe...
method XPackWatchActivate (line 2263) | func (c *Client) XPackWatchActivate(watchId string) *XPackWatcherActiv...
method XPackWatchDeactivate (line 2268) | func (c *Client) XPackWatchDeactivate(watchId string) *XPackWatcherDea...
method XPackWatchStats (line 2273) | func (c *Client) XPackWatchStats() *XPackWatcherStatsService {
method XPackWatchStart (line 2278) | func (c *Client) XPackWatchStart() *XPackWatcherStartService {
method XPackWatchStop (line 2283) | func (c *Client) XPackWatchStop() *XPackWatcherStopService {
method ElasticsearchVersion (line 2291) | func (c *Client) ElasticsearchVersion(url string) (string, error) {
method IndexNames (line 2300) | func (c *Client) IndexNames() ([]string, error) {
method Ping (line 2317) | func (c *Client) Ping(url string) *PingService {
method WaitForStatus (line 2327) | func (c *Client) WaitForStatus(status string, timeout string) error {
method WaitForGreenStatus (line 2340) | func (c *Client) WaitForGreenStatus(timeout string) error {
method WaitForYellowStatus (line 2346) | func (c *Client) WaitForYellowStatus(timeout string) error {
function NewClient (line 206) | func NewClient(options ...ClientOptionFunc) (*Client, error) {
function NewClientFromConfig (line 211) | func NewClientFromConfig(cfg *config.Config) (*Client, error) {
function NewSimpleClient (line 234) | func NewSimpleClient(options ...ClientOptionFunc) (*Client, error) {
function Dial (line 312) | func Dial(options ...ClientOptionFunc) (*Client, error) {
function DialContext (line 319) | func DialContext(ctx context.Context, options ...ClientOptionFunc) (*Cli...
function DialWithConfig (line 427) | func DialWithConfig(ctx context.Context, cfg *config.Config) (*Client, e...
function configToOptions (line 435) | func configToOptions(cfg *config.Config) ([]ClientOptionFunc, error) {
function SetHttpClient (line 480) | func SetHttpClient(httpClient Doer) ClientOptionFunc {
function SetBasicAuth (line 493) | func SetBasicAuth(username, password string) ClientOptionFunc {
function SetURL (line 504) | func SetURL(urls ...string) ClientOptionFunc {
function SetScheme (line 524) | func SetScheme(scheme string) ClientOptionFunc {
function SetSniff (line 532) | func SetSniff(enabled bool) ClientOptionFunc {
function SetSnifferTimeoutStartup (line 543) | func SetSnifferTimeoutStartup(timeout time.Duration) ClientOptionFunc {
function SetSnifferTimeout (line 554) | func SetSnifferTimeout(timeout time.Duration) ClientOptionFunc {
function SetSnifferInterval (line 563) | func SetSnifferInterval(interval time.Duration) ClientOptionFunc {
type SnifferCallback (line 571) | type SnifferCallback
function SetSnifferCallback (line 582) | func SetSnifferCallback(f SnifferCallback) ClientOptionFunc {
function SetHealthcheck (line 592) | func SetHealthcheck(enabled bool) ClientOptionFunc {
function SetHealthcheckTimeoutStartup (line 603) | func SetHealthcheckTimeoutStartup(timeout time.Duration) ClientOptionFunc {
function SetHealthcheckTimeout (line 615) | func SetHealthcheckTimeout(timeout time.Duration) ClientOptionFunc {
function SetHealthcheckInterval (line 624) | func SetHealthcheckInterval(interval time.Duration) ClientOptionFunc {
function SetMaxRetries (line 635) | func SetMaxRetries(maxRetries int) ClientOptionFunc {
function SetGzip (line 656) | func SetGzip(enabled bool) ClientOptionFunc {
function SetDecoder (line 665) | func SetDecoder(decoder Decoder) ClientOptionFunc {
function SetRequiredPlugins (line 678) | func SetRequiredPlugins(plugins ...string) ClientOptionFunc {
function SetErrorLog (line 690) | func SetErrorLog(logger Logger) ClientOptionFunc {
function SetInfoLog (line 699) | func SetInfoLog(logger Logger) ClientOptionFunc {
function SetTraceLog (line 708) | func SetTraceLog(logger Logger) ClientOptionFunc {
function SetSendGetBodyAs (line 717) | func SetSendGetBodyAs(httpMethod string) ClientOptionFunc {
function SetRetrier (line 726) | func SetRetrier(retrier Retrier) ClientOptionFunc {
function SetRetryStatusCodes (line 740) | func SetRetryStatusCodes(statusCodes ...int) ClientOptionFunc {
function SetHeaders (line 749) | func SetHeaders(headers http.Header) ClientOptionFunc {
type PerformRequestOptions (line 1289) | type PerformRequestOptions struct
FILE: client_test.go
function findConn (line 31) | func findConn(s string, slice ...*conn) (int, bool) {
function TestClientDefaults (line 42) | func TestClientDefaults(t *testing.T) {
function TestClientWithoutURL (line 82) | func TestClientWithoutURL(t *testing.T) {
function TestClientWithSingleURL (line 100) | func TestClientWithSingleURL(t *testing.T) {
function TestClientWithMultipleURLs (line 118) | func TestClientWithMultipleURLs(t *testing.T) {
function TestClientWithInvalidURLs (line 134) | func TestClientWithInvalidURLs(t *testing.T) {
function TestClientWithBasicAuth (line 147) | func TestClientWithBasicAuth(t *testing.T) {
function TestClientWithBasicAuthInUserInfo (line 160) | func TestClientWithBasicAuthInUserInfo(t *testing.T) {
function TestClientWithBasicAuthDuringHealthcheck (line 173) | func TestClientWithBasicAuthDuringHealthcheck(t *testing.T) {
function TestClientWithXpackSecurity (line 204) | func TestClientWithXpackSecurity(t *testing.T) {
function TestClientWithXpackSecurityUnauthorized (line 218) | func TestClientWithXpackSecurityUnauthorized(t *testing.T) {
function TestClientWithoutBasicAuthButAuthEnabledInElasticDuringHealthcheck (line 231) | func TestClientWithoutBasicAuthButAuthEnabledInElasticDuringHealthcheck(...
function TestClientFromConfig (line 257) | func TestClientFromConfig(t *testing.T) {
function TestClientDialFromConfig (line 279) | func TestClientDialFromConfig(t *testing.T) {
function TestClientDialContext (line 301) | func TestClientDialContext(t *testing.T) {
function TestClientDialContextTimeoutFromHealthcheck (line 311) | func TestClientDialContextTimeoutFromHealthcheck(t *testing.T) {
function TestClientDialContextTimeoutFromSniffer (line 327) | func TestClientDialContextTimeoutFromSniffer(t *testing.T) {
function TestClientSniffSuccess (line 343) | func TestClientSniffSuccess(t *testing.T) {
function TestClientSniffFailure (line 354) | func TestClientSniffFailure(t *testing.T) {
function TestClientSnifferCallback (line 361) | func TestClientSnifferCallback(t *testing.T) {
function TestClientSniffDisabled (line 378) | func TestClientSniffDisabled(t *testing.T) {
function TestClientWillMarkConnectionsAsAliveWhenAllAreDead (line 409) | func TestClientWillMarkConnectionsAsAliveWhenAllAreDead(t *testing.T) {
function TestClientWithRequiredPlugins (line 444) | func TestClientWithRequiredPlugins(t *testing.T) {
function TestClientHealthcheckStartupTimeout (line 454) | func TestClientHealthcheckStartupTimeout(t *testing.T) {
function TestClientHealthcheckTimeoutLeak (line 469) | func TestClientHealthcheckTimeoutLeak(t *testing.T) {
function TestClientSniffUpdatingNodeURL (line 543) | func TestClientSniffUpdatingNodeURL(t *testing.T) {
function TestSimpleClientDefaults (line 640) | func TestSimpleClientDefaults(t *testing.T) {
function TestClientStartAndStop (line 682) | func TestClientStartAndStop(t *testing.T) {
function TestClientStartAndStopWithSnifferAndHealthchecksDisabled (line 722) | func TestClientStartAndStopWithSnifferAndHealthchecksDisabled(t *testing...
function TestClientSniffNode (line 764) | func TestClientSniffNode(t *testing.T) {
function TestClientSniffOnDefaultURL (line 792) | func TestClientSniffOnDefaultURL(t *testing.T) {
function TestClientSniffTimeoutLeak (line 825) | func TestClientSniffTimeoutLeak(t *testing.T) {
function TestClientExtractHostname (line 900) | func TestClientExtractHostname(t *testing.T) {
function TestClientSelectConnHealthy (line 942) | func TestClientSelectConnHealthy(t *testing.T) {
function TestClientSelectConnHealthyAndDead (line 981) | func TestClientSelectConnHealthyAndDead(t *testing.T) {
function TestClientSelectConnDeadAndHealthy (line 1020) | func TestClientSelectConnDeadAndHealthy(t *testing.T) {
function TestClientSelectConnAllDead (line 1059) | func TestClientSelectConnAllDead(t *testing.T) {
function TestElasticsearchVersion (line 1101) | func TestElasticsearchVersion(t *testing.T) {
function TestIndexNames (line 1117) | func TestIndexNames(t *testing.T) {
function TestPerformRequest (line 1140) | func TestPerformRequest(t *testing.T) {
function TestPerformRequestWithStream (line 1165) | func TestPerformRequestWithStream(t *testing.T) {
function TestPerformRequestWithSimpleClient (line 1197) | func TestPerformRequestWithSimpleClient(t *testing.T) {
function TestPerformRequestWithLogger (line 1222) | func TestPerformRequestWithLogger(t *testing.T) {
function TestPerformRequestWithLoggerAndTracer (line 1261) | func TestPerformRequestWithLoggerAndTracer(t *testing.T) {
function TestPerformRequestWithTracerOnError (line 1302) | func TestPerformRequestWithTracerOnError(t *testing.T) {
type customLogger (line 1322) | type customLogger struct
method Printf (line 1326) | func (l *customLogger) Printf(format string, v ...interface{}) {
function TestPerformRequestWithCustomLogger (line 1330) | func TestPerformRequestWithCustomLogger(t *testing.T) {
function TestPerformRequestWithMaxResponseSize (line 1368) | func TestPerformRequestWithMaxResponseSize(t *testing.T) {
function TestPerformRequestOnNoConnectionsWithHealthcheckRevival (line 1395) | func TestPerformRequestOnNoConnectionsWithHealthcheckRevival(t *testing....
type failingTransport (line 1432) | type failingTransport struct
method RoundTrip (line 1439) | func (tr *failingTransport) RoundTrip(r *http.Request) (*http.Response...
function TestPerformRequestRetryOnHttpError (line 1449) | func TestPerformRequestRetryOnHttpError(t *testing.T) {
function TestPerformRequestNoRetryOnValidButUnsuccessfulHttpStatus (line 1482) | func TestPerformRequestNoRetryOnValidButUnsuccessfulHttpStatus(t *testin...
function TestPerformRequestOnSpecifiedHttpStatusCodes (line 1518) | func TestPerformRequestOnSpecifiedHttpStatusCodes(t *testing.T) {
type failingBody (line 1560) | type failingBody struct
method MarshalJSON (line 1563) | func (fb failingBody) MarshalJSON() ([]byte, error) {
function TestPerformRequestWithSetBodyError (line 1567) | func TestPerformRequestWithSetBodyError(t *testing.T) {
type sleepingTransport (line 1586) | type sleepingTransport struct
method RoundTrip (line 1591) | func (tr *sleepingTransport) RoundTrip(r *http.Request) (*http.Respons...
function TestPerformRequestWithCancel (line 1596) | func TestPerformRequestWithCancel(t *testing.T) {
function TestPerformRequestWithTimeout (line 1634) | func TestPerformRequestWithTimeout(t *testing.T) {
function TestPerformRequestWithCustomHTTPHeadersOnRequest (line 1669) | func TestPerformRequestWithCustomHTTPHeadersOnRequest(t *testing.T) {
function TestPerformRequestWithCustomHTTPHeadersOnClient (line 1695) | func TestPerformRequestWithCustomHTTPHeadersOnClient(t *testing.T) {
function TestPerformRequestSetsDefaultUserAgent (line 1724) | func TestPerformRequestSetsDefaultUserAgent(t *testing.T) {
function TestPerformRequestWithCustomHTTPHeadersPriority (line 1757) | func TestPerformRequestWithCustomHTTPHeadersPriority(t *testing.T) {
function TestPerformRequestWithCompressionEnabled (line 1822) | func TestPerformRequestWithCompressionEnabled(t *testing.T) {
function TestPerformRequestWithCompressionDisabled (line 1830) | func TestPerformRequestWithCompressionDisabled(t *testing.T) {
function testPerformRequestWithCompression (line 1838) | func testPerformRequestWithCompression(t *testing.T, hc *http.Client) {
FILE: cluster-test/cluster-test.go
type Tweet (line 24) | type Tweet struct
function main (line 49) | func main() {
type RunInfo (line 80) | type RunInfo struct
type TestCase (line 84) | type TestCase struct
method SetIndex (line 113) | func (t *TestCase) SetIndex(name string) {
method SetErrorLogFile (line 117) | func (t *TestCase) SetErrorLogFile(name string) {
method SetInfoLogFile (line 121) | func (t *TestCase) SetInfoLogFile(name string) {
method SetTraceLogFile (line 125) | func (t *TestCase) SetTraceLogFile(name string) {
method SetMaxRetries (line 129) | func (t *TestCase) SetMaxRetries(n int) {
method SetSniff (line 133) | func (t *TestCase) SetSniff(enabled bool) {
method SetSnifferInterval (line 137) | func (t *TestCase) SetSnifferInterval(d time.Duration) {
method SetHealthcheck (line 141) | func (t *TestCase) SetHealthcheck(enabled bool) {
method SetHealthcheckInterval (line 145) | func (t *TestCase) SetHealthcheckInterval(d time.Duration) {
method Run (line 149) | func (t *TestCase) Run(n int) error {
method monitor (line 163) | func (t *TestCase) monitor() {
method setup (line 185) | func (t *TestCase) setup() error {
method search (line 289) | func (t *TestCase) search() {
function NewTestCase (line 101) | func NewTestCase(index string, nodes []string) (*TestCase, error) {
FILE: cluster_health.go
type ClusterHealthService (line 21) | type ClusterHealthService struct
method Pretty (line 50) | func (s *ClusterHealthService) Pretty(pretty bool) *ClusterHealthServi...
method Human (line 57) | func (s *ClusterHealthService) Human(human bool) *ClusterHealthService {
method ErrorTrace (line 63) | func (s *ClusterHealthService) ErrorTrace(errorTrace bool) *ClusterHea...
method FilterPath (line 69) | func (s *ClusterHealthService) FilterPath(filterPath ...string) *Clust...
method Header (line 75) | func (s *ClusterHealthService) Header(name string, value string) *Clus...
method Headers (line 84) | func (s *ClusterHealthService) Headers(headers http.Header) *ClusterHe...
method Index (line 90) | func (s *ClusterHealthService) Index(indices ...string) *ClusterHealth...
method Level (line 96) | func (s *ClusterHealthService) Level(level string) *ClusterHealthServi...
method Local (line 103) | func (s *ClusterHealthService) Local(local bool) *ClusterHealthService {
method MasterTimeout (line 109) | func (s *ClusterHealthService) MasterTimeout(masterTimeout string) *Cl...
method Timeout (line 115) | func (s *ClusterHealthService) Timeout(timeout string) *ClusterHealthS...
method WaitForActiveShards (line 121) | func (s *ClusterHealthService) WaitForActiveShards(waitForActiveShards...
method WaitForNodes (line 128) | func (s *ClusterHealthService) WaitForNodes(waitForNodes string) *Clus...
method WaitForNoRelocatingShards (line 134) | func (s *ClusterHealthService) WaitForNoRelocatingShards(waitForNoRelo...
method WaitForStatus (line 141) | func (s *ClusterHealthService) WaitForStatus(waitForStatus string) *Cl...
method WaitForGreenStatus (line 147) | func (s *ClusterHealthService) WaitForGreenStatus() *ClusterHealthServ...
method WaitForYellowStatus (line 152) | func (s *ClusterHealthService) WaitForYellowStatus() *ClusterHealthSer...
method buildURL (line 157) | func (s *ClusterHealthService) buildURL() (string, url.Values, error) {
method Validate (line 214) | func (s *ClusterHealthService) Validate() error {
method Do (line 219) | func (s *ClusterHealthService) Do(ctx context.Context) (*ClusterHealth...
function NewClusterHealthService (line 42) | func NewClusterHealthService(client *Client) *ClusterHealthService {
type ClusterHealthResponse (line 251) | type ClusterHealthResponse struct
type ClusterIndexHealth (line 275) | type ClusterIndexHealth struct
type ClusterShardHealth (line 289) | type ClusterShardHealth struct
FILE: cluster_health_test.go
function TestClusterHealth (line 13) | func TestClusterHealth(t *testing.T) {
function TestClusterHealthURLs (line 29) | func TestClusterHealthURLs(t *testing.T) {
function TestClusterHealthWaitForStatus (line 77) | func TestClusterHealthWaitForStatus(t *testing.T) {
FILE: cluster_reroute.go
type ClusterRerouteService (line 23) | type ClusterRerouteService struct
method Pretty (line 50) | func (s *ClusterRerouteService) Pretty(pretty bool) *ClusterRerouteSer...
method Human (line 57) | func (s *ClusterRerouteService) Human(human bool) *ClusterRerouteServi...
method ErrorTrace (line 63) | func (s *ClusterRerouteService) ErrorTrace(errorTrace bool) *ClusterRe...
method FilterPath (line 69) | func (s *ClusterRerouteService) FilterPath(filterPath ...string) *Clus...
method Header (line 75) | func (s *ClusterRerouteService) Header(name string, value string) *Clu...
method Headers (line 84) | func (s *ClusterRerouteService) Headers(headers http.Header) *ClusterR...
method Metric (line 92) | func (s *ClusterRerouteService) Metric(metrics ...string) *ClusterRero...
method DryRun (line 99) | func (s *ClusterRerouteService) DryRun(dryRun bool) *ClusterRerouteSer...
method Explain (line 106) | func (s *ClusterRerouteService) Explain(explain bool) *ClusterRerouteS...
method RetryFailed (line 113) | func (s *ClusterRerouteService) RetryFailed(retryFailed bool) *Cluster...
method MasterTimeout (line 119) | func (s *ClusterRerouteService) MasterTimeout(masterTimeout string) *C...
method Timeout (line 125) | func (s *ClusterRerouteService) Timeout(timeout string) *ClusterRerout...
method Add (line 131) | func (s *ClusterRerouteService) Add(commands ...AllocationCommand) *Cl...
method Body (line 139) | func (s *ClusterRerouteService) Body(body interface{}) *ClusterReroute...
method buildURL (line 145) | func (s *ClusterRerouteService) buildURL() (string, url.Values, error) {
method Validate (line 185) | func (s *ClusterRerouteService) Validate() error {
method Do (line 193) | func (s *ClusterRerouteService) Do(ctx context.Context) (*ClusterRerou...
function NewClusterRerouteService (line 43) | func NewClusterRerouteService(client *Client) *ClusterRerouteService {
type ClusterRerouteResponse (line 246) | type ClusterRerouteResponse struct
type RerouteExplanation (line 253) | type RerouteExplanation struct
type RerouteDecision (line 260) | type RerouteDecision interface
type AllocationCommand (line 266) | type AllocationCommand interface
type MoveAllocationCommand (line 275) | type MoveAllocationCommand struct
method Name (line 293) | func (cmd *MoveAllocationCommand) Name() string { return "move" }
method Source (line 296) | func (cmd *MoveAllocationCommand) Source() (interface{}, error) {
function NewMoveAllocationCommand (line 283) | func NewMoveAllocationCommand(index string, shardId int, fromNode, toNod...
type CancelAllocationCommand (line 308) | type CancelAllocationCommand struct
method Name (line 326) | func (cmd *CancelAllocationCommand) Name() string { return "cancel" }
method Source (line 329) | func (cmd *CancelAllocationCommand) Source() (interface{}, error) {
function NewCancelAllocationCommand (line 316) | func NewCancelAllocationCommand(index string, shardId int, node string, ...
type AllocateStalePrimaryAllocationCommand (line 343) | type AllocateStalePrimaryAllocationCommand struct
method Name (line 362) | func (cmd *AllocateStalePrimaryAllocationCommand) Name() string { retu...
method Source (line 365) | func (cmd *AllocateStalePrimaryAllocationCommand) Source() (interface{...
function NewAllocateStalePrimaryAllocationCommand (line 352) | func NewAllocateStalePrimaryAllocationCommand(index string, shardId int,...
type AllocateReplicaAllocationCommand (line 378) | type AllocateReplicaAllocationCommand struct
method Name (line 395) | func (cmd *AllocateReplicaAllocationCommand) Name() string { return "a...
method Source (line 398) | func (cmd *AllocateReplicaAllocationCommand) Source() (interface{}, er...
function NewAllocateReplicaAllocationCommand (line 386) | func NewAllocateReplicaAllocationCommand(index string, shardId int, node...
type AllocateEmptyPrimaryAllocationCommand (line 409) | type AllocateEmptyPrimaryAllocationCommand struct
method Name (line 428) | func (cmd *AllocateEmptyPrimaryAllocationCommand) Name() string { retu...
method Source (line 431) | func (cmd *AllocateEmptyPrimaryAllocationCommand) Source() (interface{...
function NewAllocateEmptyPrimaryAllocationCommand (line 418) | func NewAllocateEmptyPrimaryAllocationCommand(index string, shardId int,...
FILE: cluster_reroute_test.go
function TestClusterRerouteURLs (line 14) | func TestClusterRerouteURLs(t *testing.T) {
function TestClusterReroute (line 54) | func TestClusterReroute(t *testing.T) {
function testClusterRerouteWithCommands (line 66) | func testClusterRerouteWithCommands(client *Client, t *testing.T) {
function testClusterRerouteWithoutBody (line 107) | func testClusterRerouteWithoutBody(client *Client, t *testing.T) {
FILE: cluster_state.go
type ClusterStateService (line 21) | type ClusterStateService struct
method Pretty (line 50) | func (s *ClusterStateService) Pretty(pretty bool) *ClusterStateService {
method Human (line 57) | func (s *ClusterStateService) Human(human bool) *ClusterStateService {
method ErrorTrace (line 63) | func (s *ClusterStateService) ErrorTrace(errorTrace bool) *ClusterStat...
method FilterPath (line 69) | func (s *ClusterStateService) FilterPath(filterPath ...string) *Cluste...
method Header (line 75) | func (s *ClusterStateService) Header(name string, value string) *Clust...
method Headers (line 84) | func (s *ClusterStateService) Headers(headers http.Header) *ClusterSta...
method Index (line 91) | func (s *ClusterStateService) Index(indices ...string) *ClusterStateSe...
method Metric (line 99) | func (s *ClusterStateService) Metric(metrics ...string) *ClusterStateS...
method AllowNoIndices (line 107) | func (s *ClusterStateService) AllowNoIndices(allowNoIndices bool) *Clu...
method ExpandWildcards (line 114) | func (s *ClusterStateService) ExpandWildcards(expandWildcards string) ...
method FlatSettings (line 120) | func (s *ClusterStateService) FlatSettings(flatSettings bool) *Cluster...
method IgnoreUnavailable (line 127) | func (s *ClusterStateService) IgnoreUnavailable(ignoreUnavailable bool...
method Local (line 134) | func (s *ClusterStateService) Local(local bool) *ClusterStateService {
method MasterTimeout (line 140) | func (s *ClusterStateService) MasterTimeout(masterTimeout string) *Clu...
method buildURL (line 146) | func (s *ClusterStateService) buildURL() (string, url.Values, error) {
method Validate (line 200) | func (s *ClusterStateService) Validate() error {
method Do (line 205) | func (s *ClusterStateService) Do(ctx context.Context) (*ClusterStateRe...
function NewClusterStateService (line 41) | func NewClusterStateService(client *Client) *ClusterStateService {
type ClusterStateResponse (line 237) | type ClusterStateResponse struct
type clusterBlocks (line 253) | type clusterBlocks struct
type clusterBlock (line 258) | type clusterBlock struct
type clusterStateMetadata (line 265) | type clusterStateMetadata struct
type clusterCoordinationMetaData (line 290) | type clusterCoordinationMetaData struct
type discoveryNode (line 297) | type discoveryNode struct
type clusterStateRoutingTable (line 305) | type clusterStateRoutingTable struct
type clusterStateRoutingNode (line 309) | type clusterStateRoutingNode struct
type indexTemplateMetaData (line 315) | type indexTemplateMetaData struct
type indexMetaData (line 324) | type indexMetaData struct
type indexRoutingTable (line 342) | type indexRoutingTable struct
type shardRouting (line 346) | type shardRouting struct
type RestoreSource (line 359) | type RestoreSource struct
type allocationId (line 366) | type allocationId struct
type unassignedInfo (line 371) | type unassignedInfo struct
FILE: cluster_state_test.go
function TestClusterState (line 13) | func TestClusterState(t *testing.T) {
function TestClusterStateURLs (line 29) | func TestClusterStateURLs(t *testing.T) {
function TestClusterStateGet (line 95) | func TestClusterStateGet(t *testing.T) {
FILE: cluster_stats.go
type ClusterStatsService (line 19) | type ClusterStatsService struct
method Pretty (line 41) | func (s *ClusterStatsService) Pretty(pretty bool) *ClusterStatsService {
method Human (line 48) | func (s *ClusterStatsService) Human(human bool) *ClusterStatsService {
method ErrorTrace (line 54) | func (s *ClusterStatsService) ErrorTrace(errorTrace bool) *ClusterStat...
method FilterPath (line 60) | func (s *ClusterStatsService) FilterPath(filterPath ...string) *Cluste...
method Header (line 66) | func (s *ClusterStatsService) Header(name string, value string) *Clust...
method Headers (line 75) | func (s *ClusterStatsService) Headers(headers http.Header) *ClusterSta...
method NodeId (line 81) | func (s *ClusterStatsService) NodeId(nodeId []string) *ClusterStatsSer...
method FlatSettings (line 87) | func (s *ClusterStatsService) FlatSettings(flatSettings bool) *Cluster...
method buildURL (line 93) | func (s *ClusterStatsService) buildURL() (string, url.Values, error) {
method Validate (line 133) | func (s *ClusterStatsService) Validate() error {
method Do (line 138) | func (s *ClusterStatsService) Do(ctx context.Context) (*ClusterStatsRe...
function NewClusterStatsService (line 33) | func NewClusterStatsService(client *Client) *ClusterStatsService {
type ClusterStatsResponse (line 170) | type ClusterStatsResponse struct
type ClusterStatsNodesResponse (line 180) | type ClusterStatsNodesResponse struct
type ClusterStatsIndices (line 187) | type ClusterStatsIndices struct
type ClusterStatsAnalysisStats (line 201) | type ClusterStatsAnalysisStats struct
type ClusterStatsMappingStats (line 212) | type ClusterStatsMappingStats struct
type IndexFeatureStats (line 217) | type IndexFeatureStats struct
type RuntimeFieldStats (line 225) | type RuntimeFieldStats struct
type FieldScriptStats (line 245) | type FieldScriptStats struct
type ClusterStatsVersionStats (line 256) | type ClusterStatsVersionStats struct
type ClusterStatsIndicesShards (line 264) | type ClusterStatsIndicesShards struct
type ClusterStatsIndicesShardsIndex (line 271) | type ClusterStatsIndicesShardsIndex struct
type ClusterStatsIndicesShardsIndexIntMinMax (line 277) | type ClusterStatsIndicesShardsIndexIntMinMax struct
type ClusterStatsIndicesShardsIndexFloat64MinMax (line 283) | type ClusterStatsIndicesShardsIndexFloat64MinMax struct
type ClusterStatsIndicesDocs (line 289) | type ClusterStatsIndicesDocs struct
type ClusterStatsIndicesStore (line 294) | type ClusterStatsIndicesStore struct
type ClusterStatsIndicesFieldData (line 303) | type ClusterStatsIndicesFieldData struct
type ClusterStatsIndicesQueryCache (line 313) | type ClusterStatsIndicesQueryCache struct
type ClusterStatsIndicesCompletion (line 324) | type ClusterStatsIndicesCompletion struct
type ClusterStatsIndicesSegmentsFile (line 333) | type ClusterStatsIndicesSegmentsFile struct
type ClusterStatsNodes (line 341) | type ClusterStatsNodes struct
type ClusterStatsNodesCount (line 357) | type ClusterStatsNodesCount struct
type ClusterStatsNodesOsStats (line 374) | type ClusterStatsNodesOsStats struct
type ClusterStatsNodesOsStatsMem (line 393) | type ClusterStatsNodesOsStatsMem struct
type ClusterStatsNodesOsStatsCPU (line 404) | type ClusterStatsNodesOsStatsCPU struct
type ClusterStatsNodesProcessStats (line 416) | type ClusterStatsNodesProcessStats struct
type ClusterStatsNodesProcessStatsCPU (line 421) | type ClusterStatsNodesProcessStatsCPU struct
type ClusterStatsNodesProcessStatsOpenFileDescriptors (line 425) | type ClusterStatsNodesProcessStatsOpenFileDescriptors struct
type ClusterStatsNodesJvmStats (line 431) | type ClusterStatsNodesJvmStats struct
type ClusterStatsNodesJvmStatsVersion (line 439) | type ClusterStatsNodesJvmStatsVersion struct
type ClusterStatsNodesJvmStatsMem (line 449) | type ClusterStatsNodesJvmStatsMem struct
type ClusterStatsNodesFsStats (line 456) | type ClusterStatsNodesFsStats struct
type ClusterStatsNodesPlugin (line 479) | type ClusterStatsNodesPlugin struct
type ClusterStatsNodesNetworkTypes (line 488) | type ClusterStatsNodesNetworkTypes struct
type ClusterStatsNodesDiscoveryTypes (line 493) | type ClusterStatsNodesDiscoveryTypes interface
type ClusterStatsNodesPackagingTypes (line 495) | type ClusterStatsNodesPackagingTypes
type ClusterStatsNodesPackagingType (line 497) | type ClusterStatsNodesPackagingType struct
type ClusterStatsNodesIngest (line 503) | type ClusterStatsNodesIngest struct
FILE: cluster_stats_integration_test.go
function TestClusterStats (line 12) | func TestClusterStats(t *testing.T) {
FILE: cluster_stats_test.go
function TestClusterStatsURLs (line 13) | func TestClusterStatsURLs(t *testing.T) {
function TestClusterStatsErrorResponse (line 1449) | func TestClusterStatsErrorResponse(t *testing.T) {
FILE: config/config.go
type Config (line 15) | type Config struct
function Parse (line 37) | func Parse(elasticURL string) (*Config, error) {
FILE: config/config_test.go
function TestParse (line 9) | func TestParse(t *testing.T) {
function TestParseDoesNotFailWithoutIndexName (line 50) | func TestParseDoesNotFailWithoutIndexName(t *testing.T) {
function TestParseTrimsIndexName (line 64) | func TestParseTrimsIndexName(t *testing.T) {
FILE: connection.go
type conn (line 14) | type conn struct
method String (line 33) | func (c *conn) String() string {
method NodeID (line 40) | func (c *conn) NodeID() string {
method URL (line 47) | func (c *conn) URL() string {
method IsDead (line 55) | func (c *conn) IsDead() bool {
method MarkAsDead (line 63) | func (c *conn) MarkAsDead() {
method MarkAsAlive (line 76) | func (c *conn) MarkAsAlive() {
method MarkAsHealthy (line 84) | func (c *conn) MarkAsHealthy() {
function newConn (line 24) | func newConn(nodeID, url string) *conn {
FILE: count.go
type CountService (line 20) | type CountService struct
method Pretty (line 59) | func (s *CountService) Pretty(pretty bool) *CountService {
method Human (line 66) | func (s *CountService) Human(human bool) *CountService {
method ErrorTrace (line 72) | func (s *CountService) ErrorTrace(errorTrace bool) *CountService {
method FilterPath (line 78) | func (s *CountService) FilterPath(filterPath ...string) *CountService {
method Header (line 84) | func (s *CountService) Header(name string, value string) *CountService {
method Headers (line 93) | func (s *CountService) Headers(headers http.Header) *CountService {
method Index (line 99) | func (s *CountService) Index(index ...string) *CountService {
method Type (line 111) | func (s *CountService) Type(typ ...string) *CountService {
method AllowNoIndices (line 122) | func (s *CountService) AllowNoIndices(allowNoIndices bool) *CountServi...
method AnalyzeWildcard (line 129) | func (s *CountService) AnalyzeWildcard(analyzeWildcard bool) *CountSer...
method Analyzer (line 135) | func (s *CountService) Analyzer(analyzer string) *CountService {
method DefaultOperator (line 141) | func (s *CountService) DefaultOperator(defaultOperator string) *CountS...
method Df (line 148) | func (s *CountService) Df(df string) *CountService {
method ExpandWildcards (line 155) | func (s *CountService) ExpandWildcards(expandWildcards string) *CountS...
method IgnoreUnavailable (line 162) | func (s *CountService) IgnoreUnavailable(ignoreUnavailable bool) *Coun...
method IgnoreThrottled (line 169) | func (s *CountService) IgnoreThrottled(ignoreThrottled bool) *CountSer...
method Lenient (line 176) | func (s *CountService) Lenient(lenient bool) *CountService {
method LowercaseExpandedTerms (line 182) | func (s *CountService) LowercaseExpandedTerms(lowercaseExpandedTerms b...
method MinScore (line 189) | func (s *CountService) MinScore(minScore interface{}) *CountService {
method Preference (line 196) | func (s *CountService) Preference(preference string) *CountService {
method Q (line 203) | func (s *CountService) Q(q string) *CountService {
method Query (line 209) | func (s *CountService) Query(query Query) *CountService {
method Routing (line 215) | func (s *CountService) Routing(routing string) *CountService {
method TerminateAfter (line 222) | func (s *CountService) TerminateAfter(terminateAfter int) *CountService {
method BodyJson (line 230) | func (s *CountService) BodyJson(body interface{}) *CountService {
method BodyString (line 237) | func (s *CountService) BodyString(body string) *CountService {
method buildURL (line 243) | func (s *CountService) buildURL() (string, url.Values, error) {
method Validate (line 330) | func (s *CountService) Validate() error {
method Do (line 335) | func (s *CountService) Do(ctx context.Context) (int64, error) {
function NewCountService (line 52) | func NewCountService(client *Client) *CountService {
type CountResponse (line 388) | type CountResponse struct
FILE: count_test.go
function TestCountURL (line 12) | func TestCountURL(t *testing.T) {
function TestCount (line 53) | func TestCount(t *testing.T) {
FILE: decoder.go
type Decoder (line 16) | type Decoder interface
type DefaultDecoder (line 22) | type DefaultDecoder struct
method Decode (line 25) | func (u *DefaultDecoder) Decode(data []byte, v interface{}) error {
type NumberDecoder (line 31) | type NumberDecoder struct
method Decode (line 34) | func (u *NumberDecoder) Decode(data []byte, v interface{}) error {
FILE: decoder_test.go
type decoder (line 15) | type decoder struct
method Decode (line 19) | func (d *decoder) Decode(data []byte, v interface{}) error {
function TestDecoder (line 26) | func TestDecoder(t *testing.T) {
FILE: delete.go
type DeleteService (line 22) | type DeleteService struct
method Pretty (line 54) | func (s *DeleteService) Pretty(pretty bool) *DeleteService {
method Human (line 61) | func (s *DeleteService) Human(human bool) *DeleteService {
method ErrorTrace (line 67) | func (s *DeleteService) ErrorTrace(errorTrace bool) *DeleteService {
method FilterPath (line 73) | func (s *DeleteService) FilterPath(filterPath ...string) *DeleteService {
method Header (line 79) | func (s *DeleteService) Header(name string, value string) *DeleteServi...
method Headers (line 88) | func (s *DeleteService) Headers(headers http.Header) *DeleteService {
method Type (line 96) | func (s *DeleteService) Type(typ string) *DeleteService {
method Id (line 102) | func (s *DeleteService) Id(id string) *DeleteService {
method Index (line 108) | func (s *DeleteService) Index(index string) *DeleteService {
method Routing (line 114) | func (s *DeleteService) Routing(routing string) *DeleteService {
method Timeout (line 120) | func (s *DeleteService) Timeout(timeout string) *DeleteService {
method Version (line 126) | func (s *DeleteService) Version(version interface{}) *DeleteService {
method VersionType (line 132) | func (s *DeleteService) VersionType(versionType string) *DeleteService {
method WaitForActiveShards (line 142) | func (s *DeleteService) WaitForActiveShards(waitForActiveShards string...
method Parent (line 148) | func (s *DeleteService) Parent(parent string) *DeleteService {
method Refresh (line 157) | func (s *DeleteService) Refresh(refresh string) *DeleteService {
method IfSeqNo (line 164) | func (s *DeleteService) IfSeqNo(seqNo int64) *DeleteService {
method IfPrimaryTerm (line 171) | func (s *DeleteService) IfPrimaryTerm(primaryTerm int64) *DeleteService {
method buildURL (line 177) | func (s *DeleteService) buildURL() (string, url.Values, error) {
method Validate (line 233) | func (s *DeleteService) Validate() error {
method Do (line 253) | func (s *DeleteService) Do(ctx context.Context) (*DeleteResponse, erro...
function NewDeleteService (line 46) | func NewDeleteService(client *Client) *DeleteService {
type DeleteResponse (line 294) | type DeleteResponse struct
FILE: delete_by_query.go
type DeleteByQueryService (line 19) | type DeleteByQueryService struct
method Pretty (line 87) | func (s *DeleteByQueryService) Pretty(pretty bool) *DeleteByQueryServi...
method Human (line 94) | func (s *DeleteByQueryService) Human(human bool) *DeleteByQueryService {
method ErrorTrace (line 100) | func (s *DeleteByQueryService) ErrorTrace(errorTrace bool) *DeleteByQu...
method FilterPath (line 106) | func (s *DeleteByQueryService) FilterPath(filterPath ...string) *Delet...
method Header (line 112) | func (s *DeleteByQueryService) Header(name string, value string) *Dele...
method Headers (line 121) | func (s *DeleteByQueryService) Headers(headers http.Header) *DeleteByQ...
method Index (line 127) | func (s *DeleteByQueryService) Index(index ...string) *DeleteByQuerySe...
method Type (line 136) | func (s *DeleteByQueryService) Type(typ ...string) *DeleteByQueryServi...
method XSource (line 143) | func (s *DeleteByQueryService) XSource(xSource ...string) *DeleteByQue...
method XSourceExclude (line 149) | func (s *DeleteByQueryService) XSourceExclude(xSourceExclude ...string...
method XSourceInclude (line 155) | func (s *DeleteByQueryService) XSourceInclude(xSourceInclude ...string...
method Analyzer (line 161) | func (s *DeleteByQueryService) Analyzer(analyzer string) *DeleteByQuer...
method AnalyzeWildcard (line 168) | func (s *DeleteByQueryService) AnalyzeWildcard(analyzeWildcard bool) *...
method AllowNoIndices (line 176) | func (s *DeleteByQueryService) AllowNoIndices(allow bool) *DeleteByQue...
method Conflicts (line 183) | func (s *DeleteByQueryService) Conflicts(conflicts string) *DeleteByQu...
method AbortOnVersionConflict (line 190) | func (s *DeleteByQueryService) AbortOnVersionConflict() *DeleteByQuery...
method ProceedOnVersionConflict (line 197) | func (s *DeleteByQueryService) ProceedOnVersionConflict() *DeleteByQue...
method DefaultOperator (line 203) | func (s *DeleteByQueryService) DefaultOperator(defaultOperator string)...
method DF (line 209) | func (s *DeleteByQueryService) DF(defaultField string) *DeleteByQueryS...
method DefaultField (line 216) | func (s *DeleteByQueryService) DefaultField(defaultField string) *Dele...
method DocvalueFields (line 222) | func (s *DeleteByQueryService) DocvalueFields(docvalueFields ...string...
method ExpandWildcards (line 229) | func (s *DeleteByQueryService) ExpandWildcards(expand string) *DeleteB...
method Explain (line 236) | func (s *DeleteByQueryService) Explain(explain bool) *DeleteByQuerySer...
method From (line 242) | func (s *DeleteByQueryService) From(from int) *DeleteByQueryService {
method IgnoreUnavailable (line 249) | func (s *DeleteByQueryService) IgnoreUnavailable(ignore bool) *DeleteB...
method Lenient (line 256) | func (s *DeleteByQueryService) Lenient(lenient bool) *DeleteByQuerySer...
method LowercaseExpandedTerms (line 262) | func (s *DeleteByQueryService) LowercaseExpandedTerms(lowercaseExpande...
method MaxDocs (line 269) | func (s *DeleteByQueryService) MaxDocs(maxDocs int) *DeleteByQueryServ...
method Preference (line 276) | func (s *DeleteByQueryService) Preference(preference string) *DeleteBy...
method Q (line 283) | func (s *DeleteByQueryService) Q(query string) *DeleteByQueryService {
method QueryString (line 290) | func (s *DeleteByQueryService) QueryString(query string) *DeleteByQuer...
method Query (line 296) | func (s *DeleteByQueryService) Query(query Query) *DeleteByQueryService {
method Refresh (line 305) | func (s *DeleteByQueryService) Refresh(refresh string) *DeleteByQueryS...
method RequestCache (line 312) | func (s *DeleteByQueryService) RequestCache(requestCache bool) *Delete...
method RequestsPerSecond (line 319) | func (s *DeleteByQueryService) RequestsPerSecond(requestsPerSecond int...
method Routing (line 325) | func (s *DeleteByQueryService) Routing(routing ...string) *DeleteByQue...
method Scroll (line 332) | func (s *DeleteByQueryService) Scroll(scroll string) *DeleteByQuerySer...
method ScrollSize (line 338) | func (s *DeleteByQueryService) ScrollSize(scrollSize int) *DeleteByQue...
method SearchTimeout (line 345) | func (s *DeleteByQueryService) SearchTimeout(searchTimeout string) *De...
method SearchType (line 352) | func (s *DeleteByQueryService) SearchType(searchType string) *DeleteBy...
method Size (line 358) | func (s *DeleteByQueryService) Size(size int) *DeleteByQueryService {
method Slices (line 368) | func (s *DeleteByQueryService) Slices(slices interface{}) *DeleteByQue...
method Sort (line 374) | func (s *DeleteByQueryService) Sort(sort ...string) *DeleteByQueryServ...
method SortByField (line 380) | func (s *DeleteByQueryService) SortByField(field string, ascending boo...
method Stats (line 390) | func (s *DeleteByQueryService) Stats(stats ...string) *DeleteByQuerySe...
method StoredFields (line 396) | func (s *DeleteByQueryService) StoredFields(storedFields ...string) *D...
method SuggestField (line 402) | func (s *DeleteByQueryService) SuggestField(suggestField string) *Dele...
method SuggestMode (line 409) | func (s *DeleteByQueryService) SuggestMode(suggestMode string) *Delete...
method SuggestSize (line 415) | func (s *DeleteByQueryService) SuggestSize(suggestSize int) *DeleteByQ...
method SuggestText (line 421) | func (s *DeleteByQueryService) SuggestText(suggestText string) *Delete...
method TerminateAfter (line 428) | func (s *DeleteByQueryService) TerminateAfter(terminateAfter int) *Del...
method Timeout (line 435) | func (s *DeleteByQueryService) Timeout(timeout string) *DeleteByQueryS...
method TimeoutInMillis (line 441) | func (s *DeleteByQueryService) TimeoutInMillis(timeoutInMillis int) *D...
method TrackScores (line 448) | func (s *DeleteByQueryService) TrackScores(trackScores bool) *DeleteBy...
method Version (line 454) | func (s *DeleteByQueryService) Version(version bool) *DeleteByQuerySer...
method WaitForActiveShards (line 463) | func (s *DeleteByQueryService) WaitForActiveShards(waitForActiveShards...
method WaitForCompletion (line 469) | func (s *DeleteByQueryService) WaitForCompletion(waitForCompletion boo...
method Body (line 475) | func (s *DeleteByQueryService) Body(body string) *DeleteByQueryService {
method buildURL (line 481) | func (s *DeleteByQueryService) buildURL() (string, url.Values, error) {
method Validate (line 643) | func (s *DeleteByQueryService) Validate() error {
method Do (line 655) | func (s *DeleteByQueryService) Do(ctx context.Context) (*BulkIndexBySc...
method DoAsync (line 704) | func (s *DeleteByQueryService) DoAsync(ctx context.Context) (*StartTas...
function NewDeleteByQueryService (line 79) | func NewDeleteByQueryService(client *Client) *DeleteByQueryService {
type BulkIndexByScrollResponse (line 758) | type BulkIndexByScrollResponse struct
type bulkIndexByScrollResponseFailure (line 783) | type bulkIndexByScrollResponseFailure struct
FILE: delete_by_query_test.go
function TestDeleteByQueryBuildURL (line 12) | func TestDeleteByQueryBuildURL(t *testing.T) {
function TestDeleteByQuery (line 81) | func TestDeleteByQuery(t *testing.T) {
function TestDeleteByQueryAsync (line 147) | func TestDeleteByQueryAsync(t *testing.T) {
FILE: delete_test.go
function TestDelete (line 12) | func TestDelete(t *testing.T) {
function TestDeleteValidate (line 105) | func TestDeleteValidate(t *testing.T) {
function TestDeleteOptimistic (line 127) | func TestDeleteOptimistic(t *testing.T) {
FILE: docvalue_field.go
type DocvalueField (line 9) | type DocvalueField struct
method Source (line 15) | func (d DocvalueField) Source() (interface{}, error) {
type DocvalueFields (line 26) | type DocvalueFields
method Source (line 29) | func (d DocvalueFields) Source() (interface{}, error) {
FILE: docvalue_field_test.go
function TestDocvalueField (line 13) | func TestDocvalueField(t *testing.T) {
function TestDocvalueFields (line 42) | func TestDocvalueFields(t *testing.T) {
FILE: errors.go
function checkResponse (line 28) | func checkResponse(req *http.Request, res *http.Response, ignoreErrors ....
function createResponseError (line 44) | func createResponseError(res *http.Response) error {
type Error (line 67) | type Error struct
method Error (line 105) | func (e *Error) Error() string {
type ErrorDetails (line 74) | type ErrorDetails struct
type ScriptErrorPosition (line 98) | type ScriptErrorPosition struct
function ErrorReason (line 115) | func ErrorReason(err error) string {
function IsContextErr (line 127) | func IsContextErr(err error) bool {
function IsConnErr (line 144) | func IsConnErr(err error) bool {
function IsNotFound (line 151) | func IsNotFound(err interface{}) bool {
function IsTimeout (line 158) | func IsTimeout(err interface{}) bool {
function IsConflict (line 167) | func IsConflict(err interface{}) bool {
function IsUnauthorized (line 176) | func IsUnauthorized(err interface{}) bool {
function IsForbidden (line 184) | func IsForbidden(err interface{}) bool {
function IsStatusCode (line 191) | func IsStatusCode(err interface{}, code int) bool {
type ShardsInfo (line 208) | type ShardsInfo struct
type ShardOperationFailedException (line 216) | type ShardOperationFailedException struct
type BroadcastResponse (line 228) | type BroadcastResponse struct
type FailedNodeException (line 237) | type FailedNodeException struct
FILE: errors_test.go
function TestErrorReason (line 15) | func TestErrorReason(t *testing.T) {
function TestResponseError (line 33) | func TestResponseError(t *testing.T) {
function TestResponseErrorHTML (line 100) | func TestResponseErrorHTML(t *testing.T) {
function TestResponseErrorWithIgnore (line 134) | func TestResponseErrorWithIgnore(t *testing.T) {
function TestIsNotFound (line 159) | func TestIsNotFound(t *testing.T) {
function TestIsTimeout (line 195) | func TestIsTimeout(t *testing.T) {
function TestIsConflict (line 231) | func TestIsConflict(t *testing.T) {
function TestIsStatusCode (line 267) | func TestIsStatusCode(t *testing.T) {
FILE: example_test.go
type Tweet (line 19) | type Tweet struct
function Example (line 30) | func Example() {
function ExampleNewClient_default (line 241) | func ExampleNewClient_default() {
function ExampleNewClient_cluster (line 255) | func ExampleNewClient_cluster() {
function ExampleNewClient_manyOptions (line 266) | func ExampleNewClient_manyOptions() {
function ExampleIndicesExistsService (line 286) | func ExampleIndicesExistsService() {
function ExampleIndicesCreateService (line 304) | func ExampleIndicesCreateService() {
function ExampleIndicesDeleteService (line 322) | func ExampleIndicesDeleteService() {
function ExampleSearchService (line 340) | func ExampleSearchService() {
function ExampleAggregations (line 390) | func ExampleAggregations() {
function ExampleSearchResult (line 439) | func ExampleSearchResult() {
function ExampleClusterHealthService (line 490) | func ExampleClusterHealthService() {
function ExampleClusterHealthService_WaitForStatus (line 507) | func ExampleClusterHealthService_WaitForStatus() {
function ExampleClusterStateService (line 525) | func ExampleClusterStateService() {
FILE: exists.go
type ExistsService (line 21) | type ExistsService struct
method Pretty (line 49) | func (s *ExistsService) Pretty(pretty bool) *ExistsService {
method Human (line 56) | func (s *ExistsService) Human(human bool) *ExistsService {
method ErrorTrace (line 62) | func (s *ExistsService) ErrorTrace(errorTrace bool) *ExistsService {
method FilterPath (line 68) | func (s *ExistsService) FilterPath(filterPath ...string) *ExistsService {
method Header (line 74) | func (s *ExistsService) Header(name string, value string) *ExistsServi...
method Headers (line 83) | func (s *ExistsService) Headers(headers http.Header) *ExistsService {
method Id (line 89) | func (s *ExistsService) Id(id string) *ExistsService {
method Index (line 95) | func (s *ExistsService) Index(index string) *ExistsService {
method Type (line 102) | func (s *ExistsService) Type(typ string) *ExistsService {
method Preference (line 108) | func (s *ExistsService) Preference(preference string) *ExistsService {
method Realtime (line 114) | func (s *ExistsService) Realtime(realtime bool) *ExistsService {
method Refresh (line 123) | func (s *ExistsService) Refresh(refresh string) *ExistsService {
method Routing (line 129) | func (s *ExistsService) Routing(routing string) *ExistsService {
method Parent (line 135) | func (s *ExistsService) Parent(parent string) *ExistsService {
method buildURL (line 141) | func (s *ExistsService) buildURL() (string, url.Values, error) {
method Validate (line 185) | func (s *ExistsService) Validate() error {
method Do (line 203) | func (s *ExistsService) Do(ctx context.Context) (bool, error) {
function NewExistsService (line 41) | func NewExistsService(client *Client) *ExistsService {
FILE: exists_test.go
function TestExists (line 12) | func TestExists(t *testing.T) {
function TestExistsValidate (line 24) | func TestExistsValidate(t *testing.T) {
FILE: explain.go
type ExplainService (line 20) | type ExplainService struct
method Pretty (line 64) | func (s *ExplainService) Pretty(pretty bool) *ExplainService {
method Human (line 71) | func (s *ExplainService) Human(human bool) *ExplainService {
method ErrorTrace (line 77) | func (s *ExplainService) ErrorTrace(errorTrace bool) *ExplainService {
method FilterPath (line 83) | func (s *ExplainService) FilterPath(filterPath ...string) *ExplainServ...
method Header (line 89) | func (s *ExplainService) Header(name string, value string) *ExplainSer...
method Headers (line 98) | func (s *ExplainService) Headers(headers http.Header) *ExplainService {
method Id (line 104) | func (s *ExplainService) Id(id string) *ExplainService {
method Index (line 110) | func (s *ExplainService) Index(index string) *ExplainService {
method Type (line 118) | func (s *ExplainService) Type(typ string) *ExplainService {
method Source (line 124) | func (s *ExplainService) Source(source string) *ExplainService {
method XSourceExclude (line 130) | func (s *ExplainService) XSourceExclude(xSourceExclude ...string) *Exp...
method Lenient (line 137) | func (s *ExplainService) Lenient(lenient bool) *ExplainService {
method Q (line 143) | func (s *ExplainService) Q(q string) *ExplainService {
method Routing (line 149) | func (s *ExplainService) Routing(routing string) *ExplainService {
method AnalyzeWildcard (line 156) | func (s *ExplainService) AnalyzeWildcard(analyzeWildcard bool) *Explai...
method Analyzer (line 162) | func (s *ExplainService) Analyzer(analyzer string) *ExplainService {
method Df (line 168) | func (s *ExplainService) Df(df string) *ExplainService {
method Fields (line 174) | func (s *ExplainService) Fields(fields ...string) *ExplainService {
method LowercaseExpandedTerms (line 180) | func (s *ExplainService) LowercaseExpandedTerms(lowercaseExpandedTerms...
method XSourceInclude (line 186) | func (s *ExplainService) XSourceInclude(xSourceInclude ...string) *Exp...
method DefaultOperator (line 192) | func (s *ExplainService) DefaultOperator(defaultOperator string) *Expl...
method Parent (line 198) | func (s *ExplainService) Parent(parent string) *ExplainService {
method Preference (line 204) | func (s *ExplainService) Preference(preference string) *ExplainService {
method XSource (line 210) | func (s *ExplainService) XSource(xSource ...string) *ExplainService {
method Query (line 216) | func (s *ExplainService) Query(query Query) *ExplainService {
method BodyJson (line 229) | func (s *ExplainService) BodyJson(body interface{}) *ExplainService {
method BodyString (line 235) | func (s *ExplainService) BodyString(body string) *ExplainService {
method buildURL (line 241) | func (s *ExplainService) buildURL() (string, url.Values, error) {
method Validate (line 325) | func (s *ExplainService) Validate() error {
method Do (line 343) | func (s *ExplainService) Do(ctx context.Context) (*ExplainResponse, er...
function NewExplainService (line 52) | func NewExplainService(client *Client) *ExplainService {
type ExplainResponse (line 384) | type ExplainResponse struct
FILE: explain_test.go
function TestExplain (line 12) | func TestExplain(t *testing.T) {
FILE: fetch_source_context.go
type FetchSourceContext (line 19) | type FetchSourceContext struct
method FetchSource (line 35) | func (fsc *FetchSourceContext) FetchSource() bool {
method SetFetchSource (line 40) | func (fsc *FetchSourceContext) SetFetchSource(fetchSource bool) {
method Include (line 46) | func (fsc *FetchSourceContext) Include(includes ...string) *FetchSourc...
method Exclude (line 53) | func (fsc *FetchSourceContext) Exclude(excludes ...string) *FetchSourc...
method Source (line 59) | func (fsc *FetchSourceContext) Source() (interface{}, error) {
method Query (line 77) | func (fsc *FetchSourceContext) Query() url.Values {
function NewFetchSourceContext (line 26) | func NewFetchSourceContext(fetchSource bool) *FetchSourceContext {
FILE: fetch_source_context_test.go
function TestFetchSourceContextNoFetchSource (line 12) | func TestFetchSourceContextNoFetchSource(t *testing.T) {
function TestFetchSourceContextNoFetchSourceIgnoreIncludesAndExcludes (line 29) | func TestFetchSourceContextNoFetchSourceIgnoreIncludesAndExcludes(t *tes...
function TestFetchSourceContextFetchSource (line 46) | func TestFetchSourceContextFetchSource(t *testing.T) {
function TestFetchSourceContextFetchSourceWithIncludesOnly (line 63) | func TestFetchSourceContextFetchSourceWithIncludesOnly(t *testing.T) {
function TestFetchSourceContextFetchSourceWithIncludesAndExcludes (line 80) | func TestFetchSourceContextFetchSourceWithIncludesAndExcludes(t *testing...
function TestFetchSourceContextQueryDefaults (line 97) | func TestFetchSourceContextQueryDefaults(t *testing.T) {
function TestFetchSourceContextQueryNoFetchSource (line 107) | func TestFetchSourceContextQueryNoFetchSource(t *testing.T) {
function TestFetchSourceContextQueryFetchSourceWithIncludesAndExcludes (line 117) | func TestFetchSourceContextQueryFetchSourceWithIncludesAndExcludes(t *te...
FILE: field_caps.go
type FieldCapsService (line 21) | type FieldCapsService struct
method Pretty (line 48) | func (s *FieldCapsService) Pretty(pretty bool) *FieldCapsService {
method Human (line 55) | func (s *FieldCapsService) Human(human bool) *FieldCapsService {
method ErrorTrace (line 61) | func (s *FieldCapsService) ErrorTrace(errorTrace bool) *FieldCapsServi...
method FilterPath (line 67) | func (s *FieldCapsService) FilterPath(filterPath ...string) *FieldCaps...
method Header (line 73) | func (s *FieldCapsService) Header(name string, value string) *FieldCap...
method Headers (line 82) | func (s *FieldCapsService) Headers(headers http.Header) *FieldCapsServ...
method Index (line 89) | func (s *FieldCapsService) Index(index ...string) *FieldCapsService {
method AllowNoIndices (line 97) | func (s *FieldCapsService) AllowNoIndices(allowNoIndices bool) *FieldC...
method ExpandWildcards (line 104) | func (s *FieldCapsService) ExpandWildcards(expandWildcards string) *Fi...
method Fields (line 110) | func (s *FieldCapsService) Fields(fields ...string) *FieldCapsService {
method IgnoreUnavailable (line 116) | func (s *FieldCapsService) IgnoreUnavailable(ignoreUnavailable bool) *...
method IncludeUnmapped (line 122) | func (s *FieldCapsService) IncludeUnmapped(includeUnmapped bool) *Fiel...
method BodyJson (line 128) | func (s *FieldCapsService) BodyJson(body interface{}) *FieldCapsService {
method BodyString (line 134) | func (s *FieldCapsService) BodyString(body string) *FieldCapsService {
method buildURL (line 140) | func (s *FieldCapsService) buildURL() (string, url.Values, error) {
method Validate (line 188) | func (s *FieldCapsService) Validate() error {
method Do (line 193) | func (s *FieldCapsService) Do(ctx context.Context) (*FieldCapsResponse...
function NewFieldCapsService (line 41) | func NewFieldCapsService(client *Client) *FieldCapsService {
type FieldCapsRequest (line 243) | type FieldCapsRequest struct
type FieldCapsResponse (line 252) | type FieldCapsResponse struct
type FieldCapsType (line 259) | type FieldCapsType
type FieldCaps (line 262) | type FieldCaps struct
FILE: field_caps_test.go
function TestFieldCapsURLs (line 16) | func TestFieldCapsURLs(t *testing.T) {
function TestFieldCapsRequestSerialize (line 58) | func TestFieldCapsRequestSerialize(t *testing.T) {
function TestFieldCapsRequestDeserialize (line 73) | func TestFieldCapsRequestDeserialize(t *testing.T) {
function TestFieldCapsResponse (line 91) | func TestFieldCapsResponse(t *testing.T) {
function TestFieldCapsIntegrationTest (line 176) | func TestFieldCapsIntegrationTest(t *testing.T) {
FILE: geo_point.go
type GeoPoint (line 15) | type GeoPoint struct
method Source (line 21) | func (pt *GeoPoint) Source() map[string]float64 {
method MarshalJSON (line 29) | func (pt *GeoPoint) MarshalJSON() ([]byte, error) {
function GeoPointFromLatLon (line 34) | func GeoPointFromLatLon(lat, lon float64) *GeoPoint {
function GeoPointFromString (line 40) | func GeoPointFromString(latLon string) (*GeoPoint, error) {
FILE: geo_point_test.go
function TestGeoPointSource (line 13) | func TestGeoPointSource(t *testing.T) {
function TestGeoPointMarshalJSON (line 27) | func TestGeoPointMarshalJSON(t *testing.T) {
function TestGeoPointIndexAndSearch (line 41) | func TestGeoPointIndexAndSearch(t *testing.T) {
FILE: get.go
type GetService (line 23) | type GetService struct
method Pretty (line 56) | func (s *GetService) Pretty(pretty bool) *GetService {
method Human (line 63) | func (s *GetService) Human(human bool) *GetService {
method ErrorTrace (line 69) | func (s *GetService) ErrorTrace(errorTrace bool) *GetService {
method FilterPath (line 75) | func (s *GetService) FilterPath(filterPath ...string) *GetService {
method Header (line 81) | func (s *GetService) Header(name string, value string) *GetService {
method Headers (line 90) | func (s *GetService) Headers(headers http.Header) *GetService {
method Index (line 96) | func (s *GetService) Index(index string) *GetService {
method Type (line 104) | func (s *GetService) Type(typ string) *GetService {
method Id (line 110) | func (s *GetService) Id(id string) *GetService {
method Parent (line 116) | func (s *GetService) Parent(parent string) *GetService {
method Routing (line 122) | func (s *GetService) Routing(routing string) *GetService {
method Preference (line 128) | func (s *GetService) Preference(preference string) *GetService {
method StoredFields (line 134) | func (s *GetService) StoredFields(storedFields ...string) *GetService {
method FetchSource (line 139) | func (s *GetService) FetchSource(fetchSource bool) *GetService {
method FetchSourceContext (line 148) | func (s *GetService) FetchSourceContext(fetchSourceContext *FetchSourc...
method Refresh (line 157) | func (s *GetService) Refresh(refresh string) *GetService {
method Realtime (line 163) | func (s *GetService) Realtime(realtime bool) *GetService {
method VersionType (line 169) | func (s *GetService) VersionType(versionType string) *GetService {
method Version (line 175) | func (s *GetService) Version(version interface{}) *GetService {
method IgnoreErrorsOnGeneratedFields (line 182) | func (s *GetService) IgnoreErrorsOnGeneratedFields(ignore bool) *GetSe...
method Validate (line 188) | func (s *GetService) Validate() error {
method buildURL (line 206) | func (s *GetService) buildURL() (string, url.Values, error) {
method Do (line 267) | func (s *GetService) Do(ctx context.Context) (*GetResult, error) {
function NewGetService (line 48) | func NewGetService(client *Client) *GetService {
type GetResult (line 301) | type GetResult struct
FILE: get_test.go
function TestGet (line 13) | func TestGet(t *testing.T) {
function TestGetWithSourceFiltering (line 47) | func TestGetWithSourceFiltering(t *testing.T) {
function TestGetWithFields (line 93) | func TestGetWithFields(t *testing.T) {
function TestGetValidate (line 144) | func TestGetValidate(t *testing.T) {
FILE: highlight.go
type Highlight (line 10) | type Highlight struct
method Fields (line 43) | func (hl *Highlight) Fields(fields ...*HighlighterField) *Highlight {
method Field (line 48) | func (hl *Highlight) Field(name string) *Highlight {
method TagsSchema (line 54) | func (hl *Highlight) TagsSchema(schemaName string) *Highlight {
method HighlightFilter (line 59) | func (hl *Highlight) HighlightFilter(highlightFilter bool) *Highlight {
method FragmentSize (line 64) | func (hl *Highlight) FragmentSize(fragmentSize int) *Highlight {
method NumOfFragments (line 69) | func (hl *Highlight) NumOfFragments(numOfFragments int) *Highlight {
method Encoder (line 74) | func (hl *Highlight) Encoder(encoder string) *Highlight {
method PreTags (line 79) | func (hl *Highlight) PreTags(preTags ...string) *Highlight {
method PostTags (line 84) | func (hl *Highlight) PostTags(postTags ...string) *Highlight {
method Order (line 89) | func (hl *Highlight) Order(order string) *Highlight {
method RequireFieldMatch (line 94) | func (hl *Highlight) RequireFieldMatch(requireFieldMatch bool) *Highli...
method MaxAnalyzedOffset (line 99) | func (hl *Highlight) MaxAnalyzedOffset(maxAnalyzedOffset int) *Highlig...
method BoundaryMaxScan (line 104) | func (hl *Highlight) BoundaryMaxScan(boundaryMaxScan int) *Highlight {
method BoundaryChars (line 109) | func (hl *Highlight) BoundaryChars(boundaryChars string) *Highlight {
method BoundaryScannerType (line 114) | func (hl *Highlight) BoundaryScannerType(boundaryScannerType string) *...
method BoundaryScannerLocale (line 119) | func (hl *Highlight) BoundaryScannerLocale(boundaryScannerLocale strin...
method HighlighterType (line 124) | func (hl *Highlight) HighlighterType(highlighterType string) *Highlight {
method Fragmenter (line 129) | func (hl *Highlight) Fragmenter(fragmenter string) *Highlight {
method HighlightQuery (line 134) | func (hl *Highlight) HighlightQuery(highlightQuery Query) *Highlight {
method NoMatchSize (line 139) | func (hl *Highlight) NoMatchSize(noMatchSize int) *Highlight {
method Options (line 144) | func (hl *Highlight) Options(options map[string]interface{}) *Highlight {
method ForceSource (line 149) | func (hl *Highlight) ForceSource(forceSource bool) *Highlight {
method UseExplicitFieldOrder (line 154) | func (hl *Highlight) UseExplicitFieldOrder(useExplicitFieldOrder bool)...
method Source (line 160) | func (hl *Highlight) Source() (interface{}, error) {
function NewHighlight (line 36) | func NewHighlight() *Highlight {
type HighlighterField (line 266) | type HighlighterField struct
method PreTags (line 325) | func (f *HighlighterField) PreTags(preTags ...string) *HighlighterField {
method PostTags (line 330) | func (f *HighlighterField) PostTags(postTags ...string) *HighlighterFi...
method FragmentSize (line 335) | func (f *HighlighterField) FragmentSize(fragmentSize int) *Highlighter...
method FragmentOffset (line 340) | func (f *HighlighterField) FragmentOffset(fragmentOffset int) *Highlig...
method NumOfFragments (line 345) | func (f *HighlighterField) NumOfFragments(numOfFragments int) *Highlig...
method HighlightFilter (line 350) | func (f *HighlighterField) HighlightFilter(highlightFilter bool) *High...
method Order (line 355) | func (f *HighlighterField) Order(order string) *HighlighterField {
method RequireFieldMatch (line 360) | func (f *HighlighterField) RequireFieldMatch(requireFieldMatch bool) *...
method BoundaryMaxScan (line 365) | func (f *HighlighterField) BoundaryMaxScan(boundaryMaxScan int) *Highl...
method BoundaryChars (line 370) | func (f *HighlighterField) BoundaryChars(boundaryChars ...rune) *Highl...
method HighlighterType (line 375) | func (f *HighlighterField) HighlighterType(highlighterType string) *Hi...
method Fragmenter (line 380) | func (f *HighlighterField) Fragmenter(fragmenter string) *HighlighterF...
method HighlightQuery (line 385) | func (f *HighlighterField) HighlightQuery(highlightQuery Query) *Highl...
method NoMatchSize (line 390) | func (f *HighlighterField) NoMatchSize(noMatchSize int) *HighlighterFi...
method Options (line 395) | func (f *HighlighterField) Options(options map[string]interface{}) *Hi...
method MatchedFields (line 400) | func (f *HighlighterField) MatchedFields(matchedFields ...string) *Hig...
method PhraseLimit (line 405) | func (f *HighlighterField) PhraseLimit(phraseLimit int) *HighlighterFi...
method ForceSource (line 410) | func (f *HighlighterField) ForceSource(forceSource bool) *HighlighterF...
method Source (line 415) | func (f *HighlighterField) Source() (interface{}, error) {
function NewHighlighterField (line 310) | func NewHighlighterField(name string) *HighlighterField {
FILE: highlight_test.go
function TestHighlighterField (line 13) | func TestHighlighterField(t *testing.T) {
function TestHighlighterFieldWithOptions (line 30) | func TestHighlighterFieldWithOptions(t *testing.T) {
function TestHighlightWithStringField (line 47) | func TestHighlightWithStringField(t *testing.T) {
function TestHighlightWithFields (line 64) | func TestHighlightWithFields(t *testing.T) {
function TestHighlightWithMultipleFields (line 82) | func TestHighlightWithMultipleFields(t *testing.T) {
function TestHighlighterWithExplicitFieldOrder (line 101) | func TestHighlighterWithExplicitFieldOrder(t *testing.T) {
function TestHighlightWithBoundarySettings (line 120) | func TestHighlightWithBoundarySettings(t *testing.T) {
function TestHighlightWithTermQuery (line 139) | func TestHighlightWithTermQuery(t *testing.T) {
FILE: index.go
type IndexService (line 22) | type IndexService struct
method Pretty (line 60) | func (s *IndexService) Pretty(pretty bool) *IndexService {
method Human (line 67) | func (s *IndexService) Human(human bool) *IndexService {
method ErrorTrace (line 73) | func (s *IndexService) ErrorTrace(errorTrace bool) *IndexService {
method FilterPath (line 79) | func (s *IndexService) FilterPath(filterPath ...string) *IndexService {
method Header (line 85) | func (s *IndexService) Header(name string, value string) *IndexService {
method Headers (line 94) | func (s *IndexService) Headers(headers http.Header) *IndexService {
method Id (line 100) | func (s *IndexService) Id(id string) *IndexService {
method Index (line 106) | func (s *IndexService) Index(index string) *IndexService {
method Type (line 114) | func (s *IndexService) Type(typ string) *IndexService {
method WaitForActiveShards (line 124) | func (s *IndexService) WaitForActiveShards(waitForActiveShards string)...
method Pipeline (line 130) | func (s *IndexService) Pipeline(pipeline string) *IndexService {
method Refresh (line 139) | func (s *IndexService) Refresh(refresh string) *IndexService {
method Ttl (line 145) | func (s *IndexService) Ttl(ttl string) *IndexService {
method TTL (line 151) | func (s *IndexService) TTL(ttl string) *IndexService {
method Version (line 157) | func (s *IndexService) Version(version interface{}) *IndexService {
method OpType (line 163) | func (s *IndexService) OpType(opType string) *IndexService {
method Parent (line 169) | func (s *IndexService) Parent(parent string) *IndexService {
method Routing (line 175) | func (s *IndexService) Routing(routing string) *IndexService {
method Timeout (line 181) | func (s *IndexService) Timeout(timeout string) *IndexService {
method Timestamp (line 187) | func (s *IndexService) Timestamp(timestamp string) *IndexService {
method VersionType (line 193) | func (s *IndexService) VersionType(versionType string) *IndexService {
method IfSeqNo (line 200) | func (s *IndexService) IfSeqNo(seqNo int64) *IndexService {
method IfPrimaryTerm (line 207) | func (s *IndexService) IfPrimaryTerm(primaryTerm int64) *IndexService {
method BodyJson (line 213) | func (s *IndexService) BodyJson(body interface{}) *IndexService {
method BodyString (line 219) | func (s *IndexService) BodyString(body string) *IndexService {
method buildURL (line 225) | func (s *IndexService) buildURL() (string, string, url.Values, error) {
method Validate (line 307) | func (s *IndexService) Validate() error {
method Do (line 325) | func (s *IndexService) Do(ctx context.Context) (*IndexResponse, error) {
function NewIndexService (line 52) | func NewIndexService(client *Client) *IndexService {
type IndexResponse (line 366) | type IndexResponse struct
FILE: index_test.go
function TestIndexLifecycle (line 14) | func TestIndexLifecycle(t *testing.T) {
function TestIndexLifecycleWithAutomaticIDGeneration (line 94) | func TestIndexLifecycleWithAutomaticIDGeneration(t *testing.T) {
function TestIndexValidate (line 177) | func TestIndexValidate(t *testing.T) {
function TestIndexCreateExistsOpenCloseDelete (line 192) | func TestIndexCreateExistsOpenCloseDelete(t *testing.T) {
function TestIndexOptimistic (line 270) | func TestIndexOptimistic(t *testing.T) {
function TestIndexOnReadOnlyIndex (line 321) | func TestIndexOnReadOnlyIndex(t *testing.T) {
FILE: indices_analyze.go
type IndicesAnalyzeService (line 22) | type IndicesAnalyzeService struct
method Pretty (line 48) | func (s *IndicesAnalyzeService) Pretty(pretty bool) *IndicesAnalyzeSer...
method Human (line 55) | func (s *IndicesAnalyzeService) Human(human bool) *IndicesAnalyzeServi...
method ErrorTrace (line 61) | func (s *IndicesAnalyzeService) ErrorTrace(errorTrace bool) *IndicesAn...
method FilterPath (line 67) | func (s *IndicesAnalyzeService) FilterPath(filterPath ...string) *Indi...
method Header (line 73) | func (s *IndicesAnalyzeService) Header(name string, value string) *Ind...
method Headers (line 82) | func (s *IndicesAnalyzeService) Headers(headers http.Header) *IndicesA...
method Index (line 88) | func (s *IndicesAnalyzeService) Index(index string) *IndicesAnalyzeSer...
method Format (line 94) | func (s *IndicesAnalyzeService) Format(format string) *IndicesAnalyzeS...
method PreferLocal (line 101) | func (s *IndicesAnalyzeService) PreferLocal(preferLocal bool) *Indices...
method Request (line 107) | func (s *IndicesAnalyzeService) Request(request *IndicesAnalyzeRequest...
method Analyzer (line 117) | func (s *IndicesAnalyzeService) Analyzer(analyzer string) *IndicesAnal...
method Attributes (line 124) | func (s *IndicesAnalyzeService) Attributes(attributes ...string) *Indi...
method CharFilter (line 130) | func (s *IndicesAnalyzeService) CharFilter(charFilter ...string) *Indi...
method Explain (line 136) | func (s *IndicesAnalyzeService) Explain(explain bool) *IndicesAnalyzeS...
method Field (line 142) | func (s *IndicesAnalyzeService) Field(field string) *IndicesAnalyzeSer...
method Filter (line 148) | func (s *IndicesAnalyzeService) Filter(filter ...string) *IndicesAnaly...
method Text (line 154) | func (s *IndicesAnalyzeService) Text(text ...string) *IndicesAnalyzeSe...
method Tokenizer (line 160) | func (s *IndicesAnalyzeService) Tokenizer(tokenizer string) *IndicesAn...
method BodyJson (line 166) | func (s *IndicesAnalyzeService) BodyJson(body interface{}) *IndicesAna...
method BodyString (line 172) | func (s *IndicesAnalyzeService) BodyString(body string) *IndicesAnalyz...
method buildURL (line 178) | func (s *IndicesAnalyzeService) buildURL() (string, url.Values, error) {
method Do (line 219) | func (s *IndicesAnalyzeService) Do(ctx context.Context) (*IndicesAnaly...
method Validate (line 262) | func (s *IndicesAnalyzeService) Validate() error {
function NewIndicesAnalyzeService (line 40) | func NewIndicesAnalyzeService(client *Client) *IndicesAnalyzeService {
type IndicesAnalyzeRequest (line 276) | type IndicesAnalyzeRequest struct
type IndicesAnalyzeResponse (line 287) | type IndicesAnalyzeResponse struct
type AnalyzeTokenList (line 292) | type AnalyzeTokenList struct
type AnalyzeToken (line 297) | type AnalyzeToken struct
type CharFilteredText (line 309) | type CharFilteredText struct
type IndicesAnalyzeResponseDetail (line 314) | type IndicesAnalyzeResponseDetail struct
FILE: indices_analyze_test.go
function TestIndicesAnalyzeURL (line 8) | func TestIndicesAnalyzeURL(t *testing.T) {
function TestIndicesAnalyze (line 36) | func TestIndicesAnalyze(t *testing.T) {
function TestIndicesAnalyzeDetail (line 49) | func TestIndicesAnalyzeDetail(t *testing.T) {
function TestIndicesAnalyzeWithIndex (line 63) | func TestIndicesAnalyzeWithIndex(t *testing.T) {
function TestIndicesAnalyzeValidate (line 75) | func TestIndicesAnalyzeValidate(t *testing.T) {
FILE: indices_clear_cache.go
type IndicesClearCacheService (line 22) | type IndicesClearCacheService struct
method Pretty (line 48) | func (s *IndicesClearCacheService) Pretty(pretty bool) *IndicesClearCa...
method Human (line 55) | func (s *IndicesClearCacheService) Human(human bool) *IndicesClearCach...
method ErrorTrace (line 61) | func (s *IndicesClearCacheService) ErrorTrace(errorTrace bool) *Indice...
method FilterPath (line 67) | func (s *IndicesClearCacheService) FilterPath(filterPath ...string) *I...
method Header (line 73) | func (s *IndicesClearCacheService) Header(name string, value string) *...
method Headers (line 82) | func (s *IndicesClearCacheService) Headers(headers http.Header) *Indic...
method Index (line 88) | func (s *IndicesClearCacheService) Index(indices ...string) *IndicesCl...
method IgnoreUnavailable (line 95) | func (s *IndicesClearCacheService) IgnoreUnavailable(ignoreUnavailable...
method AllowNoIndices (line 103) | func (s *IndicesClearCacheService) AllowNoIndices(allowNoIndices bool)...
method ExpandWildcards (line 110) | func (s *IndicesClearCacheService) ExpandWildcards(expandWildcards str...
method FieldData (line 117) | func (s *IndicesClearCacheService) FieldData(fieldData bool) *IndicesC...
method Fields (line 124) | func (s *IndicesClearCacheService) Fields(fields string) *IndicesClear...
method Query (line 130) | func (s *IndicesClearCacheService) Query(queryCache bool) *IndicesClea...
method Request (line 136) | func (s *IndicesClearCacheService) Request(requestCache bool) *Indices...
method buildURL (line 142) | func (s *IndicesClearCacheService) buildURL() (string, url.Values, err...
method Validate (line 201) | func (s *IndicesClearCacheService) Validate() error {
method Do (line 206) | func (s *IndicesClearCacheService) Do(ctx context.Context) (*IndicesCl...
function NewIndicesClearCacheService (line 43) | func NewIndicesClearCacheService(client *Client) *IndicesClearCacheServi...
type IndicesClearCacheResponse (line 238) | type IndicesClearCacheResponse struct
FILE: indices_clear_cache_test.go
function TestIndicesClearCache (line 12) | func TestIndicesClearCache(t *testing.T) {
function TestIndicesClearCacheBuildURL (line 24) | func TestIndicesClearCacheBuildURL(t *testing.T) {
FILE: indices_close.go
type IndicesCloseService (line 21) | type IndicesCloseService struct
method Pretty (line 44) | func (s *IndicesCloseService) Pretty(pretty bool) *IndicesCloseService {
method Human (line 51) | func (s *IndicesCloseService) Human(human bool) *IndicesCloseService {
method ErrorTrace (line 57) | func (s *IndicesCloseService) ErrorTrace(errorTrace bool) *IndicesClos...
method FilterPath (line 63) | func (s *IndicesCloseService) FilterPath(filterPath ...string) *Indice...
method Header (line 69) | func (s *IndicesCloseService) Header(name string, value string) *Indic...
method Headers (line 78) | func (s *IndicesCloseService) Headers(headers http.Header) *IndicesClo...
method Index (line 84) | func (s *IndicesCloseService) Index(index string) *IndicesCloseService {
method Timeout (line 90) | func (s *IndicesCloseService) Timeout(timeout string) *IndicesCloseSer...
method MasterTimeout (line 96) | func (s *IndicesCloseService) MasterTimeout(masterTimeout string) *Ind...
method IgnoreUnavailable (line 103) | func (s *IndicesCloseService) IgnoreUnavailable(ignoreUnavailable bool...
method AllowNoIndices (line 110) | func (s *IndicesCloseService) AllowNoIndices(allowNoIndices bool) *Ind...
method ExpandWildcards (line 117) | func (s *IndicesCloseService) ExpandWildcards(expandWildcards string) ...
method buildURL (line 123) | func (s *IndicesCloseService) buildURL() (string, url.Values, error) {
method Validate (line 166) | func (s *IndicesCloseService) Validate() error {
method Do (line 178) | func (s *IndicesCloseService) Do(ctx context.Context) (*IndicesCloseRe...
function NewIndicesCloseService (line 39) | func NewIndicesCloseService(client *Client) *IndicesCloseService {
type IndicesCloseResponse (line 210) | type IndicesCloseResponse struct
FILE: indices_close_test.go
function TestIndicesCloseValidate (line 73) | func TestIndicesCloseValidate(t *testing.T) {
FILE: indices_component_templates_test.go
function TestComponentTemplatesLifecycle (line 12) | func TestComponentTemplatesLifecycle(t *testing.T) {
FILE: indices_create.go
type IndicesCreateService (line 22) | type IndicesCreateService struct
method Pretty (line 45) | func (s *IndicesCreateService) Pretty(pretty bool) *IndicesCreateServi...
method Human (line 52) | func (s *IndicesCreateService) Human(human bool) *IndicesCreateService {
method ErrorTrace (line 58) | func (s *IndicesCreateService) ErrorTrace(errorTrace bool) *IndicesCre...
method FilterPath (line 64) | func (s *IndicesCreateService) FilterPath(filterPath ...string) *Indic...
method Header (line 70) | func (s *IndicesCreateService) Header(name string, value string) *Indi...
method Headers (line 79) | func (s *IndicesCreateService) Headers(headers http.Header) *IndicesCr...
method Index (line 85) | func (s *IndicesCreateService) Index(index string) *IndicesCreateServi...
method Timeout (line 91) | func (s *IndicesCreateService) Timeout(timeout string) *IndicesCreateS...
method MasterTimeout (line 97) | func (s *IndicesCreateService) MasterTimeout(masterTimeout string) *In...
method IncludeTypeName (line 103) | func (s *IndicesCreateService) IncludeTypeName(includeTypeName bool) *...
method Body (line 110) | func (s *IndicesCreateService) Body(body string) *IndicesCreateService {
method BodyString (line 116) | func (s *IndicesCreateService) BodyString(body string) *IndicesCreateS...
method BodyJson (line 123) | func (s *IndicesCreateService) BodyJson(body interface{}) *IndicesCrea...
method Do (line 129) | func (s *IndicesCreateService) Do(ctx context.Context) (*IndicesCreate...
function NewIndicesCreateService (line 40) | func NewIndicesCreateService(client *Client) *IndicesCreateService {
type IndicesCreateResult (line 195) | type IndicesCreateResult struct
FILE: indices_create_test.go
function TestIndicesLifecycle (line 12) | func TestIndicesLifecycle(t *testing.T) {
function TestIndicesCreateValidate (line 52) | func TestIndicesCreateValidate(t *testing.T) {
FILE: indices_delete.go
type IndicesDeleteService (line 21) | type IndicesDeleteService struct
method Pretty (line 47) | func (s *IndicesDeleteService) Pretty(pretty bool) *IndicesDeleteServi...
method Human (line 54) | func (s *IndicesDeleteService) Human(human bool) *IndicesDeleteService {
method ErrorTrace (line 60) | func (s *IndicesDeleteService) ErrorTrace(errorTrace bool) *IndicesDel...
method FilterPath (line 66) | func (s *IndicesDeleteService) FilterPath(filterPath ...string) *Indic...
method Header (line 72) | func (s *IndicesDeleteService) Header(name string, value string) *Indi...
method Headers (line 81) | func (s *IndicesDeleteService) Headers(headers http.Header) *IndicesDe...
method Index (line 88) | func (s *IndicesDeleteService) Index(index []string) *IndicesDeleteSer...
method Timeout (line 94) | func (s *IndicesDeleteService) Timeout(timeout string) *IndicesDeleteS...
method MasterTimeout (line 100) | func (s *IndicesDeleteService) MasterTimeout(masterTimeout string) *In...
method IgnoreUnavailable (line 106) | func (s *IndicesDeleteService) IgnoreUnavailable(ignoreUnavailable boo...
method AllowNoIndices (line 113) | func (s *IndicesDeleteService) AllowNoIndices(allowNoIndices bool) *In...
method ExpandWildcards (line 120) | func (s *IndicesDeleteService) ExpandWildcards(expandWildcards string)...
method buildURL (line 126) | func (s *IndicesDeleteService) buildURL() (string, url.Values, error) {
method Validate (line 168) | func (s *IndicesDeleteService) Validate() error {
method Do (line 180) | func (s *IndicesDeleteService) Do(ctx context.Context) (*IndicesDelete...
function NewIndicesDeleteService (line 39) | func NewIndicesDeleteService(client *Client) *IndicesDeleteService {
type IndicesDeleteResponse (line 214) | type IndicesDeleteResponse struct
FILE: indices_delete_component_template.go
type IndicesDeleteComponentTemplateService (line 21) | type IndicesDeleteComponentTemplateService struct
method Pretty (line 43) | func (s *IndicesDeleteComponentTemplateService) Pretty(pretty bool) *I...
method Human (line 50) | func (s *IndicesDeleteComponentTemplateService) Human(human bool) *Ind...
method ErrorTrace (line 56) | func (s *IndicesDeleteComponentTemplateService) ErrorTrace(errorTrace ...
method FilterPath (line 62) | func (s *IndicesDeleteComponentTemplateService) FilterPath(filterPath ...
method Header (line 68) | func (s *IndicesDeleteComponentTemplateService) Header(name string, va...
method Headers (line 77) | func (s *IndicesDeleteComponentTemplateService) Headers(headers http.H...
method Name (line 83) | func (s *IndicesDeleteComponentTemplateService) Name(name string) *Ind...
method Timeout (line 89) | func (s *IndicesDeleteComponentTemplateService) Timeout(timeout string...
method MasterTimeout (line 95) | func (s *IndicesDeleteComponentTemplateService) MasterTimeout(masterTi...
method buildURL (line 101) | func (s *IndicesDeleteComponentTemplateService) buildURL() (string, ur...
method Validate (line 134) | func (s *IndicesDeleteComponentTemplateService) Validate() error {
method Do (line 146) | func (s *IndicesDeleteComponentTemplateService) Do(ctx context.Context...
function NewIndicesDeleteComponentTemplateService (line 36) | func NewIndicesDeleteComponentTemplateService(client *Client) *IndicesDe...
type IndicesDeleteComponentTemplateResponse (line 178) | type IndicesDeleteComponentTemplateResponse struct
FILE: indices_delete_index_template.go
type IndicesDeleteIndexTemplateService (line 25) | type IndicesDeleteIndexTemplateService struct
method Pretty (line 47) | func (s *IndicesDeleteIndexTemplateService) Pretty(pretty bool) *Indic...
method Human (line 54) | func (s *IndicesDeleteIndexTemplateService) Human(human bool) *Indices...
method ErrorTrace (line 60) | func (s *IndicesDeleteIndexTemplateService) ErrorTrace(errorTrace bool...
method FilterPath (line 66) | func (s *IndicesDeleteIndexTemplateService) FilterPath(filterPath ...s...
method Header (line 72) | func (s *IndicesDeleteIndexTemplateService) Header(name string, value ...
method Headers (line 81) | func (s *IndicesDeleteIndexTemplateService) Headers(headers http.Heade...
method Name (line 87) | func (s *IndicesDeleteIndexTemplateService) Name(name string) *Indices...
method Timeout (line 93) | func (s *IndicesDeleteIndexTemplateService) Timeout(timeout string) *I...
method MasterTimeout (line 99) | func (s *IndicesDeleteIndexTemplateService) MasterTimeout(masterTimeou...
method buildURL (line 105) | func (s *IndicesDeleteIndexTemplateService) buildURL() (string, url.Va...
method Validate (line 138) | func (s *IndicesDeleteIndexTemplateService) Validate() error {
method Do (line 150) | func (s *IndicesDeleteIndexTemplateService) Do(ctx context.Context) (*...
function NewIndicesDeleteIndexTemplateService (line 40) | func NewIndicesDeleteIndexTemplateService(client *Client) *IndicesDelete...
type IndicesDeleteIndexTemplateResponse (line 182) | type IndicesDeleteIndexTemplateResponse struct
FILE: indices_delete_integration_test.go
function TestIndicesDeleteIntegration (line 12) | func TestIndicesDeleteIntegration(t *testing.T) {
FILE: indices_delete_template.go
type IndicesDeleteTemplateService (line 27) | type IndicesDeleteTemplateService struct
method Pretty (line 49) | func (s *IndicesDeleteTemplateService) Pretty(pretty bool) *IndicesDel...
method Human (line 56) | func (s *IndicesDeleteTemplateService) Human(human bool) *IndicesDelet...
method ErrorTrace (line 62) | func (s *IndicesDeleteTemplateService) ErrorTrace(errorTrace bool) *In...
method FilterPath (line 68) | func (s *IndicesDeleteTemplateService) FilterPath(filterPath ...string...
method Header (line 74) | func (s *IndicesDeleteTemplateService) Header(name string, value strin...
method Headers (line 83) | func (s *IndicesDeleteTemplateService) Headers(headers http.Header) *I...
method Name (line 89) | func (s *IndicesDeleteTemplateService) Name(name string) *IndicesDelet...
method Timeout (line 95) | func (s *IndicesDeleteTemplateService) Timeout(timeout string) *Indice...
method MasterTimeout (line 101) | func (s *IndicesDeleteTemplateService) MasterTimeout(masterTimeout str...
method buildURL (line 107) | func (s *IndicesDeleteTemplateService) buildURL() (string, url.Values,...
method Validate (line 140) | func (s *IndicesDeleteTemplateService) Validate() error {
method Do (line 154) | func (s *IndicesDeleteTemplateService) Do(ctx context.Context) (*Indic...
function NewIndicesDeleteTemplateService (line 42) | func NewIndicesDeleteTemplateService(client *Client) *IndicesDeleteTempl...
type IndicesDeleteTemplateResponse (line 186) | type IndicesDeleteTemplateResponse struct
FILE: indices_delete_test.go
function TestIndicesDeleteValidate (line 12) | func TestIndicesDeleteValidate(t *testing.T) {
FILE: indices_exists.go
type IndicesExistsService (line 21) | type IndicesExistsService struct
method Pretty (line 46) | func (s *IndicesExistsService) Pretty(pretty bool) *IndicesExistsServi...
method Human (line 53) | func (s *IndicesExistsService) Human(human bool) *IndicesExistsService {
method ErrorTrace (line 59) | func (s *IndicesExistsService) ErrorTrace(errorTrace bool) *IndicesExi...
method FilterPath (line 65) | func (s *IndicesExistsService) FilterPath(filterPath ...string) *Indic...
method Header (line 71) | func (s *IndicesExistsService) Header(name string, value string) *Indi...
method Headers (line 80) | func (s *IndicesExistsService) Headers(headers http.Header) *IndicesEx...
method Index (line 86) | func (s *IndicesExistsService) Index(index []string) *IndicesExistsSer...
method AllowNoIndices (line 94) | func (s *IndicesExistsService) AllowNoIndices(allowNoIndices bool) *In...
method ExpandWildcards (line 101) | func (s *IndicesExistsService) ExpandWildcards(expandWildcards string)...
method Local (line 108) | func (s *IndicesExistsService) Local(local bool) *IndicesExistsService {
method IgnoreUnavailable (line 115) | func (s *IndicesExistsService) IgnoreUnavailable(ignoreUnavailable boo...
method buildURL (line 121) | func (s *IndicesExistsService) buildURL() (string, url.Values, error) {
method Validate (line 160) | func (s *IndicesExistsService) Validate() error {
method Do (line 172) | func (s *IndicesExistsService) Do(ctx context.Context) (bool, error) {
function NewIndicesExistsService (line 38) | func NewIndicesExistsService(client *Client) *IndicesExistsService {
FILE: indices_exists_template.go
type IndicesExistsTemplateService (line 22) | type IndicesExistsTemplateService struct
method Pretty (line 44) | func (s *IndicesExistsTemplateService) Pretty(pretty bool) *IndicesExi...
method Human (line 51) | func (s *IndicesExistsTemplateService) Human(human bool) *IndicesExist...
method ErrorTrace (line 57) | func (s *IndicesExistsTemplateService) ErrorTrace(errorTrace bool) *In...
method FilterPath (line 63) | func (s *IndicesExistsTemplateService) FilterPath(filterPath ...string...
method Header (line 69) | func (s *IndicesExistsTemplateService) Header(name string, value strin...
method Headers (line 78) | func (s *IndicesExistsTemplateService) Headers(headers http.Header) *I...
method Name (line 84) | func (s *IndicesExistsTemplateService) Name(name string) *IndicesExist...
method Local (line 91) | func (s *IndicesExistsTemplateService) Local(local bool) *IndicesExist...
method MasterTimeout (line 97) | func (s *IndicesExistsTemplateService) MasterTimeout(masterTimeout str...
method buildURL (line 103) | func (s *IndicesExistsTemplateService) buildURL() (string, url.Values,...
method Validate (line 136) | func (s *IndicesExistsTemplateService) Validate() error {
method Do (line 150) | func (s *IndicesExistsTemplateService) Do(ctx context.Context) (bool, ...
function NewIndicesExistsTemplateService (line 37) | func NewIndicesExistsTemplateService(client *Client) *IndicesExistsTempl...
FILE: indices_exists_template_test.go
function TestIndexExistsTemplate (line 12) | func TestIndexExistsTemplate(t *testing.T) {
FILE: indices_exists_test.go
function TestIndicesExistsWithoutIndex (line 12) | func TestIndicesExistsWithoutIndex(t *testing.T) {
FILE: indices_flush.go
type IndicesFlushService (line 23) | type IndicesFlushService struct
method Pretty (line 49) | func (s *IndicesFlushService) Pretty(pretty bool) *IndicesFlushService {
method Human (line 56) | func (s *IndicesFlushService) Human(human bool) *IndicesFlushService {
method ErrorTrace (line 62) | func (s *IndicesFlushService) ErrorTrace(errorTrace bool) *IndicesFlus...
method FilterPath (line 68) | func (s *IndicesFlushService) FilterPath(filterPath ...string) *Indice...
method Header (line 74) | func (s *IndicesFlushService) Header(name string, value string) *Indic...
method Headers (line 83) | func (s *IndicesFlushService) Headers(headers http.Header) *IndicesFlu...
method Index (line 89) | func (s *IndicesFlushService) Index(indices ...string) *IndicesFlushSe...
method Force (line 98) | func (s *IndicesFlushService) Force(force bool) *IndicesFlushService {
method WaitIfOngoing (line 107) | func (s *IndicesFlushService) WaitIfOngoing(waitIfOngoing bool) *Indic...
method IgnoreUnavailable (line 114) | func (s *IndicesFlushService) IgnoreUnavailable(ignoreUnavailable bool...
method AllowNoIndices (line 122) | func (s *IndicesFlushService) AllowNoIndices(allowNoIndices bool) *Ind...
method ExpandWildcards (line 129) | func (s *IndicesFlushService) ExpandWildcards(expandWildcards string) ...
method buildURL (line 135) | func (s *IndicesFlushService) buildURL() (string, url.Values, error) {
method Validate (line 184) | func (s *IndicesFlushService) Validate() error {
method Do (line 189) | func (s *IndicesFlushService) Do(ctx context.Context) (*IndicesFlushRe...
function NewIndicesFlushService (line 41) | func NewIndicesFlushService(client *Client) *IndicesFlushService {
type IndicesFlushResponse (line 222) | type IndicesFlushResponse struct
FILE: indices_flush_synced.go
type IndicesSyncedFlushService (line 23) | type IndicesSyncedFlushService struct
method Pretty (line 46) | func (s *IndicesSyncedFlushService) Pretty(pretty bool) *IndicesSynced...
method Human (line 53) | func (s *IndicesSyncedFlushService) Human(human bool) *IndicesSyncedFl...
method ErrorTrace (line 59) | func (s *IndicesSyncedFlushService) ErrorTrace(errorTrace bool) *Indic...
method FilterPath (line 65) | func (s *IndicesSyncedFlushService) FilterPath(filterPath ...string) *...
method Header (line 71) | func (s *IndicesSyncedFlushService) Header(name string, value string) ...
method Headers (line 80) | func (s *IndicesSyncedFlushService) Headers(headers http.Header) *Indi...
method Index (line 86) | func (s *IndicesSyncedFlushService) Index(indices ...string) *IndicesS...
method IgnoreUnavailable (line 93) | func (s *IndicesSyncedFlushService) IgnoreUnavailable(ignoreUnavailabl...
method AllowNoIndices (line 101) | func (s *IndicesSyncedFlushService) AllowNoIndices(allowNoIndices bool...
method ExpandWildcards (line 108) | func (s *IndicesSyncedFlushService) ExpandWildcards(expandWildcards st...
method buildURL (line 114) | func (s *IndicesSyncedFlushService) buildURL() (string, url.Values, er...
method Validate (line 157) | func (s *IndicesSyncedFlushService) Validate() error {
method Do (line 165) | func (s *IndicesSyncedFlushService) Do(ctx context.Context) (*IndicesS...
function NewIndicesSyncedFlushService (line 39) | func NewIndicesSyncedFlushService(client *Client) *IndicesSyncedFlushSer...
type IndicesSyncedFlushResponse (line 199) | type IndicesSyncedFlushResponse struct
method UnmarshalJSON (line 263) | func (resp *IndicesSyncedFlushResponse) UnmarshalJSON(data []byte) err...
type IndicesShardsSyncedFlushResult (line 236) | type IndicesShardsSyncedFlushResult struct
type IndicesShardsSyncedFlushResultFailure (line 245) | type IndicesShardsSyncedFlushResultFailure struct
FILE: indices_flush_synced_test.go
function TestSyncedFlush (line 13) | func TestSyncedFlush(t *testing.T) {
function TestSyncedFlushBuildURL (line 27) | func TestSyncedFlushBuildURL(t *testing.T) {
function TestSyncedFlushResponse (line 74) | func TestSyncedFlushResponse(t *testing.T) {
FILE: indices_flush_test.go
function TestFlush (line 12) | func TestFlush(t *testing.T) {
function TestFlushBuildURL (line 25) | func TestFlushBuildURL(t *testing.T) {
FILE: indices_forcemerge.go
type IndicesForcemergeService (line 24) | type IndicesForcemergeService struct
method Pretty (line 51) | func (s *IndicesForcemergeService) Pretty(pretty bool) *IndicesForceme...
method Human (line 58) | func (s *IndicesForcemergeService) Human(human bool) *IndicesForcemerg...
method ErrorTrace (line 64) | func (s *IndicesForcemergeService) ErrorTrace(errorTrace bool) *Indice...
method FilterPath (line 70) | func (s *IndicesForcemergeService) FilterPath(filterPath ...string) *I...
method Header (line 76) | func (s *IndicesForcemergeService) Header(name string, value string) *...
method Headers (line 85) | func (s *IndicesForcemergeService) Headers(headers http.Header) *Indic...
method Index (line 92) | func (s *IndicesForcemergeService) Index(index ...string) *IndicesForc...
method AllowNoIndices (line 103) | func (s *IndicesForcemergeService) AllowNoIndices(allowNoIndices bool)...
method ExpandWildcards (line 110) | func (s *IndicesForcemergeService) ExpandWildcards(expandWildcards str...
method Flush (line 117) | func (s *IndicesForcemergeService) Flush(flush bool) *IndicesForcemerg...
method IgnoreUnavailable (line 124) | func (s *IndicesForcemergeService) IgnoreUnavailable(ignoreUnavailable...
method MaxNumSegments (line 131) | func (s *IndicesForcemergeService) MaxNumSegments(maxNumSegments inter...
method OnlyExpungeDeletes (line 138) | func (s *IndicesForcemergeService) OnlyExpungeDeletes(onlyExpungeDelet...
method buildURL (line 144) | func (s *IndicesForcemergeService) buildURL() (string, url.Values, err...
method Validate (line 196) | func (s *IndicesForcemergeService) Validate() error {
method Do (line 201) | func (s *IndicesForcemergeService) Do(ctx context.Context) (*IndicesFo...
function NewIndicesForcemergeService (line 43) | func NewIndicesForcemergeService(client *Client) *IndicesForcemergeServi...
type IndicesForcemergeResponse (line 233) | type IndicesForcemergeResponse struct
FILE: indices_forcemerge_test.go
function TestIndicesForcemergeBuildURL (line 12) | func TestIndicesForcemergeBuildURL(t *testing.T) {
function TestIndicesForcemerge (line 45) | func TestIndicesForcemerge(t *testing.T) {
FILE: indices_freeze.go
type IndicesFreezeService (line 25) | type IndicesFreezeService struct
method Pretty (line 51) | func (s *IndicesFreezeService) Pretty(pretty bool) *IndicesFreezeServi...
method Human (line 58) | func (s *IndicesFreezeService) Human(human bool) *IndicesFreezeService {
method ErrorTrace (line 64) | func (s *IndicesFreezeService) ErrorTrace(errorTrace bool) *IndicesFre...
method FilterPath (line 70) | func (s *IndicesFreezeService) FilterPath(filterPath ...string) *Indic...
method Header (line 76) | func (s *IndicesFreezeService) Header(name string, value string) *Indi...
method Headers (line 85) | func (s *IndicesFreezeService) Headers(headers http.Header) *IndicesFr...
method Index (line 91) | func (s *IndicesFreezeService) Index(index string) *IndicesFreezeServi...
method Timeout (line 97) | func (s *IndicesFreezeService) Timeout(timeout string) *IndicesFreezeS...
method MasterTimeout (line 103) | func (s *IndicesFreezeService) MasterTimeout(masterTimeout string) *In...
method IgnoreUnavailable (line 110) | func (s *IndicesFreezeService) IgnoreUnavailable(ignoreUnavailable boo...
method AllowNoIndices (line 118) | func (s *IndicesFreezeService) AllowNoIndices(allowNoIndices bool) *In...
method ExpandWildcards (line 125) | func (s *IndicesFreezeService) ExpandWildcards(expandWildcards string)...
method WaitForActiveShards (line 132) | func (s *IndicesFreezeService) WaitForActiveShards(numShards string) *...
method buildURL (line 138) | func (s *IndicesFreezeService) buildURL() (string, url.Values, error) {
method Validate (line 186) | func (s *IndicesFreezeService) Validate() error {
method Do (line 201) | func (s *IndicesFreezeService) Do(ctx context.Context) (*IndicesFreeze...
function NewIndicesFreezeService (line 44) | func NewIndicesFreezeService(client *Client) *IndicesFreezeService {
type IndicesFreezeResponse (line 233) | type IndicesFreezeResponse struct
FILE: indices_freeze_test.go
function TestIndicesFreezeBuildURL (line 11) | func TestIndicesFreezeBuildURL(t *testing.T) {
FILE: indices_get.go
type IndicesGetService (line 21) | type IndicesGetService struct
method Pretty (line 49) | func (s *IndicesGetService) Pretty(pretty bool) *IndicesGetService {
method Human (line 56) | func (s *IndicesGetService) Human(human bool) *IndicesGetService {
method ErrorTrace (line 62) | func (s *IndicesGetService) ErrorTrace(errorTrace bool) *IndicesGetSer...
method FilterPath (line 68) | func (s *IndicesGetService) FilterPath(filterPath ...string) *IndicesG...
method Header (line 74) | func (s *IndicesGetService) Header(name string, value string) *Indices...
method Headers (line 83) | func (s *IndicesGetService) Headers(headers http.Header) *IndicesGetSe...
method Index (line 89) | func (s *IndicesGetService) Index(indices ...string) *IndicesGetService {
method Feature (line 95) | func (s *IndicesGetService) Feature(features ...string) *IndicesGetSer...
method Local (line 102) | func (s *IndicesGetService) Local(local bool) *IndicesGetService {
method IgnoreUnavailable (line 108) | func (s *IndicesGetService) IgnoreUnavailable(ignoreUnavailable bool) ...
method AllowNoIndices (line 115) | func (s *IndicesGetService) AllowNoIndices(allowNoIndices bool) *Indic...
method ExpandWildcards (line 122) | func (s *IndicesGetService) ExpandWildcards(expandWildcards string) *I...
method buildURL (line 128) | func (s *IndicesGetService) buildURL() (string, url.Values, error) {
method Validate (line 188) | func (s *IndicesGetService) Validate() error {
method Do (line 200) | func (s *IndicesGetService) Do(ctx context.Context) (map[string]*Indic...
function NewIndicesGetService (line 40) | func NewIndicesGetService(client *Client) *IndicesGetService {
type IndicesGetResponse (line 232) | type IndicesGetResponse struct
FILE: indices_get_aliases.go
type AliasesService (line 20) | type AliasesService struct
method Pretty (line 42) | func (s *AliasesService) Pretty(pretty bool) *AliasesService {
method Human (line 49) | func (s *AliasesService) Human(human bool) *AliasesService {
method ErrorTrace (line 55) | func (s *AliasesService) ErrorTrace(errorTrace bool) *AliasesService {
method FilterPath (line 61) | func (s *AliasesService) FilterPath(filterPath ...string) *AliasesServ...
method Header (line 67) | func (s *AliasesService) Header(name string, value string) *AliasesSer...
method Headers (line 76) | func (s *AliasesService) Headers(headers http.Header) *AliasesService {
method Index (line 82) | func (s *AliasesService) Index(index ...string) *AliasesService {
method Alias (line 88) | func (s *AliasesService) Alias(alias ...string) *AliasesService {
method buildURL (line 94) | func (s *AliasesService) buildURL() (string, url.Values, error) {
method Do (line 130) | func (s *AliasesService) Do(ctx context.Context) (*AliasesResult, erro...
function NewAliasesService (line 34) | func NewAliasesService(client *Client) *AliasesService {
type AliasesResult (line 196) | type AliasesResult struct
method IndicesByAlias (line 210) | func (ar AliasesResult) IndicesByAlias(aliasName string) []string {
type indexResult (line 200) | type indexResult struct
method HasAlias (line 223) | func (ir indexResult) HasAlias(aliasName string) bool {
type aliasResult (line 204) | type aliasResult struct
FILE: indices_get_aliases_test.go
function TestAliasesBuildURL (line 12) | func TestAliasesBuildURL(t *testing.T) {
function TestAliases (line 79) | func TestAliases(t *testing.T) {
FILE: indices_get_component_template.go
type IndicesGetComponentTemplateService (line 21) | type IndicesGetComponentTemplateService struct
method Pretty (line 45) | func (s *IndicesGetComponentTemplateService) Pretty(pretty bool) *Indi...
method Human (line 52) | func (s *IndicesGetComponentTemplateService) Human(human bool) *Indice...
method ErrorTrace (line 58) | func (s *IndicesGetComponentTemplateService) ErrorTrace(errorTrace boo...
method FilterPath (line 64) | func (s *IndicesGetComponentTemplateService) FilterPath(filterPath ......
method Header (line 70) | func (s *IndicesGetComponentTemplateService) Header(name string, value...
method Headers (line 79) | func (s *IndicesGetComponentTemplateService) Headers(headers http.Head...
method Name (line 85) | func (s *IndicesGetComponentTemplateService) Name(name ...string) *Ind...
method FlatSettings (line 91) | func (s *IndicesGetComponentTemplateService) FlatSettings(flatSettings...
method Local (line 98) | func (s *IndicesGetComponentTemplateService) Local(local bool) *Indice...
method MasterTimeout (line 104) | func (s *IndicesGetComponentTemplateService) MasterTimeout(masterTimeo...
method buildURL (line 110) | func (s *IndicesGetComponentTemplateService) buildURL() (string, url.V...
method Validate (line 152) | func (s *IndicesGetComponentTemplateService) Validate() error {
method Do (line 157) | func (s *IndicesGetComponentTemplateService) Do(ctx context.Context) (...
function NewIndicesGetComponentTemplateService (line 37) | func NewIndicesGetComponentTemplateService(client *Client) *IndicesGetCo...
type IndicesGetComponentTemplateResponse (line 189) | type IndicesGetComponentTemplateResponse struct
type IndicesGetComponentTemplates (line 193) | type IndicesGetComponentTemplates struct
type IndicesGetComponentTemplate (line 198) | type IndicesGetComponentTemplate struct
type IndicesGetComponentTemplateData (line 203) | type IndicesGetComponentTemplateData struct
FILE: indices_get_field_mapping.go
type IndicesGetFieldMappingService (line 22) | type IndicesGetFieldMappingService struct
method Pretty (line 54) | func (s *IndicesGetFieldMappingService) Pretty(pretty bool) *IndicesGe...
method Human (line 61) | func (s *IndicesGetFieldMappingService) Human(human bool) *IndicesGetF...
method ErrorTrace (line 67) | func (s *IndicesGetFieldMappingService) ErrorTrace(errorTrace bool) *I...
method FilterPath (line 73) | func (s *IndicesGetFieldMappingService) FilterPath(filterPath ...strin...
method Header (line 79) | func (s *IndicesGetFieldMappingService) Header(name string, value stri...
method Headers (line 88) | func (s *IndicesGetFieldMappingService) Headers(headers http.Header) *...
method Index (line 94) | func (s *IndicesGetFieldMappingService) Index(indices ...string) *Indi...
method Type (line 100) | func (s *IndicesGetFieldMappingService) Type(types ...string) *Indices...
method Field (line 106) | func (s *IndicesGetFieldMappingService) Field(fields ...string) *Indic...
method AllowNoIndices (line 114) | func (s *IndicesGetFieldMappingService) AllowNoIndices(allowNoIndices ...
method ExpandWildcards (line 121) | func (s *IndicesGetFieldMappingService) ExpandWildcards(expandWildcard...
method Local (line 128) | func (s *IndicesGetFieldMappingService) Local(local bool) *IndicesGetF...
method IgnoreUnavailable (line 135) | func (s *IndicesGetFieldMappingService) IgnoreUnavailable(ignoreUnavai...
method buildURL (line 141) | func (s *IndicesGetFieldMappingService) buildURL() (string, url.Values...
method Validate (line 202) | func (s *IndicesGetFieldMappingService) Validate() error {
method Do (line 208) | func (s *IndicesGetFieldMappingService) Do(ctx context.Context) (map[s...
function NewGetFieldMappingService (line 42) | func NewGetFieldMappingService(client *Client) *IndicesGetFieldMappingSe...
function NewIndicesGetFieldMappingService (line 47) | func NewIndicesGetFieldMappingService(client *Client) *IndicesGetFieldMa...
FILE: indices_get_field_mapping_test.go
function TestIndicesGetFieldMappingURL (line 11) | func TestIndicesGetFieldMappingURL(t *testing.T) {
FILE: indices_get_index_template.go
type IndicesGetIndexTemplateService (line 25) | type IndicesGetIndexTemplateService struct
method Pretty (line 49) | func (s *IndicesGetIndexTemplateService) Pretty(pretty bool) *IndicesG...
method Human (line 56) | func (s *IndicesGetIndexTemplateService) Human(human bool) *IndicesGet...
method ErrorTrace (line 62) | func (s *IndicesGetIndexTemplateService) ErrorTrace(errorTrace bool) *...
method FilterPath (line 68) | func (s *IndicesGetIndexTemplateService) FilterPath(filterPath ...stri...
method Header (line 74) | func (s *IndicesGetIndexTemplateService) Header(name string, value str...
method Headers (line 83) | func (s *IndicesGetIndexTemplateService) Headers(headers http.Header) ...
method Name (line 89) | func (s *IndicesGetIndexTemplateService) Name(name ...string) *Indices...
method FlatSettings (line 95) | func (s *IndicesGetIndexTemplateService) FlatSettings(flatSettings boo...
method Local (line 102) | func (s *IndicesGetIndexTemplateService) Local(local bool) *IndicesGet...
method MasterTimeout (line 108) | func (s *IndicesGetIndexTemplateService) MasterTimeout(masterTimeout s...
method buildURL (line 114) | func (s *IndicesGetIndexTemplateService) buildURL() (string, url.Value...
method Validate (line 156) | func (s *IndicesGetIndexTemplateService) Validate() error {
method Do (line 161) | func (s *IndicesGetIndexTemplateService) Do(ctx context.Context) (*Ind...
function NewIndicesGetIndexTemplateService (line 41) | func NewIndicesGetIndexTemplateService(client *Client) *IndicesGetIndexT...
type IndicesGetIndexTemplateResponse (line 193) | type IndicesGetIndexTemplateResponse struct
type IndicesGetIndexTemplatesSlice (line 198) | type IndicesGetIndexTemplatesSlice
method ByName (line 202) | func (slice IndicesGetIndexTemplatesSlice) ByName(name string) (*Indic...
type IndicesGetIndexTemplates (line 211) | type IndicesGetIndexTemplates struct
type IndicesGetIndexTemplate (line 216) | type IndicesGetIndexTemplate struct
type IndicesGetIndexTemplateData (line 227) | type IndicesGetIndexTemplateData struct
type IndicesDataStream (line 233) | type IndicesDataStream struct
type IndicesDataStreamTimestampField (line 248) | type IndicesDataStreamTimestampField struct
FILE: indices_get_index_template_test.go
function TestIndexGetIndexTemplateURL (line 12) | func TestIndexGetIndexTemplateURL(t *testing.T) {
function TestIndexGetIndexTemplateService (line 36) | func TestIndexGetIndexTemplateService(t *testing.T) {
FILE: indices_get_mapping.go
type IndicesGetMappingService (line 22) | type IndicesGetMappingService struct
method Pretty (line 55) | func (s *IndicesGetMappingService) Pretty(pretty bool) *IndicesGetMapp...
method Human (line 62) | func (s *IndicesGetMappingService) Human(human bool) *IndicesGetMappin...
method ErrorTrace (line 68) | func (s *IndicesGetMappingService) ErrorTrace(errorTrace bool) *Indice...
method FilterPath (line 74) | func (s *IndicesGetMappingService) FilterPath(filterPath ...string) *I...
method Header (line 80) | func (s *IndicesGetMappingService) Header(name string, value string) *...
method Headers (line 89) | func (s *IndicesGetMappingService) Headers(headers http.Header) *Indic...
method Index (line 95) | func (s *IndicesGetMappingService) Index(indices ...string) *IndicesGe...
method Type (line 101) | func (s *IndicesGetMappingService) Type(types ...string) *IndicesGetMa...
method AllowNoIndices (line 109) | func (s *IndicesGetMappingService) AllowNoIndices(allowNoIndices bool)...
method ExpandWildcards (line 116) | func (s *IndicesGetMappingService) ExpandWildcards(expandWildcards str...
method Local (line 123) | func (s *IndicesGetMappingService) Local(local bool) *IndicesGetMappin...
method IgnoreUnavailable (line 130) | func (s *IndicesGetMappingService) IgnoreUnavailable(ignoreUnavailable...
method buildURL (line 136) | func (s *IndicesGetMappingService) buildURL() (string, url.Values, err...
method Validate (line 190) | func (s *IndicesGetMappingService) Validate() error {
method Do (line 196) | func (s *IndicesGetMappingService) Do(ctx context.Context) (map[string...
function NewGetMappingService (line 41) | func NewGetMappingService(client *Client) *IndicesGetMappingService {
function NewIndicesGetMappingService (line 46) | func NewIndicesGetMappingService(client *Client) *IndicesGetMappingServi...
FILE: indices_get_mapping_test.go
function TestIndicesGetMappingURL (line 11) | func TestIndicesGetMappingURL(t *testing.T) {
FILE: indices_get_settings.go
type IndicesGetSettingsService (line 22) | type IndicesGetSettingsService struct
method Pretty (line 50) | func (s *IndicesGetSettingsService) Pretty(pretty bool) *IndicesGetSet...
method Human (line 57) | func (s *IndicesGetSettingsService) Human(human bool) *IndicesGetSetti...
method ErrorTrace (line 63) | func (s *IndicesGetSettingsService) ErrorTrace(errorTrace bool) *Indic...
method FilterPath (line 69) | func (s *IndicesGetSettingsService) FilterPath(filterPath ...string) *...
method Header (line 75) | func (s *IndicesGetSettingsService) Header(name string, value string) ...
method Headers (line 84) | func (s *IndicesGetSettingsService) Headers(headers http.Header) *Indi...
method Index (line 91) | func (s *IndicesGetSettingsService) Index(indices ...string) *IndicesG...
method Name (line 97) | func (s *IndicesGetSettingsService) Name(name ...string) *IndicesGetSe...
method IgnoreUnavailable (line 104) | func (s *IndicesGetSettingsService) IgnoreUnavailable(ignoreUnavailabl...
method AllowNoIndices (line 112) | func (s *IndicesGetSettingsService) AllowNoIndices(allowNoIndices bool...
method ExpandWildcards (line 120) | func (s *IndicesGetSettingsService) ExpandWildcards(expandWildcards st...
method FlatSettings (line 126) | func (s *IndicesGetSettingsService) FlatSettings(flatSettings bool) *I...
method Local (line 133) | func (s *IndicesGetSettingsService) Local(local bool) *IndicesGetSetti...
method buildURL (line 139) | func (s *IndicesGetSettingsService) buildURL() (string, url.Values, er...
method Validate (line 199) | func (s *IndicesGetSettingsService) Validate() error {
method Do (line 204) | func (s *IndicesGetSettingsService) Do(ctx context.Context) (map[strin...
function NewIndicesGetSettingsService (line 41) | func NewIndicesGetSettingsService(client *Client) *IndicesGetSettingsSer...
type IndicesGetSettingsResponse (line 236) | type IndicesGetSettingsResponse struct
FILE: indices_get_settings_test.go
function TestIndexGetSettingsURL (line 12) | func TestIndexGetSettingsURL(t *testing.T) {
function TestIndexGetSettingsService (line 53) | func TestIndexGetSettingsService(t *testing.T) {
FILE: indices_get_template.go
type IndicesGetTemplateService (line 27) | type IndicesGetTemplateService struct
method Pretty (line 50) | func (s *IndicesGetTemplateService) Pretty(pretty bool) *IndicesGetTem...
method Human (line 57) | func (s *IndicesGetTemplateService) Human(human bool) *IndicesGetTempl...
method ErrorTrace (line 63) | func (s *IndicesGetTemplateService) ErrorTrace(errorTrace bool) *Indic...
method FilterPath (line 69) | func (s *IndicesGetTemplateService) FilterPath(filterPath ...string) *...
method Header (line 75) | func (s *IndicesGetTemplateService) Header(name string, value string) ...
method Headers (line 84) | func (s *IndicesGetTemplateService) Headers(headers http.Header) *Indi...
method Name (line 90) | func (s *IndicesGetTemplateService) Name(name ...string) *IndicesGetTe...
method FlatSettings (line 96) | func (s *IndicesGetTemplateService) FlatSettings(flatSettings bool) *I...
method Local (line 103) | func (s *IndicesGetTemplateService) Local(local bool) *IndicesGetTempl...
method buildURL (line 109) | func (s *IndicesGetTemplateService) buildURL() (string, url.Values, er...
method Validate (line 148) | func (s *IndicesGetTemplateService) Validate() error {
method Do (line 155) | func (s *IndicesGetTemplateService) Do(ctx context.Context) (map[strin...
function NewIndicesGetTemplateService (line 42) | func NewIndicesGetTemplateService(client *Client) *IndicesGetTemplateSer...
type IndicesGetTemplateResponse (line 187) | type IndicesGetTemplateResponse struct
FILE: indices_get_template_test.go
function TestIndexGetTemplateURL (line 12) | func TestIndexGetTemplateURL(t *testing.T) {
function TestIndexGetTemplateService (line 44) | func TestIndexGetTemplateService(t *testing.T) {
FILE: indices_get_test.go
function TestIndicesGetValidate (line 12) | func TestIndicesGetValidate(t *testing.T) {
function TestIndicesGetURL (line 25) | func TestIndicesGetURL(t *testing.T) {
function TestIndicesGetService (line 66) | func TestIndicesGetService(t *testing.T) {
FILE: indices_index_templates_test.go
function TestIndexTemplatesLifecycle (line 12) | func TestIndexTemplatesLifecycle(t *testing.T) {
FILE: indices_open.go
type IndicesOpenService (line 21) | type IndicesOpenService struct
method Pretty (line 45) | func (s *IndicesOpenService) Pretty(pretty bool) *IndicesOpenService {
method Human (line 52) | func (s *IndicesOpenService) Human(human bool) *IndicesOpenService {
method ErrorTrace (line 58) | func (s *IndicesOpenService) ErrorTrace(errorTrace bool) *IndicesOpenS...
method FilterPath (line 64) | func (s *IndicesOpenService) FilterPath(filterPath ...string) *Indices...
method Header (line 70) | func (s *IndicesOpenService) Header(name string, value string) *Indice...
method Headers (line 79) | func (s *IndicesOpenService) Headers(headers http.Header) *IndicesOpen...
method Index (line 85) | func (s *IndicesOpenService) Index(index string) *IndicesOpenService {
method Timeout (line 91) | func (s *IndicesOpenService) Timeout(timeout string) *IndicesOpenServi...
method MasterTimeout (line 97) | func (s *IndicesOpenService) MasterTimeout(masterTimeout string) *Indi...
method IgnoreUnavailable (line 104) | func (s *IndicesOpenService) IgnoreUnavailable(ignoreUnavailable bool)...
method AllowNoIndices (line 112) | func (s *IndicesOpenService) AllowNoIndices(allowNoIndices bool) *Indi...
method ExpandWildcards (line 119) | func (s *IndicesOpenService) ExpandWildcards(expandWildcards string) *...
method WaitForActiveShards (line 127) | func (s *IndicesOpenService) WaitForActiveShards(waitForActiveShards s...
method buildURL (line 133) | func (s *IndicesOpenService) buildURL() (string, url.Values, error) {
method Validate (line 179) | func (s *IndicesOpenService) Validate() error {
method Do (line 191) | func (s *IndicesOpenService) Do(ctx context.Context) (*IndicesOpenResp...
function NewIndicesOpenService (line 40) | func NewIndicesOpenService(client *Client) *IndicesOpenService {
type IndicesOpenResponse (line 223) | type IndicesOpenResponse struct
FILE: indices_open_test.go
function TestIndicesOpenValidate (line 12) | func TestIndicesOpenValidate(t *testing.T) {
FILE: indices_put_alias.go
type AliasAction (line 18) | type AliasAction interface
type AliasAddAction (line 23) | type AliasAddAction struct
method Index (line 41) | func (a *AliasAddAction) Index(index ...string) *AliasAddAction {
method removeBlankIndexNames (line 46) | func (a *AliasAddAction) removeBlankIndexNames() {
method Filter (line 57) | func (a *AliasAddAction) Filter(filter Query) *AliasAddAction {
method Routing (line 64) | func (a *AliasAddAction) Routing(routing string) *AliasAddAction {
method IndexRouting (line 70) | func (a *AliasAddAction) IndexRouting(routing string) *AliasAddAction {
method SearchRouting (line 76) | func (a *AliasAddAction) SearchRouting(routing ...string) *AliasAddAct...
method IsWriteIndex (line 82) | func (a *AliasAddAction) IsWriteIndex(flag bool) *AliasAddAction {
method Validate (line 88) | func (a *AliasAddAction) Validate() error {
method Source (line 106) | func (a *AliasAddAction) Source() (interface{}, error) {
function NewAliasAddAction (line 34) | func NewAliasAddAction(alias string) *AliasAddAction {
type AliasRemoveAction (line 144) | type AliasRemoveAction struct
method Index (line 157) | func (a *AliasRemoveAction) Index(index ...string) *AliasRemoveAction {
method removeBlankIndexNames (line 162) | func (a *AliasRemoveAction) removeBlankIndexNames() {
method Validate (line 173) | func (a *AliasRemoveAction) Validate() error {
method Source (line 188) | func (a *AliasRemoveAction) Source() (interface{}, error) {
function NewAliasRemoveAction (line 150) | func NewAliasRemoveAction(alias string) *AliasRemoveAction {
type AliasRemoveIndexAction (line 208) | type AliasRemoveIndexAction struct
method Validate (line 220) | func (a *AliasRemoveIndexAction) Validate() error {
method Source (line 228) | func (a *AliasRemoveIndexAction) Source() (interface{}, error) {
function NewAliasRemoveIndexAction (line 213) | func NewAliasRemoveIndexAction(index string) *AliasRemoveIndexAction {
type AliasService (line 244) | type AliasService struct
method Pretty (line 265) | func (s *AliasService) Pretty(pretty bool) *AliasService {
method Human (line 272) | func (s *AliasService) Human(human bool) *AliasService {
method ErrorTrace (line 278) | func (s *AliasService) ErrorTrace(errorTrace bool) *AliasService {
method FilterPath (line 284) | func (s *AliasService) FilterPath(filterPath ...string) *AliasService {
method Header (line 290) | func (s *AliasService) Header(name string, value string) *AliasService {
method Headers (line 299) | func (s *AliasService) Headers(headers http.Header) *AliasService {
method Add (line 305) | func (s *AliasService) Add(indexName string, aliasName string) *AliasS...
method AddWithFilter (line 312) | func (s *AliasService) AddWithFilter(indexName string, aliasName strin...
method Remove (line 319) | func (s *AliasService) Remove(indexName string, aliasName string) *Ali...
method Action (line 327) | func (s *AliasService) Action(action ...AliasAction) *AliasService {
method buildURL (line 333) | func (s *AliasService) buildURL() (string, url.Values, error) {
method Do (line 354) | func (s *AliasService) Do(ctx context.Context) (*AliasResult, error) {
function NewAliasService (line 257) | func NewAliasService(client *Client) *AliasService {
type AliasResult (line 395) | type AliasResult struct
FILE: indices_put_alias_test.go
constant testAliasName (line 14) | testAliasName = "elastic-test-alias"
constant testAliasName2 (line 15) | testAliasName2 = "elastic-test-alias2"
function TestAliasLifecycle (line 18) | func TestAliasLifecycle(t *testing.T) {
function TestAliasAddAction (line 148) | func TestAliasAddAction(t *testing.T) {
function TestAliasRemoveAction (line 218) | func TestAliasRemoveAction(t *testing.T) {
function TestAliasRemoveIndexAction (line 268) | func TestAliasRemoveIndexAction(t *testing.T) {
FILE: indices_put_component_template.go
type IndicesPutComponentTemplateService (line 21) | type IndicesPutComponentTemplateService struct
method Pretty (line 47) | func (s *IndicesPutComponentTemplateService) Pretty(pretty bool) *Indi...
method Human (line 54) | func (s *IndicesPutComponentTemplateService) Human(human bool) *Indice...
method ErrorTrace (line 60) | func (s *IndicesPutComponentTemplateService) ErrorTrace(errorTrace boo...
method FilterPath (line 66) | func (s *IndicesPutComponentTemplateService) FilterPath(filterPath ......
method Header (line 72) | func (s *IndicesPutComponentTemplateService) Header(name string, value...
method Headers (line 81) | func (s *IndicesPutComponentTemplateService) Headers(headers http.Head...
method Name (line 87) | func (s *IndicesPutComponentTemplateService) Name(name string) *Indice...
method Create (line 94) | func (s *IndicesPutComponentTemplateService) Create(create bool) *Indi...
method Cause (line 100) | func (s *IndicesPutComponentTemplateService) Cause(cause string) *Indi...
method MasterTimeout (line 106) | func (s *IndicesPutComponentTemplateService) MasterTimeout(masterTimeo...
method BodyJson (line 113) | func (s *IndicesPutComponentTemplateService) BodyJson(body interface{}...
method BodyString (line 119) | func (s *IndicesPutComponentTemplateService) BodyString(body string) *...
method buildURL (line 125) | func (s *IndicesPutComponentTemplateService) buildURL() (string, url.V...
method Validate (line 161) | func (s *IndicesPutComponentTemplateService) Validate() error {
method Do (line 176) | func (s *IndicesPutComponentTemplateService) Do(ctx context.Context) (...
function NewIndicesPutComponentTemplateService (line 40) | func NewIndicesPutComponentTemplateService(client *Client) *IndicesPutCo...
type IndicesPutComponentTemplateResponse (line 217) | type IndicesPutComponentTemplateResponse struct
FILE: indices_put_index_template.go
type IndicesPutIndexTemplateService (line 26) | type IndicesPutIndexTemplateService struct
method Pretty (line 52) | func (s *IndicesPutIndexTemplateService) Pretty(pretty bool) *IndicesP...
method Human (line 59) | func (s *IndicesPutIndexTemplateService) Human(human bool) *IndicesPut...
method ErrorTrace (line 65) | func (s *IndicesPutIndexTemplateService) ErrorTrace(errorTrace bool) *...
method FilterPath (line 71) | func (s *IndicesPutIndexTemplateService) FilterPath(filterPath ...stri...
method Header (line 77) | func (s *IndicesPutIndexTemplateService) Header(name string, value str...
method Headers (line 86) | func (s *IndicesPutIndexTemplateService) Headers(headers http.Header) ...
method Name (line 92) | func (s *IndicesPutIndexTemplateService) Name(name string) *IndicesPut...
method Create (line 99) | func (s *IndicesPutIndexTemplateService) Create(create bool) *IndicesP...
method Cause (line 105) | func (s *IndicesPutIndexTemplateService) Cause(cause string) *IndicesP...
method MasterTimeout (line 111) | func (s *IndicesPutIndexTemplateService) MasterTimeout(masterTimeout s...
method BodyJson (line 118) | func (s *IndicesPutIndexTemplateService) BodyJson(body interface{}) *I...
method BodyString (line 124) | func (s *IndicesPutIndexTemplateService) BodyString(body string) *Indi...
method buildURL (line 130) | func (s *IndicesPutIndexTemplateService) buildURL() (string, url.Value...
method Validate (line 166) | func (s *IndicesPutIndexTemplateService) Validate() error {
method Do (line 181) | func (s *IndicesPutIndexTemplateService) Do(ctx context.Context) (*Ind...
function NewIndicesPutIndexTemplateService (line 45) | func NewIndicesPutIndexTemplateService(client *Client) *IndicesPutIndexT...
type IndicesPutIndexTemplateResponse (line 222) | type IndicesPutIndexTemplateResponse struct
FILE: indices_put_mapping.go
type IndicesPutMappingService (line 22) | type IndicesPutMappingService struct
method Pretty (line 58) | func (s *IndicesPutMappingService) Pretty(pretty bool) *IndicesPutMapp...
method Human (line 65) | func (s *IndicesPutMappingService) Human(human bool) *IndicesPutMappin...
method ErrorTrace (line 71) | func (s *IndicesPutMappingService) ErrorTrace(errorTrace bool) *Indice...
method FilterPath (line 77) | func (s *IndicesPutMappingService) FilterPath(filterPath ...string) *I...
method Header (line 83) | func (s *IndicesPutMappingService) Header(name string, value string) *...
method Headers (line 92) | func (s *IndicesPutMappingService) Headers(headers http.Header) *Indic...
method Index (line 99) | func (s *IndicesPutMappingService) Index(indices ...string) *IndicesPu...
method Timeout (line 105) | func (s *IndicesPutMappingService) Timeout(timeout string) *IndicesPut...
method MasterTimeout (line 111) | func (s *IndicesPutMappingService) MasterTimeout(masterTimeout string)...
method IgnoreUnavailable (line 118) | func (s *IndicesPutMappingService) IgnoreUnavailable(ignoreUnavailable...
method AllowNoIndices (line 126) | func (s *IndicesPutMappingService) AllowNoIndices(allowNoIndices bool)...
method ExpandWildcards (line 133) | func (s *IndicesPutMappingService) ExpandWildcards(expandWildcards str...
method IncludeTypeName (line 139) | func (s *IndicesPutMappingService) IncludeTypeName(includeTypeName boo...
method WriteIndexOnly (line 145) | func (s *IndicesPutMappingService) WriteIndexOnly(writeIndexOnly bool)...
method BodyJson (line 151) | func (s *IndicesPutMappingService) BodyJson(mapping map[string]interfa...
method BodyString (line 157) | func (s *IndicesPutMappingService) BodyString(mapping string) *Indices...
method buildURL (line 163) | func (s *IndicesPutMappingService) buildURL() (string, url.Values, err...
method Validate (line 210) | func (s *IndicesPutMappingService) Validate() error {
method Do (line 225) | func (s *IndicesPutMappingService) Do(ctx context.Context) (*PutMappin...
function NewPutMappingService (line 45) | func NewPutMappingService(client *Client) *IndicesPutMappingService {
function NewIndicesPutMappingService (line 50) | func NewIndicesPutMappingService(client *Client) *IndicesPutMappingServi...
type PutMappingResponse (line 266) | type PutMappingResponse struct
FILE: indices_put_mapping_test.go
function TestPutMappingURL (line 12) | func TestPutMappingURL(t *testing.T) {
function TestMappingLifecycle (line 40) | func TestMappingLifecycle(t *testing.T) {
FILE: indices_put_settings.go
type IndicesPutSettingsService (line 22) | type IndicesPutSettingsService struct
method Pretty (line 50) | func (s *IndicesPutSettingsService) Pretty(pretty bool) *IndicesPutSet...
method Human (line 57) | func (s *IndicesPutSettingsService) Human(human bool) *IndicesPutSetti...
method ErrorTrace (line 63) | func (s *IndicesPutSettingsService) ErrorTrace(errorTrace bool) *Indic...
method FilterPath (line 69) | func (s *IndicesPutSettingsService) FilterPath(filterPath ...string) *...
method Header (line 75) | func (s *IndicesPutSettingsService) Header(name string, value string) ...
method Headers (line 84) | func (s *IndicesPutSettingsService) Headers(headers http.Header) *Indi...
method Index (line 91) | func (s *IndicesPutSettingsService) Index(indices ...string) *IndicesP...
method AllowNoIndices (line 99) | func (s *IndicesPutSettingsService) AllowNoIndices(allowNoIndices bool...
method ExpandWildcards (line 106) | func (s *IndicesPutSettingsService) ExpandWildcards(expandWildcards st...
method FlatSettings (line 112) | func (s *IndicesPutSettingsService) FlatSettings(flatSettings bool) *I...
method IgnoreUnavailable (line 119) | func (s *IndicesPutSettingsService) IgnoreUnavailable(ignoreUnavailabl...
method MasterTimeout (line 125) | func (s *IndicesPutSettingsService) MasterTimeout(masterTimeout string...
method BodyJson (line 131) | func (s *IndicesPutSettingsService) BodyJson(body interface{}) *Indice...
method BodyString (line 137) | func (s *IndicesPutSettingsService) BodyString(body string) *IndicesPu...
method buildURL (line 143) | func (s *IndicesPutSettingsService) buildURL() (string, url.Values, er...
method Validate (line 192) | func (s *IndicesPutSettingsService) Validate() error {
method Do (line 197) | func (s *IndicesPutSettingsService) Do(ctx context.Context) (*IndicesP...
function NewIndicesPutSettingsService (line 42) | func NewIndicesPutSettingsService(client *Client) *IndicesPutSettingsSer...
type IndicesPutSettingsResponse (line 238) | type IndicesPutSettingsResponse struct
FILE: indices_put_settings_test.go
function TestIndicesPutSettingsBuildURL (line 12) | func TestIndicesPutSettingsBuildURL(t *testing.T) {
function TestIndicesSettingsLifecycle (line 44) | func TestIndicesSettingsLifecycle(t *testing.T) {
FILE: indices_put_template.go
type IndicesPutTemplateService (line 27) | type IndicesPutTemplateService struct
method Pretty (line 57) | func (s *IndicesPutTemplateService) Pretty(pretty bool) *IndicesPutTem...
method Human (line 64) | func (s *IndicesPutTemplateService) Human(human bool) *IndicesPutTempl...
method ErrorTrace (line 70) | func (s *IndicesPutTemplateService) ErrorTrace(errorTrace bool) *Indic...
method FilterPath (line 76) | func (s *IndicesPutTemplateService) FilterPath(filterPath ...string) *...
method Header (line 82) | func (s *IndicesPutTemplateService) Header(name string, value string) ...
method Headers (line 91) | func (s *IndicesPutTemplateService) Headers(headers http.Header) *Indi...
method Name (line 97) | func (s *IndicesPutTemplateService) Name(name string) *IndicesPutTempl...
method Cause (line 104) | func (s *IndicesPutTemplateService) Cause(cause string) *IndicesPutTem...
method Timeout (line 110) | func (s *IndicesPutTemplateService) Timeout(timeout string) *IndicesPu...
method MasterTimeout (line 116) | func (s *IndicesPutTemplateService) MasterTimeout(masterTimeout string...
method IncludeTypeName (line 122) | func (s *IndicesPutTemplateService) IncludeTypeName(includeTypeName bo...
method FlatSettings (line 128) | func (s *IndicesPutTemplateService) FlatSettings(flatSettings bool) *I...
method Order (line 135) | func (s *IndicesPutTemplateService) Order(order interface{}) *IndicesP...
method Version (line 141) | func (s *IndicesPutTemplateService) Version(version int) *IndicesPutTe...
method Create (line 148) | func (s *IndicesPutTemplateService) Create(create bool) *IndicesPutTem...
method BodyJson (line 154) | func (s *IndicesPutTemplateService) BodyJson(body interface{}) *Indice...
method BodyString (line 160) | func (s *IndicesPutTemplateService) BodyString(body string) *IndicesPu...
method buildURL (line 166) | func (s *IndicesPutTemplateService) buildURL() (string, url.Values, er...
method Validate (line 217) | func (s *IndicesPutTemplateService) Validate() error {
method Do (line 234) | func (s *IndicesPutTemplateService) Do(ctx context.Context) (*IndicesP...
function NewIndicesPutTemplateService (line 50) | func NewIndicesPutTemplateService(client *Client) *IndicesPutTemplateSer...
type IndicesPutTemplateResponse (line 275) | type IndicesPutTemplateResponse struct
FILE: indices_refresh.go
type RefreshService (line 19) | type RefreshService struct
method Pretty (line 40) | func (s *RefreshService) Pretty(pretty bool) *RefreshService {
method Human (line 47) | func (s *RefreshService) Human(human bool) *RefreshService {
method ErrorTrace (line 53) | func (s *RefreshService) ErrorTrace(errorTrace bool) *RefreshService {
method FilterPath (line 59) | func (s *RefreshService) FilterPath(filterPath ...string) *RefreshServ...
method Header (line 65) | func (s *RefreshService) Header(name string, value string) *RefreshSer...
method Headers (line 74) | func (s *RefreshService) Headers(headers http.Header) *RefreshService {
method Index (line 80) | func (s *RefreshService) Index(index ...string) *RefreshService {
method buildURL (line 86) | func (s *RefreshService) buildURL() (string, url.Values, error) {
method Do (line 119) | func (s *RefreshService) Do(ctx context.Context) (*RefreshResult, erro...
function NewRefreshService (line 32) | func NewRefreshService(client *Client) *RefreshService {
type RefreshResult (line 147) | type RefreshResult struct
FILE: indices_refresh_test.go
function TestRefreshBuildURL (line 12) | func TestRefreshBuildURL(t *testing.T) {
function TestRefresh (line 45) | func TestRefresh(t *testing.T) {
FILE: indices_rollover.go
type IndicesRolloverService (line 23) | type IndicesRolloverService struct
method Pretty (line 56) | func (s *IndicesRolloverService) Pretty(pretty bool) *IndicesRolloverS...
method Human (line 63) | func (s *IndicesRolloverService) Human(human bool) *IndicesRolloverSer...
method ErrorTrace (line 69) | func (s *IndicesRolloverService) ErrorTrace(errorTrace bool) *IndicesR...
method FilterPath (line 75) | func (s *IndicesRolloverService) FilterPath(filterPath ...string) *Ind...
method Header (line 81) | func (s *IndicesRolloverService) Header(name string, value string) *In...
method Headers (line 90) | func (s *IndicesRolloverService) Headers(headers http.Header) *Indices...
method Alias (line 96) | func (s *IndicesRolloverService) Alias(alias string) *IndicesRolloverS...
method NewIndex (line 102) | func (s *IndicesRolloverService) NewIndex(newIndex string) *IndicesRol...
method MasterTimeout (line 108) | func (s *IndicesRolloverService) MasterTimeout(masterTimeout string) *...
method Timeout (line 114) | func (s *IndicesRolloverService) Timeout(timeout string) *IndicesRollo...
method WaitForActiveShards (line 121) | func (s *IndicesRolloverService) WaitForActiveShards(waitForActiveShar...
method DryRun (line 128) | func (s *IndicesRolloverService) DryRun(dryRun bool) *IndicesRolloverS...
method Conditions (line 134) | func (s *IndicesRolloverService) Conditions(conditions map[string]inte...
method AddCondition (line 140) | func (s *IndicesRolloverService) AddCondition(name string, value inter...
method AddMaxIndexAgeCondition (line 146) | func (s *IndicesRolloverService) AddMaxIndexAgeCondition(time string) ...
method AddMaxIndexDocsCondition (line 152) | func (s *IndicesRolloverService) AddMaxIndexDocsCondition(docs int64) ...
method Settings (line 158) | func (s *IndicesRolloverService) Settings(settings map[string]interfac...
method AddSetting (line 164) | func (s *IndicesRolloverService) AddSetting(name string, value interfa...
method Mappings (line 170) | func (s *IndicesRolloverService) Mappings(mappings map[string]interfac...
method AddMapping (line 176) | func (s *IndicesRolloverService) AddMapping(typ string, mapping interf...
method BodyJson (line 184) | func (s *IndicesRolloverService) BodyJson(body interface{}) *IndicesRo...
method BodyString (line 191) | func (s *IndicesRolloverService) BodyString(body string) *IndicesRollo...
method getBod
Condensed preview — 646 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,369K chars).
[
{
"path": ".github/workflows/codeql-v7.yml",
"chars": 1761,
"preview": "name: \"Code scanning - action\"\n\non:\n push:\n branches:\n - '*.v7'\n pull_request:\n branches:\n - '*.v7'\n "
},
{
"path": ".github/workflows/test-v7.yml",
"chars": 1460,
"preview": "on:\n push:\n branches:\n - '*.v7'\n pull_request:\n branches:\n - '*.v7'\nname: Test v7\njobs:\n test:\n st"
},
{
"path": ".gitignore",
"chars": 430,
"preview": "# Compiled Object files, Static and Dynamic libs (Shared Objects)\n*.o\n*.a\n*.so\n\n# Folders\n_obj\n_test\n\n# Architecture spe"
},
{
"path": "CHANGELOG-3.0.md",
"chars": 17547,
"preview": "# Elastic 3.0\n\nElasticsearch 2.0 comes with some [breaking changes](https://www.elastic.co/guide/en/elasticsearch/refere"
},
{
"path": "CHANGELOG-5.0.md",
"chars": 7811,
"preview": "# Changes in Elastic 5.0\n\n## Enforce context.Context in PerformRequest and Do\n\nWe enforce the usage of `context.Context`"
},
{
"path": "CHANGELOG-6.0.md",
"chars": 622,
"preview": "# Changes from 5.0 to 6.0\n\nSee [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/master/breakin"
},
{
"path": "CHANGELOG-7.0.md",
"chars": 1251,
"preview": "# Changes from 6.0 to 7.0\n\nSee [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/breaking-c"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 3215,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
},
{
"path": "CONTRIBUTING.md",
"chars": 1997,
"preview": "# How to contribute\n\nElastic is an open-source project and we are looking forward to each\ncontribution.\n\nNotice that whi"
},
{
"path": "CONTRIBUTORS",
"chars": 11299,
"preview": "# This is a list of people who have contributed code\n# to the Elastic repository.\n#\n# It is just my small \"thank you\" to"
},
{
"path": "ISSUE_TEMPLATE.md",
"chars": 494,
"preview": "Please use the following questions as a guideline to help me answer\nyour issue/question without further inquiry. Thank y"
},
{
"path": "LICENSE",
"chars": 1083,
"preview": "The MIT License (MIT)\nCopyright © 2012-2015 Oliver Eilhard\n\nPermission is hereby granted, free of charge, to any person "
},
{
"path": "Makefile",
"chars": 123,
"preview": ".PHONY: test\ntest:\n\tgo test -race -deprecations -strict-decoder -v . ./aws/... ./config/... ./trace/... ./uritemplates/."
},
{
"path": "README.md",
"chars": 15210,
"preview": "# Elastic\n\n**This is a development branch that is actively being worked on. DO NOT USE IN PRODUCTION! If you want to use"
},
{
"path": "acknowledged_response.go",
"chars": 519,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "aws/sign_v4.go",
"chars": 1522,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "aws/sign_v4_test.go",
"chars": 2517,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "aws/v4/CREDITS",
"chars": 159,
"preview": "This package contains code that is Copyright (c) 2016 Anthony Atkinson\nand licensed under the MIT license.\n\nSee https://"
},
{
"path": "aws/v4/aws_v4.go",
"chars": 2293,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "aws/v4/aws_v4_test.go",
"chars": 2740,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "backoff.go",
"chars": 4155,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "backoff_test.go",
"chars": 2788,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk.go",
"chars": 12915,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_create_request.go",
"chars": 6980,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_create_request_easyjson.go",
"chars": 7036,
"preview": "// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.\n\npackage elastic\n\nimport (\n\tjson \"encoding/json\""
},
{
"path": "bulk_create_request_test.go",
"chars": 4043,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_delete_request.go",
"chars": 5321,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_delete_request_easyjson.go",
"chars": 6188,
"preview": "// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.\n\npackage elastic\n\nimport (\n\tjson \"encoding/json\""
},
{
"path": "bulk_delete_request_test.go",
"chars": 2152,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_index_request.go",
"chars": 7312,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_index_request_easyjson.go",
"chars": 7022,
"preview": "// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.\n\npackage elastic\n\nimport (\n\tjson \"encoding/json\""
},
{
"path": "bulk_index_request_test.go",
"chars": 4447,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_processor.go",
"chars": 19545,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_processor_test.go",
"chars": 12036,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_request.go",
"chars": 410,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_test.go",
"chars": 19728,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_update_request.go",
"chars": 9618,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "bulk_update_request_easyjson.go",
"chars": 11591,
"preview": "// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.\n\npackage elastic\n\nimport (\n\tjson \"encoding/json\""
},
{
"path": "bulk_update_request_test.go",
"chars": 5202,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "canonicalize.go",
"chars": 1294,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "canonicalize_test.go",
"chars": 1867,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_aliases.go",
"chars": 6225,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_aliases_test.go",
"chars": 1368,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_allocation.go",
"chars": 7021,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_allocation_test.go",
"chars": 739,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_count.go",
"chars": 5886,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_count_integration_test.go",
"chars": 1010,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_count_test.go",
"chars": 745,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_fielddata.go",
"chars": 5969,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_fielddata_test.go",
"chars": 1147,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_health.go",
"chars": 6799,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_health_test.go",
"chars": 741,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_indices.go",
"chars": 31302,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_indices_test.go",
"chars": 2567,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_master.go",
"chars": 5284,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_master_test.go",
"chars": 731,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_shards.go",
"chars": 17276,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_shards_test.go",
"chars": 1747,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_snapshots.go",
"chars": 8257,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_snapshots_integration_test.go",
"chars": 1843,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cat_snapshots_test.go",
"chars": 759,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "clear_scroll.go",
"chars": 4301,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "clear_scroll_test.go",
"chars": 2343,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "client.go",
"chars": 73787,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "client_test.go",
"chars": 50350,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cluster-test/Makefile",
"chars": 322,
"preview": ".PHONY: build run-omega-cluster-test\n\ndefault: build\n\nbuild:\n\tgo build cluster-test.go\n\nrun-omega-cluster-test:\n\tgo run "
},
{
"path": "cluster-test/README.md",
"chars": 2227,
"preview": "# Cluster Test\n\nThis directory contains a program you can use to test a cluster.\n\nHere's how:\n\nFirst, install a cluster "
},
{
"path": "cluster-test/cluster-test.go",
"chars": 9368,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cluster_health.go",
"chars": 9785,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cluster_health_test.go",
"chars": 3374,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cluster_reroute.go",
"chars": 13475,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cluster_reroute_test.go",
"chars": 3240,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cluster_state.go",
"chars": 13313,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cluster_state_test.go",
"chars": 2658,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cluster_stats.go",
"chars": 17717,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cluster_stats_integration_test.go",
"chars": 853,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "cluster_stats_test.go",
"chars": 31073,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "config/config.go",
"chars": 2097,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "config/config_test.go",
"chars": 2648,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "config/doc.go",
"chars": 281,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "connection.go",
"chars": 1975,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "count.go",
"chars": 11015,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "count_test.go",
"chars": 2659,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "decoder.go",
"chars": 1200,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "decoder_test.go",
"chars": 1049,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "delete.go",
"chars": 8492,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "delete_by_query.go",
"chars": 24876,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "delete_by_query_test.go",
"chars": 4841,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "delete_test.go",
"chars": 4443,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "doc.go",
"chars": 1765,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "docker-compose.cluster.yml",
"chars": 2112,
"preview": "services:\n es1:\n image: docker.elastic.co/elasticsearch/elasticsearch:${VERSION:-7.14.0}\n hostname: es1\n envir"
},
{
"path": "docker-compose.yml",
"chars": 1761,
"preview": "services:\n elasticsearch:\n image: docker.elastic.co/elasticsearch/elasticsearch:${VERSION:-7.17.1}\n hostname: ela"
},
{
"path": "docvalue_field.go",
"chars": 980,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "docvalue_field_test.go",
"chars": 1331,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "errors.go",
"chars": 8794,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "errors_test.go",
"chars": 9126,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "example_test.go",
"chars": 15070,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "exists.go",
"chars": 5905,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "exists_test.go",
"chars": 1128,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "explain.go",
"chars": 10586,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "explain_test.go",
"chars": 1018,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "fetch_source_context.go",
"chars": 2626,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "fetch_source_context_test.go",
"chars": 3203,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "field_caps.go",
"chars": 8296,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "field_caps_test.go",
"chars": 5371,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "geo_point.go",
"chars": 1464,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "geo_point_test.go",
"chars": 2743,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "get.go",
"chars": 8878,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "get_test.go",
"chars": 4890,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "go.mod",
"chars": 844,
"preview": "module github.com/olivere/elastic/v7\n\ngo 1.17\n\nrequire (\n\tgithub.com/aws/aws-sdk-go v1.43.21\n\tgithub.com/fortytw2/leakte"
},
{
"path": "highlight.go",
"chars": 12163,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "highlight_test.go",
"chars": 5836,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "index.go",
"chars": 10047,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "index_test.go",
"chars": 9247,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_analyze.go",
"chars": 9556,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_analyze_test.go",
"chars": 2150,
"preview": "package elastic\n\nimport (\n\t\"context\"\n\t\"testing\"\n)\n\nfunc TestIndicesAnalyzeURL(t *testing.T) {\n\tclient := setupTestClient"
},
{
"path": "indices_clear_cache.go",
"chars": 7020,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_clear_cache_test.go",
"chars": 1154,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_close.go",
"chars": 6081,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_close_test.go",
"chars": 2085,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_component_templates_test.go",
"chars": 1830,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_create.go",
"chars": 5474,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_create_test.go",
"chars": 1637,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_delete.go",
"chars": 6075,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_delete_component_template.go",
"chars": 5443,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_delete_index_template.go",
"chars": 5502,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_delete_integration_test.go",
"chars": 761,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_delete_template.go",
"chars": 5516,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_delete_test.go",
"chars": 577,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_exists.go",
"chars": 5829,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_exists_template.go",
"chars": 5237,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_exists_template_test.go",
"chars": 1616,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_exists_test.go",
"chars": 582,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_flush.go",
"chars": 6621,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_flush_synced.go",
"chars": 8293,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_flush_synced_test.go",
"chars": 4207,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_flush_test.go",
"chars": 1538,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_forcemerge.go",
"chars": 7038,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_forcemerge_test.go",
"chars": 1145,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_freeze.go",
"chars": 6821,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_freeze_test.go",
"chars": 683,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get.go",
"chars": 6554,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_aliases.go",
"chars": 5766,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_aliases_test.go",
"chars": 6693,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_component_template.go",
"chars": 6307,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_field_mapping.go",
"chars": 6933,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_field_mapping_test.go",
"chars": 1205,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_index_template.go",
"chars": 8346,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_index_template_test.go",
"chars": 2349,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_mapping.go",
"chars": 6426,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_mapping_test.go",
"chars": 1001,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_settings.go",
"chars": 7014,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_settings_test.go",
"chars": 1916,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_template.go",
"chars": 5782,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_template_test.go",
"chars": 2102,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_get_test.go",
"chars": 2245,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_index_templates_test.go",
"chars": 1840,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_open.go",
"chars": 6542,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_open_test.go",
"chars": 571,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_put_alias.go",
"chars": 10209,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_put_alias_test.go",
"chars": 8233,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_put_component_template.go",
"chars": 6482,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_put_index_template.go",
"chars": 6550,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_put_mapping.go",
"chars": 8086,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_put_mapping_test.go",
"chars": 1999,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_put_settings.go",
"chars": 7133,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_put_settings_test.go",
"chars": 2384,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_put_template.go",
"chars": 8071,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_refresh.go",
"chars": 3772,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_refresh_test.go",
"chars": 1819,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_rollover.go",
"chars": 9463,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_rollover_test.go",
"chars": 3090,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_segments.go",
"chars": 9219,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_segments_test.go",
"chars": 2402,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_shrink.go",
"chars": 6422,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_shrink_test.go",
"chars": 766,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_stats.go",
"chars": 22415,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_stats_test.go",
"chars": 3342,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_unfreeze.go",
"chars": 6909,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "indices_unfreeze_test.go",
"chars": 689,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "ingest_delete_pipeline.go",
"chars": 5114,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "ingest_delete_pipeline_test.go",
"chars": 676,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "ingest_get_pipeline.go",
"chars": 4966,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "ingest_get_pipeline_test.go",
"chars": 3125,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "ingest_put_pipeline.go",
"chars": 5737,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "ingest_put_pipeline_test.go",
"chars": 670,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "ingest_simulate_pipeline.go",
"chars": 5952,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "ingest_simulate_pipeline_test.go",
"chars": 745,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "inner_hit.go",
"chars": 4197,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "inner_hit_test.go",
"chars": 1448,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "logger.go",
"chars": 326,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "mget.go",
"chars": 8323,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "mget_test.go",
"chars": 2630,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "msearch.go",
"chars": 4497,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "msearch_test.go",
"chars": 7985,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "mtermvectors.go",
"chars": 15377,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "mtermvectors_test.go",
"chars": 3055,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "nodes_info.go",
"chars": 15668,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "nodes_info_test.go",
"chars": 1770,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
},
{
"path": "nodes_stats.go",
"chars": 26101,
"preview": "// Copyright 2012-present Oliver Eilhard. All rights reserved.\n// Use of this source code is governed by a MIT-license.\n"
}
]
// ... and 446 more files (download for full content)
About this extraction
This page contains the full source code of the olivere/elastic GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 646 files (2.9 MB), approximately 794.4k tokens, and a symbol index with 6422 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.