Average age

So, I have a database whith personal information where we calculate the age of the people using the birthdate, the problem is that I want to calculate the average age of the population, but I have a problems: scalability. Currently my database has only 52 intros, but I am planning to have thousands, and a have a json with thousands or dozens of thousands may be a problem to my RAM.

  1. Is there a way to choose what fields I want it to return?

  2. How can I use the "size" parameter on the "search" function of the python library?

Thanks very much for you attention!

Looks into the avg aggregation. You can give it a script to do the subtraction. That way you don't need to do the math on your side.

ES builds a columnar store of the fields on index to make aggregations generally pretty quick. I'd expect averaging a few thousand ages to be basically instant, all other things being equal.

Thank you very much!

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