def test_filter_robots(app, es, event_queues, indexed_events, with_robots):
"""Test the filter_robots query modifier."""
query_modifiers = []
if not with_robots:
query_modifiers = [filter_robots]
StatAggregator(client=current_search_client,
event='file-download',
aggregation_field='file_id',
aggregation_interval='day',
query_modifiers=query_modifiers).run()
current_search_client.indices.refresh(index='*')
query = Search(
using=current_search_client,
index='stats-file-download',
doc_type='file-download-day-aggregation'
)[0:30].sort('file_id')
results = query.execute()
assert len(results) == 3
for result in results:
if 'file_id' in result:
assert result.count == (5 if with_robots else 2)
test_aggregations.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录