# Access field that was excluded from \_source

**URL:** https://discuss.elastic.co/t/access-field-that-was-excluded-from-source/363329
**Category:** Elasticsearch
**Tags:** vector-search
**Created:** [July 18, 2024, 7:57am UTC](https://discuss.elastic.co/t/access-field-that-was-excluded-from-source/363329 "2024-07-18T07:57:11Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discuss.elastic.co/u/Chenko)
#### Post date: [July 18, 2024, 7:57am UTC](https://discuss.elastic.co/t/access-field-that-was-excluded-from-source/363329/1 "2024-07-18T07:57:11Z")

</div>

Hi,

As mentioned in the title, I have an index with a few fields that are not included in the `_source` field.

I was wondering, since we can still search on these fields, is there a way to access their values?

One solution I explored was adding the `store` mapping property, but this does not seem to work with `dense_vector` fields.

However, since we can still search on these fields using a normal query or on vector fields using a `knn` query, is there a method to retrieve the values of these fields?

Kind regards,  
Chenko Mortier

---

<div class="post-metadata">

### Author: ![Kathleen\_DeRusso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kathleen_derusso/32/132039_2.png) [@Kathleen\_DeRusso](https://discuss.elastic.co/u/Kathleen_DeRusso)
#### Post date: [July 18, 2024, 12:27pm UTC](https://discuss.elastic.co/t/access-field-that-was-excluded-from-source/363329/2 "2024-07-18T12:27:01Z")

</div>

Hi there @Chenko!

No, unfortunately if you do not include fields in `_source` it saves space by not storing it in a way that is retrievable. This impacts using the `update`, `update_by_query` and `reindex` APIs as well as highlighting as a result.

It's searchable because it's still part of the inverted index.

A recommended solution is to keep content in source but use [source filtering](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.html#source-filtering) instead.

You could also look at [synthetic source](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html#synthetic-source) however note that this is in tech preview for `dense_vector` fields.

---

<div class="post-metadata">

### Author: ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discuss.elastic.co/u/Chenko)
#### Post date: [July 18, 2024, 12:44pm UTC](https://discuss.elastic.co/t/access-field-that-was-excluded-from-source/363329/3 "2024-07-18T12:44:20Z")

</div>

Hi @Kathleen_DeRusso thanks for your reply!

> [@Kathleen\_DeRusso](#):
>
> No, unfortunately if you do not include fields in `_source` it saves space by not storing it in a way that is retrievable. This impacts using the `update`, `update_by_query` and `reindex` APIs as well as highlighting as a result.

That is unfortunate.

> [@Kathleen\_DeRusso](#):
>
> It's searchable because it's still part of the inverted index.

That's what I was afraid of.

> [@Kathleen\_DeRusso](#):
>
> A recommended solution is to keep content in source but use [source filtering](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.html#source-filtering) instead.

I thought this would not improve performance, will this still improve performance?  
For example when excluding the KNN field at search time, will this have better performance than not doing this, also how does this compare to excluding it at ingest time?

> [@Kathleen\_DeRusso](#):
>
> You could also look at [synthetic source](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html#synthetic-source) however note that this is in tech preview for `dense_vector` fields.

I will take a look at synthetic source, thanks for this suggestion!

---

<div class="post-metadata">

### Author: ![Kathleen\_DeRusso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kathleen_derusso/32/132039_2.png) [@Kathleen\_DeRusso](https://discuss.elastic.co/u/Kathleen_DeRusso)
#### Post date: [July 18, 2024, 12:56pm UTC](https://discuss.elastic.co/t/access-field-that-was-excluded-from-source/363329/4 "2024-07-18T12:56:08Z")

</div>

> [@Chenko](#):
>
> I thought this would not improve performance, will this still improve performance?  
> For example when excluding the KNN field at search time, will this have better performance than not doing this, also how does this compare to excluding it at ingest time?

Correct, this will not improve performance as the documents are still in `_source`

---

<div class="post-metadata">

### Author: ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discuss.elastic.co/u/Chenko)
#### Post date: [July 18, 2024, 1:00pm UTC](https://discuss.elastic.co/t/access-field-that-was-excluded-from-source/363329/5 "2024-07-18T13:00:58Z")

</div>

> [@Kathleen\_DeRusso](#):
>
> Correct, this will not improve performance as the documents are still in `_source`

Ah okay, makes sense. Thanks.

About the synthetic source, would this improve performance, or make it slower?  
I seem to read it makes it slower, or am I misunderstanding this?

---

<div class="post-metadata">

### Author: ![Kathleen\_DeRusso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kathleen_derusso/32/132039_2.png) [@Kathleen\_DeRusso](https://discuss.elastic.co/u/Kathleen_DeRusso)
#### Post date: [July 18, 2024, 2:07pm UTC](https://discuss.elastic.co/t/access-field-that-was-excluded-from-source/363329/6 "2024-07-18T14:07:47Z")

</div>

Correct - it's more of a space saving optimization.

---

<div class="post-metadata">

### Author: ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discuss.elastic.co/u/Chenko)
#### Post date: [July 18, 2024, 2:17pm UTC](https://discuss.elastic.co/t/access-field-that-was-excluded-from-source/363329/7 "2024-07-18T14:17:50Z")

</div>

Okay thanks for the additional help.
