Delete from Text Index

Deletes a document from the index.

The Delete from Text Index API removes content from a text index that you have created and indexed content into. You specify the document reference of the document that you want to delete, and the API removes it from the text index. After you delete a document, it is not available for use in other APIs such as Query Text Index.

Quick Start

Haven OnDemand finds the documents to delete by using the index reference value, which is stored in the reference field of each document. You can set the reference manually when you add documents by using the Add to Text Index API. If you do not manually specify a reference, Haven OnDemand adds one automatically. When you use the Query Text Index API, the response includes the reference for each result document.

Note: The index reference refers only to the reference fields in text indexes. It is not the same as the references obtained from object storing APIs such as the Store Object API.

You pass the document reference in the index_reference parameter. You must also provide the name of the text index that the document is contained in.


  "index": "myindex",
  "documents_deleted": 1

You can also delete multiple documents by sending multiple document references. For example:


  "index": "myindex",
  "documents_deleted": 2

For general information about Haven OnDemand unstructured text indexing, see Text Indexes - Key Concepts. You might also like to look at our beginner and advanced how tos: Introduction to Haven OnDemand Unstructured Text Indexing and Advanced Haven OnDemand Unstructured Text Indexing.


This API requires an authentication token to be supplied in the following parameter:

Parameter Description
apikey The API key to use to authenticate the API request.

This API accepts the following parameters:

Name Type Description
resource The index to delete the document from.
Name Type Description
boolean Set to true to delete all documents from the text index. Default value: false.
array<string> The references for a document in the Haven OnDemand database that you want to delete.

This API returns a JSON response that is described by the model below. This single model is presented both as an easy to read abstract definition and as the formal JSON schema.

Asynchronous Use

Additional requests are required to get the result if this API is invoked asynchronously.

You can use /1/job/status/<job-id> to get the status of the job, including results if the job is finished.

You can also use /1/job/result/<job-id>, which waits until the job has finished and then returns the result.

This is an abstract definition of the response that describes each of the properties that might be returned.
Delete From Text Index Response {
documents_deleted ( integer ) The number of deleted documents.
index ( string ) The index the document was deleted from.
Model Schema
This is a JSON schema that describes the syntax of the response. See for a complete reference.
    "properties": {
        "documents_deleted": {
            "type": "integer"
        "index": {
            "type": "string"
    "required": [
    "type": "object"

If you would like to provide us with more information then please use the box below:

We will use your submission to help improve our product.