Class: ElasticSearch::Node::Embedded
- Inherits:
-
Object
- Object
- ElasticSearch::Node::Embedded
- Includes:
- ClientProvider
- Defined in:
- lib/elasticsearch-node/embedded.rb
Instance Method Summary collapse
- #client ⇒ Object
- #close ⇒ Object
-
#initialize(opts = {}) ⇒ Embedded
constructor
A new instance of Embedded.
- #ip ⇒ Object
- #port ⇒ Object
Methods included from ClientProvider
Constructor Details
#initialize(opts = {}) ⇒ Embedded
Returns a new instance of Embedded.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/elasticsearch-node/embedded.rb', line 13 def initialize(opts = {}) node_builder = org.elasticsearch.node.NodeBuilder.nodeBuilder.loadConfigSettings(true) settings_builder = org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder if opts[:config] settings_builder.put("path.home", opts[:config]) end settings_builder.put(opts[:settings]) if opts[:settings] tuple = org.elasticsearch.node.internal.InternalSettingsPerparer.prepareSettings(settings_builder.build, true) org.elasticsearch.common.logging.log4j.LogConfigurator.configure(tuple.v1()); @node = node_builder.settings(settings_builder).node super(opts) end |
Instance Method Details
#client ⇒ Object
37 38 39 |
# File 'lib/elasticsearch-node/embedded.rb', line 37 def client @node.client end |
#close ⇒ Object
41 42 43 |
# File 'lib/elasticsearch-node/embedded.rb', line 41 def close @node.close end |
#ip ⇒ Object
33 34 35 |
# File 'lib/elasticsearch-node/embedded.rb', line 33 def ip socket_address.host_string end |
#port ⇒ Object
29 30 31 |
# File 'lib/elasticsearch-node/embedded.rb', line 29 def port Integer(socket_address.port) end |