You're seeing just the function agg_avg, go back to ExAliyunOts.Search module for more information.
Link to this function

agg_avg(aggregation_name, field_name, options \\ [])

View Source


agg_avg(aggregation_name(), field_name(), options()) :: map()

Calculate the average value of the assigned field by aggregation in the nested :aggs option of :search_query option in ExAliyunOts.search/4.

Official document in Chinese | English


import MyApp.TableStore

search "table", "index_name",
  search_query: [
    query: ...,
    aggs: [
      agg_avg("agg_name", "score")

The aggregation_name can be any business description string, when get the calculated results, we need to use it to fetch them.


  • :missing, when the field is not existed in a row of data, if :missing is not set, the row will be ignored in statistics; if :missing is set, the row will use :missing value to participate in the statistics of average value, by default it's nil (not-set).