Skip to content

405 status code thrown due to missing delete by query plugin. #2069

Open
@TomonoriSoejima

Description

@TomonoriSoejima

Issue description

A user stumbled upon 405 status code in their application log.

0.000 405 405 381 507 "DELETE http://10.212.133.38:80/index_query?q=* HTTP/1.1" "Jakarta Commons-HttpClient/3.0.1" - - arn:aws:xxxxx "Root=1-xxxx" "-" "-" 0 2023-03-07T06:18:57.581000Z "forward" "-" "-" "10.212.133.108:9200" "405" "-" "-"**

You can see "DELETE http://10.212.133.38:80/index_query?q=*, which results in 405 and this syntax is drawn from blocks below.

            try {
                if (resources.getResourceWrite().isTyped()) {
                    client.delete(resources.getResourceWrite().index() + "/" + resources.getResourceWrite().type() + "/_query?q=*");
                } else {
                    client.delete(resources.getResourceWrite().index() + "/_query?q=*");
                }
            } catch (EsHadoopInvalidRequest ehir) {
                log.info("Skipping delete by query as the plugin is not installed...");
            }

It mentions delete by query as the plugin but this doc https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugins-delete-by-query.html says

The Delete-By-Query plugin has been removed in favor of a new Delete By Query API implementation in core.

As delete by query is now done by API, maybe we should adapt this code to do the same.

POST /my-index-000001/_delete_by_query
{
  "query": {
    "match": {
      "user.id": "elkbee"
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions