Class: Misc::TermsLookup

Inherits:
Object
  • Object
show all
Includes:
AttributesReader
Defined in:
lib/misc/terms_lookup.rb

Overview

Terms lookup fetches the field values of an existing document. Elasticsearch then uses those values as search terms. This can be helpful when searching for a large set of terms. Because terms lookup fetches values from a document, the _source mapping field must be enabled to use terms lookup. The _source field is enabled by default.

Instance Method Summary collapse

Methods included from AttributesReader

#attributes

Constructor Details

#initialize(index:, id:, path:) ⇒ TermsLookup

Returns a new instance of TermsLookup.



15
16
17
18
19
# File 'lib/misc/terms_lookup.rb', line 15

def initialize(index:, id:, path:)
  @index = index
  @id = id
  @path = path
end

Instance Method Details

#settingsHash

Returns serialized json query for the object.

Returns:

  • (Hash)

    serialized json query for the object



22
23
24
25
26
27
28
# File 'lib/misc/terms_lookup.rb', line 22

def settings
  settings = {}
  settings[:index] = @index.intern
  settings[:id] = @id.intern
  settings[:path] = @path.intern
  settings
end