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
        }
      ]
    }
  }












本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/bonelee/p/6432324.html,如需转载请自行联系原作者
相关文章
|
JavaScript
31avalon - 指令ms-rules(验证规则绑定)
31avalon - 指令ms-rules(验证规则绑定)
51 0
32avalon - 指令ms-rules(自定义验证规则)
32avalon - 指令ms-rules(自定义验证规则)
41 1
|
5月前
|
C++ 开发者
cpplint 新增自定义checker介绍
通过为cpplint新增自定义规则,可以让 cpplint 更加贴合项目的编码规范,从而提高代码的质量和一致性。
80 0
|
7月前
|
JSON 前端开发 JavaScript
ES6(2015)-ES13(2022)新增特性大总结
ES6(2015)-ES13(2022)新增特性大总结
97 0
|
测试技术 索引
ES数据删除优化
分享一下ES数据删除优化的相关经历,根据业务需要一共优化了3次,包含了其中踩到的坑和一些花时间解决的问题.
1096 0
es聚合查询并且返回对应组的数据
es聚合查询并且返回对应组的数据
444 0
|
监控 Java 索引
增大max_result_window是错的,ES只能查询前10000条数据的正确解决方案
增大max_result_window是错的,ES只能查询前10000条数据的正确解决方案
增大max_result_window是错的,ES只能查询前10000条数据的正确解决方案
|
前端开发 JavaScript Java
ES6②
ES6②
101 0
ES查询学习(随时更新)
ES查询学习(随时更新)
134 0