green open ab_namespacename_namespaceid_appName_appId-2019.02.13 5 1 540 0 1.2mb 617kb我有很多以上格式的日志,我想通过@timestamp (在上面的日志(2019.02.13))范围删除旧的日志(假设超过5天)。我已经做了按查询删除日志的查询。
`let query = { index: '*', headers: null, body: { query: { filter: { '@timestamp': { 'gte': 'now-5d', }, }, }, }, }; try { results = await this.elasticSearchClient.deleteByQuery(query); console.log('results', results); return results; } catch (e) { throw new LogHubException(e.message, HttpStatus.NOT_FOUND);` I have got the below error:[parsing_exception] no [query] registered for [@timestamp], with { line=1 & col=42 }
注意:我使用了NestJS来调用elasticsearch api,并使用了elasticsearch6.4。我不想使用elasticsearch-curator。
发布于 2019-02-14 17:38:22
您的查询应如下所示:
{
"query": {
"range": {
"@timestamp": {
"gte": "now-5d"
}
}
}
}在NestJS代码中相应地更新更改。
https://stackoverflow.com/questions/54687093
复制相似问题