es aggregate query records

Record what es polymerization using the syntax

Is the equivalent of sql group by group statistics, such as this pile of data count how many of each category separately, this specific point status code field may be 200, 500 or other, then there are a few statistics about the 200 other there are a few, well, my language is not clear, I hope I'll look when I can see myself in it, said Shane, the following syntax:

GET index_name/_search
{
  "size":0,
  "aggs" : {
    "your_aggs" : {
      "terms" : { "field" : "your_filed" } } } }
这个会返回你指定字段的所有值及相应的数量

Guess you like

Origin www.cnblogs.com/cai-cai-/p/12336679.html