Putting a mapping in an index
In the previous chapter, we saw how to build mapping by indexing documents. This recipe shows how to put a type mapping in an index. This kind of operation can be considered as the Elasticsearch version of an SQL-created table.
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, the index created in the Creating an index recipe is required.
How to do it...
The HTTP method to put a mapping is PUT (also POST works). The URL format for putting a mapping is:
http://<server>/<index_name>/<type_name>/_mapping ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access