Method: IndexTank::Index#bulk_delete

Defined in:
lib/indextank/index.rb

#bulk_delete(docids) ⇒ Object



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/indextank/index.rb', line 109

def bulk_delete(docids)
  data = []
  docids.each do |docid|
    data << {'docid' => docid}
  end
  resp = @conn.delete do |req|
    req.url "docs"
    req.body = data.to_json
  end
  case resp.status
  when 200
    resp.body
  when 401
    raise InvalidApiKey
  when 409
    raise IndexInitializing
  when 404
    raise NonExistentIndex
  when 400
    raise InvalidArgument, resp.body
  else
    raise UnexpectedHTTPException, resp.body
  end
end