# Dense vector field space requirements

**URL:** https://discuss.elastic.co/t/dense-vector-field-space-requirements/316304
**Category:** Elasticsearch
**Tags:** vector-search
**Created:** [October 11, 2022, 9:30am UTC](https://discuss.elastic.co/t/dense-vector-field-space-requirements/316304 "2022-10-11T09:30:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ruslaniv](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@ruslaniv](https://discuss.elastic.co/u/ruslaniv)
#### Post date: [October 11, 2022, 9:30am UTC](https://discuss.elastic.co/t/dense-vector-field-space-requirements/316304/1 "2022-10-11T09:30:20Z")

</div>

Hi!  
We are experimenting with dense vector field type for the purpose of similarity search.

So we have a test index with approx 5\_000\_000 documents, each document has about 30 fields and 25 of these fields are mapped to both `keyword` AND `text`.

So I created a new index, where 24 of these 25 fields were set only to `keyword` **AND** `index` set to `False`. And only one field mapped to `dense_vector` with 768 dimensions and `index` set to `True`.

After indexing 500\_000 documents we have noticed that the index size is already at 10 Gb, so the full test set would be approx 100 Gb. Whereas the current index takes only approx 30Gb.

My assumption was that by eliminating so many redundant fields and removing them from the index the index size would be somewhat smaller but it looks like it is going to be quite larger instead.

According to this: [Performance and storage of the dense\_vector type](https://discuss.elastic.co/t/performance-and-storage-of-the-dense-vector-type/265850) each vector takes 3kB **before** compression, so the size of my new index really puzzles me.

Does dense vector field take so much space or am I doing something wrong?

---

<div class="post-metadata">

### Author: ![ruslaniv](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@ruslaniv](https://discuss.elastic.co/u/ruslaniv)
#### Post date: [November 7, 2022, 5:37am UTC](https://discuss.elastic.co/t/dense-vector-field-space-requirements/316304/2 "2022-11-07T05:37:57Z")

</div>

Well, I just saved a 768 vector in a plain text file and it takes about 17 Kb on disk.  
So for 5\_000\_000 documents it will require about 85 Gb. But then I do not understand where this formula `4*dims+4` comes from because I'm definitely seeing different results.

---

<div class="post-metadata">

### Author: ![ruslaniv](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@ruslaniv](https://discuss.elastic.co/u/ruslaniv)
#### Post date: [November 25, 2022, 6:49am UTC](https://discuss.elastic.co/t/dense-vector-field-space-requirements/316304/3 "2022-11-25T06:49:25Z")

</div>

Just to add some empirical evidence after indexing nearly 5\_500\_000 documents with a `dense_vector` field of dimensionality of 1024 on 2 different servers (test and prod): the index size is approximately 22GB per 1\_000\_000 documents.

---

<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: [December 23, 2022, 6:50am UTC](https://discuss.elastic.co/t/dense-vector-field-space-requirements/316304/4 "2022-12-23T06:50:05Z")

</div>

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