Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 707c60681a | |||
| dc24a0cd84 | |||
| d6c5440900 | |||
| 0415843a16 | |||
| bcf443f976 | |||
| 31003b1523 | |||
| d313fd2e8f | |||
| b55e3f7e95 | |||
| a3a1795ab5 | |||
| 164ead7dbd | |||
| 19fb0d0948 | |||
| 57d7ee0aaa |
@@ -93,7 +93,7 @@ public class RESTClientSample {
|
||||
HashMap<String, Object> mapping = new HashMap<String, Object>();
|
||||
mapping.put("properties", ageMapping);
|
||||
createIndexRequest.mapping(mapping);
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(createIndexRequest, RequestOptions.DEFAULT
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
|
||||
|
||||
//Adding data to the index.
|
||||
IndexRequest request = new IndexRequest("custom-index"); //Add a document to the custom-index we created.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
message: "🔥 [OpenSearch 1.0 released on July 12th! Get it now!](/downloads.html)"
|
||||
@@ -0,0 +1 @@
|
||||
message: "🌡️ [OpenSearch 1.1.0 is here, get it while it's hot!](/downloads.html)"
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"current": "1.0",
|
||||
"past": []
|
||||
}
|
||||
+5
-24
@@ -31,33 +31,14 @@ To get started, choose **Index Management** in OpenSearch Dashboards.
|
||||
|
||||
A policy is a set of rules that describes how an index should be managed. For information about creating a policy, see [Policies]({{site.url}}{{site.baseurl}}/im-plugin/ism/policies/).
|
||||
|
||||
You can use the visual editor or JSON editor to create policies. Compared to the JSON editor, the visual editor offers a more structured way of defining policies by separating the process into creating error notifications, defining ISM templates, and adding states. We recommend using the visual editor if you want to see pre-defined fields, such as which actions you can assign to a state or under what conditions a state can transition into a destination state.
|
||||
|
||||
#### Visual editor
|
||||
|
||||
1. Choose the **Index Policies** tab.
|
||||
2. Choose **Create policy**.
|
||||
3. Choose **Visual editor**.
|
||||
4. In the **Policy info** section, enter a policy ID and an optional description.
|
||||
5. In the **Error notification** section, set up an optional error notification that gets sent whenever a policy execution fails. For more information, see [Error notifications]({{site.url}}{{site.baseurl}}/im-plugin/ism/policies#error-notifications).
|
||||
6. In **ISM templates**, enter any ISM template patterns to automatically apply this policy to existing and future indices. For example, if you specify a template of `sample-index*`, the ISM plugin automatically applies this policy to any indices whose names start with `sample-index`.
|
||||
7. In **States**, add any states you want to include in the policy. Each state has [actions]({{site.url}}{{site.baseurl}}/im-plugin/ism/policies/#actions) the plugin executes when the index enters a certain state, and [transitions]({{site.url}}{{site.baseurl}}/im-plugin/ism/policies/#transitions), which have conditions that, when met, transition the index into a destination state. The first state you create in a policy is automatically set as the initial state. Each policy must have at least one state, but actions and transitions are optional.
|
||||
8. Choose **Create**.
|
||||
3. In the **Name policy** section, enter a policy ID.
|
||||
4. In the **Define policy** section, enter your policy.
|
||||
5. Choose **Create**.
|
||||
|
||||
|
||||
#### JSON editor
|
||||
|
||||
1. Choose the **Index Policies** tab.
|
||||
2. Choose **Create policy**.
|
||||
3. Choose **JSON editor**.
|
||||
4. In the **Name policy** section, enter a policy ID.
|
||||
5. In the **Define policy** section, enter your policy.
|
||||
6. Choose **Create**.
|
||||
|
||||
After you create a policy, your next step is to attach it to an index or indices.
|
||||
You can set up an `ism_template` in the policy so when an index that matches the ISM template pattern is created, the plugin automatically attaches the policy to the index.
|
||||
|
||||
The following example demonstrates how to create a policy that automatically gets attached to all indices whose names start with `index_name-`.
|
||||
After you create a policy, your next step is to attach this policy to an index or indices.
|
||||
You can set up an `ism_template` in the policy so when you create an index that matches the ISM template pattern, the index will have this policy attached to it:
|
||||
|
||||
```json
|
||||
PUT _plugins/_ism/policies/policy_id
|
||||
|
||||
@@ -39,7 +39,7 @@ Field | Description | Type | Required | Read Only
|
||||
|
||||
---
|
||||
|
||||
## States
|
||||
## States
|
||||
|
||||
A state is the description of the status that the managed index is currently in. A managed index can be in only one state at a time. Each state has associated actions that are executed sequentially on entering a state and transitions that are checked after all the actions have been completed.
|
||||
|
||||
@@ -71,7 +71,7 @@ The `retry` operation has the following parameters:
|
||||
Parameter | Description | Type | Required | Default
|
||||
:--- | :--- |:--- |:--- |
|
||||
`count` | The number of retry counts. | `number` | Yes | -
|
||||
`backoff` | The backoff policy type to use when retrying. Valid values are Exponential, Constant, and Linear. | `string` | No | Exponential
|
||||
`backoff` | The backoff policy type to use when retrying. | `string` | No | Exponential
|
||||
`delay` | The time to wait between retries. Accepts time units for minutes, hours, and days. | `time unit` | No | 1 minute
|
||||
|
||||
The following example action has a timeout period of one hour. The policy retries this action three times with an exponential backoff policy, with a delay of 10 minutes between each retry:
|
||||
@@ -558,9 +558,11 @@ The following sample template policy is for a rollover use case.
|
||||
PUT _index_template/ism_rollover
|
||||
{
|
||||
"index_patterns": ["log*"],
|
||||
"settings": {
|
||||
"template": {
|
||||
"settings": {
|
||||
"plugins.index_state_management.rollover_alias": "log"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -586,6 +588,12 @@ The following sample template policy is for a rollover use case.
|
||||
}
|
||||
```
|
||||
|
||||
5. Verify if the policy is attached to the `log-000001` index:
|
||||
|
||||
```json
|
||||
GET _plugins/_ism/explain/log-000001?pretty
|
||||
```
|
||||
|
||||
## Example policy
|
||||
|
||||
The following example policy implements a `hot`, `warm`, and `delete` workflow. You can use this policy as a template to prioritize resources to your indices based on their levels of activity.
|
||||
@@ -659,6 +667,6 @@ After 30 days, the policy moves this index into a `delete` state. The service se
|
||||
}
|
||||
```
|
||||
|
||||
This diagram shows the `states`, `transitions`, and `actions` of the above policy as a finite-state machine. For more information about finite-state machines, see [Wikipedia](https://en.wikipedia.org/wiki/Finite-state_machine).
|
||||
This diagram shows the `states`, `transitions`, and `actions` of the above policy as a finite-state machine. For more information about finite-state machines, see [Wikipedia](https://en.wikipedia.org/wiki/Finite-state_machine).
|
||||
|
||||

|
||||
|
||||
@@ -6,3 +6,9 @@
|
||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3.0.1/es5/tex-mml-chtml.js"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if jekyll.environment == "development" %}
|
||||
<script src="{{ '/assets/js/version-selector.js' | relative_url }}"></script>
|
||||
{% else %}
|
||||
<script src="{{ '/docs/latest/assets/js/version-selector.js' }}"></script>
|
||||
{% endif %}
|
||||
|
||||
@@ -57,6 +57,10 @@ layout: table_wrappers
|
||||
</a>
|
||||
</div>
|
||||
<nav role="navigation" aria-label="Main" id="site-nav" class="site-nav">
|
||||
{% assign past_versions = site.data.versions.past | join: ";" %}
|
||||
<div class="version-wrapper">
|
||||
<version-selector selected="{{ site.data.versions.current }}"></version-selector>
|
||||
</div>
|
||||
{% assign pages_top_size = site.html_pages
|
||||
| where_exp:"item", "item.title != nil"
|
||||
| where_exp:"item", "item.parent == nil"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
$content-width: 900px;
|
||||
|
||||
//
|
||||
// Brand colors
|
||||
//
|
||||
|
||||
@@ -60,7 +60,7 @@ code {
|
||||
}
|
||||
|
||||
.site-nav {
|
||||
padding-top: 2rem;
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.nav-category {
|
||||
@@ -389,7 +389,7 @@ html {
|
||||
|
||||
body {
|
||||
@include serif;
|
||||
@include font-size(18);
|
||||
@include font-size(16);
|
||||
background: $background-lightest;
|
||||
color: $text;
|
||||
line-height: 1.6;
|
||||
@@ -962,6 +962,7 @@ main {
|
||||
line-height: 1.3;
|
||||
padding: 1px 0 6px;
|
||||
margin: .45em 0 .35em;
|
||||
letter-spacing: -1px;
|
||||
|
||||
@include mq(md) {
|
||||
@include font-size(32, true);
|
||||
@@ -975,6 +976,7 @@ main {
|
||||
a {
|
||||
font-weight: 300;
|
||||
background: none;
|
||||
color: $text-link-alternate;
|
||||
|
||||
&:hover, :active {
|
||||
background: none;
|
||||
@@ -1082,6 +1084,11 @@ main {
|
||||
@include sans-serif;
|
||||
@include warning-stripes;
|
||||
|
||||
/* To match the website */
|
||||
font-size: 1.125rem;
|
||||
text-decoration-thickness: 0.5px;
|
||||
text-underline-offset: 1px;
|
||||
|
||||
a {
|
||||
color: $text;
|
||||
|
||||
@@ -1102,3 +1109,17 @@ main {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.version-wrapper {
|
||||
text-align: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
version-selector {
|
||||
z-index: 1;
|
||||
font-size: .9rem;
|
||||
|
||||
--normal-bg: linear-gradient(#{lighten($blue-300, 5%)}, #{darken($blue-300, 2%)});
|
||||
--hover-bg: linear-gradient(#{lighten($blue-300, 2%)}, #{darken($blue-300, 4%)});
|
||||
--link-color: #{$blue-300};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
const PREFIX = "OpenSearch ";
|
||||
const tpl = `
|
||||
<style>
|
||||
:host {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
font-size: 1em;
|
||||
user-select: none;
|
||||
margin: 3px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
text-decoration: none;
|
||||
color: #FFFFFF;
|
||||
background-color: #00509c;
|
||||
background-image: var(--normal-bg);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.12);
|
||||
border-radius: 4px;
|
||||
padding: 0.3em 3em 0.3em 1em;
|
||||
margin: 0;
|
||||
|
||||
position: relative;
|
||||
display: block;
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#root:hover {
|
||||
background-image: var(--hover-bg);
|
||||
}
|
||||
|
||||
#root:focus:hover {
|
||||
box-shadow: 0 0 0 3px rgba(0, 0, 255, 0.25);
|
||||
}
|
||||
|
||||
#root:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
bottom: 5px;
|
||||
width: 0;
|
||||
border-width: 0 1px;
|
||||
border-color: #000 rgba(0, 0, 0, .2) #000 rgba(255, 255, 255, .6);
|
||||
right: 2em;
|
||||
border-style: solid;
|
||||
background-blend-mode: multiply;
|
||||
}
|
||||
|
||||
#root > svg {
|
||||
position: absolute;
|
||||
right: .5em;
|
||||
top: .6em;
|
||||
}
|
||||
|
||||
#dropdown {
|
||||
position: absolute;
|
||||
min-width: calc(100% - 2px);
|
||||
top: 100%;
|
||||
left: 0;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.12);
|
||||
|
||||
margin: -5px 1px 0 1px;
|
||||
padding-top: 5px;
|
||||
white-space: nowrap;
|
||||
border-radius: 0 0 4px 4px;
|
||||
|
||||
background: #fff;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
:host(:not([aria-expanded="true"])) #dropdown {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#spacer {
|
||||
appearance: none;
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
height: 0;
|
||||
margin: 0 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#spacer > a,
|
||||
#dropdown > a {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
padding: 0.3em calc(3em - 1px) 0.3em calc(1em - 1px);
|
||||
border-bottom: 1px solid #eee;
|
||||
text-decoration: none;
|
||||
color: var(--link-color);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#dropdown > a:last-child {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
#dropdown > a:hover {
|
||||
background: #efefef;
|
||||
}
|
||||
|
||||
a.latest:after {
|
||||
content: "LATEST";
|
||||
position: absolute;
|
||||
right: .4rem;
|
||||
font-size: 0.6em;
|
||||
font-weight: 700;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
<a id="root" role="button" aria-labelledby="selected" aria-controls="dropdown" tabindex="0">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6l6-6"/></g></svg>
|
||||
<span id="selected"></span>
|
||||
</a>
|
||||
<div id="dropdown" role="navigation"></div>
|
||||
<div id="spacer" aria-hidden="true"></div>
|
||||
`;
|
||||
|
||||
class VersionSelector extends HTMLElement {
|
||||
static get observedAttributes() {
|
||||
return ['selected'];
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.attachShadow({mode: 'open'});
|
||||
this._onBlur = (e => {
|
||||
this._expand(false);
|
||||
this.removeEventListener('blur', this._onBlur);
|
||||
}).bind(this);
|
||||
}
|
||||
|
||||
async connectedCallback() {
|
||||
const {shadowRoot} = this;
|
||||
const frag = this._makeFragment(tpl);
|
||||
|
||||
frag.querySelector('#selected').textContent = `${PREFIX}${this.getAttribute('selected')}`;
|
||||
|
||||
const pathName = location.pathname.replace(/\/docs(\/((latest|\d+\.\d+)\/?)?)?/, '');
|
||||
const versionsDOMText = DOC_VERSIONS.map((v, idx) => `<a href="/docs/${v}/${pathName}"${idx === 0 ? ' class="latest"' : ''}>${PREFIX}${v}</a>`)
|
||||
.join('');
|
||||
|
||||
frag.querySelector('#dropdown').appendChild(this._makeFragment(versionsDOMText));
|
||||
frag.querySelector('#spacer').appendChild(this._makeFragment(versionsDOMText));
|
||||
|
||||
shadowRoot.appendChild(frag);
|
||||
|
||||
this._instrument(shadowRoot);
|
||||
}
|
||||
|
||||
_instrument(shadowRoot) {
|
||||
shadowRoot.querySelector('#root').addEventListener('click', e => {
|
||||
this._expand(this.getAttribute('aria-expanded') !== 'true');
|
||||
});
|
||||
}
|
||||
|
||||
_expand(flag) {
|
||||
this.setAttribute('aria-expanded', flag);
|
||||
if (flag) this.addEventListener('blur', this._onBlur);
|
||||
}
|
||||
|
||||
_makeFragment(html) {
|
||||
return document.createRange().createContextualFragment(html);
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('version-selector', VersionSelector);
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
permalink: /assets/js/version-selector.js
|
||||
---
|
||||
(() => {
|
||||
{% assign current_array = site.data.versions.current | split: '!' %}
|
||||
{% assign all_versions = current_array | concat: site.data.versions.past %}
|
||||
const DOC_VERSIONS = {{ all_versions | jsonify }};
|
||||
{% include_relative _version-selector.js %}
|
||||
})();
|
||||
Reference in New Issue
Block a user