Method: MeiliSearch::Index#delete_documents
- Defined in:
- lib/meilisearch/index.rb
#delete_documents(options = {}) ⇒ Object Also known as: delete_multiple_documents
Public: Delete documents from an index
options: A Hash or an Array containing documents_ids or a hash with filter:.
filter: - A hash containing a filter that should match documents.
Available ONLY with Meilisearch v1.2 and newer (optional)
Returns a Task object.
179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/meilisearch/index.rb', line 179 def delete_documents( = {}) Utils.version_error_handler(__method__) do if .is_a?(Hash) && .key?(:filter) http_post "/indexes/#{@uid}/documents/delete", else # backwards compatibility: # expect to be a array or/number/string to send alongside as documents_ids. = [] unless .is_a?(Array) http_post "/indexes/#{@uid}/documents/delete-batch", end end end |