> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bigdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve limited chunks

The `search.run()` method accepts the parameter \[limit] to
control the amount of data to retrieve from bigdata. By default,
\[limit] specifies the number of desired documents to
download, and the logic will send multiple requests to bigdata to gather
all those documents, but it is not possible to control the amount of
retrieved chunks or usage. (See [monitor\_usage](./monitor_usage))

In some use cases, customers want to specify the number of requested
chunks to control usage. For instance, the following code requests only
`100` chunks and if it returns all requested `100` chunks, it will consume
`10` API query unit.

```python theme={null}
from bigdata_client import Bigdata
from bigdata_client.query import Similarity
from bigdata_client.search import ChunkLimit

bigdata = Bigdata()
search = bigdata.search.new(query=Similarity("AI in finance"))

documents = search.run(ChunkLimit(100))

chunk_count = 0
for doc in documents:
    chunk_count += len(doc.chunks)
    if doc.cluster:
        chunk_count += sum([len(docs.chunks) for docs in doc.cluster])

print(f"Retrieved chunks count: {chunk_count}")
print(f"Note: Ten retrieved chunks consume one API Query Unit")
print(f"Usage (In API Query Units): {search.get_usage()}")
```

Output:

```text theme={null}
Retrieved chunks count: 85
Note: Ten retrieved chunks consume one API Query Unit
Usage (In API Query Units): 8
```

<Note>
  The response might contain a smaller number of chunks due to discarding
  duplicates.
</Note>
