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

[BUG] doc_count_error_upper_bound for terms agg should not show 0 when descending _count sort is not used #11851

Open
jed326 opened this issue Jan 11, 2024 · 1 comment
Labels
bug Something isn't working Search:Aggregations

Comments

@jed326
Copy link
Collaborator

jed326 commented Jan 11, 2024

Describe the bug

Encountered this as a part of #11732

doc_count_error is only relevant when the buckets are sorted in descending _count order (I think this is a documentation gap too, but that's a separate issue https://opensearch.org/docs/latest/aggregations/bucket/terms/). If a different sort order is used then doc_count_error_upper_bound currently shows 0. This can be confusing for users since it implies that there are no candidate buckets being eliminated by shard_size.

Related component

Search:Aggregations

To Reproduce

Example using noaa data from OSB but the underlying data doesn't really matter:

GET weather-data-2016-multi/_search
{
  "size": 0,
  "aggs": {
    "station": {
      "terms": {
        "field": "station.elevation",
        "size": 1
        , "order": {
          "_key": "asc"
        }
      }
    }
  }
}

{
  "took": 1256,
  "timed_out": false,
  "terminated_early": true,
  "_shards": {
    "total": 2,
    "successful": 2,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 10000,
      "relation": "gte"
    },
    "max_score": null,
    "hits": []
  },
  "aggregations": {
    "station": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 33581715,
      "buckets": [
        {
          "key": -999.9000244140625,
          "doc_count": 77766
        }
      ]
    }
  }
}

Expected behavior

Whenever the doc_count_error cannot be calculated, it either show not be returned in the response body or it should return -1 to differentiate the cases where there is no error vs cases where it cannot be computed.

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@jed326 jed326 added bug Something isn't working untriaged labels Jan 11, 2024
@jed326 jed326 changed the title [BUG] doc_count_error_upper_bound for terms should not show 0 when descending _count sort is not used [BUG] doc_count_error_upper_bound for terms agg should not show 0 when descending _count sort is not used Jan 11, 2024
@peternied
Copy link
Member

[Triage - attendees 1 2]
@jed326 Thanks for filing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Search:Aggregations
Projects
None yet
Development

No branches or pull requests

2 participants