Aggregation Metadata(聚合元数据)

原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/5.4/agg-metadata.html

译文链接 : Aggregation Metadata(聚合元数据)

贡献者 : 程威ApacheCNApache中文网

您可以将一条元数据与请求时的各个聚合相关联,并一起返回。 考虑这个例子,我们想将颜色蓝色与我们的 terms 聚合相关联。

  1. curl -XGET 'localhost:9200/twitter/tweet/_search?pretty' -H 'Content-Type: application/json' -d'
  2. {
  3. "size": 0,
  4. "aggs": {
  5. "titles": {
  6. "terms": {
  7. "field": "title"
  8. },
  9. "meta": {
  10. "color": "blue"
  11. }
  12. }
  13. }
  14. }
  15. '
  1. 那么这个元数据将被返回到我们的标题术语聚合
  1. {
  2. "aggregations": {
  3. "titles": {
  4. "meta": {
  5. "color" : "blue"
  6. },
  7. "doc_count_error_upper_bound" : 0,
  8. "sum_other_doc_count" : 0,
  9. "buckets": [
  10. ]
  11. }
  12. },
  13. ...
  14. }