# Multisearch (bulk) knn searches

**URL:** <https://discuss.elastic.co/t/multisearch-bulk-knn-searches/333095>\
**Category:** Elasticsearch\
**Tags:** language-clients, vector-search\
**Created:** [May 10, 2023, 2:31pm UTC](https://discuss.elastic.co/t/multisearch-bulk-knn-searches/333095 "2023-05-10T14:31:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndtreviv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ndtreviv/32/22494_2.png) [@ndtreviv](https://discuss.elastic.co/u/ndtreviv)\
**Post date:** [May 10, 2023, 2:31pm UTC](https://discuss.elastic.co/t/multisearch-bulk-knn-searches/333095/1 "2023-05-10T14:31:34Z")

</div>

Hello,

I want to use `knn` searching on `dense_vector`s for similarity searches, but I want to issue multiple requests at once using the `Multisearch` API.

Is this possible?  
The Java client library (`co.elastic.clients:elasticsearch-java:8.7.1`) doesn't appear to support `knn` in the Multisearch body builder.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![ndtreviv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ndtreviv/32/22494_2.png) [@ndtreviv](https://discuss.elastic.co/u/ndtreviv)\
**Post date:** [May 10, 2023, 2:32pm UTC](https://discuss.elastic.co/t/multisearch-bulk-knn-searches/333095/2 "2023-05-10T14:32:57Z")

</div>

Wait, I was being dumb. It does support it. I somehow default to building my queries from the `.query` object, but you don't do that for `knn` because it's not a typical `query`.

Follow: `new MultisearchBody.Builder().knn...`

---

<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:** [May 11, 2023, 12:27am UTC](https://discuss.elastic.co/t/multisearch-bulk-knn-searches/333095/3 "2023-05-11T00:27:50Z")

</div>

Thanks for sharing the solution! 😃

---

<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 8, 2023, 12:28am UTC](https://discuss.elastic.co/t/multisearch-bulk-knn-searches/333095/4 "2023-06-08T00:28:18Z")

</div>

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