High-cardinality Field Histogram Aggregation
High-cardinality fields are usually used for histogram grouping and aggregation instead of single-point grouping and aggregation. For example, collecting the statistics of logs at a certain period. Assume that the following query statement exists:
POST testindex/_search?pretty { "size": 0, "aggs": { "avg_score": { "avg": { "field": "score" }, "aggs": { "groupbytime": { "date_histogram": { "field": "timestamp", "calendar_interval": "day" } } } } } }
This query groups the field timestamp using a histogram and calculates the average score. timestamp is a typical high-cardinality field. To use the enhanced aggregation for the preceding query, set parameters as follows:
// Configure an index "settings" : { "index" : { "search" : { "turbo" : { "enabled" : "true" // Enable optimization } }, "sort" : { // Specify a sorting key "field" : [ "timestamp" ] } } }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot