【发布时间】:2012-11-01 08:59:12
【问题描述】:
这里是代码供参考。我正在尝试制作一个 hubot 插件,该插件可以记录到 elasticsearch,然后使用 hubot 命令来搜索这些日志。
https://gist.github.com/4050748
我正在尝试检索匹配两个查询的记录。
{
query: {
match: {
user: "SomeUsername"
},
range: {
date: {
from: (Date.now() - 3600)
}
}
},
size: 50
}
我期待:
- 最多 50 条记录
- 具有给定用户的记录
- 最近一小时的记录
我明白了:
- 最多 10 条记录
- 具有给定用户的记录
- 任何时候
如何获取过去一小时内使用某个用户名的所有记录?我需要将 match_all 与过滤器一起使用吗?我的尝试不受支持吗?
在 SQL 中会是这样的:
Select (*) from messages where user_name = ? and time > ?
【问题讨论】:
标签: coffeescript elasticsearch hubot