How to do it...

The HTTP method that's used for both operations is POST. The URL formats for refreshing an index are as follows:

http://<server>/<index_name(s)>/_refresh

The URL formats for refreshing all the indices in a cluster are as follows:

http://<server>/_refresh

To refresh an index, we will perform the following steps:

  1. If we consider the type order of the previous chapter, the call will be as follows:
POST /myindex/_refresh
  1. The result returned by Elasticsearch should be as follows:
{
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
}
}