Class: Elasticity::Search::Definition
- Inherits:
-
Object
- Object
- Elasticity::Search::Definition
- Defined in:
- lib/elasticity/search.rb
Overview
Elasticity::Search::Definition is a struct that encapsulates all the data specific to one ElasticSearch search.
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#document_type ⇒ Object
Returns the value of attribute document_type.
-
#index_name ⇒ Object
Returns the value of attribute index_name.
Instance Method Summary collapse
-
#initialize(index_name, document_type, body) ⇒ Definition
constructor
A new instance of Definition.
- #to_msearch_args ⇒ Object
- #to_search_args ⇒ Object
- #update(body_changes) ⇒ Object
Constructor Details
#initialize(index_name, document_type, body) ⇒ Definition
8 9 10 11 12 |
# File 'lib/elasticity/search.rb', line 8 def initialize(index_name, document_type, body) @index_name = index_name @document_type = document_type @body = body end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
6 7 8 |
# File 'lib/elasticity/search.rb', line 6 def body @body end |
#document_type ⇒ Object
Returns the value of attribute document_type
6 7 8 |
# File 'lib/elasticity/search.rb', line 6 def document_type @document_type end |
#index_name ⇒ Object
Returns the value of attribute index_name
6 7 8 |
# File 'lib/elasticity/search.rb', line 6 def index_name @index_name end |
Instance Method Details
#to_msearch_args ⇒ Object
22 23 24 |
# File 'lib/elasticity/search.rb', line 22 def to_msearch_args { index: @index_name, type: @document_type, search: @body } end |
#to_search_args ⇒ Object
18 19 20 |
# File 'lib/elasticity/search.rb', line 18 def to_search_args { index: @index_name, type: @document_type, body: @body } end |
#update(body_changes) ⇒ Object
14 15 16 |
# File 'lib/elasticity/search.rb', line 14 def update(body_changes) self.class.new(@index_name, @document_type, @body.deep_merge(body_changes)) end |