沙师弟,师父的充电器掉了

Es 6.7 source include 单个字段的奇异现象

Elasticsearch | 作者 KeithChen | 发布于2019年09月23日 | 阅读数:2132

1.source禁用后,无法更新字段。
2.source任意 include其中一个字段后,就可以更新任意字段。并且查询的时候,文档中更新的新数值,也可以被当作查询条件,查询到对应的文档。(不仅限于source的字段),当然查询返回的时候,还是只有source的字段,没有其他字段。
已邀请:

trycatchfinal

赞同来自:


Note, this operation still means full reindex of the document, it just removes some network roundtrips and reduces chances of version conflicts between the get and the index. The _source field needs to be enabled for this feature to work.


参考:https://www.elastic.co/guide/e ... .html


Think before disabling the _source field

Users often disable the _source field without thinking about the consequences, and then live to regret it. If the _source field isn’t available then a number of features are not supported:

The update, update_by_query, and reindex APIs.
On the fly highlighting.
The ability to reindex from one Elasticsearch index to another, either to change mappings or analysis, or to upgrade an index to a new major version.
The ability to debug queries or aggregations by viewing the original document used at index time.
Potentially in the future, the ability to repair index corruption automatically.


参考:https://www.elastic.co/guide/e ... .html
 
按照官方文档:
如果_source不启用,update,update_by_query, reindex操作都是不能够使用的。
这是由于这些操作是先获取文档,将更新请求和原始文档的_source信息merge后,再重新index文档。
 
update是用来更新部分字段的,如果更新全部字段,可以使用index操作。_source不启用,不会影响index.

要回复问题请先登录注册