Skip to content

Conversation

@talevy
Copy link
Contributor

@talevy talevy commented Nov 10, 2020

This commit adds a new endpoint for Rollup V2, a new way to rollup indices.

Instead of relying on a cron-job, this action will rollup a whole index on the spot.

When an index is rolled up using a Rollup Config, it does the following

  1. check that original index is read-only
  2. runs an aggregation and indexes results into a temporary hidden rollup index
  3. "resizes" the temporary index into the final rollup-index (in-place segment pointer juggling)
  4. adds RollupMetadata about the rollup-group (keyed by original index name) and adds custom index-metadata with data about what the rollup index's original index is so that its group information in RollupMetadata can be looked up

example usage:

POST /index/_rollup
{
    "rollup_index": "index_rolled",
    "groups": {
        "date_histogram": {
            "field": "date",
            "calendar_interval": "1M"
        },
        "terms": {
            "fields": ["unit"]
        }
    },
    "metrics": [
        {
            "field": "temperature",
            "metrics": ["sum"]
        }
    ]
}

@talevy talevy added >feature :StorageEngine/Rollup Turn fine-grained time-based data into coarser-grained data v8.0.0 Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Nov 10, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (:Analytics/Rollup)

@talevy
Copy link
Contributor Author

talevy commented Nov 12, 2020

run elasticsearch-ci/2
run elasticsearch-ci/bwc

@talevy
Copy link
Contributor Author

talevy commented Nov 12, 2020

For the reviewers @csoulios and @not-napoleon, I am still working on making more of the indexer logic unit-testable. I would love some feedback on the general process and any large gotchyas you may see. There is a lot of state change and index dancing. I do intend to make these parts a bit more resilient, but that may not be a part of this PR pending further discussion! thanks!

This commit adds a new endpoint for Rollup V2, a new way to rollup indices.

Instead of relying on a cron-job, this action will rollup a whole index on the spot.

When an index is rolled up using a Rollup Config, it does the following

1. check that original index is read-only
2. runs an aggregation and indexes results into a temporary hidden rollup index
3. "resizes" the temporary index into the final rollup-index (in-place segment pointer juggling)
4. adds RollupMetadata about the rollup-group (keyed by original index name) and adds custom index-metadata with data about what the rollup index's original index is so that its group information in RollupMetadata can be looked up

example usage:

```
POST /_rollup_vtwo/index
{
    "rollup_index": "index_rolled",
    "groups": {
        "date_histogram": {
            "field": "date",
            "calendar_interval": "1M"
        },
        "terms": {
            "fields": ["unit"]
        }
    },
    "metrics": [
        {
            "field": "temperature",
            "metrics": ["sum"]
        }
    ]
}
```
Copy link
Member

@not-napoleon not-napoleon left a comment

Choose a reason for hiding this comment

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

I left a few thoughts, but I don't think any of them are blockers to merging.

@talevy talevy changed the title Adds a new Rollup V2 Action Adds a new Rollup Action Nov 19, 2020
@talevy talevy merged commit 06da3d7 into elastic:master Nov 23, 2020
@talevy talevy deleted the rollupv2action branch November 23, 2020 21:04
talevy added a commit to talevy/elasticsearch that referenced this pull request Nov 23, 2020
This commit adds a new endpoint for Rollup V2, a new way to rollup indices.

Instead of relying on a cron-job, this action will rollup a whole index on the spot.

When an index is rolled up using a Rollup Config, it does the following

1. check that original index is read-only
2. runs an aggregation and indexes results into a temporary hidden rollup index
3. "resizes" the temporary index into the final rollup-index (in-place segment pointer juggling)
4. adds RollupMetadata about the rollup-group (keyed by original index name) and adds
    custom index-metadata with data about what the rollup index's original index is so that its
    group information in RollupMetadata can be looked up

example usage:

```
POST /_rollup_vtwo/index
{
    "rollup_index": "index_rolled",
    "groups": {
        "date_histogram": {
            "field": "date",
            "calendar_interval": "1M"
        },
        "terms": {
            "fields": ["unit"]
        }
    },
    "metrics": [
        {
            "field": "temperature",
            "metrics": ["sum"]
        }
    ]
}
```

relates elastic#42720.
talevy added a commit that referenced this pull request Nov 24, 2020
This commit adds a new endpoint for Rollup V2, a new way to rollup indices.

Instead of relying on a cron-job, this action will rollup a whole index on the spot.

When an index is rolled up using a Rollup Config, it does the following

1. check that original index is read-only
2. runs an aggregation and indexes results into a temporary hidden rollup index
3. "resizes" the temporary index into the final rollup-index (in-place segment pointer juggling)
4. adds RollupMetadata about the rollup-group (keyed by original index name) and adds
    custom index-metadata with data about what the rollup index's original index is so that its
    group information in RollupMetadata can be looked up

example usage:

```
POST /_rollup_vtwo/index
{
    "rollup_index": "index_rolled",
    "groups": {
        "date_histogram": {
            "field": "date",
            "calendar_interval": "1M"
        },
        "terms": {
            "fields": ["unit"]
        }
    },
    "metrics": [
        {
            "field": "temperature",
            "metrics": ["sum"]
        }
    ]
}
```

relates #42720.
csoulios added a commit that referenced this pull request May 25, 2022
This PR implements downsampling operation on time series indices.

The PR creates a _rollup endpoint that allows users to downsample an index and can be
accessed by the following call:

POST /<source_index>/_rollup/<rollup_index>
{
    "fixed_interval": "1d"
}

Requirements

An index can be downsampled if all of the following requirements are met:

    Must be a time series index (have the index.mode: time_series index setting)
    Must not be writeable (have the index.blocks.write: true index setting)
    Must have dimension fields marked with mapping parameter time_series_dimension: true
    Must have metric fields marked with mapping parameter time_series_metric

Relates to #74660

Fixes #65769
Fixes #69799
Finally, this PR is based on the code written for #64900
salvatore-campagna pushed a commit to salvatore-campagna/elasticsearch that referenced this pull request May 26, 2022
This PR implements downsampling operation on time series indices.

The PR creates a _rollup endpoint that allows users to downsample an index and can be
accessed by the following call:

POST /<source_index>/_rollup/<rollup_index>
{
    "fixed_interval": "1d"
}

Requirements

An index can be downsampled if all of the following requirements are met:

    Must be a time series index (have the index.mode: time_series index setting)
    Must not be writeable (have the index.blocks.write: true index setting)
    Must have dimension fields marked with mapping parameter time_series_dimension: true
    Must have metric fields marked with mapping parameter time_series_metric

Relates to elastic#74660

Fixes elastic#65769
Fixes elastic#69799
Finally, this PR is based on the code written for elastic#64900
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :StorageEngine/Rollup Turn fine-grained time-based data into coarser-grained data Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v7.11.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants