algoliasearch/src/main/java/com/algolia/search/saas/Index.java
@Deprecated
    public void deleteByQuery(@NonNull Query query, @Nullable RequestOptions requestOptions) throws AlgoliaException {
        try {
            boolean hasMore;
            do {
                // Browse index for the next batch of objects.
                // WARNING: Since deletion invalidates cursors, we always browse from the start.
                List<String> objectIDs = new ArrayList<>(1000);
                JSONObject content = browse(query, requestOptions);
                JSONArray hits = content.getJSONArray("hits");
                for (int i = 0; i < hits.length(); ++i) {
                    JSONObject hit = hits.getJSONObject(i);
                    objectIDs.add(hit.getString("objectID"));
                }
                hasMore = content.optString("cursor", null) != null;

                // Delete objects.
                JSONObject task = this.deleteObjects(objectIDs, /* requestOptions: */ null);
                this.waitTask(task.getString("taskID"));
            }
            while (hasMore);
        } catch (JSONException e) {
            throw new AlgoliaException(e.getMessage());
        }
    }
@Deprecated
    public void deleteByQuery(@NonNull Query query, @Nullable RequestOptions requestOptions) throws AlgoliaException {
        try {
            boolean hasMore;
            do {
                // Browse index for the next batch of objects.
                // WARNING: Since deletion invalidates cursors, we always browse from the start.
                List<String> objectIDs = new ArrayList<>(1000);
                JSONObject content = browse(query, requestOptions);
                JSONArray hits = content.getJSONArray("hits");
                for (int i = 0; i < hits.length(); ++i) {
                    JSONObject hit = hits.getJSONObject(i);
                    objectIDs.add(hit.getString("objectID"));
                }
                hasMore = content.optString("cursor", null) != null;

                // Delete objects.
                JSONObject task = this.deleteObjects(objectIDs, /* requestOptions: */ null);
                this.waitTask(task.getString("taskID"));
            }
            while (hasMore);
        } catch (JSONException e) {
            throw new AlgoliaException(e.getMessage());
        }
    }
Deletes all objects matching a query using browse and deleteObjects.

@param query          the query string
@param requestOptions Request-specific options.
@throws AlgoliaException
@deprecated use {@link Index#deleteBy(Query)} instead.