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

Query API key information API only accepts "aggs" and not "aggregations" #106839

Closed
l-trotta opened this issue Mar 27, 2024 · 2 comments · Fixed by #107054
Closed

Query API key information API only accepts "aggs" and not "aggregations" #106839

l-trotta opened this issue Mar 27, 2024 · 2 comments · Fixed by #107054
Assignees
Labels
>bug :Security/Security Security issues without another label Team:Security Meta label for security team

Comments

@l-trotta
Copy link

l-trotta commented Mar 27, 2024

Elasticsearch Version

8.13.0

Installed Plugins

No response

Java Version

bundled

OS Version

elasticsearch cloud

Problem Description

Query API key information API returns:
[query_api_key_request_payload] unknown field [aggregations]

when called using aggregations instead of aggs, in the main aggregation (while the sub aggregations accept both).

Here's the line where we could see that it only accepts aggs.

This is a problem for the client libraries since all other aggregations accept both names.

Steps to Reproduce

POST /_security/_query/api_key
{
  "size": 0,
  "aggregations": {
    "keys_by_username": {
      "composite": {
        "sources": [ { "usernames": { "terms": { "field": "username" } } } ]  
      },
      "aggregations": {
        "expires_soon": {
          "filter": {
            "range": { "expiration": { "lte": "now+30d/d" } }  
          },
          "aggregations": {
            "key_names": { "terms": { "field": "name" } }
          }
        }
      }
    }
  }
}

Logs (if relevant)

No response

@l-trotta l-trotta added >bug needs:triage Requires assignment of a team area label labels Mar 27, 2024
@swallez swallez added the :Security/Security Security issues without another label label Mar 27, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Security Meta label for security team label Mar 27, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Mar 27, 2024
@l-trotta l-trotta changed the title Query API key information API only accepts "aggs" and not "aggregation" Query API key information API only accepts "aggs" and not "aggregations" Mar 27, 2024
@l-trotta
Copy link
Author

l-trotta commented Apr 2, 2024

Forgot to mention: this issue is related to PR #104895, and like issue 106817 it prevents the strongly typed clients from supporting the new feature introduced in the PR. @albertzaharovits could you please take a look?

@albertzaharovits albertzaharovits self-assigned this Apr 3, 2024
albertzaharovits added a commit that referenced this issue Apr 3, 2024
…107054)

The Query API Key Information endpoint supports aggs since #104895.
But some lang clients actually use the `aggregations` keyword in requests,
as the preferred synonym to `aggs`.
This PR adds support for the `aggregations` request keyword as a synonym
for the existing `aggs` term.

Closes #106839
albertzaharovits added a commit to albertzaharovits/elasticsearch that referenced this issue Apr 4, 2024
…lastic#107054)

The Query API Key Information endpoint supports aggs since elastic#104895.
But some lang clients actually use the `aggregations` keyword in requests,
as the preferred synonym to `aggs`.
This PR adds support for the `aggregations` request keyword as a synonym
for the existing `aggs` term.

Closes elastic#106839
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Security/Security Security issues without another label Team:Security Meta label for security team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants