ElasticSearch aggregation is too time-consuming, how to optimize it

some index data 10G , execute the following query frequently,

{
    "aggs": {
        "sold": {
            "sum": {
                "field": "sold"
            }
        },
        "category": {
            "terms": {
                "field": "cat",
                "size": 100,
                "execution_hint": "map"
            }
        }
    },
    "sort": [
        ...
    ],
    "query": {
        ...
    }
}

sold is the total sales volume of products that meet the query criteria
category is the category to which the products that meet the query criteria are listed

but the above query is very slow. If you only use query to query the product, the time will be between 8s-15s , but if you add aggs , the time will soar to more than 50s , which can no longer be used normally.

10G volume, and the number of records is only 1300W . Is it large in the data for es ?
query conditions are mostly interval queries, such as price range, sales volume range, query time has reached 10s , is it normal?
above query+aggs query, aggs is there room for optimization?

Apr.19,2021

only use query to query products, and the time is between 8s-15s.
this is not normal. Generally speaking, it takes less than 2 seconds to be considered normal (more strictly 1s)
first consider the optimization of ES configuration (number of clusters, machine configuration such as memory, SSD, etc.)
and then consider optimized aggregation
.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b4210e-2c5ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b4210e-2c5ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?