# Slice dense vector contents?

**URL:** https://discuss.elastic.co/t/slice-dense-vector-contents/307972
**Category:** Elasticsearch
**Created:** [June 23, 2022, 9:18am UTC](https://discuss.elastic.co/t/slice-dense-vector-contents/307972 "2022-06-23T09:18:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lz-mn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lz-mn/32/77605_2.png) [@lz-mn](https://discuss.elastic.co/u/lz-mn)
#### Post date: [June 23, 2022, 9:18am UTC](https://discuss.elastic.co/t/slice-dense-vector-contents/307972/1 "2022-06-23T09:18:09Z")

</div>

Hi,

I have about a million documents indexed with a dense vector. I am trying to add a new field to each document with a slice of its vector, e.g. the first 700 elements only. What is the best way to do this please?

The reason is so I can use the ANN search functionality with the truncated vectors.

Thank you!

---

<div class="post-metadata">

### Author: ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)
#### Post date: [June 27, 2022, 8:15pm UTC](https://discuss.elastic.co/t/slice-dense-vector-contents/307972/2 "2022-06-27T20:15:43Z")

</div>

If you just going to use the new field in your searches, the best way is to create a new index with a new dense\_vector field, and index modified vectors into it. The modification you can do on your application side.

If you are going to use both fields: new and old, then you need to reindex the whole index. You can use [script](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-change-name) to modify the content of your vectors.

---

<div class="post-metadata">

### Author: ![lz-mn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lz-mn/32/77605_2.png) [@lz-mn](https://discuss.elastic.co/u/lz-mn)
#### Post date: [June 28, 2022, 8:39am UTC](https://discuss.elastic.co/t/slice-dense-vector-contents/307972/3 "2022-06-28T08:39:25Z")

</div>

Thank you Mayya!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 26, 2022, 8:40am UTC](https://discuss.elastic.co/t/slice-dense-vector-contents/307972/4 "2022-07-26T08:40:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
