Refreshing an index
When you send data to Elasticsearch, the data is not instantly searchable. This only happens after a time interval (generally a second) known as the refresh rate. This delayed approach to data reading/writing allows you to efficiently write large blocks of data by reducing small disk action and increasing the throughput.
Elasticsearch allows the user to control the state of the searcher by forcefully refreshing an index. If it's not forced, the newly indexed document will only be searchable after a fixed time interval (usually, 1 second).
Getting ready
You will need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe of Chapter 1, Getting Started.
To execute the commands in this recipe, you can use any HTTP client, such as curl (https://curl.haxx.se/), Postman (https://www.getpostman.com/), or others. I suggest using the Kibana console as it provides code completion and better character...