Class: Dina::Search

Inherits:
BaseSearch show all
Defined in:
lib/dina/search/search.rb

Class Method Summary collapse

Methods inherited from BaseSearch

endpoint, index_name

Class Method Details

.endpoint_pathObject



6
7
8
# File 'lib/dina/search/search.rb', line 6

def self.endpoint_path
  "search-api/search-ws/search"
end

.execute(index:, payload: { query: { match_all: {} } }) ⇒ Hash

Executes a search

> { query: { match_all: {} }

Parameters:

  • index (String)

    the index, accepted value is one of “agent”, “material_sample”, “object_store”

  • payload (Hash) (defaults to: { query: { match_all: {} } })

    the payload hash as an Elasticsearch-formatted body

Returns:

  • (Hash)

    the search result with symbolized keys



17
18
19
20
21
22
# File 'lib/dina/search/search.rb', line 17

def self.execute(index:, payload: { query: { match_all: {} } })
  params = {
    indexName: index_name(index: index)
  }
  super(params.compact, method: :post, payload: payload)[:hits]
end