# Deleting and index data with two params is not allowing - 8.11.0

**URL:** https://discuss.elastic.co/t/deleting-and-index-data-with-two-params-is-not-allowing-8-11-0/348571
**Category:** Elasticsearch
**Created:** [December 4, 2023, 3:17pm UTC](https://discuss.elastic.co/t/deleting-and-index-data-with-two-params-is-not-allowing-8-11-0/348571 "2023-12-04T15:17:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Rubsy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rubsy/32/121963_2.png) [@Rubsy](https://discuss.elastic.co/u/Rubsy)
#### Post date: [December 4, 2023, 3:17pm UTC](https://discuss.elastic.co/t/deleting-and-index-data-with-two-params-is-not-allowing-8-11-0/348571/1 "2023-12-04T15:17:59Z")

</div>

Here is my data

```auto
PUT dynamicasset/_doc/E3EBDC84-9281-46D3-9DA1-31672642C7D3
{
"CustomerId":"E3EBDC84-9281-46D3-9DA1-31672642C7D3",
"InvoiceNumber": "301",
"InvoiceAmount": 450,
"Description": "Test Sample for deleting based on two condition"
}

```

I am trying to delete this data based on CustomerId and Invoice number which is not happened and I am getting error as

```auto
DELETE dynamicasset/_delete
{
"query":{
"bool": {
"must":[
{"term":{"CustomerId":"E3EBDC84-9281-46D3-9DA1-31672642C7D3"}},
{"term":{"CustomerId":"E3EBDC84-9281-46D3-9DA1-31672642C7D3"}}
]
}
}
}

```

_Error -_

```auto
{
"error": "Incorrect HTTP method for uri [/dynamicasset/_delete?pretty=true] and method [DELETE], allowed: [POST]",
"status": 405
}

```

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [December 4, 2023, 3:23pm UTC](https://discuss.elastic.co/t/deleting-and-index-data-with-two-params-is-not-allowing-8-11-0/348571/2 "2023-12-04T15:23:37Z")

</div>

> [@Rubsy](#):
>
> `DELETE dynamicasset/_delete`

Not sure from where you got this endpoint, but I don't think this exists.

Are you trying to use `delete_by_query`? If so, you need to follow the example in the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html).

I think it wyoud be something like:

```auto
POST dynamicasset/_delete_by_query
{
"query":{
"bool": {
"must":[
{"term":{"CustomerId":"E3EBDC84-9281-46D3-9DA1-31672642C7D3"}},
{"term":{"CustomerId":"E3EBDC84-9281-46D3-9DA1-31672642C7D3"}}
]
}
}
}

```

---

<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: [January 1, 2024, 3:24pm UTC](https://discuss.elastic.co/t/deleting-and-index-data-with-two-params-is-not-allowing-8-11-0/348571/3 "2024-01-01T15:24:27Z")

</div>

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