# Limit parameter change results of near\_vector query

**URL:** https://forum.weaviate.io/t/limit-parameter-change-results-of-near-vector-query/7458
**Category:** Support
**Created:** [November 5, 2024, 3:04pm UTC](https://forum.weaviate.io/t/limit-parameter-change-results-of-near-vector-query/7458 "2024-11-05T15:04:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![accorrea1-stf](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/accorrea1-stf/32/2812_2.png) [@accorrea1-stf](https://forum.weaviate.io/u/accorrea1-stf)
#### Post date: [November 5, 2024, 3:04pm UTC](https://forum.weaviate.io/t/limit-parameter-change-results-of-near-vector-query/7458/1 "2024-11-05T15:04:14Z")

</div>

### Description

I’m geting an unexpected result running a near\_vector search on my Weaviate database.

The database contains 570 objects.

Running a near vector query, using limit 3, I receive 3 wrong objects, the lowest distance being 0.6878337.

Running the exact same query without the limit parameter, the result is 100 objects, and the lowest distance is 0.5604408.

It seem’s that the query does not search on the full database. Is this the behavior of the limit parameter? Even without it, we can expect the query to use all the nodes or the 100 internal limit can also be an issue?

### Server Setup Information

- Weaviate Server Version: 1.24.9 deployed, on my dev machine I can reproduce the issue on versions 1.23.16, 1.24.26, 1.25.24, 1.26.8 and 1.27.1
- Deployment Method: docker
- Client Language and Version: python client 4.7.1 and direct graphQL query using the REST API
- Multitenancy?: no

---

<div class="post-metadata">

### Author: ![Shahin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/shahin/32/7944_2.png) [@Shahin](https://forum.weaviate.io/u/Shahin)
#### Post date: [November 5, 2024, 4:28pm UTC](https://forum.weaviate.io/t/limit-parameter-change-results-of-near-vector-query/7458/2 "2024-11-05T16:28:26Z")

</div>

🤗 @accorrea1-stf,

Welcome to our community! It’s great to have you here.

I wonder about the HNSW configuration in your cluster. Have you explored the ef operator? A higher ef value results in a more extensive search, enhancing accuracy.

> **[Vector Indexing | Weaviate](https://weaviate.io/developers/weaviate/concepts/vector-index#managing-search-quality-vs-speed-tradeoffs)**
>
> Vector indexing is a key component of vector databases. It can help to significantly increase the speed of the search process of similarity search with only a minimal tradeoff in search accuracy (HNSW index), or efficiently store many subsets of data...

By increasing the **ef** value, you improve the accuracy of your searches. I would suggest trying out a few fixed values such as 100, 250, 500, and 1000. My hope is that by setting it to one of these higher values, you will achieve more consistent results, as the graph for the vector index will be explored more exhaustively.

Here’s some code to help you achieve this:

```auto
from weaviate.classes.config import Reconfigure

collection.config.update(

vector_index_config=Reconfigure().VectorIndex.hnsw(ef=512)

)

```

Best regards,  
Mohamed Shahin  
Weaviate Support

---

<div class="post-metadata">

### Author: ![accorrea1-stf](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/accorrea1-stf/32/2812_2.png) [@accorrea1-stf](https://forum.weaviate.io/u/accorrea1-stf)
#### Post date: [November 5, 2024, 5:34pm UTC](https://forum.weaviate.io/t/limit-parameter-change-results-of-near-vector-query/7458/3 "2024-11-05T17:34:08Z")

</div>

Thank you for your answer Mohamed!

I’m going to do some tests increasing the ef value.

Our current config is:

```auto
{'cleanupIntervalSeconds': 300,
  'distanceMetric': 'cosine',
  'dynamicEfMin': 100,
  'dynamicEfMax': 500,
  'dynamicEfFactor': 8,
  'ef': -1,
  'efConstruction': 128,
  'filterStrategy': 'sweeping',
  'flatSearchCutoff': 40000,
  'maxConnections': 64,
  'skip': False,
  'vectorCacheMaxObjects': 1000000000000}

```

---

<div class="post-metadata">

### Author: ![Shahin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/shahin/32/7944_2.png) [@Shahin](https://forum.weaviate.io/u/Shahin)
#### Post date: [November 6, 2024, 8:42am UTC](https://forum.weaviate.io/t/limit-parameter-change-results-of-near-vector-query/7458/4 "2024-11-06T08:42:10Z")

</div>

@accorrea1-stf Awesome, let me know how it goes.
