# Returns Different Datas from same query with elastic and nest

**URL:** <https://discuss.elastic.co/t/returns-different-datas-from-same-query-with-elastic-and-nest/217370>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [January 31, 2020, 12:38pm UTC](https://discuss.elastic.co/t/returns-different-datas-from-same-query-with-elastic-and-nest/217370 "2020-01-31T12:38:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamala\_enderson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kamala_enderson/32/59101_2.png) [@kamala\_enderson](https://discuss.elastic.co/u/kamala_enderson)\
**Post date:** [January 31, 2020, 12:38pm UTC](https://discuss.elastic.co/t/returns-different-datas-from-same-query-with-elastic-and-nest/217370/1 "2020-01-31T12:38:02Z")

</div>

Hello,  
If it is so easy question, I'm so sorry ,I am new at elasticsearch.  
I use nest for elasticsearch and when I think the two way of same query in Kibana and Nest, I get different result. So where is my code wrong ? (I think elasticsearch query is true)  
this my elasticsearch query

```
   GET myIndıces/_search
{
  "query": {
    "range": {
      "createdDate": {
        "lte": "2020-01-31T12:22:30.000Z"
      }
    }
  },
  "sort": [
    {
      "createdDate": {
        "order": "desc"
      }
    }
  ]
}

```

and my nest code

```
     var search = new SearchRequest<TweetDTO>
    {
        From = (clientSearchDTO.Page * 10),
        Size = 10,
        Sort = new List<ISort>
        {
             new FieldSort{Field = "createdDate",Order = SortOrder.Descending}
        }
    };

    List<QueryContainer> queryList = new List<QueryContainer>();
    BoolQuery boolQuery = new BoolQuery();
    if (EndDate != null)
    {

        boolQuery.Filter = new List<QueryContainer>
        {
            new DateRangeQuery
            {
                Field = new Field("createdDate"),
                LessThanOrEqualTo = DateMath.Anchored(clientSearchDTO.EndDate.Value)
            }
        };
    }
    boolQuery.Must = queryList;
    search.Query = boolQuery;

    var result = _elasticClient.Search<TweetDTO>(search);
    return result.Documents.ToList();

```

Thanks for any help

---

<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:** [February 28, 2020, 12:45pm UTC](https://discuss.elastic.co/t/returns-different-datas-from-same-query-with-elastic-and-nest/217370/2 "2020-02-28T12:45:43Z")

</div>

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