# Knn\_vectors field understanding

**URL:** <https://discuss.elastic.co/t/knn-vectors-field-understanding/374923>\
**Category:** Elasticsearch\
**Tags:** vector-search\
**Created:** [February 24, 2025, 7:01am UTC](https://discuss.elastic.co/t/knn-vectors-field-understanding/374923 "2025-02-24T07:01:02Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![yli](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yli](https://discuss.elastic.co/u/yli)\
**Post date:** [February 26, 2025, 9:58pm UTC](https://discuss.elastic.co/t/knn-vectors-field-understanding/374923/21 "2025-02-26T21:58:15Z")

</div>

@RainTown , thanks a lot for sharing your thoughts and tests, I really appreciate it.

---

<div class="post-metadata">

**Author:** ![yli](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yli](https://discuss.elastic.co/u/yli)\
**Post date:** [March 6, 2025, 3:49pm UTC](https://discuss.elastic.co/t/knn-vectors-field-understanding/374923/22 "2025-03-06T15:49:04Z")

</div>

Hi @RainTown and @john-wagster, suppose that we will use synthetic source for dense vector field, may I ask whether you know the difference between the raw vectors obtained via for example the following query

```json
POST https://127.0.0.1:9200/file_flat_1024_exclude_vec_3/_search
{
     "size": 5,
     "_source": false,
     "script_fields": {
       "raw_vector": {
         "script": {
           "source": "doc['file_section_embedding'].vectorValue"
        }
      }
    },
    "query": {
      "match_all": {}
     }
 }

```

and the vector values that we would obtained from synthetic source? Thanks a lot.

---

<div class="post-metadata">

**Author:** ![john-wagster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john-wagster/32/139021_2.png) [@john-wagster](https://discuss.elastic.co/u/john-wagster)\
**Post date:** [March 6, 2025, 4:23pm UTC](https://discuss.elastic.co/t/knn-vectors-field-understanding/374923/23 "2025-03-06T16:23:50Z")

</div>

> and the vector values that we would obtained from synthetic source? Thanks a lot.

I would expect that `vectorValue` and the stored synthetic source value are the same (should be I haven't tried it myself). But here's my reasoning. If you use synthetic source essentially what happens is we drill down into Lucene and retrieve the `float[]` that's used for comparisons while satisfying the query itself. (Here's the original PR that I went and took a look at to verify that behavior: [Synthetic \_source: support dense\_vector by nik9000 · Pull Request #89840 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/pull/89840/files))

My apologies I wasn't tracking some of the follow up but happy to talk through synthetic source more if it would help. I definitely think disabling `_source` will greatly reduce the disk foot print and then synthetic source is backed by the Lucene copy that you have to store anyway so it's not the original request vectors exactly (which is a string) but it will be close (the reason it's close and not exact has to do with floating point precision as it's stored a a `float[]` on disk in Lucene; as in an equals comparison would potentially fail but I would expect all vector operations will be identical).

---

<div class="post-metadata">

**Author:** ![yli](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yli](https://discuss.elastic.co/u/yli)\
**Post date:** [March 6, 2025, 11:13pm UTC](https://discuss.elastic.co/t/knn-vectors-field-understanding/374923/24 "2025-03-06T23:13:04Z")

</div>

Hi @john-wagster , thanks a lot for sharing. I will reach out if we would go with the synthetic source approach.

[Previous page](https://discuss.elastic.co/t/knn-vectors-field-understanding/374923.md?page=1)
