elasticsearch-api 0.4.11 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -6
- data/README.md +3 -4
- data/lib/elasticsearch/api.rb +16 -9
- data/lib/elasticsearch/api/actions/cat/aliases.rb +67 -0
- data/lib/elasticsearch/api/actions/cat/allocation.rb +69 -0
- data/lib/elasticsearch/api/actions/cat/count.rb +59 -0
- data/lib/elasticsearch/api/actions/cat/health.rb +43 -0
- data/lib/elasticsearch/api/actions/cat/help.rb +25 -0
- data/lib/elasticsearch/api/actions/cat/indices.rb +77 -0
- data/lib/elasticsearch/api/actions/cat/master.rb +40 -0
- data/lib/elasticsearch/api/actions/cat/nodes.rb +38 -0
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +40 -0
- data/lib/elasticsearch/api/actions/cat/recovery.rb +73 -0
- data/lib/elasticsearch/api/actions/cat/shards.rb +72 -0
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +3 -1
- data/lib/elasticsearch/api/actions/cluster/state.rb +23 -14
- data/lib/elasticsearch/api/actions/count_percolate.rb +78 -0
- data/lib/elasticsearch/api/actions/indices/exists.rb +4 -1
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +5 -3
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +34 -0
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +4 -1
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +5 -3
- data/lib/elasticsearch/api/actions/indices/get_aliases.rb +6 -3
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +2 -1
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +8 -3
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +7 -2
- data/lib/elasticsearch/api/actions/indices/get_warmer.rb +0 -2
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +0 -1
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +11 -4
- data/lib/elasticsearch/api/actions/indices/put_warmer.rb +0 -1
- data/lib/elasticsearch/api/actions/mpercolate.rb +58 -0
- data/lib/elasticsearch/api/actions/mtermvectors.rb +67 -0
- data/lib/elasticsearch/api/actions/{cluster/node_hot_threads.rb → nodes/hot_threads.rb} +3 -3
- data/lib/elasticsearch/api/actions/{cluster/node_info.rb → nodes/info.rb} +3 -3
- data/lib/elasticsearch/api/actions/{cluster/node_shutdown.rb → nodes/shutdown.rb} +3 -3
- data/lib/elasticsearch/api/actions/nodes/stats.rb +79 -0
- data/lib/elasticsearch/api/actions/percolate.rb +67 -21
- data/lib/elasticsearch/api/actions/snapshot/create.rb +48 -0
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +44 -0
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +41 -0
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +38 -0
- data/lib/elasticsearch/api/actions/snapshot/get.rb +47 -0
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +42 -0
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +53 -0
- data/lib/elasticsearch/api/actions/termvector.rb +77 -0
- data/lib/elasticsearch/api/namespace/cat.rb +20 -0
- data/lib/elasticsearch/api/namespace/nodes.rb +20 -0
- data/lib/elasticsearch/api/namespace/snapshot.rb +20 -0
- data/lib/elasticsearch/api/utils.rb +2 -4
- data/lib/elasticsearch/api/version.rb +1 -1
- data/test/integration/yaml_test_runner.rb +37 -8
- data/test/unit/cat/aliases_test.rb +26 -0
- data/test/unit/cat/allocation_test.rb +26 -0
- data/test/unit/cat/count_test.rb +26 -0
- data/test/unit/cat/health_test.rb +26 -0
- data/test/unit/cat/help_test.rb +26 -0
- data/test/unit/cat/indices_test.rb +26 -0
- data/test/unit/cat/master_test.rb +26 -0
- data/test/unit/cat/nodes_test.rb +26 -0
- data/test/unit/cat/pending_tasks_test.rb +26 -0
- data/test/unit/cat/recovery_test.rb +26 -0
- data/test/unit/cat/shards_test.rb +26 -0
- data/test/unit/cluster/state_test.rb +12 -3
- data/test/unit/count_percolate_test.rb +26 -0
- data/test/unit/indices/exists_alias_test.rb +0 -6
- data/test/unit/indices/exists_template_test.rb +59 -0
- data/test/unit/indices/get_alias_test.rb +0 -6
- data/test/unit/indices/get_aliases_test.rb +10 -0
- data/test/unit/indices/get_field_mapping_test.rb +1 -1
- data/test/unit/indices/get_mapping_test.rb +3 -3
- data/test/unit/indices/get_settings_test.rb +10 -0
- data/test/unit/indices/get_warmer_test.rb +0 -6
- data/test/unit/indices/put_alias_test.rb +0 -6
- data/test/unit/indices/put_mapping_test.rb +5 -11
- data/test/unit/indices/put_settings_test.rb +9 -0
- data/test/unit/indices/put_warmer_test.rb +0 -6
- data/test/unit/mpercolate_test.rb +51 -0
- data/test/unit/mtermvectors_test.rb +38 -0
- data/test/unit/{cluster/node_hot_threads_test.rb → nodes/hot_threads_test.rb} +5 -5
- data/test/unit/{cluster/node_info_test.rb → nodes/info_test.rb} +6 -6
- data/test/unit/{cluster/node_shutdown_test.rb → nodes/shutdown_test.rb} +6 -6
- data/test/unit/{cluster/node_stats_test.rb → nodes/stats_test.rb} +10 -10
- data/test/unit/percolate_test.rb +2 -13
- data/test/unit/snapshot/create_repository_test.rb +38 -0
- data/test/unit/snapshot/create_test.rb +38 -0
- data/test/unit/snapshot/delete_repository_test.rb +35 -0
- data/test/unit/snapshot/delete_test.rb +38 -0
- data/test/unit/snapshot/get_repository_test.rb +26 -0
- data/test/unit/snapshot/get_test.rb +38 -0
- data/test/unit/snapshot/restore_test.rb +38 -0
- data/test/unit/termvector_test.rb +44 -0
- data/test/unit/utils_test.rb +11 -0
- metadata +89 -17
- data/lib/elasticsearch/api/actions/cluster/node_stats.rb +0 -75
@@ -0,0 +1,38 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# TODO: Description
|
7
|
+
#
|
8
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
|
9
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
10
|
+
# @option arguments [List] :h Comma-separated list of column names to display
|
11
|
+
# @option arguments [Boolean] :help Return help information
|
12
|
+
# @option arguments [Boolean] :v Verbose mode. Display column headers
|
13
|
+
#
|
14
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-nodes.html
|
15
|
+
#
|
16
|
+
def nodes(arguments={})
|
17
|
+
valid_params = [
|
18
|
+
:local,
|
19
|
+
:master_timeout,
|
20
|
+
:h,
|
21
|
+
:help,
|
22
|
+
:v ]
|
23
|
+
|
24
|
+
method = 'GET'
|
25
|
+
path = "_cat/nodes"
|
26
|
+
|
27
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
28
|
+
|
29
|
+
params[:h] = Utils.__listify(params[:h]) if params[:h]
|
30
|
+
|
31
|
+
body = nil
|
32
|
+
|
33
|
+
perform_request(method, path, params, body).body
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Display the information from the {Cluster::Actions#pending_tasks} API in a tabular format
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
#
|
10
|
+
# puts client.cat.pending_tasks
|
11
|
+
#
|
12
|
+
# @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
|
13
|
+
# @option arguments [Boolean] :v Display column headers as part of the output
|
14
|
+
# @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
|
15
|
+
# @option arguments [Boolean] :help Return information about headers
|
16
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
17
|
+
# (default: false)
|
18
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
19
|
+
#
|
20
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-pending-tasks.html
|
21
|
+
#
|
22
|
+
def pending_tasks(arguments={})
|
23
|
+
valid_params = [
|
24
|
+
:local,
|
25
|
+
:master_timeout,
|
26
|
+
:h,
|
27
|
+
:help,
|
28
|
+
:v ]
|
29
|
+
|
30
|
+
method = 'GET'
|
31
|
+
path = "_cat/pending_tasks"
|
32
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
33
|
+
body = nil
|
34
|
+
|
35
|
+
perform_request(method, path, params, body).body
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Display information about the recovery process (allocating shards)
|
7
|
+
#
|
8
|
+
# @example Display information for all indices
|
9
|
+
#
|
10
|
+
# puts client.cat.recovery
|
11
|
+
#
|
12
|
+
# @example Display information for a specific index
|
13
|
+
#
|
14
|
+
# puts client.cat.recovery index: 'index-a'
|
15
|
+
#
|
16
|
+
# @example Display information for indices matching a pattern
|
17
|
+
#
|
18
|
+
# puts client.cat.recovery index: 'index-*'
|
19
|
+
#
|
20
|
+
# @example Display header names in the output
|
21
|
+
#
|
22
|
+
# puts client.cat.recovery v: true
|
23
|
+
#
|
24
|
+
# @example Display only specific columns in the output (see the `help` parameter)
|
25
|
+
#
|
26
|
+
# puts client.cat.recovery h: ['node', 'index', 'shard', 'percent']
|
27
|
+
#
|
28
|
+
# @example Display only specific columns in the output, using the short names
|
29
|
+
#
|
30
|
+
# puts client.cat.recovery h: 'n,i,s,per'
|
31
|
+
#
|
32
|
+
# @example Return the information as Ruby objects
|
33
|
+
#
|
34
|
+
# client.cat.recovery format: 'json'
|
35
|
+
#
|
36
|
+
# @option arguments [List] :index A comma-separated list of index names to limit the returned information
|
37
|
+
# @option arguments [String] :bytes The unit in which to display byte values (options: b, k, m, g)
|
38
|
+
# @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
|
39
|
+
# @option arguments [Boolean] :v Display column headers as part of the output
|
40
|
+
# @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
|
41
|
+
# @option arguments [Boolean] :help Return information about headers
|
42
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
43
|
+
# (default: false)
|
44
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
45
|
+
#
|
46
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-recovery.html
|
47
|
+
#
|
48
|
+
def recovery(arguments={})
|
49
|
+
valid_params = [
|
50
|
+
:bytes,
|
51
|
+
:local,
|
52
|
+
:master_timeout,
|
53
|
+
:h,
|
54
|
+
:help,
|
55
|
+
:v ]
|
56
|
+
|
57
|
+
index = arguments.delete(:index)
|
58
|
+
|
59
|
+
method = 'GET'
|
60
|
+
|
61
|
+
path = Utils.__pathify '_cat/recovery', Utils.__listify(index)
|
62
|
+
|
63
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
64
|
+
params[:h] = Utils.__listify(params[:h]) if params[:h]
|
65
|
+
|
66
|
+
body = nil
|
67
|
+
|
68
|
+
perform_request(method, path, params, body).body
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Display shard allocation across nodes
|
7
|
+
#
|
8
|
+
# @example Display information for all indices
|
9
|
+
#
|
10
|
+
# puts client.cat.shards
|
11
|
+
#
|
12
|
+
# @example Display information for a specific index
|
13
|
+
#
|
14
|
+
# puts client.cat.shards index: 'index-a'
|
15
|
+
#
|
16
|
+
# @example Display information for a list of indices
|
17
|
+
#
|
18
|
+
# puts client.cat.shards index: ['index-a', 'index-b']
|
19
|
+
#
|
20
|
+
# @example Display header names in the output
|
21
|
+
#
|
22
|
+
# puts client.cat.shards v: true
|
23
|
+
#
|
24
|
+
# @example Display only specific columns in the output (see the `help` parameter)
|
25
|
+
#
|
26
|
+
# puts client.cat.shards h: ['node', 'index', 'shard', 'prirep', 'docs', 'store', 'merges.total']
|
27
|
+
#
|
28
|
+
# @example Display only specific columns in the output, using the short names
|
29
|
+
#
|
30
|
+
# puts client.cat.shards h: 'n,i,s,p,d,sto,mt'
|
31
|
+
#
|
32
|
+
# @example Return the information as Ruby objects
|
33
|
+
#
|
34
|
+
# client.cat.shards format: 'json'
|
35
|
+
#
|
36
|
+
# @option arguments [List] :index A comma-separated list of index names to limit the returned information
|
37
|
+
# @option arguments [String] :bytes The unit in which to display byte values (options: b, k, m, g)
|
38
|
+
# @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
|
39
|
+
# @option arguments [Boolean] :v Display column headers as part of the output
|
40
|
+
# @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
|
41
|
+
# @option arguments [Boolean] :help Return information about headers
|
42
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
43
|
+
# (default: false)
|
44
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
45
|
+
#
|
46
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-shards.html
|
47
|
+
#
|
48
|
+
def shards(arguments={})
|
49
|
+
valid_params = [
|
50
|
+
:local,
|
51
|
+
:master_timeout,
|
52
|
+
:h,
|
53
|
+
:help,
|
54
|
+
:v ]
|
55
|
+
|
56
|
+
index = arguments.delete(:index)
|
57
|
+
|
58
|
+
method = 'GET'
|
59
|
+
|
60
|
+
path = Utils.__pathify '_cat/shards', Utils.__listify(index)
|
61
|
+
|
62
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
63
|
+
params[:h] = Utils.__listify(params[:h]) if params[:h]
|
64
|
+
|
65
|
+
body = nil
|
66
|
+
|
67
|
+
perform_request(method, path, params, body).body
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -15,9 +15,11 @@ module Elasticsearch
|
|
15
15
|
# @see http://elasticsearch.org/guide/reference/api/admin-cluster-update-settings/
|
16
16
|
#
|
17
17
|
def put_settings(arguments={})
|
18
|
+
valid_params = [ :flat_settings ]
|
19
|
+
|
18
20
|
method = 'PUT'
|
19
21
|
path = "_cluster/settings"
|
20
|
-
params =
|
22
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
21
23
|
body = arguments[:body] || {}
|
22
24
|
|
23
25
|
perform_request(method, path, params, body).body
|
@@ -9,13 +9,12 @@ module Elasticsearch
|
|
9
9
|
#
|
10
10
|
# client.cluster.state
|
11
11
|
#
|
12
|
-
# @option arguments [
|
13
|
-
#
|
14
|
-
# @option arguments [List] :
|
15
|
-
#
|
16
|
-
# @option arguments [
|
17
|
-
#
|
18
|
-
# (`routing_table` and `routing_nodes`)
|
12
|
+
# @option arguments [List] :index A comma-separated list of index names; use `_all` or omit to
|
13
|
+
# perform the operation on all indices
|
14
|
+
# @option arguments [List] :metric Limit the information returned to the specified metrics
|
15
|
+
# (options: _all, blocks, index_templates, metadata, nodes, routing_table)
|
16
|
+
# @option arguments [List] :index_templates A comma separated list to return specific index templates when
|
17
|
+
# returning metadata
|
19
18
|
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
20
19
|
# (default: false)
|
21
20
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
@@ -23,20 +22,30 @@ module Elasticsearch
|
|
23
22
|
# @see http://elasticsearch.org/guide/reference/api/admin-cluster-state/
|
24
23
|
#
|
25
24
|
def state(arguments={})
|
25
|
+
arguments = arguments.clone
|
26
|
+
index = arguments.delete(:index)
|
27
|
+
metric = arguments.delete(:metric)
|
28
|
+
|
26
29
|
valid_params = [
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:filter_indices,
|
30
|
-
:filter_metadata,
|
31
|
-
:filter_nodes,
|
32
|
-
:filter_routing_table,
|
30
|
+
:metric,
|
31
|
+
:index_templates,
|
33
32
|
:local,
|
34
|
-
:master_timeout
|
33
|
+
:master_timeout,
|
34
|
+
:flat_settings ]
|
35
35
|
|
36
36
|
method = 'GET'
|
37
37
|
path = "_cluster/state"
|
38
38
|
|
39
|
+
path = Utils.__pathify '_cluster/state',
|
40
|
+
Utils.__listify(metric),
|
41
|
+
Utils.__listify(index)
|
42
|
+
|
39
43
|
params = Utils.__validate_and_extract_params arguments, valid_params
|
44
|
+
|
45
|
+
[:index_templates].each do |key|
|
46
|
+
params[key] = Utils.__listify(params[key]) if params[key]
|
47
|
+
end
|
48
|
+
|
40
49
|
body = nil
|
41
50
|
|
42
51
|
perform_request(method, path, params, body).body
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Actions
|
4
|
+
|
5
|
+
# Return the number of queries matching a document.
|
6
|
+
#
|
7
|
+
# Percolator allows you to register queries and then evaluate a document against them:
|
8
|
+
# the number of matching queries is returned in the response.
|
9
|
+
#
|
10
|
+
# @example Register query named "alert-1" for the "my-index" index
|
11
|
+
#
|
12
|
+
# client.index index: 'my-index',
|
13
|
+
# type: '.percolator',
|
14
|
+
# id: 'alert-1',
|
15
|
+
# body: { query: { query_string: { query: 'foo' } } }
|
16
|
+
#
|
17
|
+
# @example Return the number of matching queries for a custom document
|
18
|
+
#
|
19
|
+
# client.count_percolate index: 'my-index', type: 'my-type', body: { doc: { title: "Foo Bar" } }
|
20
|
+
# # => { ..., total: 1}
|
21
|
+
#
|
22
|
+
# @example Return the number of matching queries for an existing document
|
23
|
+
#
|
24
|
+
# client.index index: 'my-index', type: 'my-type', id: '123', body: { title: "Foo Bar" }
|
25
|
+
#
|
26
|
+
# client.count_percolate index: 'my-index', type: 'my-type', id: '123'
|
27
|
+
# # => { ..., total: 1}
|
28
|
+
#
|
29
|
+
# @option arguments [String] :index The index of the document being percolated. (*Required*)
|
30
|
+
# @option arguments [String] :type The type of the document being percolated. (*Required*)
|
31
|
+
# @option arguments [String] :id Fetch the document specified by index/type/id and
|
32
|
+
# use it instead of the passed `doc`
|
33
|
+
# @option arguments [Hash] :body The percolator request definition using the percolate DSL
|
34
|
+
# @option arguments [List] :routing A comma-separated list of specific routing values
|
35
|
+
# @option arguments [String] :preference Specify the node or shard the operation should be performed on
|
36
|
+
# (default: random)
|
37
|
+
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
38
|
+
# unavailable (missing or closed)
|
39
|
+
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
|
40
|
+
# no concrete indices. (This includes `_all` string or when no
|
41
|
+
# indices have been specified)
|
42
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are
|
43
|
+
# open, closed or both. (options: open, closed)
|
44
|
+
# @option arguments [String] :percolate_index The index to percolate the document into. Defaults to passed `index`.
|
45
|
+
# @option arguments [String] :percolate_type The type to percolate document into. Defaults to passed `type`.
|
46
|
+
# @option arguments [Number] :version Explicit version number for concurrency control
|
47
|
+
# @option arguments [String] :version_type Specific version type (options: internal, external)
|
48
|
+
#
|
49
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-percolate.html
|
50
|
+
#
|
51
|
+
def count_percolate(arguments={})
|
52
|
+
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
53
|
+
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
|
54
|
+
valid_params = [
|
55
|
+
:routing,
|
56
|
+
:preference,
|
57
|
+
:ignore_unavailable,
|
58
|
+
:allow_no_indices,
|
59
|
+
:expand_wildcards,
|
60
|
+
:percolate_index,
|
61
|
+
:percolate_type,
|
62
|
+
:version,
|
63
|
+
:version_type ]
|
64
|
+
|
65
|
+
method = 'GET'
|
66
|
+
path = Utils.__pathify Utils.__escape(arguments[:index]),
|
67
|
+
Utils.__escape(arguments[:type]),
|
68
|
+
arguments[:id],
|
69
|
+
'_percolate/count'
|
70
|
+
|
71
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
72
|
+
body = arguments[:body]
|
73
|
+
|
74
|
+
perform_request(method, path, params, body).body
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -19,6 +19,8 @@ module Elasticsearch
|
|
19
19
|
# `missing` ones (options: none, missing) @until 1.0
|
20
20
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
21
21
|
# unavailable (missing, closed, etc)
|
22
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
23
|
+
# (default: false)
|
22
24
|
#
|
23
25
|
# @return [true,false]
|
24
26
|
#
|
@@ -31,7 +33,8 @@ module Elasticsearch
|
|
31
33
|
:ignore_indices,
|
32
34
|
:ignore_unavailable,
|
33
35
|
:allow_no_indices,
|
34
|
-
:expand_wildcards
|
36
|
+
:expand_wildcards,
|
37
|
+
:local
|
35
38
|
]
|
36
39
|
|
37
40
|
method = 'HEAD'
|
@@ -10,7 +10,7 @@ module Elasticsearch
|
|
10
10
|
# client.indices.exists_alias name: 'myalias'
|
11
11
|
#
|
12
12
|
# @option arguments [List] :index A comma-separated list of index names to filter aliases
|
13
|
-
# @option arguments [List] :name A comma-separated list of alias names to return
|
13
|
+
# @option arguments [List] :name A comma-separated list of alias names to return
|
14
14
|
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
|
15
15
|
# no concrete indices. (This includes `_all` string or when no
|
16
16
|
# indices have been specified)
|
@@ -20,16 +20,18 @@ module Elasticsearch
|
|
20
20
|
# `missing` ones (options: none, missing) @until 1.0
|
21
21
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
22
22
|
# unavailable (missing, closed, etc)
|
23
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
24
|
+
# (default: false)
|
23
25
|
#
|
24
26
|
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
|
25
27
|
#
|
26
28
|
def exists_alias(arguments={})
|
27
|
-
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
28
29
|
valid_params = [
|
29
30
|
:ignore_indices,
|
30
31
|
:ignore_unavailable,
|
31
32
|
:allow_no_indices,
|
32
|
-
:expand_wildcards
|
33
|
+
:expand_wildcards,
|
34
|
+
:local
|
33
35
|
]
|
34
36
|
|
35
37
|
method = 'HEAD'
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Indices
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# TODO: Description
|
7
|
+
#
|
8
|
+
# @option arguments [String] :name The name of the template (*Required*)
|
9
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
|
10
|
+
#
|
11
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-templates.html
|
12
|
+
#
|
13
|
+
def exists_template(arguments={})
|
14
|
+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
15
|
+
valid_params = [ :local ]
|
16
|
+
|
17
|
+
method = 'HEAD'
|
18
|
+
path = Utils.__pathify '_template', Utils.__escape(arguments[:name])
|
19
|
+
|
20
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
21
|
+
body = nil
|
22
|
+
|
23
|
+
perform_request(method, path, params, body).status == 200 ? true : false
|
24
|
+
rescue Exception => e
|
25
|
+
if e.class.to_s =~ /NotFound/ || e.message =~ /Not\s*Found|404/i
|
26
|
+
false
|
27
|
+
else
|
28
|
+
raise e
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|