Skip to content

Conversation

@l-trotta
Copy link
Contributor

@l-trotta l-trotta commented Jul 22, 2025

As reported in a Java client issue, the FiltersBucket aggregation result can have a key field if keyed was set as false in the request.

No server code, key is a common field in aggregation and I couldn't find where it's added to the FiltersAggregation result.

server code

Here's a reproducer:

PUT /logs/_bulk?refresh
{ "index" : { "_id" : 1 } }
{ "body" : "warning: page could not be rendered" }
{ "index" : { "_id" : 2 } }
{ "body" : "authentication error" }
{ "index" : { "_id" : 3 } }
{ "body" : "warning: connection timed out" }
GET logs/_search
{
  "size": 0,
  "aggs" : {
    "messages" : {
      "filters" : {
        "filters" : {
          "errors" :   { "match" : { "body" : "error"   }},
          "warnings" : { "match" : { "body" : "warning" }}
        },
        "keyed": false
      }
    }
  }
}

Response without "keyed": false is:

  "aggregations": {
    "messages": {
      "buckets": {
        "errors": {
          "doc_count": 1
        },
        "warnings": {
          "doc_count": 2
        }
      }
    }
  }

with "keyed": false it's:

  "aggregations": {
    "messages": {
      "buckets": [
        {
          "key": "errors",
          "doc_count": 1
        },
        {
          "key": "warnings",
          "doc_count": 2
        }
      ]
    }
  }

@github-actions
Copy link
Contributor

Following you can find the validation changes against the target branch for the APIs.

No changes detected.

You can validate these APIs yourself by using the make validate target.

@l-trotta l-trotta merged commit 80b7017 into main Jul 22, 2025
18 checks passed
@l-trotta l-trotta deleted the filters-bucket-fix branch July 22, 2025 12:55
github-actions bot pushed a commit that referenced this pull request Jul 22, 2025
github-actions bot pushed a commit that referenced this pull request Jul 22, 2025
github-actions bot pushed a commit that referenced this pull request Jul 22, 2025
github-actions bot pushed a commit that referenced this pull request Jul 22, 2025
github-actions bot pushed a commit that referenced this pull request Jul 22, 2025
l-trotta added a commit that referenced this pull request Jul 22, 2025
(cherry picked from commit 80b7017)

Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com>
l-trotta added a commit that referenced this pull request Jul 22, 2025
(cherry picked from commit 80b7017)

Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com>
l-trotta added a commit that referenced this pull request Jul 22, 2025
(cherry picked from commit 80b7017)

Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com>
l-trotta added a commit that referenced this pull request Jul 22, 2025
(cherry picked from commit 80b7017)

Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com>
l-trotta added a commit that referenced this pull request Jul 22, 2025
(cherry picked from commit 80b7017)

Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants