Elasticsearch:Release disk space automatic or call the api?

The official document says:
As already mentioned in Updating a Whole Document, deleting a document doesn’t immediately remove the document from disk; it just marks it as deleted. Elasticsearch will clean up deleted documents in the background as you continue to index more data. and there is a merge scheduler task to merge data.

after delete doc says Deleting documents only flags these as deleted, so they would not be searched. To reclaim disk space, you have to optimize the index

But,i find when i delete a document,the disk space will not be released until i use force merge api. Why?

If so,if i use delete-by-query plugin,i will need to use force merge api every time?

My elasticsearch's version is 2.3.1.

That is the old name for the force merge api.

The real answer is that the only efficient delete in Elasticsearch is deleting a whole index. If efficient deletes are a thing you need then you need to design your index strategy so you can delete a whole index when you want to delete stuff.

You can use the force merge API to reclaim space after a big delete-by-query but it is very inefficient.