当前位置: 首页 > elasticsearch, 搜索 > 正文

翻译 elasticsearch _id

关键字:
1 星2 星3 星4 星5 星 (1 次投票, 评分: 5.00, 总分: 5)
Loading ... Loading ...
baidu_share

原文地址:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-id-field.html

Each document indexed is associated with an id and a type. The _id field can be used to index just the id, and possible also store it. By default it is not indexed and not stored (thus, not created).

每个文档索引都有一个id和type。_id field被运来索引id,可能还存储它。在默认情况下,它是不索引和不存储(因此,没有创建)。

Note, even though the _id is not indexed, all the APIs still work (since they work with the _uid field), as well as fetching by ids using term, terms or prefix queries/filters (including the specific ids query/filter).

注意:即使_id没有被索引,所有的APIs仍能工作(他们使用_uid),以及通过ids获取term,前缀查询,过滤(包括通过制定ids的过滤和查询)。也就是说,_id没有被索引,所有操作通过_uid来工作。

The _id field can be enabled to be indexed, and possibly stored, using:
_id field可以被索引和存储。

{
    "tweet" : {
        "_id" : {"index": "not_analyzed", "store" : "yes"}
    }
}

In order to maintain backward compatibility, a node level setting index.mapping._id.indexed can be set to true to make sure that the id is indexed when upgrading to 0.16, though it’s recommended to not index the id.

为了保持向后兼容,在一个节点级别设置index.mapping._id.indexed为true是为了当升级到0.16版本时,id是被索引的。但建议没有索引的id。

The _id mapping can also be associated with a path that will be used to extract the id from a different location in the source document. For example, having the following mapping:

_id映射可以相关联一个路径。这个路径可以来自源文档的不同地方。也就是说,_id 值也可以使用文档中别的field。例如,有下面的映射:

{
    "tweet" : {
        "_id" : {
            "path" : "post_id"
        }
    }
}

Will cause 1 to be used as the id for:
将被用作id值为1使用:

{
    "message" : "You know, for Search",
    "post_id" : "1"
}

This does require an additional lightweight parsing step while indexing, in order to extract the id to decide which shard the index operation will be executed on.

当索引时,这需要一个额外的轻量花销去索引解析(即通过post_id得打id,需要一点代价)。为了提取id,以决定​​哪些shard(分片)将执行索引操作。

本文固定链接: http://www.chepoo.com/translate-elasticsearch-_id.html | IT技术精华网

翻译 elasticsearch _id:等您坐沙发呢!

发表评论