zoukankan      html  css  js  c++  java
  • ES禁用_source不会影响聚合

    From Elasticsearch's website:

    The _source field contains the original JSON document body that was passed at index time. The _source field itself is not indexed (and thus is not searchable), but it is stored so that it can be returned when executing fetch requests, like get or search

    Disabling the source will prevent Elasticsearch from displaying it in the resultset. However, filtering, querying and aggregations will not be affected.

    So these two queries will not generate any results in terms of the actual body:

    GET mq-body-local/body/_search

    GET mq-body-local/body/1

    However, you could run this aggregation that will include some of the source, for example:

    POST mq-body-local/body/_search
    
    {
      "aggs": {
        "test": {
          "terms": {
            "field": "body"
          }
        }
      }
    }
    

    Will produce this result set (I've created some test records):

    "aggregations": {
        "test": {
          "doc_count_error_upper_bound": 0,
          "sum_other_doc_count": 0,
          "buckets": [
            {
              "key": "my body",
              "doc_count": 1
            },
            {
              "key": "my body2",
              "doc_count": 1
            }
          ]
        }
      }
    
  • 相关阅读:
    hdu-1114
    hdu2546
    POJ-3126
    POJ-1915
    ZOJ-1709
    Codeforces 847H
    Codeforces 847C
    Codeforces 847I
    Codeforces 847E
    算法笔记--矩阵及矩阵快速幂
  • 原文地址:https://www.cnblogs.com/bonelee/p/6432324.html
Copyright © 2011-2022 走看看