Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow setting custom configurations in `elasticsearch.yml`

Added a block of code which will print all key:value pairs set in the
`node.elasticsearch[:custom_config]` attribute in the `elasticsearch.yml` file:

See Vagrantfile for example.

Fixes: #59, Related: #64
  • Loading branch information...
commit 68ba121f3d5647e73a7cbfdfc6373f38418de577 1 parent 0491d09
@karmi karmi authored
View
7 Vagrantfile
@@ -138,7 +138,12 @@ node_config = {
# For testing flat attributes:
"index.search.slowlog.threshold.query.trace" => "1ms",
# For testing deep attributes:
- :discovery => { :zen => { :ping => { :timeout => "9s" } } }
+ :discovery => { :zen => { :ping => { :timeout => "9s" } } },
+ # For testing custom configuration
+ :custom_config => {
+ 'threadpool.index.type' => 'fixed',
+ 'threadpool.index.size' => '2'
+ }
}
}
View
10 attributes/default.rb
@@ -95,3 +95,13 @@
#
# The default attributes set by the cookbook configure a minimal set inferred from the environment
# (eg. memory settings, node name), or reasonable defaults for production.
+#
+# The template is based on the elasticsearch.yml file from the Elasticsearch distribution;
+# to set other configurations, set the `node.elasticsearch[:custom_config]` attribute in the
+# node configuration, `elasticsearch/settings` data bag, role/environment definition, etc:
+#
+# // ...
+# 'threadpool.index.type' => 'fixed',
+# 'threadpool.index.size' => '2'
+# // ...
+#
View
15 templates/default/elasticsearch.yml.erb
@@ -5,6 +5,15 @@
# Please see the source file for context and more information:
#
# https://github.com/elasticsearch/elasticsearch/blob/master/config/elasticsearch.yml
+#
+# To set configurations not exposed by this template, set the
+# `node.elasticsearch[:custom_config]` attribute in your node configuration,
+# `elasticsearch/settings` data bag, role/environment definition, etc:
+#
+# // ...
+# 'threadpool.index.type' => 'fixed',
+# 'threadpool.index.size' => '2'
+# // ...
################################### Cluster ###################################
@@ -122,3 +131,9 @@ jmx.create_connector: true
jmx.port: 9400-9500
jmx.domain: elasticsearch
<%- end -%>
+
+################################## Custom #####################################
+
+<% node.elasticsearch[:custom_config].sort.each do |key, value| %>
+<%= key %>: <%= value %>
+<% end %>
View
3  tests/installation_test.rb
@@ -46,7 +46,8 @@
must_include("path.data: /usr/local/var/data/elasticsearch/disk1").
must_include("bootstrap.mlockall: false").
must_include("index.search.slowlog.threshold.query.trace: 1ms").
- must_include("discovery.zen.ping.timeout: 9s")
+ must_include("discovery.zen.ping.timeout: 9s").
+ must_include("threadpool.index.size: 2")
if node.name == 'precise64'
file("/usr/local/etc/elasticsearch/elasticsearch.yml").
Please sign in to comment.
Something went wrong with that request. Please try again.