How do limits work?

A question just popped into my mind based upon this post: Maximum search limit of 10000 results has been reached - #2 by DudaNogueira

In particular, this statement:

So when performing searches or deletions, there are upper limits set to prevent excessive memory usage and long-running requests, which could lead to out-of-memory errors or other performance issues. For example, when deleting objects with a batch delete operation, Weaviate imposes a default limit of 10,000 objects that can be deleted in a single query to protect against unexpected memory surges.

Right now, this is my query example:

		$query = '
		{
		  Get {
			' . $className . ' (
			  limit: ' . $this->limit . '
			  nearText: {
				concepts: ["' . $concept . '"],
				distance: ' . $this->distance . '
			  }
			  where: {

So, I am performing cosine similarity searches, and instructing the system to only return the limit number of highest responses.

So far, so good. But, suppose there are 20,000 embed objects in my data store? Does that rule above mean that each query is only going to search through the first 10,000 of the index of these embeddings? If so, wouldn’t that exclude 1/2 of my dataset from ever being searched?

Just want to make sure I understand how this works.

Hi! Sorry for the delay here.

AFAIK, or understand, this option will limit how “far” it will calculate the distance for the 10k nearest objects on that query.

After that amount of objects, you should be far away already from your query that doesn’t make sense to calculate the cosine distance.

So it’s not that you will miss the other haf of your objects. It means they are 10,000 positions away from the nearest objects of your query.

so when you say “the first 10,000 of the index” those 10.000 are already the closest ones from your query.

Let me know if this makes it clearer :slight_smile:

1 Like

Yes it does. Thank you!