# Determine if a query response was cut off

**URL:** https://forum.weaviate.io/t/determine-if-a-query-response-was-cut-off/4518
**Category:** Support
**Created:** [October 10, 2024, 2:04am UTC](https://forum.weaviate.io/t/determine-if-a-query-response-was-cut-off/4518 "2024-10-10T02:04:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![elias.gabriel](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@elias.gabriel](https://forum.weaviate.io/u/elias.gabriel)
#### Post date: [October 10, 2024, 2:04am UTC](https://forum.weaviate.io/t/determine-if-a-query-response-was-cut-off/4518/1 "2024-10-10T02:04:46Z")

</div>

### Description

I see that there’s a limit on the number of results that can be returned by a query - on K8 deployments, looks like that [limit is 100 by default](https://github.com/weaviate/weaviate-helm/blob/v17.2.1/weaviate/values.yaml#L267-L268).

The default behavior is just to cut off the response at that limit; regardless of whether or not there could be more results.

Is there a way to tell if a query response was cut off? otherwise it seems really difficult to diagnose problems where returned results don’t meet expectations (or worse, things fly under the radar) — i say that having not known about the limit, encountering problems with missing response data, and spending a while trying to figure out what’s going on

In any case, a documentation update would also be useful to explain the behavior.

### Server Setup Information

- Weaviate Server Version: 1.26.1
- Deployment Method: k8s
- Multi Node? Number of Running Nodes: 3
- Client Language and Version: Python 3, latest
- Multitenancy?: No

---

<div class="post-metadata">

### Author: ![elias.gabriel](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@elias.gabriel](https://forum.weaviate.io/u/elias.gabriel)
#### Post date: [October 15, 2024, 8:06pm UTC](https://forum.weaviate.io/t/determine-if-a-query-response-was-cut-off/4518/2 "2024-10-15T20:06:23Z")

</div>

Just want to bump this, in case there is something obvious I’m missing.

---

<div class="post-metadata">

### Author: ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)
#### Post date: [October 15, 2024, 9:20pm UTC](https://forum.weaviate.io/t/determine-if-a-query-response-was-cut-off/4518/3 "2024-10-15T21:20:50Z")

</div>

hi @elias.gabriel !!

Sorry for the delay here, had some vacation last weeks ⛰ 🏖

I am not sure yet what that 100 limit is about, but it definitely isn’t a Weaviate configuration. Probably a K8s one. Could not find much info about it, TBH.

Here is where you define the `QUERY_MAXIMUM_RESULTS`:

> <https://github.com/weaviate/weaviate-helm/blob/9f03c480efb75e40e0b302fb185a6bb8501ccfca/weaviate/values.yaml#L325>

The outcut will only jump in if you explicitly call it.

[Here we have a nice explanation about it](https://weaviate.io/blog/weaviate-1-20-release#autocut)

Now, let’s see it in action!

consider this code:

```python
client.collections.delete("Test")
collection = client.collections.create(
    name="Test",
    vectorizer_config=wvc.config.Configure.Vectorizer.text2vec_openai(),
)

collection.data.insert_many([
    {"text": "something about dogs"},
    {"text": "something about cats"},
    {"text": "something about houses"},
    {"text": "something about commercial buildings"},

])

```

Now, if I do a query, without outcut, I get everything:

```python
results = collection.query.near_text(
    query="animals",
    # auto_limit=2,
    return_metadata=wvc.query.MetadataQuery(distance=True)
)
for i in results.objects:
    print("###")
    print(i.properties)
    print(i.metadata.distance)

```

the results:

> ### 
> 
> {‘text’: ‘something about dogs’}  
> 0.16042447090148926
> 
> ### 
> 
> {‘text’: ‘something about cats’}  
> 0.17177188396453857
> 
> ### 
> 
> {‘text’: ‘something about houses’}  
> 0.22456467151641846
> 
> ### 
> 
> {‘text’: ‘something about commercial buildings’}  
> 0.23881018161773682

If I now add auto\_limit=1, it will only bring the dogs and cats object. If set it to 2, it will bring me all objects.

Let me know if this clarifies.

Thanks!

---

<div class="post-metadata">

### Author: ![elias.gabriel](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@elias.gabriel](https://forum.weaviate.io/u/elias.gabriel)
#### Post date: [October 15, 2024, 11:24pm UTC](https://forum.weaviate.io/t/determine-if-a-query-response-was-cut-off/4518/4 "2024-10-15T23:24:06Z")

</div>

Hi @DudaNogueira,

I made a small example to clarify what I’m talking about:

> **[GitHub - thearchitector/code-snippets: Code snippets and reproductions for bug...](https://github.com/thearchitector/code-snippets/tree/main)**
>
> main

I span up a minikube cluster on my machine, and installed the latest weaviate helm chart using a really simple config and all the chart defaults (including the env variable you mention).

If you create a basic collection, then add 200 objects, then query for all those objects using the created uuids, it only returns 100 of them; there is no indication that the query response was incomplete.

---

<div class="post-metadata">

### Author: ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)
#### Post date: [October 16, 2024, 2:17am UTC](https://forum.weaviate.io/t/determine-if-a-query-response-was-cut-off/4518/5 "2024-10-16T02:17:44Z")

</div>

Oh, ok. Now I understand it! I was totally off, hehehe

That’s strange, as it only returned 44, if no limits are defined.

here simpler code to reproduce:

```python
client.collections.delete("Test")
collection = client.collections.create(
    name="Test",
    vectorizer_config=wvc.config.Configure.Vectorizer.none(),
)

response = collection.data.insert_many([{"index": i} for i in range(200)])
inserted_uids_count = len(response.uuids.values())

query = collection.query.fetch_objects(
            filters=wvc.query.Filter.by_id().contains_any(response.uuids.values()),
            # limit=200
        )
assert len(query.objects) == inserted_uids_count

```

however, if we specify a limit, it will work.

This smells like a bug to me. I have asked about this internally.

I’ll get back here when I get more info.

Thanks!

---

<div class="post-metadata">

### Author: ![elias.gabriel](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@elias.gabriel](https://forum.weaviate.io/u/elias.gabriel)
#### Post date: [October 16, 2024, 4:20am UTC](https://forum.weaviate.io/t/determine-if-a-query-response-was-cut-off/4518/6 "2024-10-16T04:20:04Z")

</div>

Huh, that’s interesting; your snippet only ever returns 100 for me, same as the one I provided, not 44; that seems like a bug in itself.

If I update the `query_defaults.limit` parameter in the chart values to 150, the query then returns 150, so that chart configuration (which looks like gets mounted to a YAML configuration and passed through to `weaviate --config-file`), is definitely responsible for the behavior.

You are right, though, in that if I explicitly pass a `limit` to the query then I get all 200 objects as expected; I guess that makes sense given that the config seems to imply its the “default limit for queries that don’t supply one.”

If that is indeed the behavior, then my original question is more like “is there a way to tell if a query hit the limit (default or provided) or not?”

Also I want to emphasize that I can’t actually reproduce this problem using a Docker Compose setup, even if I supply the helm-produced yaml config to weaviate via the same CLI argument. It’s only in K8 deployments. If the default limit thing is an intended feature, then the fact it doesn’t work on Docker depls seems like another bug?

---

<div class="post-metadata">

### Author: ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)
#### Post date: [October 16, 2024, 12:10pm UTC](https://forum.weaviate.io/t/determine-if-a-query-response-was-cut-off/4518/7 "2024-10-16T12:10:52Z")

</div>

Oh, by the way, my outcome was using a docker image.

Ah!!! just checked, silly me. hehehe

Because I have reused a docker-compose.yaml I have in my “lab” folder, I had `QUERY_DEFAULTS_LIMIT` set to 44… 🙈

So if I remove that property, the query will result by default in 10, which is consistent with [the doc here](https://weaviate.io/developers/weaviate/config-refs/env-vars)

So I query\_defaults is the same as QUERY\_DEFAULTS\_LIMIT.

Now if you know the QUERY\_DEFAULTS\_LIMIT, and your results is exactly that value, you probably have more objects
