There's more...

The refresh_interval parameter allows several tricks to optimize the indexing speed. It controls the rate of refresh and refreshing itself, and reduces the indices' performance due to the opening and closing of files. A good practice is to disable the refresh interval (set-1) during a big bulk indexing and to restore the default behavior after it. This can be done by following these steps:

  1. Disable the refresh:
PUT /myindex/_settings
{"index":{"refresh_interval": "-1"}}
  1. Bulk-index millions of documents.
  2. Restore the refresh:
PUT /myindex/_settings
{"index":{"refresh_interval": "1s"}}
  1. Optionally, you can optimize an index for search performance:
POST /myindex/_forcemerge