diff --git a/docs/reference/elasticsearch/mapping-reference/pattern-text.md b/docs/reference/elasticsearch/mapping-reference/pattern-text.md index 52a7727b4f0d5..bd82f05171d99 100644 --- a/docs/reference/elasticsearch/mapping-reference/pattern-text.md +++ b/docs/reference/elasticsearch/mapping-reference/pattern-text.md @@ -46,8 +46,18 @@ In both cases, all queries return a constant score of 1.0. ## Index sorting for improved compression The compression provided by `pattern_text` can be significantly improved if the index is sorted by the `template_id` field. -This sorting is not applied by default, but can be enabled for the `message` field of LogsDB indices (assuming it is of type `pattern_text`) by setting the index setting `index.logsdb.default_sort_on_message_template` to `true`. + + +### Default sorting for LogsDB +```{applies_to} +serverless: preview +stack: preview 9.3 +``` +This index sorting is not applied by default, but can be enabled for the `message` field of LogsDB indices (assuming it is of type `pattern_text`) by setting the index setting `index.logsdb.default_sort_on_message_template` to `true`. This will cause the index to be sorted by `host.name` (if present), then `message.template_id`, and finally by `@timestamp`. + + +### Custom sorting If the index is not LogsDB or the `pattern_text` field is named something other than `message`, index sorting can still be manually applied as shown in the following example. ```console @@ -73,6 +83,7 @@ PUT logs ``` + ## Parameters for pattern text fields [pattern-text-params] The following mapping parameters are accepted: