Skip to content

Commit 41b48fd

Browse files
committed
Account for ES < 6.3 in composite_agg helper
1 parent 1382c84 commit 41b48fd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/composite_agg.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ def run_search(**kwargs):
1919
while response.aggregations.comp.buckets:
2020
for b in response.aggregations.comp.buckets:
2121
yield b
22-
response = run_search(after=response.aggregations.comp.after_key)
22+
if 'after_key' in response.aggregations.comp:
23+
after = response.aggregations.comp.after_key
24+
else:
25+
after= response.aggregations.comp.buckets[-1].key
26+
response = run_search(after=after)
2327

2428

2529
if __name__ == '__main__':

0 commit comments

Comments
 (0)