Is there a way to remove “dead” records from a col...
# community-help
j
Is there a way to remove “dead” records from a collection without having to restart the Typesense service? Example, when searching for this url, there are 234 “Found” but no hits are returned. There should be 1 record per url:
Copy code
search_parameters = {
            "q": "*",
            "query_by": "url",
            "filter_by": "url:=<http://tuckerco.com|tuckerco.com>",
            "num_typos": 0,
            "drop_tokens_threshold": 0,
        }

results = ts.collections["collection"].documents.search(search_parameters)
Output:
Copy code
{'facet_counts': [],
 'found': 234,
 'hits': [],
 'out_of': 7982751,
 'page': 1,
 'request_params': {'collection_name': 'collection',
  'first_q': '*',
  'per_page': 10,
  'q': '*'},
 'search_cutoff': False,
 'search_time_ms': 13}
f
You can delete documents either one-by-one, or using a filter. Here's some documentation: https://typesense.org/docs/29.0/api/documents.html#delete-documents
j
Thansk Fanis! How can this be prevented in the future, is this normal behavior?
f
If you don't delete a document, they will stay on the collection. Did you still get those documents in the response after deleting them?