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