elasticsearch-api 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/Rakefile +3 -3
- data/elasticsearch-api.gemspec +4 -1
- data/lib/elasticsearch/api.rb +19 -0
- data/lib/elasticsearch/api/actions/abort_benchmark.rb +1 -1
- data/lib/elasticsearch/api/actions/benchmark.rb +1 -1
- data/lib/elasticsearch/api/actions/bulk.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/aliases.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/allocation.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/count.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/fielddata.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/health.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/help.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/indices.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/master.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/nodes.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/recovery.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/segments.rb +34 -0
- data/lib/elasticsearch/api/actions/cat/shards.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/thread_pool.rb +1 -1
- data/lib/elasticsearch/api/actions/clear_scroll.rb +12 -3
- data/lib/elasticsearch/api/actions/cluster/get_settings.rb +1 -1
- data/lib/elasticsearch/api/actions/cluster/health.rb +1 -1
- data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +1 -1
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +1 -1
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +1 -1
- data/lib/elasticsearch/api/actions/cluster/state.rb +8 -2
- data/lib/elasticsearch/api/actions/count.rb +1 -1
- data/lib/elasticsearch/api/actions/count_percolate.rb +1 -1
- data/lib/elasticsearch/api/actions/delete.rb +1 -1
- data/lib/elasticsearch/api/actions/delete_by_query.rb +1 -1
- data/lib/elasticsearch/api/actions/delete_script.rb +1 -1
- data/lib/elasticsearch/api/actions/delete_template.rb +1 -1
- data/lib/elasticsearch/api/actions/exists.rb +4 -2
- data/lib/elasticsearch/api/actions/explain.rb +1 -1
- data/lib/elasticsearch/api/actions/get.rb +2 -2
- data/lib/elasticsearch/api/actions/get_script.rb +1 -1
- data/lib/elasticsearch/api/actions/get_source.rb +2 -2
- data/lib/elasticsearch/api/actions/get_template.rb +1 -1
- data/lib/elasticsearch/api/actions/index.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/analyze.rb +5 -3
- data/lib/elasticsearch/api/actions/indices/clear_cache.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/close.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/create.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/delete.rb +7 -1
- data/lib/elasticsearch/api/actions/indices/delete_alias.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/delete_mapping.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/delete_template.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/delete_warmer.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/exists.rb +3 -1
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +3 -1
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +3 -2
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +3 -1
- data/lib/elasticsearch/api/actions/indices/flush.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/get.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/get_aliases.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/get_template.rb +3 -2
- data/lib/elasticsearch/api/actions/indices/get_warmer.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/open.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/optimize.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +2 -2
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/put_template.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/put_warmer.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/recovery.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/refresh.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/segments.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/snapshot_index.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/stats.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/status.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/update_aliases.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/upgrade.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/validate_query.rb +1 -1
- data/lib/elasticsearch/api/actions/info.rb +1 -1
- data/lib/elasticsearch/api/actions/list_benchmarks.rb +1 -1
- data/lib/elasticsearch/api/actions/mget.rb +1 -1
- data/lib/elasticsearch/api/actions/mlt.rb +1 -1
- data/lib/elasticsearch/api/actions/mpercolate.rb +1 -1
- data/lib/elasticsearch/api/actions/msearch.rb +1 -1
- data/lib/elasticsearch/api/actions/mtermvectors.rb +1 -1
- data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +1 -1
- data/lib/elasticsearch/api/actions/nodes/info.rb +18 -2
- data/lib/elasticsearch/api/actions/nodes/shutdown.rb +1 -1
- data/lib/elasticsearch/api/actions/nodes/stats.rb +1 -1
- data/lib/elasticsearch/api/actions/percolate.rb +4 -5
- data/lib/elasticsearch/api/actions/ping.rb +1 -1
- data/lib/elasticsearch/api/actions/put_script.rb +1 -1
- data/lib/elasticsearch/api/actions/put_template.rb +1 -1
- data/lib/elasticsearch/api/actions/scroll.rb +2 -2
- data/lib/elasticsearch/api/actions/search.rb +4 -3
- data/lib/elasticsearch/api/actions/search_shards.rb +1 -1
- data/lib/elasticsearch/api/actions/search_template.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/create.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/get.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/status.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +1 -1
- data/lib/elasticsearch/api/actions/suggest.rb +1 -1
- data/lib/elasticsearch/api/actions/{termvector.rb → termvectors.rb} +24 -7
- data/lib/elasticsearch/api/actions/update.rb +1 -1
- data/lib/elasticsearch/api/utils.rb +27 -6
- data/lib/elasticsearch/api/version.rb +1 -1
- data/test/integration/yaml_test_runner.rb +3 -2
- data/test/unit/api_test.rb +24 -0
- data/test/unit/cat/segments_test.rb +26 -0
- data/test/unit/clear_scroll_test.rb +4 -4
- data/test/unit/exists_document_test.rb +5 -0
- data/test/unit/indices/delete_test.rb +7 -0
- data/test/unit/indices/exists_alias_test.rb +5 -0
- data/test/unit/indices/exists_test.rb +5 -0
- data/test/unit/indices/exists_type_test.rb +5 -0
- data/test/unit/indices/put_alias_test.rb +9 -0
- data/test/unit/nodes/info_test.rb +9 -0
- data/test/unit/scroll_test.rb +1 -2
- data/test/unit/{termvector_test.rb → termvectors_test.rb} +15 -12
- data/test/unit/utils_test.rb +22 -0
- data/utils/Gemfile +9 -0
- data/utils/Thorfile +3 -0
- data/utils/thor/generate_api.rb +189 -0
- data/utils/thor/generate_source.rb +122 -0
- data/utils/thor/lister.rb +41 -0
- data/utils/thor/templates/ruby/method.erb +62 -0
- data/utils/thor/templates/ruby/test.erb +26 -0
- data/utils/thor/templates/ruby/test_helper.rb +71 -0
- metadata +18 -5
@@ -0,0 +1,71 @@
|
|
1
|
+
RUBY_1_8 = defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
|
2
|
+
|
3
|
+
require 'rubygems' if RUBY_1_8
|
4
|
+
|
5
|
+
require 'simplecov' and SimpleCov.start { add_filter "/test|test_/" } if ENV["COVERAGE"]
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require 'shoulda-context'
|
9
|
+
require 'mocha/setup'
|
10
|
+
require 'turn' unless ENV["TM_FILEPATH"] || ENV["NOTURN"] || RUBY_1_8
|
11
|
+
|
12
|
+
require 'require-prof' if ENV["REQUIRE_PROF"]
|
13
|
+
Dir[ File.expand_path('../../lib/elasticsearch/api/**/*.rb', __FILE__) ].each do |f|
|
14
|
+
puts 'Loading: ' + f.to_s if ENV['DEBUG']
|
15
|
+
require f
|
16
|
+
end
|
17
|
+
RequireProf.print_timing_infos if ENV["REQUIRE_PROF"]
|
18
|
+
|
19
|
+
module Elasticsearch
|
20
|
+
module Utils
|
21
|
+
def __validate_and_extract_params(*args)
|
22
|
+
{}
|
23
|
+
end
|
24
|
+
|
25
|
+
extend self
|
26
|
+
end
|
27
|
+
|
28
|
+
module Test
|
29
|
+
def __full_namespace(o)
|
30
|
+
o.constants.inject([o]) do |sum, c|
|
31
|
+
m = o.const_get(c.to_s.to_sym)
|
32
|
+
sum << __full_namespace(m).flatten if m.is_a?(Module)
|
33
|
+
sum
|
34
|
+
end.flatten
|
35
|
+
end; module_function :__full_namespace
|
36
|
+
|
37
|
+
module Namespace
|
38
|
+
def cluster
|
39
|
+
self
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class FakeClient
|
44
|
+
# Include all "Actions" modules into the fake client
|
45
|
+
Elasticsearch::Test.__full_namespace(Elasticsearch::API).select { |m| m.to_s =~ /Actions$/ }.each do |m|
|
46
|
+
puts "Including: #{m}" if ENV['DEBUG']
|
47
|
+
include m
|
48
|
+
end
|
49
|
+
|
50
|
+
# Include the fake "namespace" methods in the client
|
51
|
+
include Namespace
|
52
|
+
|
53
|
+
def perform_request(method, path, params, body)
|
54
|
+
puts "PERFORMING REQUEST:", "--> #{method.to_s.upcase} #{path} #{params} #{body}"
|
55
|
+
FakeResponse.new(200, 'FAKE', {})
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
FakeResponse = Struct.new(:status, :body, :headers) do
|
60
|
+
def status
|
61
|
+
values[0] || 200
|
62
|
+
end
|
63
|
+
def body
|
64
|
+
values[1] || '{}'
|
65
|
+
end
|
66
|
+
def headers
|
67
|
+
values[2] || {}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -364,6 +364,7 @@ files:
|
|
364
364
|
- lib/elasticsearch/api/actions/cat/nodes.rb
|
365
365
|
- lib/elasticsearch/api/actions/cat/pending_tasks.rb
|
366
366
|
- lib/elasticsearch/api/actions/cat/recovery.rb
|
367
|
+
- lib/elasticsearch/api/actions/cat/segments.rb
|
367
368
|
- lib/elasticsearch/api/actions/cat/shards.rb
|
368
369
|
- lib/elasticsearch/api/actions/cat/thread_pool.rb
|
369
370
|
- lib/elasticsearch/api/actions/clear_scroll.rb
|
@@ -454,7 +455,7 @@ files:
|
|
454
455
|
- lib/elasticsearch/api/actions/snapshot/status.rb
|
455
456
|
- lib/elasticsearch/api/actions/snapshot/verify_repository.rb
|
456
457
|
- lib/elasticsearch/api/actions/suggest.rb
|
457
|
-
- lib/elasticsearch/api/actions/
|
458
|
+
- lib/elasticsearch/api/actions/termvectors.rb
|
458
459
|
- lib/elasticsearch/api/actions/update.rb
|
459
460
|
- lib/elasticsearch/api/namespace/cat.rb
|
460
461
|
- lib/elasticsearch/api/namespace/cluster.rb
|
@@ -467,6 +468,7 @@ files:
|
|
467
468
|
- test/integration/yaml_test_runner.rb
|
468
469
|
- test/test_helper.rb
|
469
470
|
- test/unit/abort_benchmark_test.rb
|
471
|
+
- test/unit/api_test.rb
|
470
472
|
- test/unit/benchmark_test.rb
|
471
473
|
- test/unit/bulk_test.rb
|
472
474
|
- test/unit/cat/aliases_test.rb
|
@@ -480,6 +482,7 @@ files:
|
|
480
482
|
- test/unit/cat/nodes_test.rb
|
481
483
|
- test/unit/cat/pending_tasks_test.rb
|
482
484
|
- test/unit/cat/recovery_test.rb
|
485
|
+
- test/unit/cat/segments_test.rb
|
483
486
|
- test/unit/cat/shards_test.rb
|
484
487
|
- test/unit/cat/thread_pool_test.rb
|
485
488
|
- test/unit/clear_scroll_test.rb
|
@@ -573,9 +576,17 @@ files:
|
|
573
576
|
- test/unit/snapshot/status_test.rb
|
574
577
|
- test/unit/snapshot/verify_repository_test.rb
|
575
578
|
- test/unit/suggest_test.rb
|
576
|
-
- test/unit/
|
579
|
+
- test/unit/termvectors_test.rb
|
577
580
|
- test/unit/update_document_test.rb
|
578
581
|
- test/unit/utils_test.rb
|
582
|
+
- utils/Gemfile
|
583
|
+
- utils/Thorfile
|
584
|
+
- utils/thor/generate_api.rb
|
585
|
+
- utils/thor/generate_source.rb
|
586
|
+
- utils/thor/lister.rb
|
587
|
+
- utils/thor/templates/ruby/method.erb
|
588
|
+
- utils/thor/templates/ruby/test.erb
|
589
|
+
- utils/thor/templates/ruby/test_helper.rb
|
579
590
|
homepage: https://github.com/elasticsearch/elasticsearch-ruby/tree/master/elasticsearch-api
|
580
591
|
licenses:
|
581
592
|
- Apache 2
|
@@ -605,6 +616,7 @@ test_files:
|
|
605
616
|
- test/integration/yaml_test_runner.rb
|
606
617
|
- test/test_helper.rb
|
607
618
|
- test/unit/abort_benchmark_test.rb
|
619
|
+
- test/unit/api_test.rb
|
608
620
|
- test/unit/benchmark_test.rb
|
609
621
|
- test/unit/bulk_test.rb
|
610
622
|
- test/unit/cat/aliases_test.rb
|
@@ -618,6 +630,7 @@ test_files:
|
|
618
630
|
- test/unit/cat/nodes_test.rb
|
619
631
|
- test/unit/cat/pending_tasks_test.rb
|
620
632
|
- test/unit/cat/recovery_test.rb
|
633
|
+
- test/unit/cat/segments_test.rb
|
621
634
|
- test/unit/cat/shards_test.rb
|
622
635
|
- test/unit/cat/thread_pool_test.rb
|
623
636
|
- test/unit/clear_scroll_test.rb
|
@@ -711,7 +724,7 @@ test_files:
|
|
711
724
|
- test/unit/snapshot/status_test.rb
|
712
725
|
- test/unit/snapshot/verify_repository_test.rb
|
713
726
|
- test/unit/suggest_test.rb
|
714
|
-
- test/unit/
|
727
|
+
- test/unit/termvectors_test.rb
|
715
728
|
- test/unit/update_document_test.rb
|
716
729
|
- test/unit/utils_test.rb
|
717
730
|
has_rdoc:
|