Skip to content

Commit 854c98e

Browse files
docs: Document typed config overrides
1 parent 6135034 commit 854c98e

1 file changed

Lines changed: 19 additions & 72 deletions

File tree

docs/modules/opensearch/pages/usage-guide/configuration-environment-overrides.adoc

Lines changed: 19 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -35,89 +35,36 @@ nodes:
3535
config: {}
3636
----
3737

38-
All override property values must be strings.
39-
They are added unchanged to the configuration file.
40-
Care must be taken to produce a valid configuration.
41-
42-
For a list of configuration options, we refer to the
43-
https://docs.opensearch.org/docs/latest/install-and-configure/configuring-opensearch/index/[Configuring OpenSearch{external-link-icon}^] section in the OpenSearch documentation.
44-
45-
The file `opensearch.yml` is a YAML file, where deep structures are possible.
46-
On the other hand, `configOverrides` are only flat key-value pairs.
47-
Fortunately, this is not a problem because the OpenSearch YAML parser allows both representations.
48-
Keys can be flattened as follows:
38+
Property values must be strings when defined as key-value pairs.
39+
To override properties using other types or nested structures, use a JSON merge patch by placing the properties under `jsonMergePatch`:
4940

5041
[source,yaml]
5142
----
52-
# File: opensearch.yml
53-
54-
plugins.security.restapi.roles_enabled: all_access
55-
56-
# is equivalent to
57-
58-
plugins:
59-
security:
60-
restapi:
61-
roles_enabled: all_access
43+
nodes:
44+
configOverrides:
45+
opensearch.yml:
46+
jsonMergePatch:
47+
plugins.security.restapi.roles_enabled: all_access
48+
cluster.routing.allocation.disk.threshold_enabled: false
49+
plugins.security.authcz.admin_dn:
50+
- CN=opensearch-admin-certificate
6251
----
6352

64-
Lists can be flattened as follows:
53+
The entire configuration file can be replaced using the `userProvided` property:
6554

6655
[source,yaml]
6756
----
68-
# File: opensearch.yml
69-
70-
# as a comma-separated list: <1>
71-
plugins.security.restapi.roles_enabled: role1,role2,role3
72-
73-
# as a JSON list: <2>
74-
plugins.security.restapi.roles_enabled: ["role1", "role2", "role3"]
75-
76-
# as an indexed flat list: <3>
77-
plugins.security.restapi.roles_enabled.0: role1
78-
plugins.security.restapi.roles_enabled.1: role2
79-
plugins.security.restapi.roles_enabled.2: role3
80-
81-
# All options above are equivalent to
82-
83-
plugins:
84-
security:
85-
restapi:
86-
roles_enabled:
87-
- role1
88-
- role2
89-
- role3
90-
----
91-
<1> Commas in list entries cannot be escaped.
92-
<2> The brackets must be escaped in `configOverrides` as follows: `"[\"role1\", \"role2\", \"role3\"]"`
93-
<3> Indexed flat lists are considered "legacy" in the OpenSearch code.
94-
// see https://github.com/opensearch-project/OpenSearch/blob/3.4.0/server/src/main/java/org/opensearch/common/settings/Settings.java#L1049
95-
96-
Other types can be set as strings in `configOverrides` because OpenSearch parses them:
97-
98-
[source,yaml]
57+
nodes:
58+
configOverrides:
59+
opensearch.yml:
60+
userProvided:
61+
plugins.security.restapi.roles_enabled: all_access
9962
----
100-
# File: opensearch.yml
10163

102-
# Boolean as string
103-
cluster.blocks.read_only: "true"
64+
NOTE: Replacing the entire configuration file is not recommended, as all properties normally managed by the operator must be explicitly provided to obtain a working OpenSearch cluster.
10465

105-
# Integer as string
106-
cluster.max_shards_per_node: "10000"
107-
108-
# Floating point as string
109-
cluster.routing.allocation.balance.index: "0.6"
110-
111-
# Time unit as string
112-
cluster.info.update.interval: "10s"
113-
114-
# The options above are equivalent to
115-
116-
cluster.blocks.read_only: true
117-
cluster.max_shards_per_node: 10000
118-
cluster.routing.allocation.balance.index: 0.6
119-
cluster.info.update.interval: 10s
120-
----
66+
For a list of configuration options, we refer to the
67+
https://docs.opensearch.org/docs/latest/install-and-configure/configuring-opensearch/index/[Configuring OpenSearch{external-link-icon}^] section in the OpenSearch documentation.
12168

12269
== Environment Variables
12370

0 commit comments

Comments
 (0)