Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .translation-cache/Server_settings/Searchd.md.json

Large diffs are not rendered by default.

484 changes: 246 additions & 238 deletions manual/chinese/Server_settings/Searchd.md

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions manual/english/Server_settings/Searchd.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,24 @@ expansion_phrase_warning = 1

This setting specifies whether timed grouping in API and SQL will be calculated in the local timezone or in UTC. It is optional, with a default value of 0 (meaning 'local timezone').

By default, all 'group by time' expressions (like group by day, week, month, and year in API, also group by day, month, year, yearmonth, yearmonthday in SQL) are done using local time. For example, if you have documents with attributes timed `13:00 utc` and `15:00 utc`, in the case of grouping, they both will fall into facility groups according to your local timezone setting. If you live in `utc`, it will be one day, but if you live in `utc+10`, then these documents will be matched into different `group by day` facility groups (since 13:00 utc in UTC+10 timezone is 23:00 local time, but 15:00 is 01:00 of the next day). Sometimes such behavior is unacceptable, and it is desirable to make time grouping not dependent on timezone. You can run the server with a defined global TZ environment variable, but it will affect not only grouping but also timestamping in the logs, which may be undesirable as well. Switching 'on' this option (either in config or using [SET global](../Server_settings/Setting_variables_online.md#SET) statement in SQL) will cause all time grouping expressions to be calculated in UTC, leaving the rest of time-depentend functions (i.e. logging of the server) in local TZ.
By default, all 'group by time' expressions (like group by day, week, month, and year in API, also group by day, month, year, yearmonth, yearmonthday in SQL) are done using the timezone configured for time functions (see the `timezone` setting or `TZ` environment variable). For example, if you have documents with attributes timed `13:00 utc` and `15:00 utc`, in the case of grouping, they both will fall into facility groups according to your timezone setting. If you live in `utc`, it will be one day, but if you live in `utc+10`, then these documents will be matched into different `group by day` facility groups (since 13:00 utc in UTC+10 timezone is 23:00 local time, but 15:00 is 01:00 of the next day). Sometimes such behavior is unacceptable, and it is desirable to make time grouping not dependent on timezone. Switching 'on' this option (either in config or using [SET global](../Server_settings/Setting_variables_online.md#SET) statement in SQL) will cause all time grouping expressions to be calculated in UTC, regardless of the timezone setting.

**Note:** Logging always uses the actual system local timezone (determined from `/etc/localtime` on Unix-like systems), regardless of the `TZ` environment variable or the `timezone` config setting. This ensures that log timestamps reflect the actual system time, which is useful for debugging and monitoring.


### timezone

This setting specifies the timezone to be used by date/time-related functions. By default, the local timezone is used, but you can specify a different timezone in IANA format (e.g., `Europe/Amsterdam`).
This setting specifies the timezone to be used by date/time-related functions (such as `NOW()`, `CURTIME()`, `FROM_UNIXTIME()`, etc.). By default, the system's local timezone is used, but you can specify a different timezone in IANA format (e.g., `Europe/Amsterdam` or `Asia/Singapore`).

Note that this setting has no impact on logging, which always operates in the local timezone.
**Timezone resolution order:**
1. If the `timezone` config setting is explicitly set, it takes precedence.
2. Otherwise, if the `TZ` environment variable is set, it is used.
3. If neither is set, the system's local timezone (from `/etc/localtime` on Unix-like systems) is used.

Also, note that if `grouping_in_utc` is used, the 'group by time' function will still use UTC, while other date/time-related functions will use the specified timezone. Overall, it is not recommended to mix `grouping_in_utc` and `timezone`.
**Important notes:**
- **Logging**: Logging always uses the actual system local timezone (determined from `/etc/localtime`), regardless of the `TZ` environment variable or the `timezone` config setting. This ensures that log timestamps reflect the actual system time, which is useful for debugging and monitoring.
- **Time functions**: Date/time-related functions respect the `timezone` config setting or `TZ` environment variable if set, otherwise they use the system local timezone.
- **Grouping**: If `grouping_in_utc` is enabled, the 'group by time' function will use UTC, while other date/time-related functions will use the timezone specified by this setting. Overall, it is not recommended to mix `grouping_in_utc` and `timezone`.

You can configure this option either in the config or by using the [SET global](../Server_settings/Setting_variables_online.md#SET) statement in SQL.

Expand Down
Loading