# Using the elasticsearch .net NEST client API to get snapshots with query parameters

**URL:** <https://discuss.elastic.co/t/using-the-elasticsearch-net-nest-client-api-to-get-snapshots-with-query-parameters/310021>\
**Category:** Elasticsearch\
**Tags:** language-clients, snapshot-and-restore\
**Created:** [July 19, 2022, 12:39pm UTC](https://discuss.elastic.co/t/using-the-elasticsearch-net-nest-client-api-to-get-snapshots-with-query-parameters/310021 "2022-07-19T12:39:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amirmono](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@amirmono](https://discuss.elastic.co/u/amirmono)\
**Post date:** [July 19, 2022, 12:39pm UTC](https://discuss.elastic.co/t/using-the-elasticsearch-net-nest-client-api-to-get-snapshots-with-query-parameters/310021/1 "2022-07-19T12:39:24Z")

</div>

I'm using the Nest client c# API (version 7.0.0.0) to get elasticsearch (8.2.2) snapshots information.

```auto
response =
            _elasticClient.Snapshot.Get(
            "repository_name",
            "*"
            );

```

If I'm sending a rest request I'm sending query params to sort, order and set the max size of returned snapshots:

```auto
https://esurl:9200/_snapshot/repository_name/*?size=3&sort=start_time&order=desc

```

How can I do it using the API?

---

<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:** [July 19, 2022, 3:18pm UTC](https://discuss.elastic.co/t/using-the-elasticsearch-net-nest-client-api-to-get-snapshots-with-query-parameters/310021/2 "2022-07-19T15:18:54Z")

</div>

Hi @amirmono. I've just looked into these and they are missing as the documentation and API spec doesn't list them. However, they are valid, so we'll need to add support for them in an upcoming release. I'm going to create an issue to track this. Unfortunately, right now, you will be unable to use these from within the client.

---

<div class="post-metadata">

**Author:** ![amirmono](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@amirmono](https://discuss.elastic.co/u/amirmono)\
**Post date:** [July 21, 2022, 6:58am UTC](https://discuss.elastic.co/t/using-the-elasticsearch-net-nest-client-api-to-get-snapshots-with-query-parameters/310021/3 "2022-07-21T06:58:25Z")

</div>

Thanks! @stevejgordon Is there a way to do it with the low level client?

---

<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:** [July 21, 2022, 8:43am UTC](https://discuss.elastic.co/t/using-the-elasticsearch-net-nest-client-api-to-get-snapshots-with-query-parameters/310021/4 "2022-07-21T08:43:37Z")

</div>

Hi, @amirmono. Yep, you could try something like this with the low-level client.

```auto
var response = client.LowLevel.Snapshot.Get<GetSnapshotResponse>("a-repository", "*", 
    new Elasticsearch.Net.Specification.SnapshotApi.GetSnapshotRequestParameters 
    { 
        QueryString = new Dictionary<string, object>
        {
            { "size", 3 },
            { "order", "desc" },
            { "sort", "start_time" }
        }
    });

```

---

<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:** [August 18, 2022, 8:43am UTC](https://discuss.elastic.co/t/using-the-elasticsearch-net-nest-client-api-to-get-snapshots-with-query-parameters/310021/5 "2022-08-18T08:43:38Z")

</div>

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