Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backend documentation about configuring ISM notifications #4210

Merged
merged 27 commits into from
Jun 6, 2023
Merged
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d74fea6
Add new documentation page
vagimeli May 31, 2023
a89b20d
Add new documentation
vagimeli May 31, 2023
d2549f2
Writing
vagimeli Jun 2, 2023
9604af4
Writing
vagimeli Jun 2, 2023
60bb347
Fix code example format
vagimeli Jun 2, 2023
c79118e
Copy editing
vagimeli Jun 2, 2023
f7578db
Copy editing
vagimeli Jun 2, 2023
4e258c0
Spelling error
vagimeli Jun 2, 2023
3b9ebf3
Add console sentence
vagimeli Jun 2, 2023
9a6c583
Address tech review feedback
vagimeli Jun 5, 2023
97c49ac
Address doc review comments
vagimeli Jun 5, 2023
b88f59c
Address doc review changes
vagimeli Jun 5, 2023
7a69931
Address doc review comments
vagimeli Jun 5, 2023
b60361b
Address doc review feedback
vagimeli Jun 5, 2023
03b6238
Address doc review feedback
vagimeli Jun 5, 2023
00505d4
Add more info to notification settings
kolchfa-aws Jun 6, 2023
51d5a5e
Merge branch 'main' into api-config-notice
kolchfa-aws Jun 6, 2023
8fb40aa
Reword for clarity
kolchfa-aws Jun 6, 2023
4ace6b2
Implemented tech review comments
kolchfa-aws Jun 6, 2023
c8322bd
Update _im-plugin/notifications-settings.md
kolchfa-aws Jun 6, 2023
5e75b59
Update _im-plugin/notifications-settings.md
kolchfa-aws Jun 6, 2023
7e67cff
Update _im-plugin/notifications-settings.md
kolchfa-aws Jun 6, 2023
91de742
Update _im-plugin/notifications-settings.md
kolchfa-aws Jun 6, 2023
23d608b
Update _im-plugin/notifications-settings.md
kolchfa-aws Jun 6, 2023
941d049
Update _im-plugin/notifications-settings.md
kolchfa-aws Jun 6, 2023
76b1557
Update _im-plugin/notifications-settings.md
kolchfa-aws Jun 6, 2023
022e41f
Doc review comments
kolchfa-aws Jun 6, 2023
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
190 changes: 190 additions & 0 deletions _im-plugin/notifications-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
---
layout: default
title: Notification settings
nav_order: 100
---

# Notification settings

Introduced 2.8
{: .label .label-purple }

Use notification settings to configure notifications about long-running index operations. Set up automatic [notifications]({{site.url}}{{site.baseurl}}/observing-your-data/notifications/index/) when long-running index operations are complete by [using Notifications in OpenSearch Dashboards]({{site.url}}{{site.baseurl}}/dashboards/im-dashboards/notifications/) or through the API.
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

Configuring notification settings is useful for long-running index operations, such as `open`, `reindex`, `resize`, and `force merge`. When you send a request for those operations and set the `wait_for_completion` parameter to `false`, the operation will return immediately and the response will contain a task ID. You can use that task ID to configure notifications for this operation.
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

## Configuring notification settings

When creating long-running operation notifications using the API, you can configure the `lron_config` using the `task_id` and `action_name` parameters as follows:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When creating long-running operation notifications using the API, you can configure the `lron_config` using the `task_id` and `action_name` parameters as follows:
When creating long-running operation notifications using the API, you can configure the `lron_config` object using the `task_id` and `action_name` parameters as follows:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded.


- **One-time task**: If you pass a `task_id` in the `lron_config` object, the task is one-time and the setting is automatically deleted when the task ends. If you pass both `task_id` and `action_name`, `action_name` is ignored but may be useful to you for searching and debugging notification settings.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the wording "One-time setting" or "Global, persistent setting" may be better. The "task" here may cause confusion with the "task_id" task.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhichao-aws Implemented, thanks. The PR is ready for your final review.

- **Global, persistent task**: If you pass an `action_name` and don't pass a `task_id` in the `lron_config` object, the task is global, persistent, and applies to all operations of this action type.

The following table lists the parameters for long-running index operation notifications.

