2,html
統計字段b的不一樣值的數量elasticsearch
{"size":0,"aggs":{"distinct_colors":{"cardinality":{"field":"b"}}}}ide
統計字段Local_ip的不一樣值ui
{"size":0,"aggs":{"langs":{"terms":{"field":"Local_ip","size":50000000}}}}htm
3,ip
GET /products5/_searchit
{"query":{"match":{"name":"led tv"}},"aggs":{"resellers":{"nested":{"path":"resellers"},"aggs":{"langs":{"terms":{"field":"resellers.price","size":50000000}}}}}}io
GET /products5/_searchast
{"query":{"bool":{"must":[],"must_not":[],"should":[],"filter":[{"nested":{"path":"resellers","query":{"bool":{"must":[{"term":{"resellers.price":44}}],"must_not":[],"should":[],"filter":[]}}}}]}},"from":0,"size":10,"sort":[]}
4,
PUT /products5/_doc/13
{"name":"LED TV","resellers":[{"price":101},{"price":110},{"price":130}],"date":"2015/02/01 05:02:00"}
GET /products5/_search
{"query":{"match":{"name":"led tv"}},"aggs":{"sales_per_month":{"date_histogram":{"field":"date","fixed_interval":"60m"},"aggs":{"resellers":{"nested":{"path":"resellers"},"aggs":{"sales":{"terms":{"field":"resellers.price","size":50000000}}}}}}}}
ES 分頁
https://www.elastic.co/guide/cn/elasticsearch/guide/current/pagination.html
https://www.elastic.co/guide/en/elasticsearch/reference/6.4/search-request-from-size.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html