# NEST equivalent code for an ML infer query

**URL:** <https://discuss.elastic.co/t/nest-equivalent-code-for-an-ml-infer-query/333007>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [May 10, 2023, 12:50am UTC](https://discuss.elastic.co/t/nest-equivalent-code-for-an-ml-infer-query/333007 "2023-05-10T00:50:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![virtualaidev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virtualaidev/32/120830_2.png) [@virtualaidev](https://discuss.elastic.co/u/virtualaidev)\
**Post date:** [May 10, 2023, 12:50am UTC](https://discuss.elastic.co/t/nest-equivalent-code-for-an-ml-infer-query/333007/1 "2023-05-10T00:50:00Z")

</div>

Hi there,

any NEST library documentation on how to infer query in ML? For instance I want to do the below:

```auto
POST /_ml/trained_models/sentence-transformers__all-minilm-l12-v2/_infer
{
  "docs": {
    "text_field": "similar movies of resident evil"
  }
}

```

How do you achieve the above in using NEST in .NET?

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [May 11, 2023, 1:08pm UTC](https://discuss.elastic.co/t/nest-equivalent-code-for-an-ml-infer-query/333007/2 "2023-05-11T13:08:23Z")

</div>

Hi, @virtualaidev.

That endpoint was added in ES v8.3, so the v7 NEST client will not support that endpoint. We have a new client, `Elastic.Clients.Elasticsearch`, for v8. However, it doesn't currently support the ML endpoints. A workaround would be to use the new v8 client but drop down to its Transport layer to send a raw JSON request.

To help the team prioritise support for missing endpoints in the v8 client, I recommend you open a [feature request](https://github.com/elastic/elasticsearch-net/issues/new?assignees=&labels=Feature&projects=&template=feature_request.md&title=) to log your requirement for any ML endpoints.

---

<div class="post-metadata">

**Author:** ![virtualaidev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virtualaidev/32/120830_2.png) [@virtualaidev](https://discuss.elastic.co/u/virtualaidev)\
**Post date:** [May 11, 2023, 1:21pm UTC](https://discuss.elastic.co/t/nest-equivalent-code-for-an-ml-infer-query/333007/3 "2023-05-11T13:21:55Z")

</div>

> [@stevejgordon](#):
>
> However, it doesn't currently support the ML endpoints. A workaround would be to use the new v8 client but drop down to its Transport layer to send a raw JSON request.

Hi @stevejgordon,

any reference for the sample?

---

<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, 1:22pm UTC](https://discuss.elastic.co/t/nest-equivalent-code-for-an-ml-infer-query/333007/4 "2023-06-08T13:22:15Z")

</div>

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