Delete API

This API is deprecated, please refer to the new RESTFul API instead.


This API deletes documents from the index by specifying a query.

The deleted documents cannot be recovered. Please make sure that you have a backup before performing the deletion.


  • use (required): The name of the index.
  • login (optional): The login parameter. This becomes required once you create a user.
  • key (optional): The key parameter related to the login (api key). This becomes required once you create a user.
  • q: The query used to identify which documents will be deleted.
  • uniq: This parameter is used for deleting the documents by primary key.


Delete all the documents from an OpenSearchServer index:


Delete documents matching a specific primary key:


Delete documents associated with a specific host from the index:


Delete a specific url from the index:



$delete = new OssDelete('http://localhost:9090', 'index1');
$result = $delete->delete('');

HTTP response

The following indicates that 14 documents have been deleted from the index:

    <entry key="Status">OK</entry>
    <entry key="Deleted">14</entry>

View/edit on GitHub

comments powered by Disqus