# Query DSL C#, function "Documents" return issue

**URL:** <https://discuss.elastic.co/t/query-dsl-c-function-documents-return-issue/121470>\
**Category:** Elasticsearch\
**Created:** [February 26, 2018, 10:29am UTC](https://discuss.elastic.co/t/query-dsl-c-function-documents-return-issue/121470 "2018-02-26T10:29:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DiSiZ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/disiz/32/60095_2.png) [@DiSiZ](https://discuss.elastic.co/u/DiSiZ)\
**Post date:** [February 26, 2018, 10:29am UTC](https://discuss.elastic.co/t/query-dsl-c-function-documents-return-issue/121470/1 "2018-02-26T10:29:10Z")

</div>

Hello,

I'am trying to get to some data on a elastic uri.  
The thing is, when I do this :

```
           var searchResponse = client.Search<Source>(s => s
            .Index("jam")
            .Type("jam")
            .From(0)
            .Size(1000)
            .Query(q => q
            .Match(m =>m
            .Field(f => f.Street)
            .Query("Paris")
            )
           )
           );

        var recep = searchResponse.Documents;

```

recep return :

```
  System.Collections.Generic.List'1[WpfApp1.Source]

```

The thing i dont understand is i actually get the correct "total" amount of hits but i just can't put in in a string or in a object.  
And the recep return is the path to my hits but static, he dont take the 100 hits to put it in recep he just give the path, how can i fix it ?

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [February 26, 2018, 8:56pm UTC](https://discuss.elastic.co/t/query-dsl-c-function-documents-return-issue/121470/2 "2018-02-26T20:56:05Z")

</div>

> [@DiSiZ](#):
>
> i just can't put in in a string or in a object.

`searchResponse.Documents` is a collection of `Source` documents, deserialized from the `_source` field of each hit in the response. The generic parameter type passed in `.Search<T>(...)` tells NEST what type to deserialize `_source` objects into.

You can use the low level client if you want to return the entire response as a string e.g. using NEST 6.x

```auto
var searchResponse = client.LowLevel.Search<StringResponse>("jam", "jam", PostData.Serializable(new SearchDescriptor<Question>()
    .From(0)
    .Size(10)
    .Query(q => q
        .Match(m => m
            .Field(f => f.Body)
            .Query("Paris")
        )
    )
));

// response from Elasticsearch as a JSON string
var jsonString = searchResponse.Body;

```

Take a look at the [NEST documentation getting started section](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/nest-getting-started.html) for more details.

---

<div class="post-metadata">

**Author:** ![DiSiZ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/disiz/32/60095_2.png) [@DiSiZ](https://discuss.elastic.co/u/DiSiZ)\
**Post date:** [February 27, 2018, 8:52am UTC](https://discuss.elastic.co/t/query-dsl-c-function-documents-return-issue/121470/3 "2018-02-27T08:52:45Z")

</div>

Wow thank you so much, that's exactly what i was looking for 😁

I've waste my time being completly focus on NEST high level.  
Ill take a look at the documentation but i'm on it since two days..  
Because i already recieve data in that kind of format so i had an error using NEST high level.

Have a nice day, thanks again

---

<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:** [March 27, 2018, 8:53am UTC](https://discuss.elastic.co/t/query-dsl-c-function-documents-return-issue/121470/4 "2018-03-27T08:53:11Z")

</div>

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