Class: ElasticQuery::Builder
- Inherits:
-
Object
- Object
- ElasticQuery::Builder
- Defined in:
- lib/elastic_query/builder.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
Returns the value of attribute query.
Instance Method Summary collapse
- #filter(filter_query) ⇒ Object
- #filter_nested(object_name, nested_query, options = {}) ⇒ Object
- #function_score(functions, options = {}) ⇒ Object
-
#initialize(query) ⇒ Builder
constructor
A new instance of Builder.
- #rescore(rescore_query, rescore_options = {}) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
Instance Attribute Details
#query ⇒ Object
Returns the value of attribute query.
3 4 5 |
# File 'lib/elastic_query/builder.rb', line 3 def query @query end |
Instance Method Details
#filter(filter_query) ⇒ Object
9 10 11 12 |
# File 'lib/elastic_query/builder.rb', line 9 def filter(filter_query) self.query = FilteredQuery.new(filter_query, query) self end |
#filter_nested(object_name, nested_query, options = {}) ⇒ Object
25 26 27 |
# File 'lib/elastic_query/builder.rb', line 25 def filter_nested(object_name, nested_query, = {}) filter(NestedQuery.new(object_name, nested_query, )) end |
#function_score(functions, options = {}) ⇒ Object
29 30 31 32 |
# File 'lib/elastic_query/builder.rb', line 29 def function_score(functions, = {}) self.query = FunctionScore.new(query, functions, ) self end |
#rescore(rescore_query, rescore_options = {}) ⇒ Object
14 15 16 17 |
# File 'lib/elastic_query/builder.rb', line 14 def rescore(rescore_query, = {}) self.query = RescoreQuery.new(query, rescore_query, ) self end |
#to_hash ⇒ Object
19 20 21 22 23 |
# File 'lib/elastic_query/builder.rb', line 19 def to_hash { query: query.to_hash } end |