搜索引擎索引和类型
作为搜索引擎的新手,索引和类型的概念对我来说不是很清楚。弹性搜索具有可以存储文档的索引和类型的概念。
索引的概念与数据库中的模式相关吗? 类型的概念与表相关吗?
有人可以解释一下在索引下面进行另一个分组的目的吗? 为什么我们不能将相同类型的所有文档存储在单个索引上?
Being somewhat new to search engines, the notions of indexes and types are not very clear to me. Elastic search has the notion of indexes and types where you can store a document.
Does the notion of an index correlate with a schema in a database?
While the notion of a type correlate with a table?
Can someone please explain the purpose of having another grouping below indexes?
Why can't we store all documents of the same type on a single index?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,不。首先,ElasticSearch 是无架构的:您不必预先指定文档的结构。只需向 ElasticSearch 扔一些 JSON,它就会愉快地对其进行索引、存储、检索、搜索。
索引的概念与数据库的概念相关:数据库包含许多表,例如。异构结构化数据。
类型的概念与表的概念相关:存储在一个索引下的各种类型可以具有不同的映射,即。不同的字段分析器等。
查看类型的另一种方法是将它们视为列数据库(例如 HBase 或 Cassandra)中的列族。
ElasticSearch README 中实际上有一个非常好的示例:存储两种不同的类型一个名为“twitter”的索引中的数据(用户及其推文)。
(尽管如此,没有人强迫您利用此功能:如果对您有意义,您可以在索引下拥有一种类型。)
No and no. First, ElasticSearch is schema free: you don't have to specify upfront the structure of your documents. Just throw some JSON at ElasticSearch and it will happily index it, store it, retrieve it, search it.
The concept of index correlates to the notion of database: a database contains many tables, eg. heterogenously structured data.
The notion of type correlates to the notion of table: various types stored under one index can have different mapping, ie. different analyzers for fields, etc.
Another way how to look at types would be to look at them as column families in column databases such as HBase or Cassandra.
There is actually a very nice example in the ElasticSearch README: storing two different types of data (users and their tweets) in one index, named “twitter”.
(All that said, nobody forces you to exploit this feature: you can have one type under an index, if it makes sense for you.)