# Filter by Dense or Sparse Vector

**URL:** <https://discuss.elastic.co/t/filter-by-dense-or-sparse-vector/199484>\
**Category:** Elasticsearch\
**Created:** [September 13, 2019, 10:57pm UTC](https://discuss.elastic.co/t/filter-by-dense-or-sparse-vector/199484 "2019-09-13T22:57:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seperman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seperman/32/11550_2.png) [@seperman](https://discuss.elastic.co/u/seperman)\
**Post date:** [September 13, 2019, 10:57pm UTC](https://discuss.elastic.co/t/filter-by-dense-or-sparse-vector/199484/1 "2019-09-13T22:57:58Z")

</div>

Hello,

According to [https://github.com/elastic/elasticsearch/issues/31615](https://github.com/elastic/elasticsearch/issues/31615) we can sort by cosine similarity of vectors. But how can we filter by vector values?

For example I want to filter all docs that index number 10 in the vector is less than X number. In other words filter to the docs where my\_vector\_field[10] \< X.

How can this be done?  
Thanks,  
Sep

---

<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:** [September 18, 2019, 8:16pm UTC](https://discuss.elastic.co/t/filter-by-dense-or-sparse-vector/199484/2 "2019-09-18T20:16:08Z")

</div>

Hello,  
filtering by individual values is not supported. We have decided not to support sorting as well.  
Currently vectors can be used only in script\_score query using predefined [vector functions](https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-script-score-query.html#vector-functions).  
However, if you think that accessing individual fields is a valid use case, please [submit a new issue](https://github.com/elastic/elasticsearch/issues) describing your use case in more detail.

---

<div class="post-metadata">

**Author:** ![seperman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seperman/32/11550_2.png) [@seperman](https://discuss.elastic.co/u/seperman)\
**Post date:** [September 19, 2019, 6:08am UTC](https://discuss.elastic.co/t/filter-by-dense-or-sparse-vector/199484/3 "2019-09-19T06:08:00Z")

</div>

Ok cool. Thanks for responding. I will submit a new issue.

---

<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 17, 2019, 6:08am UTC](https://discuss.elastic.co/t/filter-by-dense-or-sparse-vector/199484/4 "2019-10-17T06:08:01Z")

</div>

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