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

翻译 elasticsearch _source

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

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

The _source field is an automatically generated field that stores the actual JSON that was used as the indexed document. It is not indexed (searchable), just stored. When executing “fetch” requests, like get or search, the _source field is returned by default.

在用JSON建立文档索引时,_source field会自动生成存储。_source field没有被索引,所以搜索不到,它只是存储。当执行“取”的要求,如获取或搜索,_source字段默认情况下返回。

Though very handy to have around, the source field does incur storage overhead within the index. For this reason, it can be disabled. For example:

虽然非常方便生成source field,但在索引时,source field字段会产生存储开销。它可以被禁止。例如:

{
    "tweet" : {
        "_source" : {"enabled" : false}
    }
}

compression(压缩)

From version 0.90 onwards, all stored fields (including _source) are always compressed.
从0.90版本开始,所有存储领域(包括_source)始终处于压缩状态。

For versions before 0.90:
在0.90版本以前:

The source field can be compressed (LZF) when stored in the index. This can greatly reduce the index size, as well as possibly improving performance (when decompression overhead is better than loading a bigger source from disk). The code takes special care to decompress the source only when needed, for example decompressing it directly into the REST stream of a result.

在索引时,source field 存储,它可以被压缩(LZF)。这样就可以大大减少索引的大小,以及可能提高性能(磁盘加载一个大的source比解压缩更消耗性能)。这段代码(解压缩)仅仅适合特定场合,例如,直接解压到REST流的结果。

In order to enable compression, the compress option should be set to true. By default it is set to false. Note, this can be changed on an existing index, as a mix of compressed and uncompressed sources is supported.

为了能够压缩,这个compress选项应该为true。在默认情况下,该选项为false。注意,它可以改变已经存在的索引,也支持混合source(压缩的和非压缩)。

Moreover, a compress_threshold can be set to control when the source will be compressed. It accepts a byte size value (for example 100b, 10kb). Note, compress should be set to true.

此外,可以设置compress_threshold(压缩阀值)选项来控制将被压缩的source。它接受一个字节大小的值(例如,100b,10kb)。应注意,压缩设置为true。

includes/excludes(包含/排除)

Allow to specify paths in the source that would be included / excluded when it’s stored, supporting * as wildcard annotation. For example:

在存储source时,允许特定的路径可以被包含(存储)/排除(不存储),支持*通配符注解。例如:

{
    "my_type" : {
        "_source" : {
            "includes" : ["path1.*", "path2.*"],
            "excludes" : ["pat3.*"]
        }
    }
}

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

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

发表评论