I have some code like this.
var filter = new DateRangeQuery
{
Field = fieldName,
GreaterThan = date
};
What I'm confused about is what way around is the comparison done? Are we saying that the dates in the index should be greater than the date passed in or are we saying that the data passed in should be greater than the dates in the index?
The dates of the index must be greater than the query input.
PUT my_index/my_type/1
{
"date": "2018-01-01"
}
PUT my_index/my_type/2
{
"date": "2018-01-02"
}
GET my_index/_search
{
"query": {
"range": {
"date": {
"gt": "2017-01-01"
}
}
}
}