Python Query DSL | Aggregation partition finder

Hi Team,

Is there a way to programmatically build a search object and iterate through it's partitions? I am currently doing this by passing an incremental dict to my search object.

s = Search(using=client)
s = s.filter(**params)
i = 0
j = 100
while i < j:
  partitions = {"partition": i, "num_partitions": j}
  ns = copy.copy(s)
  ns.aggs.bucket('first', 'terms', field='tags.keyword', size=100, include=partitions)
  res = ns.execute()

Is this the only approach we can take to get all the agg results? Or is there a method we can call?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.