mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-04-11 09:48:51 +00:00
65 lines
2.0 KiB
Plaintext
65 lines
2.0 KiB
Plaintext
[[mapping-source-field]]
|
|
=== `_source`
|
|
|
|
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
|
|
<<docs-get,get>> or
|
|
<<search-search,search>>, the `_source` field is
|
|
returned by default.
|
|
|
|
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,js]
|
|
--------------------------------------------------
|
|
{
|
|
"tweet" : {
|
|
"_source" : {"enabled" : false}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
|
|
[float]
|
|
==== Compression
|
|
|
|
*From version 0.90 onwards, all stored fields (including `_source`) are
|
|
always compressed.*
|
|
|
|
For versions before 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.
|
|
|
|
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.
|
|
|
|
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`.
|
|
|
|
[float]
|
|
==== 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,js]
|
|
--------------------------------------------------
|
|
{
|
|
"my_type" : {
|
|
"_source" : {
|
|
"includes" : ["path1.*", "path2.*"],
|
|
"excludes" : ["pat3.*"]
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|