I want to filter documents only by time. For example, if I provide timestamps like: 7:00:00
and 15:00:00
by GMT, they should return dates like 15 Dec 2020
, 30 April 1340
and so on.
This query obviously does not work (I use node.js client), because it returns any date between 1000 year and 3000 year:
searchResult = await esClient.transport.request({
method: 'GET',
path: 'events/_search',
body: {
query: {
bool: {
must: {
range: {
date: {
gte: '1000-07-15T07:00:00Z',
lte: '3000-07-15T15:00:00Z'
}
}
}
}
},
}
});
As well as this query, because, according to this docs, my provided timestamps (7:00:00
and 15:00:00
) are converted into dates with default values:
searchResult = await esClient.transport.request({
method: 'GET',
path: 'events/_search',
body: {
query: {
bool: {
must: {
range: {
date: {
'gte': '7:00:00',
'lte': '15:00:00',
format: 'HH:mm:ss'
}
}
}
}
},
}
});
How can I filter only by time, but not days, months, years?