# KNN search no result

**URL:** https://discuss.elastic.co/t/knn-search-no-result/364460
**Category:** Elasticsearch
**Tags:** vector-search
**Created:** [August 6, 2024, 9:57am UTC](https://discuss.elastic.co/t/knn-search-no-result/364460 "2024-08-06T09:57:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![FFFro](https://avatars.discourse-cdn.com/v4/letter/f/8c91f0/32.png) [@FFFro](https://discuss.elastic.co/u/FFFro)
#### Post date: [August 6, 2024, 9:57am UTC](https://discuss.elastic.co/t/knn-search-no-result/364460/1 "2024-08-06T09:57:13Z")

</div>

ES 8.8  
When I write data for a period of time, using knn search results can not be found, but can use term search results; At this time, I put this part of the data to update\_by\_query, and then use the same knn search, there are results, do not know what is the cause;  
knn search

```auto
GET my_index/_search?routing=xxxx
{
  "knn": {
    "field": "text_vector",
    "query_vector": [xxxxx],
    "k": 10,
    "num_candidates": 100,
    "filter": {
      "terms": {
        "code": [
          "xxxx"
        ]
      }
    }
  },
  "_source": {
    "excludes": "text_vector"
  }
}

```

term search

```auto
{
  "query": {
    "term": {
      "code": {
        "value": "xxx"
      }
    }
  }
}

```

update\_by\_query

```auto
POST my_index/_update_by_query?routing=xxx&refresh=true
{
  "query": {
    "term": {
      "code": {
        "value": "xxx"
      }
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [August 6, 2024, 10:49am UTC](https://discuss.elastic.co/t/knn-search-no-result/364460/2 "2024-08-06T10:49:03Z")

</div>

Given that vector search is an area moving quite quickly I would recommend upgrading to the latest version and see if you still see the same issue.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [August 6, 2024, 11:06am UTC](https://discuss.elastic.co/t/knn-search-no-result/364460/3 "2024-08-06T11:06:03Z")

</div>

In addition to @Christian_Dahlqvist 's suggestion, I'd try without the `routing` key to see if this makes any difference.

And once you have upgraded, if you can reproduce this with a minimal sample script, that'd be helpful to understand what's going on here.
