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.

/1/api/[async|sync]/deletefromtextindex/v1?index=myindex&index_reference=myfile.doc

{
  "index": "myindex",
  "documents_deleted": 1
}

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

/1/api/[async|sync]/deletefromtextindex/v1?index=myindex&index_reference=myfile.doc&index_reference=myotherfile.doc

{
  "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.

Synchronous
https://api.havenondemand.com/1/api/sync/deletefromtextindex/v1
Asynchronous
https://api.havenondemand.com/1/api/async/deletefromtextindex/v1
Authentication

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.
Parameters

This API accepts the following parameters:

Required
Name Type Description
index
resource The index to delete the document from.
Optional
Name Type Description
delete_all_documents
boolean Set to true to delete all documents from the text index. Default value: false.
index_reference
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.

Model
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 json-schema.org for a complete reference.
{
    "properties": {
        "documents_deleted": {
            "type": "integer"
        },
        "index": {
            "type": "string"
        }
    },
    "required": [
        "index",
        "documents_deleted"
    ],
    "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.