elastic icon indicating copy to clipboard operation
elastic copied to clipboard

Delete with an empty id could be dangerous

Open vsiv opened this issue 11 years ago • 2 comments

@olivere just ran into an issue and thought to alert you guys. unless i am mistaken, there isn't a check for an empty id when performing index operations. This might be fine in most cases, as ES would error out, but when an id is empty and u can perform a delete call like so -

client.Delete().Index(index).Type(mtype).Id(id).Do()

the entire index is wiped out. quite dangerous. i have added checks in my code now, but if it makes sense to do it at lib level, we might save someone some grief..

its the difference between - curl -XDELETE localhost:9200/someindex/type/ vs curl -XDELETE localhost:9200/someindex/type/1

vsiv avatar Jun 16 '15 05:06 vsiv

Yes, that makes sense. I'll add checks (as ES does as well).

olivere avatar Jun 16 '15 06:06 olivere

:thumbsup:

vsiv avatar Jun 16 '15 08:06 vsiv