Chris Moore 67cabe1ec5
Add documentation for config file settings (#4058)
* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 os.yml config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 os.yml config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 os.yml config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 os.yml config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 os.yml config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 os.yml config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* fix#214 config file settings

Signed-off-by: cwillum <cwmmoore@amazon.com>

* Refactor settings documentation

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add more settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* remove bad commits (#5505)

Signed-off-by: Stephen Crawford <steecraw@amazon.com>

* Format security settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add plugin settings and dashboards settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Specify json code highlighter

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add gateway and network settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Change heading level

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Heading text change

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Fix link

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add Notifications plugin settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Implemented tech review comments for search settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Rename directory and implement latest search setting review comment

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Remove non-existent ml circuit breaker settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add file system and s3 settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Update nav order

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add security analytics settings and specify static/dynamic for security settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Reword correlation time window

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Implemented tech review comments for network and discovery settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Apply suggestions from code review

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Implemented editorial comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Clarify security settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Apply suggestions from code review

Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Update _install-and-configure/configuring-opensearch/security-settings.md

Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Add cross links to static and dynamic settings

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Fix link

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

---------

Signed-off-by: cwillum <cwmmoore@amazon.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
Co-authored-by: Fanit Kolchina <kolchfa@amazon.com>
Co-authored-by: Stephen Crawford <65832608+scrawfor99@users.noreply.github.com>
Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
2023-11-16 16:33:15 -05:00

116 lines
4.6 KiB
Markdown
Executable File

---
layout: default
title: Configuring OpenSearch
nav_order: 10
has_children: true
redirect_from:
- /install-and-configure/configuring-opensearch/
- /opensearch/configuration/
---
# Configuring OpenSearch
There are two types of OpenSearch settings: [dynamic](#dynamic-settings) and [static](#static-settings).
## Dynamic settings
Dynamic index settings are settings that you can update at any time. You can configure dynamic OpenSearch settings through the Cluster Settings API. For details, see [Update cluster settings using the API](#updating-cluster-settings-using-the-api).
Whenever possible, use the Cluster Settings API; `opensearch.yml` is local to each node, whereas the API applies the setting to all nodes in the cluster.
{: .tip}
## Static settings
Certain operations are static and require you to modify the `opensearch.yml` [configuration file](#configuration-file) and restart the cluster. In general, these settings relate to networking, cluster formation, and the local file system. To learn more, see [Cluster formation]({{site.url}}{{site.baseurl}}/opensearch/cluster/).
## Specifying settings as environment variables
You can specify environment variables as arguments using `-E` when launching OpenSearch:
```bash
./opensearch -Ecluster.name=opensearch-cluster -Enode.name=opensearch-node1 -Ehttp.host=0.0.0.0 -Ediscovery.type=single-node
```
{% include copy.html %}
## Updating cluster settings using the API
The first step in changing a setting is to view the current settings by sending the following request:
```json
GET _cluster/settings?include_defaults=true
```
{% include copy-curl.html %}
For a more concise summary of non-default settings, send the following request:
```json
GET _cluster/settings
```
{% include copy-curl.html %}
Three categories of setting exist in the cluster settings API: persistent, transient, and default. Persistent settings, well, persist after a cluster restart. After a restart, OpenSearch clears transient settings.
If you specify the same setting in multiple places, OpenSearch uses the following precedence:
1. Transient settings
2. Persistent settings
3. Settings from `opensearch.yml`
4. Default settings
To change a setting, use the [Cluster Settings API]({{site.url}}{{site.baseurl}}/api-reference/cluster-api/cluster-settings/) and specify the new value as either persistent or transient. This example shows the flat settings form:
```json
PUT _cluster/settings
{
"persistent" : {
"action.auto_create_index" : false
}
}
```
{% include copy-curl.html %}
You can also use the expanded form, which lets you copy and paste from the GET response and change existing values:
```json
PUT _cluster/settings
{
"persistent": {
"action": {
"auto_create_index": false
}
}
}
```
{% include copy-curl.html %}
---
## Configuration file
You can find `opensearch.yml` in `/usr/share/opensearch/config/opensearch.yml` (Docker) or `/etc/opensearch/opensearch.yml` (most Linux distributions) on each node.
You can edit the `OPENSEARCH_PATH_CONF=/etc/opensearch` to change the config directory location. This variable is sourced from `/etc/default/opensearch`(Debian package) and `/etc/sysconfig/opensearch`(RPM package).
If you set your customized `OPENSEARCH_PATH_CONF` variable, be aware that other default environment variables will not be loaded.
You don't mark settings in `opensearch.yml` as persistent or transient, and settings use the flat form:
```yml
cluster.name: my-application
action.auto_create_index: true
compatibility.override_main_response_version: true
```
The demo configuration includes a number of [settings for the Security plugin]({{site.url}}{{site.baseurl}}/install-and-configure/configuring-opensearch/security-settings/) that you should modify before using OpenSearch for a production workload. To learn more, see [Security]({{site.url}}{{site.baseurl}}/security/).
### (Optional) CORS header configuration
If you are working on a client application running against an OpenSearch cluster on a different domain, you can configure headers in `opensearch.yml` to allow for developing a local application on the same machine. Use [Cross Origin Resource Sharing](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) so that your application can make calls to the OpenSearch API running locally. Add the following lines in your `custom-opensearch.yml` file (note that the "-" must be the first character in each line).
```yml
- http.host:0.0.0.0
- http.port:9200
- http.cors.allow-origin:"http://localhost"
- http.cors.enabled:true
- http.cors.allow-headers:X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization
- http.cors.allow-credentials:true
```