提炼:

介绍了三个 Elasticsearch 必须的元数据 — _index, _type, _id。由这三个元数据可以存储文档,并且检索文档。
三个元数据的组合可以确定唯一一个文档。

原文:

一个文档不仅仅包含它的数据,也包含元数据 — 有关文档的信息。三个必须的元数据元素如下:
A document doesn’t consist only of its data. It also has metadata-information about the document. The three required metadata elements are as follows.

_index
文档在哪存放
Where the document lives
_type
文档表示的对象类别
The class of object that the document represents
_id
文档唯一标识
The unique identifier for the document

_index

一个 索引 应该是因共同的特性被分组到一起的文档集合。 例如, 你可能存储所有的产品在索引 products 中, 而存储所有销售的交易到索引 sales 中。 虽然也允许存储不相关的数据到一个索引中, 单着通常看作是一个反模式的做法。
An index is a collection of documents that should be grouped together for a common reason. For example, you may store all your products in a proucts index, while all your sales transsactions go in sales. Although it is possible to store unrelated data together in a single index, it is often considered an anti-pattern.

实际上,在 Elasticsearch 中, 我们的数据是被存储和索引在 分片 中,而一个索引仅仅是逻辑上的命名空间,这个命名空间由一个或者多个分片组合在一起。然而,这是一个内部细节,我们的应用程序根本不应该关心分片, 对于应用程序而言,只需知道文档位于一个索引内。 Elasticsearch 会处理所有细节
我们将在 索引管理 介绍如何自行创建和管理索引,但现在我们将让 Elasticsearch 帮我们创建索引。 所有需要我们做的就是选择一个索引名, 这个名字必须小写,不能以下划线开头,不能包含逗号。我们用 websit 作为索引名举例。
We cover how to create and manage indices ourselves in Index Management, but for now we will let Elasticsearch create the index for us. All we have to do is choose an index name.
This name must be lowercase, cannot begin with an underscore, and cannot contain commas. Let’s use website as our index name.

_type

数据可能在索引中只是松散的组合在一起, 但是通常明确定义一些数据中的子分区是很有用的。例如, 所有的产品都放在一个索引中, 但是你有许多不同的产品类别, 比如 “electronics”, “kitchen” 和 “lawn-care”。
Data may be grouped loosely together in an index, but often there are sub-partitions inside that data which may be useful to explicitly define. For example, all your products may go inside a single index. But you have different categories of products, such as “electronics”, “kitchen” and “lawn-care”.

这些文档共享一种相同的(或非常相似)的模式:他们有一个标题、描述、产品代码和价格。他们只是正好属于产品下的一些子类。
The documents all share an identical(or very similar) schema: they have a little, description, product code, price. They just happen to belong to sub-categories under the umbrella of “Products”.

Elasticsearch 公开了一个称为 types 的特性, 它允许您在索引中对数据进行逻辑分区。 不同 types 的文档可能有不同的种字段, 但最好能够非常相似。 我们将在 类型和映射中更多得讨论关于 types 的一些应用和限制。
Elasticsearch exposes a feature called types which allows you to logically partition data inside of an index. Documents in different types may have different fields, but it is best if they are highly similar. We’ll talk more about the restrictions and applications of types in Types and Mappings.

一个 _type 命名可以是大写或者小写, 但是不能以下划线或者句号开头, 不应该包含逗号, 并且长度限制为 256 个字符。我们使用 blog 作为类型名举例。
A _type name can be lowercase or uppercase, but shouldn’t begin with an underscore or period. It alse may not contain commas, and is limited to a length of 256 characters. We will use blog for our type name.

_id

ID 是一个字符串, 当它和 _index 以及 _type 组合就可以唯一确定 Elasticsearch 中的一个文档。当你创建一个新的文档,要么提供自己的 _id,要么让 Elasticsearch 帮你生成。
The ID is a string that, when combined with the _index and _type, uniquely identifies a document in Elasticsearch. When creating a new document, you can either provide your own _id or let Elasticsearch generate one for you.

其他元数据

还有一些其他的元数据元素, 他们在类型和映射进行了介绍。通过前面已经列出的元数据元素,我们已经能存储文档到 Elasticsearch 中并通过 ID 检索它—换句话说,使用 Elasticsearch 作为文档的存储介质。
There are several other metadata elements, which are presented in Types and Mappings. With the elements listed previously, we are already able to store a document in Elasticsearch and to retrieve it by ID — in other words, to use Elasticsearch as a document store.