class Elasticband::Query::Match

Attributes

field[RW]
options[RW]
query[RW]

Public Class Methods

new(query, field = nil, options = {}) click to toggle source
# File lib/elasticband/query/match.rb, line 6
def initialize(query, field = nil, options = {})
  self.query = query
  self.field = (field || :_all).to_sym
  self.options = options
end

Public Instance Methods

to_h() click to toggle source
# File lib/elasticband/query/match.rb, line 12
def to_h
  { match: { field => query_hash } }
end

Private Instance Methods

query_hash() click to toggle source
# File lib/elasticband/query/match.rb, line 18
def query_hash
  return query if options.blank?

  { query: query }.merge!(options)
end