| Parameter | Type | Description |
| :--- | :--- | :--- |
| `lron_config` | Object | Long-running index operation notification configuration. |
| `task_id` | String | The task ID of the task that you want to be notified about. Optional. One of `task_id` and `action_name` must be specified.|
| `action_name` | String | The operation type that you want to be notified about. Provide `action_name` but not `task_id` to be notified of all operations of this type. Supported values are `indices:data/write/reindex`, `indices:admin/resize`, `indices:admin/forcemerge`, and `indices:admin/open`. Optional. One of `task_id` and `action_name` must be specified. |
| `lron_condition` | Object | Specifies which events you want to be notified about. Optional. If not provided, you'll be notified of both the operation success and failure. |
| `lron_condition.success` | Boolean | Set this parameter to `true` to be notified when the operation succeeds. Optional. Default is `true`. |
| `lron_condition.failure` | Boolean | Set this parameter to `true` to be notified when the operation fails or times out. Optional. Default is `true`. |
| `channels` | Object | Supported communication channels include Amazon Chime, Amazon Simple Notification Service (Amazon SNS), Amazon Simple Email Service (Amazon SES), email through SMTP, Slack, and custom webhooks. If either `lron_condition.success` or `lron_condition.failure` is `true`, `channels` must contain at least one channel. Learn how to configure notification channels in [Notifications]({{site.url}}{{site.baseurl}}/observing-your-data/notifications/index/). |

## Create notification settings

The following example request sets up notifications on a failure of a reindex task:

```json
POST /_plugins/_im/lron
{
"lron_config": {
"task_id":"dQlcQ0hQS2mwF-AQ7icCMw:12354",
"action_name":"indices:data/write/reindex",
"lron_condition": {
"success": false,
"failure": true
},
"channels":[
{"id":"channel1"},
{"id":"channel2"}
]
}
}
```
vagimeli marked this conversation as resolved.
Show resolved Hide resolved
{% include copy-curl.html %}

The preceding request results in the following response:

```json
{
"_id": "LRON:dQlcQ0hQS2mwF-AQ7icCMw:12354",
"lron_config": {
"lron_condition": {
"success": false,
"failure": true
},
"task_id": "dQlcQ0hQS2mwF-AQ7icCMw:12354",
"action_name": "indices:data/write/reindex",
"channels": [
{
"id": "channel1"
},
{
"id": "channel2"
}
]
}
}
```

### Notification setting ID

The response returns an ID for the notification setting in the `_id` field. You can use this ID to read, update, or delete this notification setting. For a global `lron_config`, the ID is in the form `LRON:<action_name>` (for example, `LRON:indices:data/write/reindex`).

The `action_name` may contain a slash character (`/`), which must be HTTP encoded as `%2F` if you use it the Dev Tools console. For example, `LRON:indices:data/write/reindex` becomes `LRON:indices:data%2Fwrite%2Freindex`.
{: .important}

For a task `lron_config`, the ID is in the form `LRON:<task ID>`.

## Retrieve notification settings

The following examples retrieve the current configured notification settings.

Use the following request to retrieve a notification setting with the specified [notification setting ID](#notification-setting-id):

```json
GET /_plugins/_im/lron/<lronID>
```
{% include copy-curl.html %}

Use the following request to retrieve all notification settings:

```json
GET /_plugins/_im/lron
```
{% include copy-curl.html %}

The response contains all configured notification settings with their IDs:

```json
{
"lron_configs": [
{
"_id": "LRON:dQlcQ0hQS2mwF-AQ7icCMw:12354",
"lron_config": {
xxxxxxxxx
}
},
{
"_id": "LRON:dQlcQ0hQS2mwF-AQ7icCMw:12355",
"lron_config": {
xxxxxxxxx
}
}
],
"total_number": 2
}
```

## Update notification settings

The following example modifies an existing notification setting with the specified [notification setting ID](#notification-setting-id):

```json
PUT /_plugins/_im/lron/<lronID>
{
"lron_config": {
"task_id":"dQlcQ0hQS2mwF-AQ7icCMw:12354",
"action_name":"indices:data/write/reindex",
"lron_condition": {
"success": false,
"failure": true
},
"channels":[
{"id":"channel1"},
{"id":"channel2"}
]
}
}
```
{% include copy-curl.html %}

The response contains the updated setting:

```json
{
"_id": "LRON:dQlcQ0hQS2mwF-AQ7icCMw:12354",
"lron_config": {
"lron_condition": {
"success": false,
"failure": true
},
"task_id": "dQlcQ0hQS2mwF-AQ7icCMw:12354",
"action_name": "indices:data/write/reindex",
"channels": [
{
"id": "channel1"
},
{
"id": "channel2"
}
]
}
}
```

## Delete notification settings

The following example shows how to remove a notifications setting with the specified [notification setting ID](#notification-setting-id):
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

```json
DELETE /_plugins/_im/lron/<lronID>
```
{% include copy-curl.html %}

## Next steps

- Learn more about the [ISM API]({{site.url}}{{site.baseurl}}/im-plugin/ism/api/).
- Learn more about the [Notifications]({{site.url}}{{site.baseurl}}/observing-your-data/notifications/index/) application.