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

[Aggs] Apply hard_bounds to prevent ES circuit breaker when dealing with open-ended ranges #93622

Open
wylieconlon opened this issue Mar 4, 2021 · 8 comments
Labels
bug Fixes for quality problems that affect the customer experience Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:medium Medium Level of Effort NeededFor:VisEditors Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@wylieconlon
Copy link
Contributor

wylieconlon commented Mar 4, 2021

For date histogram aggregations, we need to set the hard_bounds parameter when dealing with any date_range data type. Unlike extended_bounds, hard_bounds is exclusive, which means that to get the same results we will need to set hard_bounds to be larger than the possible time range by up to one bucket length on either side.

For example, if the date range is "now-7d" to "now", with an interval of 3 hours, then we need to set hard_bounds to now-7d-3h to now+3h to be accurate.

For histogram aggregations, we can't set hard_bounds automatically. This means that open-ended ranges in histogram aggregations can easily cause circuit breakers, so we should require users to provide a hard_bounds setting in this case.

This issue was originally found here: #76971

cc @ppisljar

@wylieconlon wylieconlon added Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) enhancement New value added to drive a business result Team:AppServices labels Mar 4, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@exalate-issue-sync exalate-issue-sync bot added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort labels Jun 21, 2021
@ppisljar
Copy link
Member

ppisljar commented Aug 9, 2022

Thank you for contributing to this issue, however, we are closing this issue due to inactivity as part of a backlog grooming effort. If you believe this feature/bug should still be considered, please reopen with a comment.

@ppisljar ppisljar closed this as not planned Won't fix, can't repro, duplicate, stale Aug 9, 2022
@simianhacker simianhacker added bug Fixes for quality problems that affect the customer experience and removed enhancement New value added to drive a business result labels Oct 5, 2022
@simianhacker
Copy link
Member

I'm re-opening this because there is currently a bug with the Lens visualization when visualizing open ended date_range fields. We (Actionable Observability) ran into this issue with: #141309

Here is an example you can run in the Dev Console:

PUT test_range
{
  "settings": {
    "number_of_shards": 2
  },
  "mappings": {
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "id": {
        "type": "keyword",
        "ignore_above": 1024
      },
      "status": {
        "type": "keyword",
        "ignore_above": 1024
      },
      "time_frame": {
        "type": "date_range", 
        "format": "epoch_millis||strict_date_optional_time"
      }
    }
  }
}

PUT test_range/_doc/1
{
  "@timestamp": "2022-09-21T13:00:00Z",
  "alert_id": "1",
  "status": "active",
  "time_frame": {
    "gte": "2022-09-21T02:00:00Z"
  }
}

PUT test_range/_doc/2
{
  "@timestamp": "2022-09-21T13:00:00Z",
  "alert_id": "2",
  "status": "recovered",
  "time_frame": {
    "gte": "2022-09-21T02:00:00Z",
    "lte": "2022-09-21T13:00:00Z"
  }
}


POST test_range/_search
{
  "size": 1,
  "query": {
    "bool": {
      "filter": [
        {
          "range": {
            "time_frame": {
              "gte": "2022-09-21T00:00:00Z",
              "lte": "2022-09-21T23:59:59Z"
            }
          }
        }
      ]
    }
  },
  "aggs": {
    "timeseries": {
      "date_histogram": {
        "field": "time_frame",
        "fixed_interval": "1h",
        "extended_bounds": {
          "min": "2022-09-21T00:00:00Z",
          "max": "2022-09-21T23:59:59Z"
        },
        "hard_bounds": {
          "min": "2022-09-21T00:00:00Z",
          "max": "2022-09-21T23:59:59Z"
        }
      }
    }
  }
}

Both extended_bounds and hard_bounds need to be set to draw the empty buckets AND to limit the date_histogram from trying to draw the buckets (to infinity) for the open ended date_range events.

@simianhacker simianhacker reopened this Oct 5, 2022
@petrklapka petrklapka added Team:Visualizations Visualization editors, elastic-charts and infrastructure and removed Team:AppServicesSv labels Nov 9, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations)

@ppisljar ppisljar added Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. and removed Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Apr 3, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@davismcphee
Copy link
Contributor

Hi @ppisljar, can you explain why this issue was moved from Visualizations to Data Discovery? It's not clear to me.

@ppisljar
Copy link
Member

ppisljar commented Apr 3, 2023

I think AggConfigs (which this issue will affect) are owned by data-discovery ?

@stratoula
Copy link
Contributor

We own aggs (as we are the only consimers) and data discovery owns search, I will transfer again the ownership. It is a bit vague which teams owns what, I totally get the confusion. :)

@stratoula stratoula added Team:Visualizations Visualization editors, elastic-charts and infrastructure and removed Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. labels Apr 3, 2023
@timductive timductive removed the loe:small Small Level of Effort label Oct 14, 2024
@timductive timductive added the loe:medium Medium Level of Effort label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:medium Medium Level of Effort NeededFor:VisEditors Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

9 participants