Managing mappings

After creating an index, the next step is to add some type mappings to it. We saw how to put a mapping via the REST API in Chapter 4, Basic Operations. In this recipe, we will see how to manage mappings via the official Python client and PyES.

Getting ready

You need a working ElasticSearch cluster and the required packages that are used in the Creating a client recipe in this chapter.

The code of this recipe is present in chapter_11/ and chapter_11/ file, which is available in the code bundle of this book and on GitHub (

How to do it...

After you have initialized a client and created an index, the following actions are available ...

Get ElasticSearch Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.