Class: Arelastic::Queries::Percolate
- Inherits:
-
Query
- Object
- Nodes::Node
- Query
- Arelastic::Queries::Percolate
- Defined in:
- lib/arelastic/queries/percolate.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
-
#field ⇒ Object
Returns the value of attribute field.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #as_elastic ⇒ Object
- #document_parameter_name ⇒ Object
-
#initialize(field, document, options = {}) ⇒ Percolate
constructor
A new instance of Percolate.
Methods inherited from Query
Methods inherited from Nodes::Node
#==, #convert_to_elastic, #read_option!
Methods included from Arities::Binary
Methods included from Arities::Polyadic
Methods included from Arities::Unary
Constructor Details
#initialize(field, document, options = {}) ⇒ Percolate
Returns a new instance of Percolate.
5 6 7 8 9 |
# File 'lib/arelastic/queries/percolate.rb', line 5 def initialize(field, document, = {}) @field = field @document = document @options = end |
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
4 5 6 |
# File 'lib/arelastic/queries/percolate.rb', line 4 def document @document end |
#field ⇒ Object
Returns the value of attribute field.
4 5 6 |
# File 'lib/arelastic/queries/percolate.rb', line 4 def field @field end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/arelastic/queries/percolate.rb', line 4 def @options end |
Instance Method Details
#as_elastic ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/arelastic/queries/percolate.rb', line 11 def as_elastic { "percolate" => { "field" => field, document_parameter_name => document }.merge() } end |
#document_parameter_name ⇒ Object
20 21 22 |
# File 'lib/arelastic/queries/percolate.rb', line 20 def document_parameter_name document.is_a?(Array) ? "documents" : "document" end |