Skip to content

Fix indices.delete_alias response #2951

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

Merged
merged 4 commits into from
Jul 18, 2025
Merged

Fix indices.delete_alias response #2951

merged 4 commits into from
Jul 18, 2025

Conversation

pquentin
Copy link
Member

This regressed between March 25th and April 15th, back when recording examples wasn't stable. Unfortunately, 22 days worth of commits is a lot: elastic/elasticsearch@e9fcb0a...d3e0ec1. If we find where this is set, we could consider asking the Elasticsearch team to not do this. It's not helpful, as acknowledged is already set to true.

Another option: I could only change the delete_alias body instead of affecting all APIs that use AcknowledgedResponseBase.

@l-trotta
Copy link
Contributor

I can't find this in the sever, AcknowledgeResponse only has one field. I think the problem is the fact that the body changes when there's an error, so for a normal response it's:

{
  "acknowledged": true
}

while when there's an error it's:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "unable to put stored script with unsupported lang [painlesss]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "unable to put stored script with unsupported lang [painlesss]"
  },
  "status": 400
}

in the spec we just map the first one, because the second case is the exception case (the server returns 404) so what java does is that it returns the error body in the exception message.

@pquentin pquentin changed the title Fix indices.delete_api response Fix indices.delete_alias response Sep 27, 2024
@pquentin
Copy link
Member Author

Actually, we also get responses like this one:

{
  "api": "indices.delete_alias",
  "file": "/test/free/indices.delete_alias/all_path_options.yml",
  "name": "check delete with prefix* index",
  "origin": "yaml",
  "request": {
    "args": {
      "index": "test_*",
      "name": "alias1"
    }
  },
  "response": {
    "headers": {
      "content-encoding": "gzip",
      "content-length": "62",
      "content-type": "application/json",
      "x-elastic-product": "Elasticsearch"
    },
    "payload": {
      "acknowledged": true,
      "errors": false
    },
    "statusCode": 200
  }
}

@l-trotta
Copy link
Contributor

ooh that's why: it's a subclass! we have to map this

@technige technige added the tracking Tracking in DevTools roadmap label Oct 4, 2024
@l-trotta
Copy link
Contributor

l-trotta commented Oct 7, 2024

update: it's more complex than it looks, I'm still working on this. in particular it seems like in case of error it can return detailed information, including a class that represents an ElasticsearchException which I don't think we already have. outdated

This comment was marked as outdated.

@l-trotta
Copy link
Contributor

l-trotta commented Jan 8, 2025

@pquentin sorry I forgot about this, rebased it + added a commit with what I think is the solution

This comment was marked as outdated.

Copy link
Contributor

github-actions bot commented Jul 11, 2025

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

API Status Request Response
indices.delete_alias 🔴 → 🟢 12/12 5/12 → 12/12

You can validate this API yourself by using the make validate target.

@pquentin
Copy link
Member Author

@l-trotta Sorry for not getting back to you sooner here. Should we add action_results too? elastic/elasticsearch#106514

@pquentin
Copy link
Member Author

Never mind, action_results only applies to `indices.update_aliases.

@pquentin pquentin merged commit 4926284 into main Jul 18, 2025
8 checks passed
@pquentin pquentin deleted the fix-delete-api branch July 18, 2025 10:28
Copy link
Contributor

The backport to 8.19 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.19 8.19
# Navigate to the new working tree
cd .worktrees/backport-8.19
# Create a new branch
git switch --create backport-2951-to-8.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 49262849630d994f02e5f903638ef795de9152f1
# Push it to GitHub
git push --set-upstream origin backport-2951-to-8.19
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.19

Then, create a pull request where the base branch is 8.19 and the compare/head branch is backport-2951-to-8.19.

github-actions bot pushed a commit that referenced this pull request Jul 18, 2025
* Fix indices.delete_api response

* specific ack response for indices delete alias

---------

Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit 4926284)
github-actions bot pushed a commit that referenced this pull request Jul 18, 2025
* Fix indices.delete_api response

* specific ack response for indices delete alias

---------

Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit 4926284)
pquentin added a commit that referenced this pull request Jul 18, 2025
* Fix indices.delete_api response

* specific ack response for indices delete alias

---------


(cherry picked from commit 4926284)

Co-authored-by: Quentin Pradet <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
pquentin added a commit that referenced this pull request Jul 18, 2025
* Fix indices.delete_api response

* specific ack response for indices delete alias

---------


(cherry picked from commit 4926284)

Co-authored-by: Quentin Pradet <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
pquentin added a commit that referenced this pull request Jul 18, 2025
* Fix indices.delete_api response

* specific ack response for indices delete alias

---------

Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit 4926284)

# Conflicts:
#	specification/indices/delete_alias/IndicesDeleteAliasResponse.ts
@pquentin
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.19

Questions ?

Please refer to the Backport tool documentation

pquentin added a commit that referenced this pull request Jul 18, 2025
* Fix indices.delete_api response

* specific ack response for indices delete alias

---------

Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit 4926284)

# Conflicts:
#	specification/indices/delete_alias/IndicesDeleteAliasResponse.ts
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