When I index some documents and they are not refreshed yet, can I deleted them?

let's say I bulk insert some documents and then I want to delete them, can ES handle it properly? if so, how?

Yes it can.
The easiest way to understand would be to read this chapter - https://www.elastic.co/guide/en/elasticsearch/guide/master/inside-a-shard.html

If you have explicitly assigned IDs to the documents at the client prior to indexing them you can delete them using this before a refresh takes place and they are made searchable. If you however rely on Elasticsearch assigning the document IDs, you may need to wait until you can identify the documents through a query unless you are keeping track of the IDs being returned in the bulk request response.

so if I have id, I can delete it, if not, I can't. right?

I believe so but have not tested it. What is your use case?

no use case right now. I'll do some test later. thank u