【发布时间】:2017-03-13 07:22:25
【问题描述】:
我正在尝试在我的索引/文档类型中查找最后 30 个条目
我什么都没试过,我完全没有想法!
我目前的方法是找到过去 5 分钟内的所有结果,然后过滤结果并抓取最后 30 个条目,但这比正确的方法要慢。
s = Search(using=es, index="history", doc_type=p)
.filter('range', timestamp={'gte': mins})
.extra(size=1000)
我试过了
s = Search(using=es, index="history", doc_type=p)
.sort("timestamp", {'order': "desc"})
.extra(size=30)
【问题讨论】:
标签: python elasticsearch-dsl elasticsearch-py