# Meta-Fields（元字段）

原文链接 : [https://www.elastic.co/guide/en/elasticsearch/reference/5.3/mapping-fields.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/mapping-fields.html)

译文链接 : [http://www.apache.wiki/pages/viewpage.action?pageId=9405203](http://www.apache.wiki/pages/viewpage.action?pageId=9405203)

贡献者 : [朱彦安](/display/~zhuyanan)，[ApacheCN](/display/~apachecn)，[Apache中文网](/display/~apachechina)

每个文档都有与之关联的元数据，比如 `**_index**，``**[_type](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-type-field.html "_type field") **和 `**`_id `**元字段。当创建 **mapping** **type**（映射类型）时，可以自定义一些这些元字段的行为。

###  Identity meta-fields（身份的元字段）

| [_index](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index-field.html) | 文档所属的索引。 |
| [_uid](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-uid-field.html) | 复合字段包含了**_type **和 **_id** 。 |
| [_type](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-type-field.html) | 文档的 [mapping type（映射类型 ）](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html#mapping-type) 。 |
| [_id](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-id-field.html) | 文档 ID。 |

###  Document source meta-fields（文档源的元字段）

[`_source`](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html "_source field")

原始的 **JSON **字符串表示文档的正文。

 [`_size`](https://www.elastic.co/guide/en/elasticsearch/plugins/5.3/mapper-size.html)

 **_source **字段的大小（以字节为单位），由 [mapper-size](https://www.elastic.co/guide/en/elasticsearch/plugins/5.3/mapper-size.html) 插件提供。

###  Indexing meta-fields（索引的元字段）

[`_all`](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-all-field.html "_all field")

一个索引其他全部字段值的全能字段。

 [`_field_names`](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-field-names-field.html "_field_names field")

 文档中包含非空值的所有字段。

### Routing meta-fields（路由的元字段）

[`_parent`](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-parent-field.html "_parent field")

用于创建两个映射类型之间的父子关系。

[`_routing`](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-routing-field.html "_routing field")

将文档路由到特定分片的自定义路由值。

###  Other meta-field（其他的元字段）

[`_meta`](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-meta-field.html "_meta field")

 特定应用的元数据。