Class: ElasticQuery::Query

Inherits:
BaseQuery show all
Defined in:
lib/elastic_query/query.rb

Overview

This class represents a basic query like a term or match query

Examples:

Quey.new(match_all: {})

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query) ⇒ Query

Returns a new instance of Query.



8
9
10
11
12
13
14
# File 'lib/elastic_query/query.rb', line 8

def initialize(query)
  if query.class < BaseQuery
    @query = query.to_hash
  else
    @query = query
  end
end

Instance Attribute Details

#queryObject

Returns the value of attribute query.



6
7
8
# File 'lib/elastic_query/query.rb', line 6

def query
  @query
end

Instance Method Details

#to_hashObject



16
17
18
# File 'lib/elastic_query/query.rb', line 16

def to_hash
  query
end