Module: ElasticsearchHermes::Indexing::Model

Defined in:
lib/elasticsearch_hermes/indexing/model.rb

Instance Method Summary collapse

Instance Method Details

#elastic_update(type: '_doc', index_name: self.class.to_s.underscore, id:, body:) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/elasticsearch_hermes/indexing/model.rb', line 6

def elastic_update(type: '_doc', index_name: self.class.to_s.underscore, id:, body:)
  ElasticsearchHermes.client.index index_payload(
    index_name: index_name,
    type: type,
    body: body,
    id: id
  )
end

#index_payload(index_name:, type:, id:, body:) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/elasticsearch_hermes/indexing/model.rb', line 15

def index_payload(index_name:, type:, id:, body:)
  {
    type: type,
    index: index_name,
    id: id,
    body: body
  }
end