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

[7.x] Change DELETE to POST for _bulk_delete to avoid incompatibility issues (#87914) #88509

Merged
merged 1 commit into from
Jan 15, 2021

Commits on Jan 15, 2021

  1. Change DELETE to POST for _bulk_delete to avoid incompatibility issues (

    elastic#87914)
    
    ## Summary
    
    Changes `DELETE` to `POST` for _bulk_delete on the client only for a variety of reasons.
    
    According to the RFC, not all servers and proxies need to honor DELETE having a body. From: https://tools.ietf.org/html/rfc7231
    
    ```
    A payload within a DELETE request message has no defined semantics;
    sending a payload body on a DELETE request might cause some existing
    implementations to reject the request.
    ```
    
    Within at least one proxy, h2o2, we have found that it does indeed change request headers which will cause NodeJS to not attach the body of a `DELETE`:
    hapijs/h2o2#124
    
    Also from other communities such as OpenAPI where they debated this, they allow it but discourage it for reasons outlined there that I will not repeat here:
    OAI/OpenAPI-Specification#1937
    
    Elastic Search API's and other Kibana API's use `POST` rather than `DELETE` for their bodies that are attached to `DELETE`:
    https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html
    
    We still support bodies in `DELETE` and `POST` but are just changing the web client to utilize `POST` moving forward.
    
    
    ### Checklist
    
    Reviewed and we already have unit tests and end to end tests for these use cases so we are good with just updating them. 
    
    - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
    FrankHassanabad committed Jan 15, 2021
    Configuration menu
    Copy the full SHA
    b6c0138 View commit details
    Browse the repository at this point in the history