Help with limited result after terms results


(Truongdqse03303) #1

Hi experts
Here is my query

{
    "size": 0,
    "query": {
        "match_all": {}
    },

    "aggs": {
        "content_level": {
            "terms": {
                "field": "content_level"
            },
            "aggs": {
                "news_id": {
                    "terms": {
                        "field": "news_id"
                    },
                    "aggs": {
                        "viewed_count_max": {
                            "max": {
                                "field": "viewed_count"
                            }
                        },
                        "like_max": {
                            "max": {
                                "field": "liked_count"
                            }
                        }
                    }
                },
                "summmmm": {
                    "sum_bucket": {
                        "buckets_path": "news_id>viewed_count_max"
                    }
                },
                "sum_like": {
                    "sum_bucket": {
                        "buckets_path": "news_id>like_max"
                    }
                }
            }
        },
        "total": {
            "sum_bucket": {
                "buckets_path": "content_level>summmmm"
            }
        }
    }
}

With my result i can take the max of viewed_count and sum it. The problems is the result of terms:field:content_level is limited so i cant take all the viewed_count to statistics.
How can i solve this problems.
Thanks


(system) #2

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