# What is the best way to change the dims for a dense\_vector in an index?

**URL:** https://discuss.elastic.co/t/what-is-the-best-way-to-change-the-dims-for-a-dense-vector-in-an-index/313920
**Category:** Elasticsearch
**Created:** [September 7, 2022, 5:51pm UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-change-the-dims-for-a-dense-vector-in-an-index/313920 "2022-09-07T17:51:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![reisner](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@reisner](https://discuss.elastic.co/u/reisner)
#### Post date: [September 7, 2022, 5:51pm UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-change-the-dims-for-a-dense-vector-in-an-index/313920/1 "2022-09-07T17:51:07Z")

</div>

I have an index with a `dense_vector` field with 256 dimensions. I want to change to a new embedding model that uses a different number of dimensions. I dont mind losing the data in the old field. What's the best way to keep the data (other than the `dense_vector`) and change the dims?

I've tried:

1. Looking into deleting a field -- but this appears to be impossible in Elastic.
2. Creating a new index with the new mapping with a higher dimensional dense\_vector and then reindexing from old to new. This failed during reindex because the dimensions of that field didn't match up.
3. Creating a new index that was missing the dense\_vector field, and then reindexing from old to new. This worked for reindexing, but then when I wanted to add the field to the mapping, it failed with `mapper [source_title_vector] cannot be changed from type [float] to [dense_vector]`...probably because the field exists in the data without a mapping (I guess its treated as a float?)

Do I need to write some code to go through the documents one at a time and insert them without this field? Any help would be appreciated.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 8, 2022, 4:01am UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-change-the-dims-for-a-dense-vector-in-an-index/313920/2 "2022-09-08T04:01:18Z")

</div>

Welcome to our community! 😃

You cannot change a mapping type once it has been created in the index. To do that you will need to create a new index with the mapping you want, then reindex into it, which is option 2 above.

I don't know much about dense vectors, but perhaps if you can share your reindex request, mappings and the error we can assist further

---

<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: [October 6, 2022, 4:01am UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-change-the-dims-for-a-dense-vector-in-an-index/313920/3 "2022-10-06T04:01:59Z")

</div>

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