Class: JayAPI::Elasticsearch::QueryBuilder::QueryClauses::Terms

Inherits:
QueryClause
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(field:, terms:) ⇒ 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

#fieldObject (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

#termsObject (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_hHash



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