Refreshing an index
Elasticsearch allows the user to control the state of the searcher using forced refresh on an index. If not forced, the newly indexed document will be only searchable after a fixed time interval (usually one second).
Getting ready
You need an up-and-running Elasticsearch installation, as used in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
To execute curl
via the command line, you need to install curl
for your operative system.
To correctly execute the following commands, use the index created in the Creating an index recipe.
How to do it...
The HTTP method used for both operations is POST
. The URL formats for refreshing an index, are:
http://<server>/<index_name(s)>/_refresh
The URL formats, for refreshing all the indices in a cluster, are:
http://<server>/_refresh
For refreshing an index, we will perform the following steps:
If we consider the type order of the previous chapter, the call will be:
curl -XPOST 'http:...