Document

Delete Document(s) by Request Object

Changed on

Delete document by document_id, by array of document_id (bulk), by query (SearchRequestObject) from index with index_id, or clear all documents from index. Immediately effective, independent of commit. Index space used by deleted documents is not reclaimed (until compaction is implemented), but result_count_total is updated. By manually deleting the delete.bin file the deleted documents can be recovered (until compaction). Deleted documents impact performance, especially but not limited to counting (Count, TopKCount). They also increase the size of the index (until compaction is implemented). For minimal query latency delete index and reindexing documents is preferred over deleting documents (until compaction is implemented). BM25 scores are not updated (until compaction is implemented), but the impact is minimal. Document ID can by obtained by search. When deleting by query (SearchRequestObject), it is advised to perform a dry run search first, to see which documents will be deleted.

delete/api/v1/index/{index_id}/doc

Request

Path parameters

index_idinteger required

index id

Headers

apikeystring required

YOUR_SECRET_API_KEY

Request body

query_stringstring

Query string, search operators + - "" are recognized.

enable_empty_queryboolean

Enable empty query: if true, an empty query string iterates through all indexed documents, supporting the query parameters: offset, length, query_facets, facet_filter, result_sort, otherwise an empty query string returns no results. Typical use cases include index browsing, index export, conversion, analytics, audits, and inspection.

offsetinteger

Offset of search results to return.

lengthinteger

Number of search results to return. With length=0, resultType::TopkCount will be automatically downgraded to resultType::Count, returning the number of results only, without returning the results itself.

result_type'Count' | 'Topk' | 'TopkCount'

The following result types are supported:

  • Count (count all results that match the query, but returning top-k results is not required)
  • Topk (returns the top-k results per query, but counting all results that match the query is not required)
  • TopkCount (returns the top-k results per query + count all results that match the query)
include_uncommittedboolean

True real-time search: include indexed, but uncommitted documents into search results.

field_filterstring[]

Specify field names where to search at query time, whereas SchemaField.indexed is set at index time. If empty then all indexed fields are searched. Field filters are active during vector and lexical search.

query_type_default'Union' | 'Intersection' | 'Phrase' | 'Not'

Specifies the default QueryType: The following query types are supported:

  • Union (OR, disjunction),
  • Intersection (AND, conjunction),
  • Phrase (""),
  • Not (-).

The default QueryType is superseded if the query parser detects that a different query type is specified within the query string (+ - "").

Example request

{
  "length": 10,
  "field_filter": [
    "title"
  ],
  "result_sort": [
    {
      "field": "date",
      "order": "Ascending",
      "base": "None"
    }
  ]
}

Response

Document deleted, returns indexed documents count

Changes

    • breaking

      removed subschema #2 subschema #3 subschema #4 from the request property oneOf list

    • warning

      removed the request property

    • warning

      removed the request property

    • warning

      removed the request property

    • warning

      removed the request property

    • warning

      removed the request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      the request property // became optional

    • info

      the request property default value was added

    • info

      the request property default value was added

    • info

      the request property default value was added

    • info

      the request property default value SearchOnly was added

    • info

      the request property default value Union was added

    • info

      the request property default value was added

    • info

      the request property default value TopkCount was added

    • info

      the request property default value Lexical was added

    • info

      added subschema #2 to the request property oneOf list

    • info

      added subschema #2 subschema #3 subschema #4 to the request property oneOf list

    • info

      api operation id delete_document_by_object_api removed and replaced with delete_document_by_request_object