Class: Elasticband::Query::Match

Inherits:
Elasticband::Query show all
Defined in:
lib/elasticband/query/match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Elasticband::Query

parse

Constructor Details

#initialize(query, field = nil, options = {}) ⇒ Match

Returns a new instance of Match.



6
7
8
9
10
# 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

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



4
5
6
# File 'lib/elasticband/query/match.rb', line 4

def field
  @field
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/elasticband/query/match.rb', line 4

def options
  @options
end

#queryObject

Returns the value of attribute query.



4
5
6
# File 'lib/elasticband/query/match.rb', line 4

def query
  @query
end

Instance Method Details

#to_hObject



12
13
14
# File 'lib/elasticband/query/match.rb', line 12

def to_h
  { match: { field => query_hash } }
end