搜索引擎索引和类型

发布于 2024-12-05 03:58:43 字数 156 浏览 2 评论 0原文

作为搜索引擎的新手,索引和类型的概念对我来说不是很清楚。弹性搜索具有可以存储文档的索引和类型的概念。

索引的概念与数据库中的模式相关吗? 类型的概念与表相关吗?

有人可以解释一下在索引下面进行另一个分组的目的吗? 为什么我们不能将相同类型的所有文档存储在单个索引上?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执着的年纪 2024-12-12 03:58:43

索引的概念与数据库中的模式相关吗?类型的概念与表相关吗?

不,不。首先,ElasticSearch 是无架构的:您不必预先指定文档的结构。只需向 ElasticSearch 扔一些 JSON,它就会愉快地对其进行索引、存储、检索、搜索。

索引的概念与数据库的概念相关:数据库包含许多,例如。异构结构化数据。

类型的概念与的概念相关:存储在一个索引下的各种类型可以具有不同的映射,即。不同的字段分析器等。

查看类型的另一种方法是将它们视为列数据库(例如 HBase 或 Cassandra)中的列族。

ElasticSearch README 中实际上有一个非常好的示例:存储两种不同的类型一个名为“twitter”的索引中的数据(用户及其推文)。

(尽管如此,没有人强迫您利用此功能:如果对您有意义,您可以在索引下拥有一种类型。)

Does the notion of an index correlate with a schema in a database? While the notion of a type correlate with a table?

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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文