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