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

Here is my data

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

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

Error -

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

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.

I think it wyoud be something like:

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

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