Class: ElasticQuery::FilteredQuery

Inherits:
Query show all
Defined in:
lib/elastic_query/filtered_query.rb

Overview

This class represents a filtered query.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filter, query) ⇒ FilteredQuery

Returns a new instance of FilteredQuery.

Parameters:

  • filter (Hash)
  • query (Hash)


11
12
13
14
# File 'lib/elastic_query/filtered_query.rb', line 11

def initialize(filter, query)
  @filter = filter
  super(query)
end

Instance Attribute Details

#filterQuery (readonly)

the filter

Returns:

  • (Query)

    the current value of filter



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

def filter
  @filter
end

#queryQuery (readonly)

the query

Returns:

  • (Query)

    the current value of query



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

def query
  @query
end

Instance Method Details

#to_hashObject



16
17
18
19
20
21
22
23
# File 'lib/elastic_query/filtered_query.rb', line 16

def to_hash
  {
    filtered: {
      query: query.to_hash,
      filter: filter.to_hash
    }
  }
end