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
@@ -37,22 +37,23 @@ module Elasticsearch
|
|
37
37
|
#
|
38
38
|
def delete_by_query(arguments={})
|
39
39
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
40
|
+
|
41
|
+
valid_params = [
|
42
|
+
:analyzer,
|
43
|
+
:consistency,
|
44
|
+
:default_operator,
|
45
|
+
:df,
|
46
|
+
:ignore_indices,
|
47
|
+
:replication,
|
48
|
+
:q,
|
49
|
+
:routing,
|
50
|
+
:source,
|
51
|
+
:timeout ]
|
52
|
+
|
40
53
|
method = 'DELETE'
|
41
54
|
path = Utils.__pathify( Utils.__listify(arguments[:index]), '/_query' )
|
42
|
-
|
43
|
-
|
44
|
-
:consistency,
|
45
|
-
:default_operator,
|
46
|
-
:df,
|
47
|
-
:ignore_indices,
|
48
|
-
:replication,
|
49
|
-
:q,
|
50
|
-
:routing,
|
51
|
-
:source,
|
52
|
-
:timeout ].include?(k)
|
53
|
-
end
|
54
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
55
|
-
params = Hash[params] unless params.is_a?(Hash)
|
55
|
+
|
56
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
56
57
|
body = arguments[:body]
|
57
58
|
|
58
59
|
perform_request(method, path, params, body).body
|
@@ -21,21 +21,23 @@ module Elasticsearch
|
|
21
21
|
# @see http://elasticsearch.org/guide/reference/api/get/
|
22
22
|
#
|
23
23
|
def exists(arguments={})
|
24
|
-
raise ArgumentError, "Required argument 'id' missing"
|
24
|
+
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
25
25
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
26
26
|
arguments[:type] ||= '_all'
|
27
27
|
|
28
|
+
valid_params = [
|
29
|
+
:parent,
|
30
|
+
:preference,
|
31
|
+
:realtime,
|
32
|
+
:refresh,
|
33
|
+
:routing ]
|
34
|
+
|
28
35
|
method = 'HEAD'
|
29
|
-
path = Utils.__pathify(
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
:refresh,
|
35
|
-
:routing ].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.__escape(arguments[:index]),
|
37
|
+
Utils.__escape(arguments[:type]),
|
38
|
+
Utils.__escape(arguments[:id])
|
39
|
+
|
40
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
39
41
|
body = nil
|
40
42
|
|
41
43
|
perform_request(method, path, params, body).status == 200 ? true : false
|
@@ -35,6 +35,10 @@ module Elasticsearch
|
|
35
35
|
# @option arguments [String] :q Query in the Lucene query string syntax
|
36
36
|
# @option arguments [String] :routing Specific routing value
|
37
37
|
# @option arguments [String] :source The URL-encoded query definition (instead of using the request body)
|
38
|
+
# @option arguments [String] :_source Specify whether the _source field should be returned,
|
39
|
+
# or a list of fields to return
|
40
|
+
# @option arguments [String] :_source_exclude A list of fields to exclude from the returned _source field
|
41
|
+
# @option arguments [String] :_source_include A list of fields to extract and return from the _source field
|
38
42
|
#
|
39
43
|
# @see http://elasticsearch.org/guide/reference/api/explain/
|
40
44
|
#
|
@@ -42,24 +46,31 @@ module Elasticsearch
|
|
42
46
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
43
47
|
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
|
44
48
|
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
49
|
+
|
50
|
+
valid_params = [
|
51
|
+
:analyze_wildcard,
|
52
|
+
:analyzer,
|
53
|
+
:default_operator,
|
54
|
+
:df,
|
55
|
+
:fields,
|
56
|
+
:lenient,
|
57
|
+
:lowercase_expanded_terms,
|
58
|
+
:parent,
|
59
|
+
:preference,
|
60
|
+
:q,
|
61
|
+
:routing,
|
62
|
+
:source,
|
63
|
+
:_source,
|
64
|
+
:_source_include,
|
65
|
+
:_source_exclude ]
|
66
|
+
|
45
67
|
method = 'GET'
|
46
|
-
path = Utils.__pathify(
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
:fields,
|
53
|
-
:lenient,
|
54
|
-
:lowercase_expanded_terms,
|
55
|
-
:parent,
|
56
|
-
:preference,
|
57
|
-
:q,
|
58
|
-
:routing,
|
59
|
-
:source ].include?(k)
|
60
|
-
end
|
61
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
62
|
-
params = Hash[params] unless params.is_a?(Hash)
|
68
|
+
path = Utils.__pathify Utils.__escape(arguments[:index]),
|
69
|
+
Utils.__escape(arguments[:type]),
|
70
|
+
Utils.__escape(arguments[:id]),
|
71
|
+
'_explain'
|
72
|
+
|
73
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
63
74
|
body = arguments[:body]
|
64
75
|
|
65
76
|
params[:fields] = Utils.__listify(params[:fields]) if params[:fields]
|
@@ -22,6 +22,10 @@ module Elasticsearch
|
|
22
22
|
# @option arguments [Boolean] :realtime Specify whether to perform the operation in realtime or search mode
|
23
23
|
# @option arguments [Boolean] :refresh Refresh the shard containing the document before performing the operation
|
24
24
|
# @option arguments [String] :routing Specific routing value
|
25
|
+
# @option arguments [String] :_source Specify whether the _source field should be returned,
|
26
|
+
# or a list of fields to return
|
27
|
+
# @option arguments [String] :_source_exclude A list of fields to exclude from the returned _source field
|
28
|
+
# @option arguments [String] :_source_include A list of fields to extract and return from the _source field
|
25
29
|
#
|
26
30
|
# @see http://elasticsearch.org/guide/reference/api/get/
|
27
31
|
#
|
@@ -30,18 +34,23 @@ module Elasticsearch
|
|
30
34
|
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
31
35
|
arguments[:type] ||= '_all'
|
32
36
|
|
37
|
+
valid_params = [
|
38
|
+
:fields,
|
39
|
+
:parent,
|
40
|
+
:preference,
|
41
|
+
:realtime,
|
42
|
+
:refresh,
|
43
|
+
:routing,
|
44
|
+
:_source,
|
45
|
+
:_source_include,
|
46
|
+
:_source_exclude ]
|
47
|
+
|
33
48
|
method = 'GET'
|
34
|
-
path = Utils.__pathify(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
:realtime,
|
40
|
-
:refresh,
|
41
|
-
:routing ].include?(k)
|
42
|
-
end
|
43
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
44
|
-
params = Hash[params] unless params.is_a?(Hash)
|
49
|
+
path = Utils.__pathify Utils.__escape(arguments[:index]),
|
50
|
+
Utils.__escape(arguments[:type]),
|
51
|
+
Utils.__escape(arguments[:id])
|
52
|
+
|
53
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
45
54
|
body = nil
|
46
55
|
|
47
56
|
params[:fields] = Utils.__listify(params[:fields]) if params[:fields]
|
@@ -22,6 +22,12 @@ module Elasticsearch
|
|
22
22
|
# @option arguments [Boolean] :realtime Specify whether to perform the operation in realtime or search mode
|
23
23
|
# @option arguments [Boolean] :refresh Refresh the shard containing the document before performing the operation
|
24
24
|
# @option arguments [String] :routing Specific routing value
|
25
|
+
# @option arguments [String] :_source Specify whether the _source field should be returned,
|
26
|
+
# or a list of fields to return
|
27
|
+
# @option arguments [String] :_source_exclude A list of fields to exclude from the returned _source field
|
28
|
+
# @option arguments [String] :_source_include A list of fields to extract and return from the _source field
|
29
|
+
#
|
30
|
+
# @see http://elasticsearch.org/guide/reference/api/get/
|
25
31
|
#
|
26
32
|
# @since 0.90.1
|
27
33
|
#
|
@@ -30,18 +36,24 @@ module Elasticsearch
|
|
30
36
|
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
31
37
|
arguments[:type] ||= '_all'
|
32
38
|
|
39
|
+
valid_params = [
|
40
|
+
:fields,
|
41
|
+
:parent,
|
42
|
+
:preference,
|
43
|
+
:realtime,
|
44
|
+
:refresh,
|
45
|
+
:routing,
|
46
|
+
:_source,
|
47
|
+
:_source_include,
|
48
|
+
:_source_exclude ]
|
49
|
+
|
33
50
|
method = 'GET'
|
34
|
-
path = Utils.__pathify(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
:refresh,
|
41
|
-
:routing ].include?(k)
|
42
|
-
end
|
43
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
44
|
-
params = Hash[params] unless params.is_a?(Hash)
|
51
|
+
path = Utils.__pathify Utils.__escape(arguments[:index]),
|
52
|
+
Utils.__escape(arguments[:type]),
|
53
|
+
Utils.__escape(arguments[:id]),
|
54
|
+
'_source'
|
55
|
+
|
56
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
45
57
|
body = nil
|
46
58
|
|
47
59
|
params[:fields] = Utils.__listify(params[:fields]) if params[:fields]
|
@@ -52,26 +52,28 @@ module Elasticsearch
|
|
52
52
|
#
|
53
53
|
def index(arguments={})
|
54
54
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
55
|
-
raise ArgumentError, "Required argument 'type' missing"
|
55
|
+
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
|
56
|
+
|
57
|
+
valid_params = [
|
58
|
+
:consistency,
|
59
|
+
:op_type,
|
60
|
+
:parent,
|
61
|
+
:percolate,
|
62
|
+
:refresh,
|
63
|
+
:replication,
|
64
|
+
:routing,
|
65
|
+
:timeout,
|
66
|
+
:timestamp,
|
67
|
+
:ttl,
|
68
|
+
:version,
|
69
|
+
:version_type ]
|
70
|
+
|
56
71
|
method = arguments[:id] ? 'PUT' : 'POST'
|
57
|
-
path = Utils.__pathify(
|
58
|
-
|
59
|
-
|
60
|
-
:op_type,
|
61
|
-
:parent,
|
62
|
-
:percolate,
|
63
|
-
:refresh,
|
64
|
-
:replication,
|
65
|
-
:routing,
|
66
|
-
:timeout,
|
67
|
-
:timestamp,
|
68
|
-
:ttl,
|
69
|
-
:version,
|
70
|
-
:version_type ].include?(k)
|
71
|
-
end
|
72
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
73
|
-
params = Hash[params] unless params.is_a?(Hash)
|
72
|
+
path = Utils.__pathify Utils.__escape(arguments[:index]),
|
73
|
+
Utils.__escape(arguments[:type]),
|
74
|
+
Utils.__escape(arguments[:id])
|
74
75
|
|
76
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
75
77
|
body = arguments[:body]
|
76
78
|
|
77
79
|
perform_request(method, path, params, body).body
|
@@ -36,21 +36,20 @@ module Elasticsearch
|
|
36
36
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze/
|
37
37
|
#
|
38
38
|
def analyze(arguments={})
|
39
|
+
valid_params = [
|
40
|
+
:analyzer,
|
41
|
+
:field,
|
42
|
+
:filters,
|
43
|
+
:index,
|
44
|
+
:prefer_local,
|
45
|
+
:text,
|
46
|
+
:tokenizer,
|
47
|
+
:format ]
|
48
|
+
|
39
49
|
method = 'GET'
|
40
|
-
path = Utils.__pathify(
|
41
|
-
params = arguments.select do |k,v|
|
42
|
-
[ :analyzer,
|
43
|
-
:field,
|
44
|
-
:filters,
|
45
|
-
:index,
|
46
|
-
:prefer_local,
|
47
|
-
:text,
|
48
|
-
:tokenizer,
|
49
|
-
:format ].include?(k)
|
50
|
-
end
|
51
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
52
|
-
params = Hash[params] unless params.is_a?(Hash)
|
50
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_analyze'
|
53
51
|
|
52
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
54
53
|
params[:filters] = Utils.__listify(params[:filters]) if params[:filters]
|
55
54
|
|
56
55
|
body = arguments[:body]
|
@@ -41,22 +41,22 @@ module Elasticsearch
|
|
41
41
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-clearcache/
|
42
42
|
#
|
43
43
|
def clear_cache(arguments={})
|
44
|
+
valid_params = [
|
45
|
+
:field_data,
|
46
|
+
:fielddata,
|
47
|
+
:fields,
|
48
|
+
:filter,
|
49
|
+
:filter_cache,
|
50
|
+
:filter_keys,
|
51
|
+
:id,
|
52
|
+
:id_cache,
|
53
|
+
:ignore_indices,
|
54
|
+
:recycler ]
|
55
|
+
|
44
56
|
method = 'POST'
|
45
|
-
path = Utils.__pathify
|
46
|
-
|
47
|
-
|
48
|
-
:fielddata,
|
49
|
-
:fields,
|
50
|
-
:filter,
|
51
|
-
:filter_cache,
|
52
|
-
:filter_keys,
|
53
|
-
:id,
|
54
|
-
:id_cache,
|
55
|
-
:ignore_indices,
|
56
|
-
:recycler ].include?(k)
|
57
|
-
end
|
58
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
59
|
-
params = Hash[params] unless params.is_a?(Hash)
|
57
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), '_cache/clear'
|
58
|
+
|
59
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
60
60
|
body = nil
|
61
61
|
|
62
62
|
params[:fields] = Utils.__listify(params[:fields]) if params[:fields]
|
@@ -18,13 +18,12 @@ module Elasticsearch
|
|
18
18
|
#
|
19
19
|
def close(arguments={})
|
20
20
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
21
|
+
valid_params = [ :timeout ]
|
22
|
+
|
21
23
|
method = 'POST'
|
22
|
-
path =
|
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]), '_close'
|
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).body
|
@@ -66,13 +66,12 @@ module Elasticsearch
|
|
66
66
|
#
|
67
67
|
def create(arguments={})
|
68
68
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
69
|
+
valid_params = [ :timeout ]
|
70
|
+
|
69
71
|
method = 'PUT'
|
70
|
-
path =
|
71
|
-
|
72
|
-
|
73
|
-
end
|
74
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
75
|
-
params = Hash[params] unless params.is_a?(Hash)
|
72
|
+
path = Utils.__pathify Utils.__escape(arguments[:index])
|
73
|
+
|
74
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
76
75
|
body = arguments[:body]
|
77
76
|
|
78
77
|
perform_request(method, path, params, body).body
|
@@ -31,13 +31,12 @@ module Elasticsearch
|
|
31
31
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-index/
|
32
32
|
#
|
33
33
|
def delete(arguments={})
|
34
|
+
valid_params = [ :timeout ]
|
35
|
+
|
34
36
|
method = 'DELETE'
|
35
|
-
path = Utils.__pathify
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
40
|
-
params = Hash[params] unless params.is_a?(Hash)
|
37
|
+
path = Utils.__pathify Utils.__listify(arguments[:index])
|
38
|
+
|
39
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
41
40
|
body = nil
|
42
41
|
|
43
42
|
perform_request(method, path, params, body).body
|
@@ -20,13 +20,12 @@ module Elasticsearch
|
|
20
20
|
def delete_alias(arguments={})
|
21
21
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
22
22
|
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
23
|
+
valid_params = [ :timeout ]
|
24
|
+
|
23
25
|
method = 'DELETE'
|
24
|
-
path =
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
# Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
|
29
|
-
params = Hash[params] unless params.is_a?(Hash)
|
26
|
+
path = Utils.__pathify Utils.__escape(arguments[:index]), '_alias', Utils.__escape(arguments[:name])
|
27
|
+
|
28
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
30
29
|
body = nil
|
31
30
|
|
32
31
|
perform_request(method, path, params, body).body
|
@@ -14,7 +14,7 @@ module Elasticsearch
|
|
14
14
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
15
15
|
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
|
16
16
|
method = 'DELETE'
|
17
|
-
path = Utils.__pathify
|
17
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__escape(arguments[:type])
|
18
18
|
params = {}
|
19
19
|
body = nil
|
20
20
|
|
@@ -16,13 +16,12 @@ module Elasticsearch
|
|
16
16
|
#
|
17
17
|
def delete_template(arguments={})
|
18
18
|
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
19
|
+
valid_params = [ :timeout ]
|
20
|
+
|
19
21
|
method = 'DELETE'
|
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 '_template', Utils.__escape(arguments[:name])
|
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
|