# Java client 8 can't DELETE document

**URL:** <https://discuss.elastic.co/t/java-client-8-cant-delete-document/354744>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [March 5, 2024, 3:13pm UTC](https://discuss.elastic.co/t/java-client-8-cant-delete-document/354744 "2024-03-05T15:13:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolasduminil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolasduminil/32/132360_2.png) [@nicolasduminil](https://discuss.elastic.co/u/nicolasduminil)\
**Post date:** [March 5, 2024, 3:13pm UTC](https://discuss.elastic.co/t/java-client-8-cant-delete-document/354744/1 "2024-03-05T15:13:45Z")

</div>

Using Java client version provided as Quarkus 3.7.1 extension. The following request ran in Kibana:

```
DELETE customers/_doc/69wID44Bdp9hpkBkyZ2a

```

works as expected. However, the code below:

```
    client.delete(DeleteRequest.of(dr -> dr.index(INDEX).id(id)));

```

where INDEX = "customers" and id = 69wID44Bdp9hpkBkyZ2a, raises the following exception:

```
Caused by: co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/delete] failed: [http_status_405] Incorrect HTTP method for uri [/customers/_doc/] and method [DELETE], allowed: [POST]
    at co.elastic.clients.transport.ElasticsearchTransportBase.getApiResponse(ElasticsearchTransportBase.java:345)
    at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:147)
    at co.elastic.clients.elasticsearch.ElasticsearchClient.delete(ElasticsearchClient.java:554)
    at fr.simplex_software.docstore.service.impl.CustomerServiceImpl.removeCustomerById(CustomerServiceImpl.java:68)
    at fr.simplex_software.docstore.service.impl.CustomerServiceImpl_ClientProxy.removeCustomerById(Unknown Source)
    at fr.simplex_software.docstore.api.impl.CustomerResourceImpl.deleteCustomerById(CustomerResourceImpl.java:64)

```

Not sure whether the issue is related to the Java client itself or to the Quarkus extension.

Please help. Many thanks in advance.  
Kind regards,  
Nicolas

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 5, 2024, 6:46pm UTC](https://discuss.elastic.co/t/java-client-8-cant-delete-document/354744/2 "2024-03-05T18:46:08Z")

</div>

That's weird because it looks like the id is not set.  
What is the elasticsearch client version? What is the dependency tree?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 2, 2024, 6:47pm UTC](https://discuss.elastic.co/t/java-client-8-cant-delete-document/354744/3 "2024-04-02T18:47:07Z")

</div>

Closed on April 2, 2024, 6:47pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
