# Is there any way we can use list of vectors to store in ElasticSearch and what are the corresponding changes required in ES query for calculating cosine similarity

**URL:** <https://discuss.elastic.co/t/is-there-any-way-we-can-use-list-of-vectors-to-store-in-elasticsearch-and-what-are-the-corresponding-changes-required-in-es-query-for-calculating-cosine-similarity/273888>\
**Category:** Elasticsearch\
**Created:** [May 25, 2021, 4:55am UTC](https://discuss.elastic.co/t/is-there-any-way-we-can-use-list-of-vectors-to-store-in-elasticsearch-and-what-are-the-corresponding-changes-required-in-es-query-for-calculating-cosine-similarity/273888 "2021-05-25T04:55:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SagarPalyal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagarpalyal/32/89208_2.png) [@SagarPalyal](https://discuss.elastic.co/u/SagarPalyal)\
**Post date:** [May 25, 2021, 4:55am UTC](https://discuss.elastic.co/t/is-there-any-way-we-can-use-list-of-vectors-to-store-in-elasticsearch-and-what-are-the-corresponding-changes-required-in-es-query-for-calculating-cosine-similarity/273888/1 "2021-05-25T04:55:57Z")

</div>

Provided I am able to create single dense vector field and calculate cosine similarity using the ElasticSearch query mentioned in official documentation. Still not getting how to create list of dense vectors and apply cosine similarity. Please let me know what I am thinking is even possible as of now to implement in ElasticSearch or not?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 31, 2021, 9:00am UTC](https://discuss.elastic.co/t/is-there-any-way-we-can-use-list-of-vectors-to-store-in-elasticsearch-and-what-are-the-corresponding-changes-required-in-es-query-for-calculating-cosine-similarity/273888/2 "2021-05-31T09:00:28Z")

</div>

as the vectors are put of the document, the vectors need to be created when that document is stored - this also means that you have to create those vectors yourself - that could be by running a job to create vectors/a data model before you index your data, but there cannot be done within Elasticsearch.

You may also have seen the machine learning integration with transforms. See [Feature importance for data frame analytics with Elastic machine learning | Elastic Blog](https://www.elastic.co/blog/feature-importance-for-data-frame-analytics-with-elastic-machine-learning) or [Overview | Machine Learning in the Elastic Stack [7.13] | Elastic](https://www.elastic.co/guide/en/machine-learning/current/ml-dfa-overview.html)

---

<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:** [June 28, 2021, 9:00am UTC](https://discuss.elastic.co/t/is-there-any-way-we-can-use-list-of-vectors-to-store-in-elasticsearch-and-what-are-the-corresponding-changes-required-in-es-query-for-calculating-cosine-similarity/273888/3 "2021-06-28T09:00:29Z")

</div>

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