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
            }
          ]
        }
      }
    
  • 相关阅读:
    Makefile学习
    Tmux使用
    Linux进程管理学习资料
    Linux内存管理学习资料
    Python常用的软件包
    Docker 学习
    Intel处理器技术文档
    Firefly-RK3399笔记
    Linux Kernel API
    ARM 技术文档
  • 原文地址:https://www.cnblogs.com/bonelee/p/6432324.html
Copyright © 2011-2022 走看看