Skip to content

Commit

Permalink
Replace usages of _source.mode in documentation (elastic#114743)
Browse files Browse the repository at this point in the history
We will deprecate the `_source.mode` mapping level configuration
in favor of the index-level `index.mapping.source.mode` setting.
As a result, we go through the documentation and update it to reflect
the introduction of the setting.
  • Loading branch information
salvatore-campagna authored and jfreden committed Nov 4, 2024
1 parent 8340707 commit 4377cff
Show file tree
Hide file tree
Showing 15 changed files with 252 additions and 43 deletions.
20 changes: 18 additions & 2 deletions docs/plugins/mapper-annotated-text.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,16 @@ duplicates removed. So:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"text": {
"type": "annotated_text",
Expand Down Expand Up @@ -215,8 +223,16 @@ are preserved.
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"text": { "type": "annotated_text", "store": true }
}
Expand Down
28 changes: 19 additions & 9 deletions docs/reference/mapping/fields/synthetic-source.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
==== Synthetic `_source`

IMPORTANT: Synthetic `_source` is Generally Available only for TSDB indices
(indices that have `index.mode` set to `time_series`). For other indices
(indices that have `index.mode` set to `time_series`). For other indices,
synthetic `_source` is in technical preview. Features in technical preview may
be changed or removed in a future release. Elastic will work to fix
any issues, but features in technical preview are not subject to the support SLA
Expand All @@ -11,15 +11,19 @@ of official GA features.
Though very handy to have around, the source field takes up a significant amount
of space on disk. Instead of storing source documents on disk exactly as you
send them, Elasticsearch can reconstruct source content on the fly upon retrieval.
Enable this by setting `mode: synthetic` in `_source`:
Enable this by using the value `synthetic` for the index setting `index.mapping.source.mode`:

[source,console,id=enable-synthetic-source-example]
----
PUT idx
{
"mappings": {
"_source": {
"mode": "synthetic"
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
}
}
Expand All @@ -38,7 +42,7 @@ properties when used with synthetic `_source`.
<<synthetic-source-fields-native-list, Most field types>> construct synthetic `_source` using existing data, most
commonly <<doc-values,`doc_values`>> and <<stored-fields, stored fields>>. For these field types, no additional space
is needed to store the contents of `_source` field. Due to the storage layout of <<doc-values,`doc_values`>>, the
generated `_source` field undergoes <<synthetic-source-modifications, modifications>> compared to original document.
generated `_source` field undergoes <<synthetic-source-modifications, modifications>> compared to the original document.

For all other field types, the original value of the field is stored as is, in the same way as the `_source` field in
non-synthetic mode. In this case there are no modifications and field data in `_source` is the same as in the original
Expand Down Expand Up @@ -227,10 +231,16 @@ For instance:
----
PUT idx_keep
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": {
"mode": "synthetic"
},
"properties": {
"path": {
"type": "object",
Expand Down
10 changes: 9 additions & 1 deletion docs/reference/mapping/types/aggregate-metric-double.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,16 @@ For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"agg_metric": {
"type": "aggregate_metric_double",
Expand Down
10 changes: 9 additions & 1 deletion docs/reference/mapping/types/boolean.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,16 @@ Synthetic source always sorts `boolean` fields. For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"bool": { "type": "boolean" }
}
Expand Down
12 changes: 10 additions & 2 deletions docs/reference/mapping/types/date.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ The following parameters are accepted by `date` fields:
<<ignore-malformed,`ignore_malformed`>>::

If `true`, malformed numbers are ignored. If `false` (default), malformed
numbers throw an exception and reject the whole document. Note that this
numbers throw an exception and reject the whole document. Note that this
cannot be set if the `script` parameter is used.

<<mapping-index,`index`>>::
Expand Down Expand Up @@ -248,8 +248,16 @@ Synthetic source always sorts `date` fields. For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"date": { "type": "date" }
}
Expand Down
10 changes: 9 additions & 1 deletion docs/reference/mapping/types/date_nanos.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,16 @@ Synthetic source always sorts `date_nanos` fields. For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"date": { "type": "date_nanos" }
}
Expand Down
30 changes: 27 additions & 3 deletions docs/reference/mapping/types/flattened.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,16 @@ For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"flattened": { "type": "flattened" }
}
Expand Down Expand Up @@ -367,8 +375,16 @@ For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"flattened": { "type": "flattened" }
}
Expand Down Expand Up @@ -407,8 +423,16 @@ For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"flattened": { "type": "flattened" }
}
Expand Down
10 changes: 9 additions & 1 deletion docs/reference/mapping/types/geo-point.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,16 @@ longitude) and reduces them to their stored precision. For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"point": { "type": "geo_point" }
}
Expand Down
10 changes: 9 additions & 1 deletion docs/reference/mapping/types/ip.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,16 @@ Synthetic source always sorts `ip` fields and removes duplicates. For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"ip": { "type": "ip" }
}
Expand Down
30 changes: 27 additions & 3 deletions docs/reference/mapping/types/keyword.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,16 @@ For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"kwd": { "type": "keyword" }
}
Expand Down Expand Up @@ -218,8 +226,16 @@ are preserved. For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"kwd": { "type": "keyword", "store": true }
}
Expand Down Expand Up @@ -248,8 +264,16 @@ For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"kwd": { "type": "keyword", "ignore_above": 3 }
}
Expand Down
20 changes: 18 additions & 2 deletions docs/reference/mapping/types/numeric.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,16 @@ Synthetic source always sorts numeric fields. For example:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"long": { "type": "long" }
}
Expand All @@ -287,8 +295,16 @@ Scaled floats will always apply their scaling factor so:
----
PUT idx
{
"settings": {
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
"mappings": {
"_source": { "mode": "synthetic" },
"properties": {
"f": { "type": "scaled_float", "scaling_factor": 0.01 }
}
Expand Down
Loading

0 comments on commit 4377cff

Please sign in to comment.