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(验证规则绑定)
47 0
32avalon - 指令ms-rules(自定义验证规则)
32avalon - 指令ms-rules(自定义验证规则)
39 1
|
3月前
|
C++ 开发者
cpplint 新增自定义checker介绍
通过为cpplint新增自定义规则,可以让 cpplint 更加贴合项目的编码规范,从而提高代码的质量和一致性。
61 0
|
5月前
|
存储
ES批量写入数据
ES批量写入数据
215 1
|
5月前
|
JSON 前端开发 JavaScript
ES6(2015)-ES13(2022)新增特性大总结
ES6(2015)-ES13(2022)新增特性大总结
90 0
如何在已创建的 es 索引中增加分片
如何在已创建的 es 索引中增加分片
|
JSON 移动开发 NoSQL
【ES系列九】——批量同步数据至ES
通过es官网提供的bulk方法进行实现
ES5新增方法(一)
前言 今天和大家分享一下ES5中一些新增的方法。 一、数组方法 迭代(遍历)方法:forEach(),map(),filter(),some(),every() array.forEach(function(value,index,arr)) value:数组当前项的值 index:数组当前项的索引 arr:数组对象本身
|
测试技术 索引
ES数据删除优化
分享一下ES数据删除优化的相关经历,根据业务需要一共优化了3次,包含了其中踩到的坑和一些花时间解决的问题.
1058 0
|
监控 Java 索引
增大max_result_window是错的,ES只能查询前10000条数据的正确解决方案
增大max_result_window是错的,ES只能查询前10000条数据的正确解决方案
增大max_result_window是错的,ES只能查询前10000条数据的正确解决方案