Module: Sequel::Plugins::Elasticsearch
- Defined in:
- lib/sequel/plugins/elasticsearch.rb,
lib/sequel/plugins/elasticsearch/result.rb
Overview
The Sequel::Elasticsearch model plugin
Defined Under Namespace
Modules: ClassMethods, InstanceMethods Classes: Result
Class Method Summary collapse
-
.apply(model, _opts = OPTS) ⇒ Object
Apply the plugin to the specified model.
-
.configure(model, opts = OPTS) ⇒ Object
Configure the plugin.
Class Method Details
.apply(model, _opts = OPTS) ⇒ Object
Apply the plugin to the specified model
18 19 20 21 22 23 |
# File 'lib/sequel/plugins/elasticsearch.rb', line 18 def self.apply(model, _opts = OPTS) model.instance_variable_set(:@elasticsearch_opts, {}) model.instance_variable_set(:@elasticsearch_index, nil) model.instance_variable_set(:@elasticsearch_type, '_doc') model end |
.configure(model, opts = OPTS) ⇒ Object
Configure the plugin
26 27 28 29 30 31 |
# File 'lib/sequel/plugins/elasticsearch.rb', line 26 def self.configure(model, opts = OPTS) model.elasticsearch_opts = opts[:elasticsearch] || {} model.elasticsearch_index = (opts[:index] || model.table_name).to_sym model.elasticsearch_type = (opts[:type] || :_doc).to_sym model end |