Class: JayAPI::Elasticsearch::QueryBuilder::QueryClauses::IDs

Inherits:
QueryClause
  • Object
show all
Defined in:
lib/jay_api/elasticsearch/query_builder/query_clauses/ids.rb

Overview

Represents an IDs query in Elasticsearch. Information about this type of query can be found here: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-ids-query

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ids:) ⇒ IDs

Returns a new instance of IDs.

Parameters:

  • ids (Array<String>)

    The ids of the documents to match.



16
17
18
19
20
# File 'lib/jay_api/elasticsearch/query_builder/query_clauses/ids.rb', line 16

def initialize(ids:)
  super()

  @ids = ids
end

Instance Attribute Details

#idsObject (readonly)

Returns the value of attribute ids.



13
14
15
# File 'lib/jay_api/elasticsearch/query_builder/query_clauses/ids.rb', line 13

def ids
  @ids
end

Instance Method Details

#to_hHash

Returns The Hash that represents this query (in Elasticsearch's DSL).

Returns:

  • (Hash)

    The Hash that represents this query (in Elasticsearch's DSL)



24
25
26
27
28
29
30
# File 'lib/jay_api/elasticsearch/query_builder/query_clauses/ids.rb', line 24

def to_h
  {
    ids: {
      values: ids
    }
  }
end