Class: Boolminot::Clauses::Nested
- Defined in:
- lib/boolminot/clauses/nested.rb
Instance Attribute Summary collapse
-
#clause ⇒ Object
readonly
Returns the value of attribute clause.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, clause, opts) ⇒ Nested
constructor
A new instance of Nested.
- #to_elasticsearch(options = {}) ⇒ Object
Methods included from Base::ClassMethods
Methods included from Base::InstanceMethods
#satisfied_by?, #to_elasticsearch_negated, #to_raw_bool
Constructor Details
#initialize(path, clause, opts) ⇒ Nested
Returns a new instance of Nested.
6 7 8 9 10 |
# File 'lib/boolminot/clauses/nested.rb', line 6 def initialize(path, clause, opts) @path = path @clause = clause @opts = opts end |
Instance Attribute Details
#clause ⇒ Object (readonly)
Returns the value of attribute clause.
4 5 6 |
# File 'lib/boolminot/clauses/nested.rb', line 4 def clause @clause end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
4 5 6 |
# File 'lib/boolminot/clauses/nested.rb', line 4 def opts @opts end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/boolminot/clauses/nested.rb', line 4 def path @path end |
Instance Method Details
#to_elasticsearch(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/boolminot/clauses/nested.rb', line 12 def to_elasticsearch( = {}) = { context: :filter } = .merge() context = .fetch(:context) inner = clause.to_elasticsearch() { type => { path: path }.merge(context => inner).merge(opts) } end |