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