elasticsearch-api 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -2
- data/Rakefile +15 -1
- data/elasticsearch-api.gemspec +12 -0
- data/lib/{elasticsearch-api → elasticsearch-api.rb} +0 -0
- data/lib/elasticsearch/api.rb +9 -0
- data/lib/elasticsearch/api/actions/bulk.rb +9 -9
- data/lib/elasticsearch/api/actions/cluster/health.rb +12 -12
- data/lib/elasticsearch/api/actions/cluster/node_hot_threads.rb +9 -9
- data/lib/elasticsearch/api/actions/cluster/node_info.rb +16 -16
- data/lib/elasticsearch/api/actions/cluster/node_shutdown.rb +7 -7
- data/lib/elasticsearch/api/actions/cluster/node_stats.rb +16 -18
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +4 -6
- data/lib/elasticsearch/api/actions/cluster/state.rb +12 -12
- data/lib/elasticsearch/api/actions/count.rb +9 -9
- data/lib/elasticsearch/api/actions/delete.rb +16 -13
- data/lib/elasticsearch/api/actions/delete_by_query.rb +15 -14
- data/lib/elasticsearch/api/actions/exists.rb +13 -11
- data/lib/elasticsearch/api/actions/explain.rb +28 -17
- data/lib/elasticsearch/api/actions/get.rb +20 -11
- data/lib/elasticsearch/api/actions/get_source.rb +23 -11
- data/lib/elasticsearch/api/actions/index.rb +20 -18
- data/lib/elasticsearch/api/actions/indices/analyze.rb +12 -13
- data/lib/elasticsearch/api/actions/indices/clear_cache.rb +15 -15
- data/lib/elasticsearch/api/actions/indices/close.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/create.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/delete.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/delete_alias.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/delete_mapping.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/delete_template.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/delete_warmer.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/flush.rb +9 -9
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/get_aliases.rb +5 -6
- 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 +1 -2
- data/lib/elasticsearch/api/actions/indices/get_warmer.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/open.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/optimize.rb +12 -12
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +5 -7
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/put_template.rb +5 -7
- data/lib/elasticsearch/api/actions/indices/refresh.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/segments.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/snapshot_index.rb +5 -6
- data/lib/elasticsearch/api/actions/indices/stats.rb +23 -23
- data/lib/elasticsearch/api/actions/indices/status.rb +8 -8
- data/lib/elasticsearch/api/actions/indices/update_aliases.rb +4 -5
- data/lib/elasticsearch/api/actions/indices/validate_query.rb +11 -9
- data/lib/elasticsearch/api/actions/mget.rb +21 -11
- data/lib/elasticsearch/api/actions/mlt.rb +28 -24
- data/lib/elasticsearch/api/actions/msearch.rb +4 -5
- data/lib/elasticsearch/api/actions/percolate.rb +7 -6
- data/lib/elasticsearch/api/actions/scroll.rb +5 -6
- data/lib/elasticsearch/api/actions/search.rb +37 -30
- data/lib/elasticsearch/api/actions/suggest.rb +8 -8
- data/lib/elasticsearch/api/actions/update.rb +24 -20
- data/lib/elasticsearch/api/utils.rb +44 -6
- data/lib/elasticsearch/api/version.rb +1 -1
- data/test/integration/yaml_test_runner.rb +4 -5
- data/test/test_helper.rb +1 -1
- data/test/unit/bulk_test.rb +9 -0
- data/test/unit/cluster/node_hot_threads_test.rb +9 -0
- data/test/unit/create_document_test.rb +9 -0
- data/test/unit/delete_document_test.rb +16 -1
- data/test/unit/exists_document_test.rb +9 -0
- data/test/unit/explain_document_test.rb +9 -0
- data/test/unit/get_document_source_test.rb +10 -1
- data/test/unit/get_document_test.rb +16 -1
- data/test/unit/index_document_test.rb +15 -0
- data/test/unit/indices/analyze_test.rb +9 -0
- data/test/unit/indices/clear_cache_test.rb +9 -0
- data/test/unit/indices/close_test.rb +9 -0
- data/test/unit/indices/create_test.rb +9 -0
- data/test/unit/indices/delete_alias_test.rb +9 -0
- data/test/unit/indices/delete_mapping_test.rb +9 -0
- data/test/unit/indices/delete_template_test.rb +9 -0
- data/test/unit/indices/delete_test.rb +9 -0
- data/test/unit/indices/delete_warmer_test.rb +9 -0
- data/test/unit/indices/exists_alias_test.rb +9 -0
- data/test/unit/indices/exists_test.rb +9 -0
- data/test/unit/indices/exists_type_test.rb +9 -0
- data/test/unit/indices/flush_test.rb +9 -0
- data/test/unit/indices/get_alias_test.rb +9 -0
- data/test/unit/indices/get_aliases_test.rb +9 -0
- data/test/unit/indices/get_mapping_test.rb +9 -0
- data/test/unit/indices/get_settings_test.rb +9 -0
- data/test/unit/indices/get_template_test.rb +10 -6
- data/test/unit/indices/get_warmer_test.rb +9 -0
- data/test/unit/indices/open_test.rb +9 -0
- data/test/unit/indices/optimize_test.rb +9 -0
- data/test/unit/indices/put_alias_test.rb +9 -0
- data/test/unit/indices/put_mapping_test.rb +9 -0
- data/test/unit/indices/put_settings_test.rb +9 -0
- data/test/unit/indices/put_template_test.rb +9 -0
- data/test/unit/indices/put_warmer_test.rb +9 -0
- data/test/unit/indices/refresh_test.rb +9 -0
- data/test/unit/indices/segments_test.rb +9 -0
- data/test/unit/indices/snapshot_index_test.rb +9 -0
- data/test/unit/indices/stats_test.rb +9 -0
- data/test/unit/indices/status_test.rb +9 -0
- data/test/unit/indices/validate_query_test.rb +9 -0
- data/test/unit/mget_test.rb +9 -0
- data/test/unit/mlt_test.rb +9 -0
- data/test/unit/msearch_test.rb +9 -0
- data/test/unit/percolate_test.rb +9 -0
- data/test/unit/search_test.rb +16 -1
- data/test/unit/suggest_test.rb +9 -0
- data/test/unit/update_document_test.rb +16 -1
- data/test/unit/utils_test.rb +34 -5
- metadata +161 -44
- checksums.yaml +0 -7
@@ -20,7 +20,7 @@ module Elasticsearch
|
|
20
20
|
def delete_warmer(arguments={})
|
21
21
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
22
22
|
method = 'DELETE'
|
23
|
-
path = Utils.__pathify
|
23
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_warmer', Utils.__listify(arguments[:name])
|
24
24
|
params = {}
|
25
25
|
body = nil
|
26
26
|
|
@@ -18,13 +18,12 @@ module Elasticsearch
|
|
18
18
|
#
|
19
19
|
def exists_alias(arguments={})
|
20
20
|
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
21
|
+
valid_params = [ :ignore_indices ]
|
22
|
+
|
21
23
|
method = 'HEAD'
|
22
|
-
path = Utils.__pathify
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
27
|
-
params = Hash[params] unless params.is_a?(Hash)
|
24
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_alias', Utils.__escape(arguments[:name])
|
25
|
+
|
26
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
28
27
|
body = nil
|
29
28
|
|
30
29
|
perform_request(method, path, params, body).status == 200 ? true : false
|
@@ -16,13 +16,12 @@ module Elasticsearch
|
|
16
16
|
def exists_type(arguments={})
|
17
17
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
18
18
|
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
|
19
|
+
valid_params = [ :ignore_indices ]
|
20
|
+
|
19
21
|
method = 'HEAD'
|
20
|
-
path = Utils.__pathify
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
25
|
-
params = Hash[params] unless params.is_a?(Hash)
|
22
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__escape(arguments[:type])
|
23
|
+
|
24
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
26
25
|
body = nil
|
27
26
|
|
28
27
|
perform_request(method, path, params, body).status == 200 ? true : false
|
@@ -20,16 +20,16 @@ module Elasticsearch
|
|
20
20
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-flush/
|
21
21
|
#
|
22
22
|
def flush(arguments={})
|
23
|
+
valid_params = [
|
24
|
+
:force,
|
25
|
+
:full,
|
26
|
+
:ignore_indices,
|
27
|
+
:refresh ]
|
28
|
+
|
23
29
|
method = 'POST'
|
24
|
-
path = Utils.__pathify
|
25
|
-
|
26
|
-
|
27
|
-
:full,
|
28
|
-
:ignore_indices,
|
29
|
-
:refresh ].include?(k)
|
30
|
-
end
|
31
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
32
|
-
params = Hash[params] unless params.is_a?(Hash)
|
30
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_flush'
|
31
|
+
|
32
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
33
33
|
body = nil
|
34
34
|
|
35
35
|
perform_request(method, path, params, body).body
|
@@ -24,13 +24,12 @@ module Elasticsearch
|
|
24
24
|
#
|
25
25
|
def get_alias(arguments={})
|
26
26
|
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
27
|
+
valid_params = [ :ignore_indices ]
|
28
|
+
|
27
29
|
method = 'GET'
|
28
|
-
path = Utils.__pathify
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
33
|
-
params = Hash[params] unless params.is_a?(Hash)
|
30
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_alias', Utils.__escape(arguments[:name])
|
31
|
+
|
32
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
34
33
|
body = nil
|
35
34
|
|
36
35
|
perform_request(method, path, params, body).body
|
@@ -15,13 +15,12 @@ module Elasticsearch
|
|
15
15
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
|
16
16
|
#
|
17
17
|
def get_aliases(arguments={})
|
18
|
+
valid_params = [ :timeout ]
|
19
|
+
|
18
20
|
method = 'GET'
|
19
|
-
path = Utils.__pathify
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
24
|
-
params = Hash[params] unless params.is_a?(Hash)
|
21
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_aliases'
|
22
|
+
|
23
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
25
24
|
body = nil
|
26
25
|
|
27
26
|
perform_request(method, path, params, body).body
|
@@ -24,7 +24,7 @@ module Elasticsearch
|
|
24
24
|
#
|
25
25
|
def get_mapping(arguments={})
|
26
26
|
method = 'GET'
|
27
|
-
path = Utils.__pathify
|
27
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_mapping'
|
28
28
|
params = {}
|
29
29
|
body = nil
|
30
30
|
|
@@ -20,7 +20,7 @@ module Elasticsearch
|
|
20
20
|
#
|
21
21
|
def get_settings(arguments={})
|
22
22
|
method = 'GET'
|
23
|
-
path = Utils.__pathify
|
23
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_settings'
|
24
24
|
params = {}
|
25
25
|
body = nil
|
26
26
|
|
@@ -16,9 +16,8 @@ module Elasticsearch
|
|
16
16
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/
|
17
17
|
#
|
18
18
|
def get_template(arguments={})
|
19
|
-
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
20
19
|
method = 'GET'
|
21
|
-
path =
|
20
|
+
path = Utils.__pathify '_template', Utils.__escape(arguments[:name])
|
22
21
|
params = {}
|
23
22
|
body = nil
|
24
23
|
|
@@ -32,7 +32,7 @@ module Elasticsearch
|
|
32
32
|
def get_warmer(arguments={})
|
33
33
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
34
34
|
method = 'GET'
|
35
|
-
path = Utils.__pathify( Utils.__listify(arguments[:index]), '_warmer', arguments[:name] )
|
35
|
+
path = Utils.__pathify( Utils.__listify(arguments[:index]), '_warmer', Utils.__escape(arguments[:name]) )
|
36
36
|
params = {}
|
37
37
|
body = nil
|
38
38
|
|
@@ -16,13 +16,12 @@ module Elasticsearch
|
|
16
16
|
#
|
17
17
|
def open(arguments={})
|
18
18
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
19
|
+
valid_params = [ :timeout ]
|
20
|
+
|
19
21
|
method = 'POST'
|
20
|
-
path =
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
25
|
-
params = Hash[params] unless params.is_a?(Hash)
|
22
|
+
path = Utils.__pathify Utils.__escape(arguments[:index]), '_open'
|
23
|
+
|
24
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
26
25
|
body = nil
|
27
26
|
|
28
27
|
perform_request(method, path, params, body).body
|
@@ -34,19 +34,19 @@ module Elasticsearch
|
|
34
34
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-optimize/
|
35
35
|
#
|
36
36
|
def optimize(arguments={})
|
37
|
+
valid_params = [
|
38
|
+
:flush,
|
39
|
+
:ignore_indices,
|
40
|
+
:max_num_segments,
|
41
|
+
:only_expunge_deletes,
|
42
|
+
:operation_threading,
|
43
|
+
:refresh,
|
44
|
+
:wait_for_merge ]
|
45
|
+
|
37
46
|
method = 'POST'
|
38
|
-
path = Utils.__pathify
|
39
|
-
|
40
|
-
|
41
|
-
:ignore_indices,
|
42
|
-
:max_num_segments,
|
43
|
-
:only_expunge_deletes,
|
44
|
-
:operation_threading,
|
45
|
-
:refresh,
|
46
|
-
:wait_for_merge ].include?(k)
|
47
|
-
end
|
48
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
49
|
-
params = Hash[params] unless params.is_a?(Hash)
|
47
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_optimize'
|
48
|
+
|
49
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
50
50
|
body = nil
|
51
51
|
|
52
52
|
perform_request(method, path, params, body).body
|
@@ -26,13 +26,12 @@ module Elasticsearch
|
|
26
26
|
def put_alias(arguments={})
|
27
27
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
28
28
|
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
29
|
+
valid_params = [ :timeout ]
|
30
|
+
|
29
31
|
method = 'PUT'
|
30
|
-
path =
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
35
|
-
params = Hash[params] unless params.is_a?(Hash)
|
32
|
+
path = Utils.__pathify Utils.__escape(arguments[:index]), '_alias', Utils.__escape(arguments[:name])
|
33
|
+
|
34
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
36
35
|
body = arguments[:body]
|
37
36
|
|
38
37
|
perform_request(method, path, params, body).body
|
@@ -31,14 +31,12 @@ module Elasticsearch
|
|
31
31
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
32
32
|
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
|
33
33
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
34
|
+
valid_params = [ :ignore_conflicts, :timeout ]
|
35
|
+
|
34
36
|
method = 'PUT'
|
35
|
-
path = Utils.__pathify
|
36
|
-
|
37
|
-
|
38
|
-
:timeout ].include?(k)
|
39
|
-
end
|
40
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
41
|
-
params = Hash[params] unless params.is_a?(Hash)
|
37
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__escape(arguments[:type]), '_mapping'
|
38
|
+
|
39
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
42
40
|
body = arguments[:body]
|
43
41
|
|
44
42
|
perform_request(method, path, params, body).body
|
@@ -33,7 +33,7 @@ module Elasticsearch
|
|
33
33
|
def put_settings(arguments={})
|
34
34
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
35
35
|
method = 'PUT'
|
36
|
-
path = Utils.__pathify
|
36
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_settings'
|
37
37
|
params = {}
|
38
38
|
body = arguments[:body]
|
39
39
|
|
@@ -22,14 +22,12 @@ module Elasticsearch
|
|
22
22
|
def put_template(arguments={})
|
23
23
|
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
24
24
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
25
|
+
valid_params = [ :order, :timeout ]
|
26
|
+
|
25
27
|
method = 'PUT'
|
26
|
-
path =
|
27
|
-
|
28
|
-
|
29
|
-
:timeout ].include?(k)
|
30
|
-
end
|
31
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
32
|
-
params = Hash[params] unless params.is_a?(Hash)
|
28
|
+
path = Utils.__pathify '_template', Utils.__escape(arguments[:name])
|
29
|
+
|
30
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
33
31
|
body = arguments[:body]
|
34
32
|
|
35
33
|
perform_request(method, path, params, body).body
|
@@ -26,13 +26,12 @@ module Elasticsearch
|
|
26
26
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-refresh/
|
27
27
|
#
|
28
28
|
def refresh(arguments={})
|
29
|
+
valid_params = [ :ignore_indices ]
|
30
|
+
|
29
31
|
method = 'POST'
|
30
|
-
path = Utils.__pathify
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
35
|
-
params = Hash[params] unless params.is_a?(Hash)
|
32
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_refresh'
|
33
|
+
|
34
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
36
35
|
body = nil
|
37
36
|
|
38
37
|
perform_request(method, path, params, body).body
|
@@ -16,13 +16,12 @@ module Elasticsearch
|
|
16
16
|
# @see http://elasticsearch.org/guide/reference/api/admin-indices-segments/
|
17
17
|
#
|
18
18
|
def segments(arguments={})
|
19
|
+
valid_params = [ :ignore_indices ]
|
20
|
+
|
19
21
|
method = 'GET'
|
20
|
-
path = Utils.__pathify
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
25
|
-
params = Hash[params] unless params.is_a?(Hash)
|
22
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_segments'
|
23
|
+
|
24
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
26
25
|
body = nil
|
27
26
|
|
28
27
|
perform_request(method, path, params, body).body
|
@@ -15,13 +15,12 @@ module Elasticsearch
|
|
15
15
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-gateway-snapshot/
|
16
16
|
#
|
17
17
|
def snapshot_index(arguments={})
|
18
|
+
valid_params = [ :ignore_indices ]
|
19
|
+
|
18
20
|
method = 'POST'
|
19
|
-
path = Utils.__pathify
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
24
|
-
params = Hash[params] unless params.is_a?(Hash)
|
21
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_gateway/snapshot'
|
22
|
+
|
23
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
25
24
|
body = nil
|
26
25
|
|
27
26
|
perform_request(method, path, params, body).body
|
@@ -60,34 +60,34 @@ module Elasticsearch
|
|
60
60
|
# @see http://elasticsearch.org/guide/reference/api/admin-indices-stats/
|
61
61
|
#
|
62
62
|
def stats(arguments={})
|
63
|
+
valid_params = [
|
64
|
+
:all,
|
65
|
+
:clear,
|
66
|
+
:docs,
|
67
|
+
:fielddata,
|
68
|
+
:fields,
|
69
|
+
:filter_cache,
|
70
|
+
:flush,
|
71
|
+
:get,
|
72
|
+
:groups,
|
73
|
+
:id_cache,
|
74
|
+
:ignore_indices,
|
75
|
+
:indexing,
|
76
|
+
:merge,
|
77
|
+
:refresh,
|
78
|
+
:search,
|
79
|
+
:store,
|
80
|
+
:warmer ]
|
81
|
+
|
63
82
|
method = 'GET'
|
64
|
-
path = Utils.__pathify
|
65
|
-
params = arguments.select do |k,v|
|
66
|
-
[ :all,
|
67
|
-
:clear,
|
68
|
-
:docs,
|
69
|
-
:fielddata,
|
70
|
-
:fields,
|
71
|
-
:filter_cache,
|
72
|
-
:flush,
|
73
|
-
:get,
|
74
|
-
:groups,
|
75
|
-
:id_cache,
|
76
|
-
:ignore_indices,
|
77
|
-
:indexing,
|
78
|
-
:merge,
|
79
|
-
:refresh,
|
80
|
-
:search,
|
81
|
-
:store,
|
82
|
-
:warmer ].include?(k)
|
83
|
-
end
|
84
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
85
|
-
params = Hash[params] unless params.is_a?(Hash)
|
86
|
-
body = nil
|
83
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_stats'
|
87
84
|
|
85
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
88
86
|
params[:fields] = Utils.__listify(params[:fields]) if params[:fields]
|
89
87
|
params[:groups] = Utils.__listify(params[:groups]) if params[:groups]
|
90
88
|
|
89
|
+
body = nil
|
90
|
+
|
91
91
|
perform_request(method, path, params, body).body
|
92
92
|
end
|
93
93
|
end
|
@@ -27,15 +27,15 @@ module Elasticsearch
|
|
27
27
|
# @see http://elasticsearch.org/guide/reference/api/admin-indices-status/
|
28
28
|
#
|
29
29
|
def status(arguments={})
|
30
|
+
valid_params = [
|
31
|
+
:ignore_indices,
|
32
|
+
:recovery,
|
33
|
+
:snapshot ]
|
34
|
+
|
30
35
|
method = 'GET'
|
31
|
-
path = Utils.__pathify
|
32
|
-
|
33
|
-
|
34
|
-
:recovery,
|
35
|
-
:snapshot ].include?(k)
|
36
|
-
end
|
37
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
38
|
-
params = Hash[params] unless params.is_a?(Hash)
|
36
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_status'
|
37
|
+
|
38
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
39
39
|
body = nil
|
40
40
|
|
41
41
|
perform_request(method, path, params, body).body
|
@@ -32,13 +32,12 @@ module Elasticsearch
|
|
32
32
|
#
|
33
33
|
def update_aliases(arguments={})
|
34
34
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
35
|
+
valid_params = [ :timeout ]
|
36
|
+
|
35
37
|
method = 'POST'
|
36
38
|
path = "_aliases"
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
41
|
-
params = Hash[params] unless params.is_a?(Hash)
|
39
|
+
|
40
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
42
41
|
body = arguments[:body]
|
43
42
|
|
44
43
|
perform_request(method, path, params, body).body
|