elasticsearch-api 0.4.11 → 1.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. data/Gemfile +2 -6
  2. data/README.md +3 -4
  3. data/lib/elasticsearch/api.rb +16 -9
  4. data/lib/elasticsearch/api/actions/cat/aliases.rb +67 -0
  5. data/lib/elasticsearch/api/actions/cat/allocation.rb +69 -0
  6. data/lib/elasticsearch/api/actions/cat/count.rb +59 -0
  7. data/lib/elasticsearch/api/actions/cat/health.rb +43 -0
  8. data/lib/elasticsearch/api/actions/cat/help.rb +25 -0
  9. data/lib/elasticsearch/api/actions/cat/indices.rb +77 -0
  10. data/lib/elasticsearch/api/actions/cat/master.rb +40 -0
  11. data/lib/elasticsearch/api/actions/cat/nodes.rb +38 -0
  12. data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +40 -0
  13. data/lib/elasticsearch/api/actions/cat/recovery.rb +73 -0
  14. data/lib/elasticsearch/api/actions/cat/shards.rb +72 -0
  15. data/lib/elasticsearch/api/actions/cluster/put_settings.rb +3 -1
  16. data/lib/elasticsearch/api/actions/cluster/state.rb +23 -14
  17. data/lib/elasticsearch/api/actions/count_percolate.rb +78 -0
  18. data/lib/elasticsearch/api/actions/indices/exists.rb +4 -1
  19. data/lib/elasticsearch/api/actions/indices/exists_alias.rb +5 -3
  20. data/lib/elasticsearch/api/actions/indices/exists_template.rb +34 -0
  21. data/lib/elasticsearch/api/actions/indices/exists_type.rb +4 -1
  22. data/lib/elasticsearch/api/actions/indices/get_alias.rb +5 -3
  23. data/lib/elasticsearch/api/actions/indices/get_aliases.rb +6 -3
  24. data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +2 -1
  25. data/lib/elasticsearch/api/actions/indices/get_mapping.rb +8 -3
  26. data/lib/elasticsearch/api/actions/indices/get_settings.rb +7 -2
  27. data/lib/elasticsearch/api/actions/indices/get_warmer.rb +0 -2
  28. data/lib/elasticsearch/api/actions/indices/put_alias.rb +0 -1
  29. data/lib/elasticsearch/api/actions/indices/put_mapping.rb +11 -4
  30. data/lib/elasticsearch/api/actions/indices/put_warmer.rb +0 -1
  31. data/lib/elasticsearch/api/actions/mpercolate.rb +58 -0
  32. data/lib/elasticsearch/api/actions/mtermvectors.rb +67 -0
  33. data/lib/elasticsearch/api/actions/{cluster/node_hot_threads.rb → nodes/hot_threads.rb} +3 -3
  34. data/lib/elasticsearch/api/actions/{cluster/node_info.rb → nodes/info.rb} +3 -3
  35. data/lib/elasticsearch/api/actions/{cluster/node_shutdown.rb → nodes/shutdown.rb} +3 -3
  36. data/lib/elasticsearch/api/actions/nodes/stats.rb +79 -0
  37. data/lib/elasticsearch/api/actions/percolate.rb +67 -21
  38. data/lib/elasticsearch/api/actions/snapshot/create.rb +48 -0
  39. data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +44 -0
  40. data/lib/elasticsearch/api/actions/snapshot/delete.rb +41 -0
  41. data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +38 -0
  42. data/lib/elasticsearch/api/actions/snapshot/get.rb +47 -0
  43. data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +42 -0
  44. data/lib/elasticsearch/api/actions/snapshot/restore.rb +53 -0
  45. data/lib/elasticsearch/api/actions/termvector.rb +77 -0
  46. data/lib/elasticsearch/api/namespace/cat.rb +20 -0
  47. data/lib/elasticsearch/api/namespace/nodes.rb +20 -0
  48. data/lib/elasticsearch/api/namespace/snapshot.rb +20 -0
  49. data/lib/elasticsearch/api/utils.rb +2 -4
  50. data/lib/elasticsearch/api/version.rb +1 -1
  51. data/test/integration/yaml_test_runner.rb +37 -8
  52. data/test/unit/cat/aliases_test.rb +26 -0
  53. data/test/unit/cat/allocation_test.rb +26 -0
  54. data/test/unit/cat/count_test.rb +26 -0
  55. data/test/unit/cat/health_test.rb +26 -0
  56. data/test/unit/cat/help_test.rb +26 -0
  57. data/test/unit/cat/indices_test.rb +26 -0
  58. data/test/unit/cat/master_test.rb +26 -0
  59. data/test/unit/cat/nodes_test.rb +26 -0
  60. data/test/unit/cat/pending_tasks_test.rb +26 -0
  61. data/test/unit/cat/recovery_test.rb +26 -0
  62. data/test/unit/cat/shards_test.rb +26 -0
  63. data/test/unit/cluster/state_test.rb +12 -3
  64. data/test/unit/count_percolate_test.rb +26 -0
  65. data/test/unit/indices/exists_alias_test.rb +0 -6
  66. data/test/unit/indices/exists_template_test.rb +59 -0
  67. data/test/unit/indices/get_alias_test.rb +0 -6
  68. data/test/unit/indices/get_aliases_test.rb +10 -0
  69. data/test/unit/indices/get_field_mapping_test.rb +1 -1
  70. data/test/unit/indices/get_mapping_test.rb +3 -3
  71. data/test/unit/indices/get_settings_test.rb +10 -0
  72. data/test/unit/indices/get_warmer_test.rb +0 -6
  73. data/test/unit/indices/put_alias_test.rb +0 -6
  74. data/test/unit/indices/put_mapping_test.rb +5 -11
  75. data/test/unit/indices/put_settings_test.rb +9 -0
  76. data/test/unit/indices/put_warmer_test.rb +0 -6
  77. data/test/unit/mpercolate_test.rb +51 -0
  78. data/test/unit/mtermvectors_test.rb +38 -0
  79. data/test/unit/{cluster/node_hot_threads_test.rb → nodes/hot_threads_test.rb} +5 -5
  80. data/test/unit/{cluster/node_info_test.rb → nodes/info_test.rb} +6 -6
  81. data/test/unit/{cluster/node_shutdown_test.rb → nodes/shutdown_test.rb} +6 -6
  82. data/test/unit/{cluster/node_stats_test.rb → nodes/stats_test.rb} +10 -10
  83. data/test/unit/percolate_test.rb +2 -13
  84. data/test/unit/snapshot/create_repository_test.rb +38 -0
  85. data/test/unit/snapshot/create_test.rb +38 -0
  86. data/test/unit/snapshot/delete_repository_test.rb +35 -0
  87. data/test/unit/snapshot/delete_test.rb +38 -0
  88. data/test/unit/snapshot/get_repository_test.rb +26 -0
  89. data/test/unit/snapshot/get_test.rb +38 -0
  90. data/test/unit/snapshot/restore_test.rb +38 -0
  91. data/test/unit/termvector_test.rb +44 -0
  92. data/test/unit/utils_test.rb +11 -0
  93. metadata +89 -17
  94. 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 [Boolean] :filter_blocks Do not return information about blocks
13
- # @option arguments [Boolean] :filter_index_templates Do not return information about index templates
14
- # @option arguments [List] :filter_indices Limit returned metadata information to specific indices
15
- # @option arguments [Boolean] :filter_metadata Do not return information about indices metadata
16
- # @option arguments [Boolean] :filter_nodes Do not return information about nodes
17
- # @option arguments [Boolean] :filter_routing_table Do not return information about shard allocation
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
- :filter_blocks,
28
- :filter_index_templates,
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 (*Required*)
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