How to do it...

The HTTP method for checking an index's existence is HEAD. The URL format for checking an index is as follows:

http://<server>/<index_name>/

To check if an index exists, we will perform the following steps:

  1. If we consider the index we created in the Creating an index recipe, the call will be as follows:
HEAD /myindex/
  1. If the index exists, an HTTP status code 200 is returned; if it is missing, a 404 code will be returned.