Creating an index
The first thing you must do before you can start indexing data in Elasticsearch is create an index – the main container of our data.
An index is similar to the concept of a database in SQL; it is a container for types (tables in SQL) and documents (records in SQL).
Getting ready
You will need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe of Chapter 1, Getting Started.
To execute the commands in this recipe, you can use any HTTP clients, such as curl (https://curl.haxx.se/), Postman (https://www.getpostman.com/), or others. I suggest using the Kibana console as it provides code completion and better character escaping for Elasticsearch.
How to do it...
The HTTP method for creating an index is PUT
; the REST URL contains the index's name:
http://<server>/<index_name>
To create an index, follow these steps:
- From the command line, execute a
PUT...