-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Elasticsearch 5.x Cookbook
By :

In the previous recipe, we saw how to initialize a client to send calls to an Elasticsearch cluster. In this recipe, we will look at how to manage indices via client calls.
You need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
You also need the Python-installed packages from the Creating a client recipe in this chapter.
The full code for this recipe can be found in the chapter_16/indices_management.py
file.
In Python, managing the life cycle of your indices is very easy. We will perform the following steps:
We initialize a client:
import elasticsearch es = elasticsearch.Elasticsearch() index_name = "my_index"
We need to check if the index exists, and, if so, we need to delete it:
if es.indices.exists(index_name): es.indices.delete(index_name)
All the indices
methods are available...
Change the font size
Change margin width
Change background colour