Fix792 rollup enhancements (#911)

* Added rollup enhancements

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

* Implemented doc review comments

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

* Implemented editorial comments

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

* Implemented 2.2 changes

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

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
This commit is contained in:
kolchfa-aws 2022-08-22 20:35:45 -04:00 committed by GitHub
parent f32c849c93
commit 2bbad2aa79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 162 additions and 103 deletions

View File

@ -347,7 +347,7 @@ POST example_rollup/_search
```json
{
"took": 476,
"took" : 14,
"timed_out" : false,
"_shards" : {
"total" : 1,
@ -370,7 +370,7 @@ POST example_rollup/_search
"buckets" : [
{
"key" : "Friday",
"doc_count": 53,
"doc_count" : 59,
"total_revenue" : {
"value" : 4858.84375
},
@ -380,7 +380,7 @@ POST example_rollup/_search
"buckets" : [
{
"key" : "Los Angeles",
"doc_count": 53,
"doc_count" : 59,
"average quantity" : {
"value" : 2.305084745762712
}
@ -390,7 +390,7 @@ POST example_rollup/_search
},
{
"key" : "Saturday",
"doc_count": 43,
"doc_count" : 46,
"total_revenue" : {
"value" : 3547.203125
},
@ -400,7 +400,7 @@ POST example_rollup/_search
"buckets" : [
{
"key" : "Los Angeles",
"doc_count": 43,
"doc_count" : 46,
"average quantity" : {
"value" : 2.260869565217391
}
@ -410,7 +410,7 @@ POST example_rollup/_search
},
{
"key" : "Tuesday",
"doc_count": 42,
"doc_count" : 45,
"total_revenue" : {
"value" : 3983.28125
},
@ -420,7 +420,7 @@ POST example_rollup/_search
"buckets" : [
{
"key" : "Los Angeles",
"doc_count": 42,
"doc_count" : 45,
"average quantity" : {
"value" : 2.2888888888888888
}
@ -430,7 +430,7 @@ POST example_rollup/_search
},
{
"key" : "Sunday",
"doc_count": 40,
"doc_count" : 44,
"total_revenue" : {
"value" : 3308.1640625
},
@ -440,15 +440,74 @@ POST example_rollup/_search
"buckets" : [
{
"key" : "Los Angeles",
"doc_count": 40,
"doc_count" : 44,
"average quantity" : {
"value" : 2.090909090909091
}
}
]
}
},
{
"key" : "Thursday",
"doc_count" : 40,
"total_revenue" : {
"value" : 2876.125
},
"per_city" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Los Angeles",
"doc_count" : 40,
"average quantity" : {
"value" : 2.3
}
}
]
}
},
{
"key" : "Monday",
"doc_count" : 38,
"total_revenue" : {
"value" : 2673.453125
},
"per_city" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Los Angeles",
"doc_count" : 38,
"average quantity" : {
"value" : 2.1578947368421053
}
}
]
}
},
{
"key" : "Wednesday",
"doc_count" : 38,
"total_revenue" : {
"value" : 3202.453125
},
"per_city" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Los Angeles",
"doc_count" : 38,
"average quantity" : {
"value" : 2.236842105263158
}
}
]
}
}
...
]
}
}
@ -477,7 +536,21 @@ You cannot search a mix of rollup and non-rollup indices with the same query.
The following example demonstrates the `doc_count` field, dynamic index names, and searching multiple rollup indices with the same rollup.
**Step 1:** Set up an ISM rollover policy to roll over any index whose name starts with `log*` after one document is uploaded to it, and then roll up the individual backing index. The target index name is dynamically generated from the source index name by prepending the string `rollup_ndx-` to the source index name.
**Step 1:** Add an index template for ISM to manage the rolling over of the indices aliased by `log`.
```json
PUT _index_template/ism_rollover
{
"index_patterns": ["log*"],
"template": {
"settings": {
"plugins.index_state_management.rollover_alias": "log"
}
}
}
```
**Step 2:** Set up an ISM rollover policy to roll over any index whose name starts with `log*` after one document is uploaded to it, and then roll up the individual backing index. The target index name is dynamically generated from the source index name by prepending the string `rollup_ndx-` to the source index name.
```json
PUT _plugins/_ism/policies/rollover_policy
@ -549,7 +622,7 @@ PUT _plugins/_ism/policies/rollover_policy
}
```
**Step 2:** Create an index named `log-000001` and set up an alias `log` for it.
**Step 3:** Create an index named `log-000001` and set up an alias `log` for it.
```json
PUT log-000001
@ -562,20 +635,6 @@ PUT log-000001
}
```
**Step 3:** Add an index template for ISM to manage the rolling over of the indices aliased by `log`.
```json
PUT _index_template/ism_rollover
{
"index_patterns": ["log*"],
"template": {
"settings": {
"plugins.index_state_management.rollover_alias": "log"
}
}
}
```
**Step 4:** Index four documents into the index created above. Two of the documents have the message "Success", and two have the message "Error".
```json
@ -656,11 +715,11 @@ The response contains two buckets, "Error" and "Success", and the document count
```json
{
"took" : 7,
"took" : 30,
"timed_out" : false,
"_shards" : {
"total" : 4,
"successful" : 4,
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
@ -678,14 +737,14 @@ The response contains two buckets, "Error" and "Success", and the document count
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Error",
"key" : "Success",
"doc_count" : 2,
"per_message" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Error",
"key" : "Success",
"doc_count" : 2,
"sum_message" : {
"value" : 50.0
@ -695,14 +754,14 @@ The response contains two buckets, "Error" and "Success", and the document count
}
},
{
"key" : "Success",
"key" : "Error",
"doc_count" : 2,
"per_message" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Success",
"key" : "Error",
"doc_count" : 2,
"sum_message" : {
"value" : 50.0