elasticsearch-api 6.0.1 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +23 -0
- data/LICENSE.txt +199 -10
- data/README.md +3 -3
- data/Rakefile +31 -2
- data/elasticsearch-api.gemspec +21 -4
- data/lib/elasticsearch/api/actions/abort_benchmark.rb +17 -0
- data/lib/elasticsearch/api/actions/benchmark.rb +23 -3
- data/lib/elasticsearch/api/actions/bulk.rb +38 -18
- data/lib/elasticsearch/api/actions/cat/aliases.rb +30 -14
- data/lib/elasticsearch/api/actions/cat/allocation.rb +31 -15
- data/lib/elasticsearch/api/actions/cat/count.rb +30 -9
- data/lib/elasticsearch/api/actions/cat/fielddata.rb +32 -11
- data/lib/elasticsearch/api/actions/cat/health.rb +31 -10
- data/lib/elasticsearch/api/actions/cat/help.rb +25 -3
- data/lib/elasticsearch/api/actions/cat/indices.rb +33 -13
- data/lib/elasticsearch/api/actions/cat/master.rb +30 -9
- data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +30 -8
- data/lib/elasticsearch/api/actions/cat/nodes.rb +31 -10
- data/lib/elasticsearch/api/actions/cat/params_registry.rb +61 -0
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +30 -9
- data/lib/elasticsearch/api/actions/cat/plugins.rb +30 -8
- data/lib/elasticsearch/api/actions/cat/recovery.rb +30 -10
- data/lib/elasticsearch/api/actions/cat/repositories.rb +30 -8
- data/lib/elasticsearch/api/actions/cat/segments.rb +30 -8
- data/lib/elasticsearch/api/actions/cat/shards.rb +31 -12
- data/lib/elasticsearch/api/actions/cat/snapshots.rb +30 -10
- data/lib/elasticsearch/api/actions/cat/tasks.rb +31 -11
- data/lib/elasticsearch/api/actions/cat/templates.rb +31 -10
- data/lib/elasticsearch/api/actions/cat/thread_pool.rb +32 -12
- data/lib/elasticsearch/api/actions/clear_scroll.rb +21 -6
- data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +25 -4
- data/lib/elasticsearch/api/actions/cluster/get_settings.rb +27 -6
- data/lib/elasticsearch/api/actions/cluster/health.rb +35 -13
- data/lib/elasticsearch/api/actions/cluster/params_registry.rb +61 -0
- data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +25 -4
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +26 -3
- data/lib/elasticsearch/api/actions/cluster/remote_info.rb +17 -0
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +29 -3
- data/lib/elasticsearch/api/actions/cluster/state.rb +31 -14
- data/lib/elasticsearch/api/actions/cluster/stats.rb +25 -5
- data/lib/elasticsearch/api/actions/count.rb +44 -34
- data/lib/elasticsearch/api/actions/create.rb +17 -0
- data/lib/elasticsearch/api/actions/delete.rb +38 -18
- data/lib/elasticsearch/api/actions/delete_by_query.rb +40 -21
- data/lib/elasticsearch/api/actions/delete_by_rethrottle.rb +46 -0
- data/lib/elasticsearch/api/actions/delete_script.rb +28 -11
- data/lib/elasticsearch/api/actions/exists.rb +37 -19
- data/lib/elasticsearch/api/actions/exists_source.rb +68 -0
- data/lib/elasticsearch/api/actions/explain.rb +54 -40
- data/lib/elasticsearch/api/actions/field_caps.rb +28 -10
- data/lib/elasticsearch/api/actions/get.rb +45 -29
- data/lib/elasticsearch/api/actions/get_script.rb +28 -5
- data/lib/elasticsearch/api/actions/get_source.rb +53 -27
- data/lib/elasticsearch/api/actions/index.rb +37 -15
- data/lib/elasticsearch/api/actions/indices/analyze.rb +30 -24
- data/lib/elasticsearch/api/actions/indices/clear_cache.rb +31 -14
- data/lib/elasticsearch/api/actions/indices/close.rb +29 -10
- data/lib/elasticsearch/api/actions/indices/create.rb +38 -20
- data/lib/elasticsearch/api/actions/indices/delete.rb +28 -9
- data/lib/elasticsearch/api/actions/indices/delete_alias.rb +25 -3
- data/lib/elasticsearch/api/actions/indices/delete_template.rb +25 -3
- data/lib/elasticsearch/api/actions/indices/exists.rb +29 -11
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +27 -10
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +26 -4
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +27 -10
- data/lib/elasticsearch/api/actions/indices/flush.rb +28 -8
- data/lib/elasticsearch/api/actions/indices/flush_synced.rb +26 -7
- data/lib/elasticsearch/api/actions/indices/forcemerge.rb +36 -15
- data/lib/elasticsearch/api/actions/indices/freeze.rb +40 -0
- data/lib/elasticsearch/api/actions/indices/get.rb +37 -23
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +31 -20
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +37 -23
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +36 -21
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +38 -28
- data/lib/elasticsearch/api/actions/indices/get_template.rb +30 -6
- data/lib/elasticsearch/api/actions/indices/open.rb +35 -21
- data/lib/elasticsearch/api/actions/indices/params_registry.rb +61 -0
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +27 -4
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +37 -32
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +36 -28
- data/lib/elasticsearch/api/actions/indices/put_template.rb +32 -6
- data/lib/elasticsearch/api/actions/indices/recovery.rb +25 -6
- data/lib/elasticsearch/api/actions/indices/refresh.rb +30 -19
- data/lib/elasticsearch/api/actions/indices/rollover.rb +31 -12
- data/lib/elasticsearch/api/actions/indices/segments.rb +32 -21
- data/lib/elasticsearch/api/actions/indices/shard_stores.rb +27 -8
- data/lib/elasticsearch/api/actions/indices/shrink.rb +27 -13
- data/lib/elasticsearch/api/actions/indices/split.rb +59 -0
- data/lib/elasticsearch/api/actions/indices/stats.rb +51 -29
- data/lib/elasticsearch/api/actions/indices/unfreeze.rb +39 -0
- data/lib/elasticsearch/api/actions/indices/update_aliases.rb +28 -5
- data/lib/elasticsearch/api/actions/indices/upgrade.rb +34 -17
- data/lib/elasticsearch/api/actions/indices/validate_query.rb +45 -36
- data/lib/elasticsearch/api/actions/info.rb +17 -0
- data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +25 -4
- data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +23 -3
- data/lib/elasticsearch/api/actions/ingest/params_registry.rb +61 -0
- data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +29 -0
- data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +25 -4
- data/lib/elasticsearch/api/actions/ingest/simulate.rb +23 -3
- data/lib/elasticsearch/api/actions/mget.rb +37 -25
- data/lib/elasticsearch/api/actions/msearch.rb +36 -9
- data/lib/elasticsearch/api/actions/msearch_template.rb +33 -4
- data/lib/elasticsearch/api/actions/mtermvectors.rb +52 -33
- data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +31 -11
- data/lib/elasticsearch/api/actions/nodes/info.rb +40 -19
- data/lib/elasticsearch/api/actions/nodes/params_registry.rb +61 -0
- data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +54 -0
- data/lib/elasticsearch/api/actions/nodes/shutdown.rb +25 -5
- data/lib/elasticsearch/api/actions/nodes/stats.rb +39 -39
- data/lib/elasticsearch/api/actions/nodes/usage.rb +31 -0
- data/lib/elasticsearch/api/actions/params_registry.rb +59 -0
- data/lib/elasticsearch/api/actions/ping.rb +17 -0
- data/lib/elasticsearch/api/actions/put_script.rb +32 -14
- data/lib/elasticsearch/api/actions/rank_eval.rb +53 -0
- data/lib/elasticsearch/api/actions/reindex.rb +38 -18
- data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +46 -0
- data/lib/elasticsearch/api/actions/remote/info.rb +17 -0
- data/lib/elasticsearch/api/actions/render_search_template.rb +24 -4
- data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +38 -0
- data/lib/elasticsearch/api/actions/scroll.rb +30 -8
- data/lib/elasticsearch/api/actions/search.rb +46 -20
- data/lib/elasticsearch/api/actions/search_shards.rb +29 -8
- data/lib/elasticsearch/api/actions/search_template.rb +51 -27
- data/lib/elasticsearch/api/actions/snapshot/create.rb +25 -5
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +27 -6
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +23 -5
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +25 -6
- data/lib/elasticsearch/api/actions/snapshot/get.rb +28 -8
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +25 -6
- data/lib/elasticsearch/api/actions/snapshot/params_registry.rb +61 -0
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +25 -6
- data/lib/elasticsearch/api/actions/snapshot/status.rb +27 -6
- data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +25 -7
- data/lib/elasticsearch/api/actions/tasks/cancel.rb +30 -17
- data/lib/elasticsearch/api/actions/tasks/get.rb +27 -6
- data/lib/elasticsearch/api/actions/tasks/list.rb +35 -22
- data/lib/elasticsearch/api/actions/tasks/params_registry.rb +61 -0
- data/lib/elasticsearch/api/actions/termvectors.rb +65 -43
- data/lib/elasticsearch/api/actions/update.rb +50 -21
- data/lib/elasticsearch/api/actions/update_by_query.rb +49 -46
- data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +46 -0
- data/lib/elasticsearch/api/namespace/cat.rb +17 -0
- data/lib/elasticsearch/api/namespace/cluster.rb +17 -0
- data/lib/elasticsearch/api/namespace/common.rb +19 -2
- data/lib/elasticsearch/api/namespace/indices.rb +17 -0
- data/lib/elasticsearch/api/namespace/ingest.rb +17 -0
- data/lib/elasticsearch/api/namespace/nodes.rb +17 -0
- data/lib/elasticsearch/api/namespace/remote.rb +17 -0
- data/lib/elasticsearch/api/namespace/snapshot.rb +17 -0
- data/lib/elasticsearch/api/namespace/tasks.rb +17 -0
- data/lib/elasticsearch/api/utils.rb +17 -0
- data/lib/elasticsearch/api/version.rb +18 -1
- data/lib/elasticsearch/api.rb +20 -0
- data/lib/elasticsearch-api.rb +17 -0
- data/spec/elasticsearch/api/actions/abort_benchmark_spec.rb +34 -0
- data/spec/elasticsearch/api/actions/benchmark_spec.rb +34 -0
- data/spec/elasticsearch/api/actions/bulk_spec.rb +139 -0
- data/spec/elasticsearch/api/actions/cat/aliases_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/allocation_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/count_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/fielddata_spec.rb +52 -0
- data/spec/elasticsearch/api/actions/cat/health_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/help_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/indices_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/master_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/nodeattrs_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/nodes_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/pending_tasks_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/plugins_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/recovery_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/repositories_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/segments_spec.rb +51 -0
- data/spec/elasticsearch/api/actions/cat/shards_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/snapshot_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/tasks_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/templates_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cat/thread_pool_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/clear_scroll_spec.rb +50 -0
- data/spec/elasticsearch/api/actions/cluster/allocation_explain_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cluster/get_settings_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cluster/health_spec.rb +69 -0
- data/spec/elasticsearch/api/actions/cluster/pending_tasks_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cluster/remote_info_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/cluster/reroute_spec.rb +52 -0
- data/spec/elasticsearch/api/actions/cluster/state_spec.rb +52 -0
- data/spec/elasticsearch/api/actions/cluster/stats_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/count_spec.rb +66 -0
- data/spec/elasticsearch/api/actions/create_document_spec.rb +82 -0
- data/spec/elasticsearch/api/actions/delete_by_query_spec.rb +72 -0
- data/spec/elasticsearch/api/actions/delete_document_spec.rb +110 -0
- data/spec/elasticsearch/api/actions/delete_script_spec.rb +50 -0
- data/spec/elasticsearch/api/actions/exists_document_spec.rb +126 -0
- data/spec/elasticsearch/api/actions/explain_document_spec.rb +99 -0
- data/spec/elasticsearch/api/actions/field_caps_spec.rb +34 -0
- data/spec/elasticsearch/api/actions/get_document_source_spec.rb +98 -0
- data/spec/elasticsearch/api/actions/get_document_spec.rb +123 -0
- data/spec/elasticsearch/api/actions/get_script_spec.rb +49 -0
- data/{test/unit/hashie_test.rb → spec/elasticsearch/api/actions/hashie_spec.rb} +28 -17
- data/spec/elasticsearch/api/actions/index_document_spec.rb +145 -0
- data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +73 -0
- data/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb +84 -0
- data/spec/elasticsearch/api/actions/indices/close_spec.rb +85 -0
- data/spec/elasticsearch/api/actions/indices/create_spec.rb +85 -0
- data/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb +83 -0
- data/spec/elasticsearch/api/actions/indices/delete_spec.rb +108 -0
- data/spec/elasticsearch/api/actions/indices/delete_template_spec.rb +86 -0
- data/spec/elasticsearch/api/actions/indices/exists_alias_spec.rb +108 -0
- data/spec/elasticsearch/api/actions/indices/exists_spec.rb +108 -0
- data/spec/elasticsearch/api/actions/indices/exists_template_spec.rb +93 -0
- data/spec/elasticsearch/api/actions/indices/exists_type_spec.rb +108 -0
- data/spec/elasticsearch/api/actions/indices/flush_spec.rb +91 -0
- data/spec/elasticsearch/api/actions/indices/flush_synced_spec.rb +90 -0
- data/spec/elasticsearch/api/actions/indices/forcemerge_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/indices/freeze_spec.rb +68 -0
- data/spec/elasticsearch/api/actions/indices/get_alias_spec.rb +61 -0
- data/spec/elasticsearch/api/actions/indices/get_field_mapping_spec.rb +61 -0
- data/spec/elasticsearch/api/actions/indices/get_mapping_spec.rb +83 -0
- data/spec/elasticsearch/api/actions/indices/get_settings_spec.rb +72 -0
- data/spec/elasticsearch/api/actions/indices/get_spec.rb +65 -0
- data/spec/elasticsearch/api/actions/indices/open_spec.rb +65 -0
- data/spec/elasticsearch/api/actions/indices/put_alias_spec.rb +89 -0
- data/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb +102 -0
- data/spec/elasticsearch/api/actions/indices/put_settings_spec.rb +108 -0
- data/spec/elasticsearch/api/actions/indices/put_template_spec.rb +107 -0
- data/spec/elasticsearch/api/actions/indices/recovery_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/indices/refresh_spec.rb +91 -0
- data/spec/elasticsearch/api/actions/indices/rollover_spec.rb +58 -0
- data/spec/elasticsearch/api/actions/indices/segments_spec.rb +91 -0
- data/spec/elasticsearch/api/actions/indices/shard_stores_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/indices/shrink_spec.rb +42 -0
- data/spec/elasticsearch/api/actions/indices/split_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/indices/stats_spec.rb +125 -0
- data/spec/elasticsearch/api/actions/indices/unfreeze_spec.rb +68 -0
- data/spec/elasticsearch/api/actions/indices/update_aliases_spec.rb +67 -0
- data/spec/elasticsearch/api/actions/indices/upgrade_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/indices/validate_query_spec.rb +128 -0
- data/spec/elasticsearch/api/actions/info_spec.rb +34 -0
- data/spec/elasticsearch/api/actions/ingest/delete_pipeline_spec.rb +60 -0
- data/spec/elasticsearch/api/actions/ingest/get_pipeline_spec.rb +50 -0
- data/spec/elasticsearch/api/actions/ingest/put_pipeline_spec.rb +60 -0
- data/spec/elasticsearch/api/actions/ingest/simulate_spec.rb +50 -0
- data/spec/elasticsearch/api/actions/json_builders_spec.rb +85 -0
- data/spec/elasticsearch/api/actions/mget_spec.rb +102 -0
- data/spec/elasticsearch/api/actions/msearch_spec.rb +169 -0
- data/spec/elasticsearch/api/actions/msearch_template_spec.rb +94 -0
- data/spec/elasticsearch/api/actions/mtermvectors_spec.rb +45 -0
- data/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb +61 -0
- data/spec/elasticsearch/api/actions/nodes/info_spec.rb +102 -0
- data/spec/elasticsearch/api/actions/nodes/reload_secure_settings_spec.rb +87 -0
- data/spec/elasticsearch/api/actions/nodes/shutdown_spec.rb +76 -0
- data/spec/elasticsearch/api/actions/nodes/stats_spec.rb +76 -0
- data/spec/elasticsearch/api/actions/ping_spec.rb +75 -0
- data/spec/elasticsearch/api/actions/put_script_spec.rb +49 -0
- data/spec/elasticsearch/api/actions/reindex_spec.rb +34 -0
- data/spec/elasticsearch/api/actions/remote/info_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/render_search_template_spec.rb +34 -0
- data/spec/elasticsearch/api/actions/scoll_spec.rb +34 -0
- data/spec/elasticsearch/api/actions/search_shards_spec.rb +34 -0
- data/spec/elasticsearch/api/actions/search_spec.rb +148 -0
- data/spec/elasticsearch/api/actions/search_template_spec.rb +34 -0
- data/spec/elasticsearch/api/actions/snapshot/create_repository_spec.rb +51 -0
- data/spec/elasticsearch/api/actions/snapshot/create_spec.rb +51 -0
- data/spec/elasticsearch/api/actions/snapshot/delete_repository_spec.rb +50 -0
- data/spec/elasticsearch/api/actions/snapshot/delete_spec.rb +51 -0
- data/spec/elasticsearch/api/actions/snapshot/get_repository_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/snapshot/get_spec.rb +51 -0
- data/spec/elasticsearch/api/actions/snapshot/restore_spec.rb +51 -0
- data/spec/elasticsearch/api/actions/snapshot/status_spec.rb +50 -0
- data/spec/elasticsearch/api/actions/snapshot/verify_repository_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/tasks/cancel_spec.rb +50 -0
- data/spec/elasticsearch/api/actions/tasks/get_spec.rb +35 -0
- data/spec/elasticsearch/api/actions/tasks/list_spec.rb +50 -0
- data/spec/elasticsearch/api/actions/termvectors_spec.rb +67 -0
- data/spec/elasticsearch/api/actions/update_by_query_spec.rb +34 -0
- data/spec/elasticsearch/api/actions/update_document_spec.rb +125 -0
- data/spec/elasticsearch/api/api_spec.rb +43 -0
- data/spec/elasticsearch/api/client_spec.rb +46 -0
- data/spec/elasticsearch/api/utils_spec.rb +430 -0
- data/spec/spec_helper.rb +79 -0
- data/test/integration/yaml_test_runner.rb +91 -44
- data/test/test_helper.rb +62 -13
- data/utils/Gemfile +17 -0
- data/utils/Thorfile +17 -0
- data/utils/thor/generate_api.rb +17 -0
- data/utils/thor/generate_source.rb +23 -2
- data/utils/thor/lister.rb +17 -0
- data/utils/thor/templates/ruby/method.erb +17 -0
- data/utils/thor/templates/ruby/test.erb +17 -0
- data/utils/thor/templates/ruby/test_helper.rb +17 -1
- metadata +290 -323
- data/lib/elasticsearch/api/actions/count_percolate.rb +0 -78
- data/lib/elasticsearch/api/actions/delete_template.rb +0 -21
- data/lib/elasticsearch/api/actions/field_stats.rb +0 -32
- data/lib/elasticsearch/api/actions/get_template.rb +0 -27
- data/lib/elasticsearch/api/actions/indices/delete_mapping.rb +0 -26
- data/lib/elasticsearch/api/actions/indices/delete_warmer.rb +0 -32
- data/lib/elasticsearch/api/actions/indices/get_aliases.rb +0 -34
- data/lib/elasticsearch/api/actions/indices/get_warmer.rb +0 -60
- data/lib/elasticsearch/api/actions/indices/optimize.rb +0 -74
- data/lib/elasticsearch/api/actions/indices/put_warmer.rb +0 -64
- data/lib/elasticsearch/api/actions/indices/seal.rb +0 -24
- data/lib/elasticsearch/api/actions/indices/snapshot_index.rb +0 -43
- data/lib/elasticsearch/api/actions/indices/status.rb +0 -60
- data/lib/elasticsearch/api/actions/list_benchmarks.rb +0 -27
- data/lib/elasticsearch/api/actions/mlt.rb +0 -128
- data/lib/elasticsearch/api/actions/mpercolate.rb +0 -59
- data/lib/elasticsearch/api/actions/percolate.rb +0 -71
- data/lib/elasticsearch/api/actions/put_template.rb +0 -25
- data/lib/elasticsearch/api/actions/search_exists.rb +0 -59
- data/lib/elasticsearch/api/actions/suggest.rb +0 -46
- data/test/unit/abort_benchmark_test.rb +0 -26
- data/test/unit/api_test.rb +0 -28
- data/test/unit/benchmark_test.rb +0 -26
- data/test/unit/bulk_test.rb +0 -133
- data/test/unit/cat/aliases_test.rb +0 -26
- data/test/unit/cat/allocation_test.rb +0 -26
- data/test/unit/cat/count_test.rb +0 -26
- data/test/unit/cat/fielddata_test.rb +0 -38
- data/test/unit/cat/health_test.rb +0 -26
- data/test/unit/cat/help_test.rb +0 -26
- data/test/unit/cat/indices_test.rb +0 -26
- data/test/unit/cat/master_test.rb +0 -26
- data/test/unit/cat/nodeattrs_test.rb +0 -26
- data/test/unit/cat/nodes_test.rb +0 -26
- data/test/unit/cat/pending_tasks_test.rb +0 -26
- data/test/unit/cat/plugins_test.rb +0 -26
- data/test/unit/cat/recovery_test.rb +0 -26
- data/test/unit/cat/repositories_test.rb +0 -26
- data/test/unit/cat/segments_test.rb +0 -26
- data/test/unit/cat/shards_test.rb +0 -26
- data/test/unit/cat/snapshots_test.rb +0 -26
- data/test/unit/cat/tasks_test.rb +0 -26
- data/test/unit/cat/templates_test.rb +0 -26
- data/test/unit/cat/thread_pool_test.rb +0 -26
- data/test/unit/clear_scroll_test.rb +0 -38
- data/test/unit/client_test.rb +0 -31
- data/test/unit/cluster/allocation_explain_test.rb +0 -26
- data/test/unit/cluster/get_settings_test.rb +0 -26
- data/test/unit/cluster/health_test.rb +0 -47
- data/test/unit/cluster/pending_tasks_test.rb +0 -26
- data/test/unit/cluster/put_settings_test.rb +0 -26
- data/test/unit/cluster/remote_info_test.rb +0 -26
- data/test/unit/cluster/reroute_test.rb +0 -38
- data/test/unit/cluster/state_test.rb +0 -46
- data/test/unit/cluster/stats_test.rb +0 -26
- data/test/unit/count_percolate_test.rb +0 -26
- data/test/unit/count_test.rb +0 -46
- data/test/unit/create_document_test.rb +0 -56
- data/test/unit/delete_by_query_test.rb +0 -51
- data/test/unit/delete_document_test.rb +0 -85
- data/test/unit/delete_script_test.rb +0 -26
- data/test/unit/delete_template_test.rb +0 -26
- data/test/unit/exists_document_test.rb +0 -90
- data/test/unit/explain_document_test.rb +0 -73
- data/test/unit/field_caps_test.rb +0 -26
- data/test/unit/field_stats_test.rb +0 -26
- data/test/unit/get_document_source_test.rb +0 -71
- data/test/unit/get_document_test.rb +0 -85
- data/test/unit/get_script_test.rb +0 -26
- data/test/unit/get_template_test.rb +0 -41
- data/test/unit/index_document_test.rb +0 -92
- data/test/unit/indices/analyze_test.rb +0 -76
- data/test/unit/indices/clear_cache_test.rb +0 -54
- data/test/unit/indices/close_test.rb +0 -51
- data/test/unit/indices/create_test.rb +0 -51
- data/test/unit/indices/delete_alias_test.rb +0 -47
- data/test/unit/indices/delete_mapping_test.rb +0 -56
- data/test/unit/indices/delete_template_test.rb +0 -51
- data/test/unit/indices/delete_test.rb +0 -69
- data/test/unit/indices/delete_warmer_test.rb +0 -68
- data/test/unit/indices/exists_alias_test.rb +0 -73
- data/test/unit/indices/exists_template_test.rb +0 -59
- data/test/unit/indices/exists_test.rb +0 -71
- data/test/unit/indices/exists_type_test.rb +0 -73
- data/test/unit/indices/flush_synced_test.rb +0 -41
- data/test/unit/indices/flush_test.rb +0 -54
- data/test/unit/indices/forcemerge_test.rb +0 -26
- data/test/unit/indices/get_alias_test.rb +0 -44
- data/test/unit/indices/get_aliases_test.rb +0 -54
- data/test/unit/indices/get_field_mapping_test.rb +0 -44
- data/test/unit/indices/get_mapping_test.rb +0 -62
- data/test/unit/indices/get_settings_test.rb +0 -54
- data/test/unit/indices/get_template_test.rb +0 -43
- data/test/unit/indices/get_test.rb +0 -45
- data/test/unit/indices/get_warmer_test.rb +0 -44
- data/test/unit/indices/open_test.rb +0 -51
- data/test/unit/indices/optimize_test.rb +0 -54
- data/test/unit/indices/put_alias_test.rb +0 -59
- data/test/unit/indices/put_mapping_test.rb +0 -60
- data/test/unit/indices/put_settings_test.rb +0 -68
- data/test/unit/indices/put_template_test.rb +0 -57
- data/test/unit/indices/put_warmer_test.rb +0 -65
- data/test/unit/indices/recovery_test.rb +0 -26
- data/test/unit/indices/refresh_test.rb +0 -64
- data/test/unit/indices/rollover_test.rb +0 -38
- data/test/unit/indices/seal_test.rb +0 -25
- data/test/unit/indices/segments_test.rb +0 -64
- data/test/unit/indices/shard_stores_test.rb +0 -26
- data/test/unit/indices/shrink_test.rb +0 -33
- data/test/unit/indices/snapshot_index_test.rb +0 -64
- data/test/unit/indices/stats_test.rb +0 -76
- data/test/unit/indices/status_test.rb +0 -72
- data/test/unit/indices/update_aliases_test.rb +0 -42
- data/test/unit/indices/upgrade_test.rb +0 -26
- data/test/unit/indices/validate_query_test.rb +0 -84
- data/test/unit/info_test.rb +0 -26
- data/test/unit/ingest/delete_pipeline_test.rb +0 -41
- data/test/unit/ingest/get_pipeline_test.rb +0 -35
- data/test/unit/ingest/put_pipeline_test.rb +0 -46
- data/test/unit/ingest/simulate_test.rb +0 -35
- data/test/unit/json_builders_test.rb +0 -64
- data/test/unit/list_benchmarks_test.rb +0 -26
- data/test/unit/mget_test.rb +0 -79
- data/test/unit/mlt_test.rb +0 -89
- data/test/unit/mpercolate_test.rb +0 -51
- data/test/unit/msearch_template_test.rb +0 -60
- data/test/unit/msearch_test.rb +0 -129
- data/test/unit/mtermvectors_test.rb +0 -38
- data/test/unit/nodes/hot_threads_test.rb +0 -44
- data/test/unit/nodes/info_test.rb +0 -75
- data/test/unit/nodes/shutdown_test.rb +0 -45
- data/test/unit/nodes/stats_test.rb +0 -65
- data/test/unit/percolate_test.rb +0 -56
- data/test/unit/ping_test.rb +0 -53
- data/test/unit/put_script_test.rb +0 -26
- data/test/unit/put_template_test.rb +0 -26
- data/test/unit/reindex_test.rb +0 -26
- data/test/unit/remote/info_test.rb +0 -26
- data/test/unit/render_search_template_test.rb +0 -25
- data/test/unit/scroll_test.rb +0 -26
- data/test/unit/search_exists_test.rb +0 -26
- data/test/unit/search_shards_test.rb +0 -26
- data/test/unit/search_template_test.rb +0 -26
- data/test/unit/search_test.rb +0 -116
- data/test/unit/snapshot/create_repository_test.rb +0 -38
- data/test/unit/snapshot/create_test.rb +0 -38
- data/test/unit/snapshot/delete_repository_test.rb +0 -35
- data/test/unit/snapshot/delete_test.rb +0 -38
- data/test/unit/snapshot/get_repository_test.rb +0 -26
- data/test/unit/snapshot/get_test.rb +0 -38
- data/test/unit/snapshot/restore_test.rb +0 -38
- data/test/unit/snapshot/status_test.rb +0 -38
- data/test/unit/snapshot/verify_repository_test.rb +0 -26
- data/test/unit/suggest_test.rb +0 -64
- data/test/unit/tasks/cancel_test.rb +0 -38
- data/test/unit/tasks/get_test.rb +0 -26
- data/test/unit/tasks/list_test.rb +0 -38
- data/test/unit/termvectors_test.rb +0 -47
- data/test/unit/update_by_query_test.rb +0 -26
- data/test/unit/update_document_test.rb +0 -85
- data/test/unit/utils_test.rb +0 -310
@@ -1,128 +0,0 @@
|
|
1
|
-
module Elasticsearch
|
2
|
-
module API
|
3
|
-
module Actions
|
4
|
-
|
5
|
-
# Return documents similar to the specified one.
|
6
|
-
#
|
7
|
-
# Performs a `more_like_this` query with the specified document as the input.
|
8
|
-
#
|
9
|
-
# @example Search for similar documents using the `title` property of document `myindex/mytype/1`
|
10
|
-
#
|
11
|
-
# # First, let's setup a synonym-aware analyzer ("quick" <=> "fast")
|
12
|
-
# client.indices.create index: 'myindex', body: {
|
13
|
-
# settings: {
|
14
|
-
# analysis: {
|
15
|
-
# filter: {
|
16
|
-
# synonyms: {
|
17
|
-
# type: 'synonym',
|
18
|
-
# synonyms: [ "quick,fast" ]
|
19
|
-
# }
|
20
|
-
# },
|
21
|
-
# analyzer: {
|
22
|
-
# title_synonym: {
|
23
|
-
# type: 'custom',
|
24
|
-
# tokenizer: 'whitespace',
|
25
|
-
# filter: ['lowercase', 'stop', 'snowball', 'synonyms']
|
26
|
-
# }
|
27
|
-
# }
|
28
|
-
# }
|
29
|
-
# },
|
30
|
-
# mappings: {
|
31
|
-
# mytype: {
|
32
|
-
# properties: {
|
33
|
-
# title: {
|
34
|
-
# type: 'string',
|
35
|
-
# analyzer: 'title_synonym'
|
36
|
-
# }
|
37
|
-
# }
|
38
|
-
# }
|
39
|
-
# }
|
40
|
-
# }
|
41
|
-
#
|
42
|
-
# # Index three documents
|
43
|
-
# client.index index: 'myindex', type: 'mytype', id: 1, body: { title: 'Quick Brown Fox' }
|
44
|
-
# client.index index: 'myindex', type: 'mytype', id: 2, body: { title: 'Slow Black Dog' }
|
45
|
-
# client.index index: 'myindex', type: 'mytype', id: 3, body: { title: 'Fast White Rabbit' }
|
46
|
-
# client.indices.refresh index: 'myindex'
|
47
|
-
#
|
48
|
-
# client.mlt index: 'myindex', type: 'mytype', id: 1, mlt_fields: 'title', min_doc_freq: 1, min_term_freq: 1
|
49
|
-
# # => { ... {"title"=>"Fast White Rabbit"}}]}}
|
50
|
-
#
|
51
|
-
# @option arguments [String] :id The document ID (*Required*)
|
52
|
-
# @option arguments [String] :index The name of the index (*Required*)
|
53
|
-
# @option arguments [String] :type The type of the document (use `_all` to fetch
|
54
|
-
# the first document matching the ID across all types) (*Required*)
|
55
|
-
# @option arguments [Hash] :body A specific search request definition
|
56
|
-
# @option arguments [Number] :boost_terms The boost factor
|
57
|
-
# @option arguments [Number] :max_doc_freq The word occurrence frequency as count: words with higher occurrence
|
58
|
-
# in the corpus will be ignored
|
59
|
-
# @option arguments [Number] :max_query_terms The maximum query terms to be included in the generated query
|
60
|
-
# @option arguments [Number] :max_word_len The minimum length of the word: longer words will be ignored
|
61
|
-
# @option arguments [Number] :min_doc_freq The word occurrence frequency as count: words with lower occurrence
|
62
|
-
# in the corpus will be ignored
|
63
|
-
# @option arguments [Number] :min_term_freq The term frequency as percent: terms with lower occurence
|
64
|
-
# in the source document will be ignored
|
65
|
-
# @option arguments [Number] :min_word_len The minimum length of the word: shorter words will be ignored
|
66
|
-
# @option arguments [List] :mlt_fields Specific fields to perform the query against
|
67
|
-
# @option arguments [Number] :percent_terms_to_match How many terms have to match in order to consider
|
68
|
-
# the document a match (default: 0.3)
|
69
|
-
# @option arguments [String] :routing Specific routing value
|
70
|
-
# @option arguments [Number] :search_from The offset from which to return results
|
71
|
-
# @option arguments [List] :search_indices A comma-separated list of indices to perform the query against
|
72
|
-
# (default: the index containing the document)
|
73
|
-
# @option arguments [String] :search_query_hint The search query hint
|
74
|
-
# @option arguments [String] :search_scroll A scroll search request definition
|
75
|
-
# @option arguments [Number] :search_size The number of documents to return (default: 10)
|
76
|
-
# @option arguments [String] :search_source A specific search request definition (instead of using the request body)
|
77
|
-
# @option arguments [String] :search_type Specific search type (eg. `dfs_then_fetch`, `count`, etc)
|
78
|
-
# @option arguments [List] :search_types A comma-separated list of types to perform the query against
|
79
|
-
# (default: the same type as the document)
|
80
|
-
# @option arguments [List] :stop_words A list of stop words to be ignored
|
81
|
-
#
|
82
|
-
# @see http://elasticsearch.org/guide/reference/api/more-like-this/
|
83
|
-
#
|
84
|
-
def mlt(arguments={})
|
85
|
-
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
86
|
-
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
|
87
|
-
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
88
|
-
|
89
|
-
valid_params = [
|
90
|
-
:boost_terms,
|
91
|
-
:max_doc_freq,
|
92
|
-
:max_query_terms,
|
93
|
-
:max_word_len,
|
94
|
-
:min_doc_freq,
|
95
|
-
:min_term_freq,
|
96
|
-
:min_word_len,
|
97
|
-
:mlt_fields,
|
98
|
-
:percent_terms_to_match,
|
99
|
-
:routing,
|
100
|
-
:search_from,
|
101
|
-
:search_indices,
|
102
|
-
:search_query_hint,
|
103
|
-
:search_scroll,
|
104
|
-
:search_size,
|
105
|
-
:search_source,
|
106
|
-
:search_type,
|
107
|
-
:search_types,
|
108
|
-
:stop_words ]
|
109
|
-
|
110
|
-
method = HTTP_GET
|
111
|
-
path = Utils.__pathify Utils.__escape(arguments[:index]),
|
112
|
-
Utils.__escape(arguments[:type]),
|
113
|
-
Utils.__escape(arguments[:id]),
|
114
|
-
'_mlt'
|
115
|
-
|
116
|
-
params = Utils.__validate_and_extract_params arguments, valid_params
|
117
|
-
|
118
|
-
[:mlt_fields, :search_indices, :search_types, :stop_words].each do |name|
|
119
|
-
params[name] = Utils.__listify(params[name]) if params[name]
|
120
|
-
end
|
121
|
-
|
122
|
-
body = arguments[:body]
|
123
|
-
|
124
|
-
perform_request(method, path, params, body).body
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module Elasticsearch
|
2
|
-
module API
|
3
|
-
module Actions
|
4
|
-
|
5
|
-
# Perform multiple percolate operations in a single request, similar to the {#msearch} API
|
6
|
-
#
|
7
|
-
# Pass the percolate definitions as header-body pairs in the `:body` argument, as an Array of Hashes.
|
8
|
-
#
|
9
|
-
# @example Perform two different percolations in a single request
|
10
|
-
#
|
11
|
-
# client.mpercolate \
|
12
|
-
# body: [
|
13
|
-
# { percolate: { index: "my-index", type: "my-type" } },
|
14
|
-
# { doc: { message: "foo bar" } },
|
15
|
-
# { percolate: { index: "my-other-index", type: "my-other-type", id: "1" } },
|
16
|
-
# { }
|
17
|
-
# ]
|
18
|
-
#
|
19
|
-
# @option arguments [String] :index The index of the document being count percolated to use as default
|
20
|
-
# @option arguments [String] :type The type of the document being percolated to use as default.
|
21
|
-
# @option arguments [Array<Hash>] The percolate request definitions (header & body pairs) (*Required*)
|
22
|
-
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
23
|
-
# unavailable (missing or closed)
|
24
|
-
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
|
25
|
-
# no concrete indices. (This includes `_all` string or when no
|
26
|
-
# indices have been specified)
|
27
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are
|
28
|
-
# open, closed or both. (options: open, closed)
|
29
|
-
#
|
30
|
-
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-percolate.html
|
31
|
-
#
|
32
|
-
def mpercolate(arguments={})
|
33
|
-
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
34
|
-
valid_params = [
|
35
|
-
:ignore_unavailable,
|
36
|
-
:allow_no_indices,
|
37
|
-
:expand_wildcards,
|
38
|
-
:percolate_format ]
|
39
|
-
|
40
|
-
method = HTTP_GET
|
41
|
-
path = "_mpercolate"
|
42
|
-
|
43
|
-
params = Utils.__validate_and_extract_params arguments, valid_params
|
44
|
-
body = arguments[:body]
|
45
|
-
|
46
|
-
case
|
47
|
-
when body.is_a?(Array)
|
48
|
-
payload = body.map { |d| d.is_a?(String) ? d : Elasticsearch::API.serializer.dump(d) }
|
49
|
-
payload << "" unless payload.empty?
|
50
|
-
payload = payload.join("\n")
|
51
|
-
else
|
52
|
-
payload = body
|
53
|
-
end
|
54
|
-
|
55
|
-
perform_request(method, path, params, payload).body
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
module Elasticsearch
|
2
|
-
module API
|
3
|
-
module Actions
|
4
|
-
|
5
|
-
# Return names of queries matching a document.
|
6
|
-
#
|
7
|
-
# Percolator allows you to register queries and then evaluate a document against them:
|
8
|
-
# the IDs of matching queries are returned in the response.
|
9
|
-
#
|
10
|
-
# @deprecated The `_percolate` API has been deprecated in favour of a special field mapping and the
|
11
|
-
# `percolate` query;
|
12
|
-
# see https://www.elastic.co/guide/en/elasticsearch/reference/5.5/breaking_50_percolator.html
|
13
|
-
#
|
14
|
-
# See full example for Elasticsearch 5.x and higher in <https://github.com/elastic/elasticsearch-ruby/blob/master/examples/percolator/percolator_alerts.rb>
|
15
|
-
#
|
16
|
-
# @option arguments [String] :index The index of the document being percolated. (*Required*)
|
17
|
-
# @option arguments [String] :type The type of the document being percolated. (*Required*)
|
18
|
-
# @option arguments [String] :id Fetch the document specified by index/type/id and
|
19
|
-
# use it instead of the passed `doc`
|
20
|
-
# @option arguments [Hash] :body The percolator request definition using the percolate DSL
|
21
|
-
# @option arguments [List] :routing A comma-separated list of specific routing values
|
22
|
-
# @option arguments [String] :preference Specify the node or shard the operation should be performed on
|
23
|
-
# (default: random)
|
24
|
-
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
25
|
-
# unavailable (missing or closed)
|
26
|
-
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
|
27
|
-
# no concrete indices. (This includes `_all` string or when no
|
28
|
-
# indices have been specified)
|
29
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are
|
30
|
-
# open, closed or both. (options: open, closed)
|
31
|
-
# @option arguments [String] :percolate_index The index to percolate the document into. Defaults to passed `index`.
|
32
|
-
# @option arguments [String] :percolate_format Return an array of matching query IDs instead of objects.
|
33
|
-
# (options: ids)
|
34
|
-
# @option arguments [String] :percolate_type The type to percolate document into. Defaults to passed `type`.
|
35
|
-
# @option arguments [Number] :version Explicit version number for concurrency control
|
36
|
-
# @option arguments [String] :version_type Specific version type (options: internal, external, external_gte, force)
|
37
|
-
#
|
38
|
-
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-percolate.html
|
39
|
-
#
|
40
|
-
def percolate(arguments={})
|
41
|
-
Utils.__report_unsupported_method :percolate
|
42
|
-
|
43
|
-
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
44
|
-
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
|
45
|
-
|
46
|
-
valid_params = [
|
47
|
-
:routing,
|
48
|
-
:preference,
|
49
|
-
:ignore_unavailable,
|
50
|
-
:allow_no_indices,
|
51
|
-
:expand_wildcards,
|
52
|
-
:percolate_index,
|
53
|
-
:percolate_type,
|
54
|
-
:percolate_format,
|
55
|
-
:version,
|
56
|
-
:version_type ]
|
57
|
-
|
58
|
-
method = HTTP_GET
|
59
|
-
path = Utils.__pathify Utils.__escape(arguments[:index]),
|
60
|
-
Utils.__escape(arguments[:type]),
|
61
|
-
Utils.__escape(arguments[:id]),
|
62
|
-
'_percolate'
|
63
|
-
|
64
|
-
params = Utils.__validate_and_extract_params arguments, valid_params
|
65
|
-
body = arguments[:body]
|
66
|
-
|
67
|
-
perform_request(method, path, params, body).body
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Elasticsearch
|
2
|
-
module API
|
3
|
-
module Actions
|
4
|
-
|
5
|
-
# Store a template for the search definition in Elasticsearch,
|
6
|
-
# to be later used with the `search_template` method
|
7
|
-
#
|
8
|
-
# @option arguments [String] :id Template ID (*Required*)
|
9
|
-
# @option arguments [Hash] :body The document (*Required*)
|
10
|
-
#
|
11
|
-
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html
|
12
|
-
#
|
13
|
-
def put_template(arguments={})
|
14
|
-
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
15
|
-
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
16
|
-
method = HTTP_PUT
|
17
|
-
path = "_search/template/#{arguments[:id]}"
|
18
|
-
params = {}
|
19
|
-
body = arguments[:body]
|
20
|
-
|
21
|
-
perform_request(method, path, params, body).body
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module Elasticsearch
|
2
|
-
module API
|
3
|
-
module Actions
|
4
|
-
|
5
|
-
# Return whether documents exists for a particular query
|
6
|
-
#
|
7
|
-
# @option arguments [List] :index A comma-separated list of indices to restrict the results
|
8
|
-
# @option arguments [List] :type A comma-separated list of types to restrict the results
|
9
|
-
# @option arguments [Hash] :body A query to restrict the results specified with the Query DSL (optional)
|
10
|
-
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
11
|
-
# unavailable (missing or closed)
|
12
|
-
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves
|
13
|
-
# into no concrete indices.
|
14
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices
|
15
|
-
# that are open, closed or both.
|
16
|
-
# (options: open, closed, none, all)
|
17
|
-
# @option arguments [Number] :min_score Include only documents with a specific `_score` value in the result
|
18
|
-
# @option arguments [String] :preference Specify the node or shard the operation should be performed on
|
19
|
-
# (default: random)
|
20
|
-
# @option arguments [String] :routing Specific routing value
|
21
|
-
# @option arguments [String] :q Query in the Lucene query string syntax
|
22
|
-
# @option arguments [String] :analyzer The analyzer to use for the query string
|
23
|
-
# @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be
|
24
|
-
# analyzed (default: false)
|
25
|
-
# @option arguments [String] :default_operator The default operator for query string query (AND or OR)
|
26
|
-
# (options: AND, OR)
|
27
|
-
# @option arguments [String] :df The field to use as default where no field prefix is given
|
28
|
-
# in the query string
|
29
|
-
# @option arguments [Boolean] :lenient Specify whether format-based query failures
|
30
|
-
# (such as providing text to a numeric field) should be ignored
|
31
|
-
# @option arguments [Boolean] :lowercase_expanded_terms Specify whether query terms should be lowercased
|
32
|
-
#
|
33
|
-
# @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-exists.html
|
34
|
-
#
|
35
|
-
def search_exists(arguments={})
|
36
|
-
valid_params = [
|
37
|
-
:ignore_unavailable,
|
38
|
-
:allow_no_indices,
|
39
|
-
:expand_wildcards,
|
40
|
-
:min_score,
|
41
|
-
:preference,
|
42
|
-
:routing,
|
43
|
-
:q,
|
44
|
-
:analyzer,
|
45
|
-
:analyze_wildcard,
|
46
|
-
:default_operator,
|
47
|
-
:df,
|
48
|
-
:lenient,
|
49
|
-
:lowercase_expanded_terms ]
|
50
|
-
method = 'POST'
|
51
|
-
path = "_search/exists"
|
52
|
-
params = Utils.__validate_and_extract_params arguments, valid_params
|
53
|
-
body = arguments[:body]
|
54
|
-
|
55
|
-
perform_request(method, path, params, body).body
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Elasticsearch
|
2
|
-
module API
|
3
|
-
module Actions
|
4
|
-
|
5
|
-
# Return query terms suggestions based on provided text and configuration.
|
6
|
-
#
|
7
|
-
# Pass the request definition in the `:body` argument.
|
8
|
-
#
|
9
|
-
# @example Return query terms suggestions ("auto-correction")
|
10
|
-
#
|
11
|
-
# client.suggest index: 'myindex',
|
12
|
-
# body: { my_suggest: { text: 'tset', term: { field: 'title' } } }
|
13
|
-
# # => { ... "my_suggest"=>[ {"text"=>"tset", ... "options"=>[{"text"=>"test", "score"=>0.75, "freq"=>5}] }]}
|
14
|
-
#
|
15
|
-
# @option arguments [List] :index A comma-separated list of index names to restrict the operation;
|
16
|
-
# use `_all` or empty string to perform the operation on all indices
|
17
|
-
# @option arguments [Hash] :body The request definition
|
18
|
-
# @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore `missing` ones
|
19
|
-
# (options: none, missing)
|
20
|
-
# @option arguments [String] :preference Specify the node or shard the operation should be performed on
|
21
|
-
# (default: random)
|
22
|
-
# @option arguments [String] :routing Specific routing value
|
23
|
-
# @option arguments [String] :source The URL-encoded request definition (instead of using request body)
|
24
|
-
#
|
25
|
-
# @since 0.90
|
26
|
-
#
|
27
|
-
# @see http://elasticsearch.org/guide/reference/api/search/suggest/
|
28
|
-
#
|
29
|
-
def suggest(arguments={})
|
30
|
-
valid_params = [
|
31
|
-
:ignore_indices,
|
32
|
-
:preference,
|
33
|
-
:routing,
|
34
|
-
:source ]
|
35
|
-
|
36
|
-
method = HTTP_POST
|
37
|
-
path = Utils.__pathify( Utils.__listify(arguments[:index]), '_suggest' )
|
38
|
-
|
39
|
-
params = Utils.__validate_and_extract_params arguments, valid_params
|
40
|
-
body = arguments[:body]
|
41
|
-
|
42
|
-
perform_request(method, path, params, body).body
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Elasticsearch
|
4
|
-
module Test
|
5
|
-
class AbortBenchmarkTest < ::Test::Unit::TestCase
|
6
|
-
|
7
|
-
context "Abort benchmark" do
|
8
|
-
subject { FakeClient.new }
|
9
|
-
|
10
|
-
should "perform correct request" do
|
11
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
12
|
-
assert_equal 'POST', method
|
13
|
-
assert_equal '_bench/abort/foo', url
|
14
|
-
assert_equal nil, params[:name]
|
15
|
-
assert_nil body
|
16
|
-
true
|
17
|
-
end.returns(FakeResponse.new)
|
18
|
-
|
19
|
-
subject.abort_benchmark :name => 'foo'
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/test/unit/api_test.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
|
5
|
-
module Elasticsearch
|
6
|
-
module Test
|
7
|
-
class APITest < ::Test::Unit::TestCase
|
8
|
-
|
9
|
-
context "The API module" do
|
10
|
-
|
11
|
-
should "access the settings" do
|
12
|
-
assert_not_nil Elasticsearch::API.settings
|
13
|
-
end
|
14
|
-
|
15
|
-
should "allow to set settings" do
|
16
|
-
assert_nothing_raised { Elasticsearch::API.settings[:foo] = 'bar' }
|
17
|
-
assert_equal 'bar', Elasticsearch::API.settings[:foo]
|
18
|
-
end
|
19
|
-
|
20
|
-
should "have default serializer" do
|
21
|
-
assert_equal MultiJson, Elasticsearch::API.serializer
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/test/unit/benchmark_test.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Elasticsearch
|
4
|
-
module Test
|
5
|
-
class BenchmarkTest < ::Test::Unit::TestCase
|
6
|
-
|
7
|
-
context "Benchmark" do
|
8
|
-
subject { FakeClient.new }
|
9
|
-
|
10
|
-
should "perform correct request" do
|
11
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
12
|
-
assert_equal 'PUT', method
|
13
|
-
assert_equal '_bench', url
|
14
|
-
assert_equal Hash.new, params
|
15
|
-
assert_equal 'foo', body[:name]
|
16
|
-
true
|
17
|
-
end.returns(FakeResponse.new)
|
18
|
-
|
19
|
-
subject.benchmark :body => { :name => 'foo' }
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/test/unit/bulk_test.rb
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Elasticsearch
|
4
|
-
module Test
|
5
|
-
class BulkTest < ::Test::Unit::TestCase
|
6
|
-
|
7
|
-
context "Bulk" do
|
8
|
-
subject { FakeClient.new }
|
9
|
-
|
10
|
-
should "post correct payload to the endpoint" do
|
11
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
12
|
-
assert_equal 'POST', method
|
13
|
-
assert_equal '_bulk', url
|
14
|
-
assert_equal Hash.new, params
|
15
|
-
|
16
|
-
if RUBY_1_8
|
17
|
-
lines = body.split("\n")
|
18
|
-
|
19
|
-
assert_equal 7, lines.size
|
20
|
-
assert_match /\{"index"\:\{/, lines[0]
|
21
|
-
assert_match /\{"title"\:"Test"/, lines[1]
|
22
|
-
assert_match /\{"update"\:\{/, lines[2]
|
23
|
-
assert_match /\{"doc"\:\{"title"/, lines[3]
|
24
|
-
else
|
25
|
-
assert_equal <<-PAYLOAD.gsub(/^\s+/, ''), body
|
26
|
-
{"index":{"_index":"myindexA","_type":"mytype","_id":"1"}}
|
27
|
-
{"title":"Test"}
|
28
|
-
{"update":{"_index":"myindexB","_type":"mytype","_id":"2"}}
|
29
|
-
{"doc":{"title":"Update"}}
|
30
|
-
{"delete":{"_index":"myindexC","_type":"mytypeC","_id":"3"}}
|
31
|
-
{"index":{"_index":"myindexD","_type":"mytype","_id":"1"}}
|
32
|
-
{"data":"MYDATA"}
|
33
|
-
PAYLOAD
|
34
|
-
end
|
35
|
-
true
|
36
|
-
end.returns(FakeResponse.new)
|
37
|
-
|
38
|
-
subject.bulk :body => [
|
39
|
-
{ :index => { :_index => 'myindexA', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } },
|
40
|
-
{ :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
|
41
|
-
{ :delete => { :_index => 'myindexC', :_type => 'mytypeC', :_id => '3' } },
|
42
|
-
{ :index => { :_index => 'myindexD', :_type => 'mytype', :_id => '1', :data => { :data => 'MYDATA' } } },
|
43
|
-
]
|
44
|
-
end
|
45
|
-
|
46
|
-
should "post payload to the correct endpoint" do
|
47
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
48
|
-
assert_equal 'POST', method
|
49
|
-
assert_equal 'myindex/_bulk', url
|
50
|
-
true
|
51
|
-
end.returns(FakeResponse.new)
|
52
|
-
|
53
|
-
subject.bulk :index => 'myindex', :body => []
|
54
|
-
end
|
55
|
-
|
56
|
-
should "handle `:data` keys correctly in header/data payloads" do
|
57
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
58
|
-
lines = body.split("\n")
|
59
|
-
assert_equal 2, lines.size
|
60
|
-
|
61
|
-
header = MultiJson.load(lines.first)
|
62
|
-
data = MultiJson.load(lines.last)
|
63
|
-
|
64
|
-
assert_equal 'myindex', header['update']['_index']
|
65
|
-
assert_equal 'mytype', header['update']['_type']
|
66
|
-
assert_equal '1', header['update']['_id']
|
67
|
-
|
68
|
-
assert_equal({'data' => { 'title' => 'Update' }}, data['doc'])
|
69
|
-
# assert_equal <<-PAYLOAD.gsub(/^\s+/, ''), body
|
70
|
-
# {"update":{"_index":"myindex","_type":"mytype","_id":"1"}}
|
71
|
-
# {"doc":{"data":{"title":"Update"}}}
|
72
|
-
# PAYLOAD
|
73
|
-
true
|
74
|
-
end.returns(FakeResponse.new)
|
75
|
-
|
76
|
-
subject.bulk :body => [
|
77
|
-
{ :update => { :_index => 'myindex', :_type => 'mytype', :_id => '1' } },
|
78
|
-
{ :doc => { :data => { :title => 'Update' } } }
|
79
|
-
]
|
80
|
-
end
|
81
|
-
|
82
|
-
should "post a string payload" do
|
83
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
84
|
-
assert_equal "foo\nbar", body
|
85
|
-
true
|
86
|
-
end.returns(FakeResponse.new)
|
87
|
-
|
88
|
-
subject.bulk :body => "foo\nbar"
|
89
|
-
end
|
90
|
-
|
91
|
-
should "post an array of strings payload" do
|
92
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
93
|
-
assert_equal "foo\nbar\n", body
|
94
|
-
true
|
95
|
-
end.returns(FakeResponse.new)
|
96
|
-
|
97
|
-
subject.bulk :body => ["foo", "bar"]
|
98
|
-
end
|
99
|
-
|
100
|
-
should "encode URL parameters" do
|
101
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
102
|
-
assert_equal '_bulk', url
|
103
|
-
assert_equal({:refresh => true}, params)
|
104
|
-
true
|
105
|
-
end.returns(FakeResponse.new)
|
106
|
-
|
107
|
-
subject.bulk :refresh => true, :body => []
|
108
|
-
end
|
109
|
-
|
110
|
-
should "URL-escape the parts" do
|
111
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
112
|
-
assert_equal 'foo%5Ebar/_bulk', url
|
113
|
-
true
|
114
|
-
end.returns(FakeResponse.new)
|
115
|
-
|
116
|
-
subject.bulk :index => 'foo^bar', :body => []
|
117
|
-
end
|
118
|
-
|
119
|
-
should "not duplicate the type" do
|
120
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
121
|
-
assert_equal 'myindex/mytype/_bulk', url
|
122
|
-
assert_empty params
|
123
|
-
true
|
124
|
-
end.returns(FakeResponse.new)
|
125
|
-
|
126
|
-
subject.bulk :index => 'myindex', :type => 'mytype', :body => []
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Elasticsearch
|
4
|
-
module Test
|
5
|
-
class CatAliasesTest < ::Test::Unit::TestCase
|
6
|
-
|
7
|
-
context "Cat: Aliases" do
|
8
|
-
subject { FakeClient.new }
|
9
|
-
|
10
|
-
should "perform correct request" do
|
11
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
12
|
-
assert_equal 'GET', method
|
13
|
-
assert_equal '_cat/aliases', url
|
14
|
-
assert_equal Hash.new, params
|
15
|
-
assert_nil body
|
16
|
-
true
|
17
|
-
end.returns(FakeResponse.new)
|
18
|
-
|
19
|
-
subject.cat.aliases
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Elasticsearch
|
4
|
-
module Test
|
5
|
-
class CatAllocationTest < ::Test::Unit::TestCase
|
6
|
-
|
7
|
-
context "Cat: Allocation" do
|
8
|
-
subject { FakeClient.new }
|
9
|
-
|
10
|
-
should "perform correct request" do
|
11
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
12
|
-
assert_equal 'GET', method
|
13
|
-
assert_equal '_cat/allocation', url
|
14
|
-
assert_equal Hash.new, params
|
15
|
-
assert_nil body
|
16
|
-
true
|
17
|
-
end.returns(FakeResponse.new)
|
18
|
-
|
19
|
-
subject.cat.allocation
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|