Class: JayAPI::Elasticsearch::QueryBuilder::QueryClauses::Terms
- Inherits:
-
QueryClause
- Object
- QueryClause
- JayAPI::Elasticsearch::QueryBuilder::QueryClauses::Terms
- Defined in:
- lib/jay_api/elasticsearch/query_builder/query_clauses/terms.rb
Overview
Represents a Terms query in Elasticsearch. Information about this type of query can be found here: www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#terms ⇒ Object
readonly
Returns the value of attribute terms.
Instance Method Summary collapse
-
#initialize(field:, terms:) ⇒ Terms
constructor
A new instance of Terms.
-
#to_h ⇒ Hash
The Hash that represents this query (in Elasticsearch’s DSL).
Constructor Details
#initialize(field:, terms:) ⇒ Terms
Returns a new instance of Terms.
17 18 19 20 21 22 |
# File 'lib/jay_api/elasticsearch/query_builder/query_clauses/terms.rb', line 17 def initialize(field:, terms:) super() @field = field @terms = terms end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/query_clauses/terms.rb', line 13 def field @field end |
#terms ⇒ Object (readonly)
Returns the value of attribute terms.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/query_clauses/terms.rb', line 13 def terms @terms end |
Instance Method Details
#to_h ⇒ Hash
Returns The Hash that represents this query (in Elasticsearch’s DSL).
26 27 28 29 30 31 32 |
# File 'lib/jay_api/elasticsearch/query_builder/query_clauses/terms.rb', line 26 def to_h { terms: { field => terms } } end |