Module: Elasticord::ORM::Delete

Defined in:
lib/elasticord/orm/delete.rb

Class Method Summary collapse

Class Method Details

.all(index) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/elasticord/orm/delete.rb', line 14

def all(index)
  begin
    Elasticord.client.indices.delete index: index
  rescue Elasticsearch::Transport::Transport::Errors::NotFound
    return true
  end
end

.by_query(index, type, attributes = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/elasticord/orm/delete.rb', line 6

def by_query(index, type, attributes = {})
  params = { index: index, body: attributes }

  params[:type] = type unless type == '_all'

  Elasticord.client.delete_by_query params
end