To achieve your goal you can use the following:
POST: https:{SOLRENDPOINT}/solr/{corename}/update/json?commit=true
Headers:
Authorization: Bearer {token}
In the request body, you would use the Solr delete command to specify the query for removing documents from the index. In this case, you can use a range query to specify the date range for deleting the documents.
Body
{
"delete": {
"query": {query for remove} e.g. "rel_date:[2022-01-01T00:00:00Z TO 2022-07-29T00:00:00Z]"
}
}
This query will remove all documents from the index that have a rel_date field within the specified date range.
Note that after sending the delete request, you will need to perform a commit operation to ensure that the index is updated. This can be done by adding the commit=true
parameter to the request URL or by sending a separate commit request to Solr.