0

In part A of my application I build a bunch of aggregations for later possible use in a query like this:

from elasticsearch_dsl import A

a = A("terms", field="some_field", size=10)

In part B of the application, I want to change the size of these aggregations and preferably without accessing private member variables. I know that this works:

a._params["size"] = value_from_user_input

But it's not pretty and raises the linter. Is there another way?

I tried:

  • looking at elasticsearch_dsl.aggs but got lost in the levels of abstraction and reflection
  • saving only the params of the aggregation and instantiating them later. That is difficult however, since the aggregations are usually more complex than the example above and/or get nested inside other aggregations.
vlz
  • 911
  • 1
  • 10
  • 18

0 Answers0