Slice dense vector contents?


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!

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 to modify the content of your vectors.

Thank you Mayya!