Module: ElasticsearchHermes::Indexing

Defined in:
lib/elasticsearch_hermes/indexing.rb

Instance Method Summary collapse

Instance Method Details

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



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

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



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

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