Indexing a document
In Elasticsearch, there are two vital operations: index and search.
Indexing means storing one or more documents in an index; this is a similar concept to inserting records in a relational database.
In Lucene, the core engine of Elasticsearch, inserting or updating a document has the same cost: in Lucene and Elasticsearch, to update means to replace.
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 client, 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.
To execute the following commands correctly, please use the index and mapping we created in the Putting a mapping in an index recipe.
How to do it...
Several...