# Semantic search with ELSER using .NET client

**URL:** <https://discuss.elastic.co/t/semantic-search-with-elser-using-net-client/365568>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [August 26, 2024, 4:55pm UTC](https://discuss.elastic.co/t/semantic-search-with-elser-using-net-client/365568 "2024-08-26T16:55:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sergey-tihon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey-tihon/32/137070_2.png) [@sergey-tihon](https://discuss.elastic.co/u/sergey-tihon)\
**Post date:** [August 26, 2024, 4:55pm UTC](https://discuss.elastic.co/t/semantic-search-with-elser-using-net-client/365568/1 "2024-08-26T16:55:22Z")

</div>

[Semantic search with ELSET guide](https://www.elastic.co/guide/en/elasticsearch/reference/current/semantic-search-elser.html) mention `sparce_vector` queries

```auto
GET my-index/_search
{
   "query":{
      "sparse_vector":{
         "field": "content_embedding",
         "inference_id": "my-elser-endpoint",
         "query": "How to avoid muscle soreness after running?"
      }
   }
}

```

How to make such requests using [Elastic.Clients.Elasticsearch](https://github.com/elastic/elasticsearch-net/tree/5618f9a3da800a5cb0cf471682af72303f7aecc8) ?

Why [SparseVectorQuery](https://github.com/elastic/elasticsearch-net/blob/5618f9a3da800a5cb0cf471682af72303f7aecc8/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SparseVectorQuery.g.cs#L32) is available only in `Elastic.Clients.Elasticsearch.Serverless` package?

Can `Elastic.Clients.Elasticsearch.Serverless` client be used instead of `Elastic.Clients.Elasticsearch` for non-serverless clusters?

---

<div class="post-metadata">

**Author:** ![sergey-tihon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey-tihon/32/137070_2.png) [@sergey-tihon](https://discuss.elastic.co/u/sergey-tihon)\
**Post date:** [August 27, 2024, 8:23pm UTC](https://discuss.elastic.co/t/semantic-search-with-elser-using-net-client/365568/2 "2024-08-27T20:23:37Z")

</div>

@flobernd can you please explain the difference between 2 new clients `Elastic.Clients.Elasticsearch.Serverless` & `Elastic.Clients.Elasticsearch` ?

---

<div class="post-metadata">

**Author:** ![flobernd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flobernd/32/124877_2.png) [@flobernd](https://discuss.elastic.co/u/flobernd)\
**Post date:** [August 28, 2024, 7:39am UTC](https://discuss.elastic.co/t/semantic-search-with-elser-using-net-client/365568/3 "2024-08-28T07:39:25Z")

</div>

Hi @sergey-tihon,

`SparseVectorQuery` should indeed be available in the regular stack client as well. I'll investigate why it's currently missing.

The `Elastic.Clients.Elasticsearch` client is the regular client to connect to the Elasticsearch stack server.

`Elastic.Clients.Elasticsearch.Serverless` is specifically created to connect to [Elasticsearch Serverless](https://www.elastic.co/docs/current/serverless) deployments.

Current, serverless supports a subset of all available APIs which means that the regular `Elastic.Clients.Elasticsearch` client can be used as well for connecting to a Serverless instance and visa verce.

---

<div class="post-metadata">

**Author:** ![flobernd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flobernd/32/124877_2.png) [@flobernd](https://discuss.elastic.co/u/flobernd)\
**Post date:** [August 28, 2024, 12:00pm UTC](https://discuss.elastic.co/t/semantic-search-with-elser-using-net-client/365568/4 "2024-08-28T12:00:22Z")

</div>

@sergey-tihon I think you saw the PR on Github already, but for visibility I want to mention here again that the missing 8.15 features are now available starting from the latest [8.15.4](https://github.com/elastic/elasticsearch-net/releases/tag/8.15.4) release (should be available on NuGet within the next few minutes).

Thanks for making me aware of the missing functionality 🙂

---

<div class="post-metadata">

**Author:** ![sergey-tihon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey-tihon/32/137070_2.png) [@sergey-tihon](https://discuss.elastic.co/u/sergey-tihon)\
**Post date:** [August 28, 2024, 12:24pm UTC](https://discuss.elastic.co/t/semantic-search-with-elser-using-net-client/365568/5 "2024-08-28T12:24:28Z")

</div>

@flobernd thank you for such a quick fix.

I am already running 8.15.4 locally and it works for me so far.
