what is the difference between _source and _all in Elasticsearch
来源:互联网 发布:周末网络国债理财机构 编辑:程序博客网 时间:2024/06/06 00:37
It's pretty much the same as the difference between indexed fields and stored fields in lucene.
You use indexed fields when you want to search on them, while you store fields that you want to retun as search results.
The _source
field is meant to store the whole source document that was originally sent to elasticsearch. It's use as search result, to be retrieved. You can't search on it. In fact it is a stored field in lucene and not indexed.
The _all
field is meant to index all the content that come from all the fields that your documents are composed of. You can search on it but never return it, since it's indexed but not stored in lucene.
There's no redundancy, the two fields are meant for a different usecase and stored in different places, within the lucene index. The _all
field becomes part of what we call the inverted index, use to index text and be able to execute full-text search against it, while the _source
field is just stored as part of the lucene documents.
You would never use the _source
field in your queries, only when you get back results since that's what elasticsearch returns by default. There are a few features that depend on the _source
field, that you lose if you disable it. One of them is the update API. Also, if you disable it you need to remember to configure as store:yes
in your mapping all the fields that you want to return as search results. I would rather say don't disable it unless it bothers you, since it's really helpful in a lot of cases. One other common usecase would be when you need to reindex your data; you can just retrieve all your documents from elasticsearch itself and just resend them to another index.
On the other hand, the _all
field is just a default catch all field, that you can use when you just want to search on all fields available and you don't want to specify them all in your queries. It's handy but I wouldn't rely on it too much on production, where it's better to run more complex queries on different fields, with different weights each. You might want to disable it if you don't use it, this will have a smaller impact than disabling the _source
in my opinion.
转载stackoverflow
- what is the difference between _source and _all in Elasticsearch
- What is the difference between BIT and TINYINT in MySQL
- What is the difference between fprintf and vfprintf in C++?
- what is the difference between definition and declaration in c
- What is the difference between test, [ and [[ ?
- What is the difference between -I and -L in makefile? and the means of -d.
- What exactly is the difference between “pass by reference” in C and in C++?
- What is the difference between Sprint and Iteration in Scrum and length of each Sprint?
- what is the difference between "isempty"and "isnull"in the qt bool QString::isEmpty () const Retur.
- In Linux, what is the difference between “buffers” and “cache” reported by the free command?
- what is the difference between the setTimeout and setInterval
- What is the difference between DHTML and the DOM?
- What is the difference between the mouseover and mouseenter events?
- What is the difference between #import and #include in Objective-C?
- What is the difference between getWidth/heigth() and getMeasuredWidth/Heigth() in Android SDK?
- What Is the Difference Between a Block, a Proc, and a Lambda in Ruby
- In SQL, what is the difference between a left join and a left outer join?
- What is the difference between a soft reference and a weak reference in Java?
- 微信高级群发接口,微信自定义菜单,微信支付-微信公众平台开发
- android第三方应用跳转到QQ并指定QQ号聊天
- 【C++注意事项】1 数据类型及类型转换
- 共价模型单种自旋的电子组态的索引方法
- Java中jre和jdk的区别
- what is the difference between _source and _all in Elasticsearch
- 纯代码 适配 iPhone 6 (+)
- JAVA枚举类型
- java POI实现向Excel中插入图片
- 无意间看到一个留学生大牛的Open IMS Core战略思想-------太牛叉了!!!!------致敬
- Android View 事件分发机制 源码解析
- 磁盘满导致mysql死锁
- 自由互联网计划-做网络的自由行者
- UVA 12325 Zombie's Treasure Chest