Core concepts of Elasticsearch

Relational databases have concepts such as rows, columns, tables, and schemas. Elasticsearch and other document-oriented stores are based on different abstractions. Elasticsearch is a document-oriented store. JSON documents are first-class citizens in Elasticsearch. These JSON documents are organized within different types and indexes. We will look at the following core abstractions of Elasticsearch:

  • Indexes
  • Types
  • Documents
  • Clusters
  • Nodes
  • Shards and replicas
  • Mappings and types
  • Inverted indexes

Let's start learning about these with an example:

PUT /catalog/_doc/1
{
"sku": "SP000001",
"title": "Elasticsearch for Hadoop",
"description": "Elasticsearch for Hadoop",
"author": "Vishal Shukla",
"ISBN": "1785288997",
"price": 26.99
}

Copy and paste this example into the editor of your Kibana Console UI and execute it. This will index a document that represents a product in the product catalog of a system. All of the examples that are written for the Kibana Console UI can be very easily converted into curl commands that can be executed from the command line. The following is the curl version of the previous Kibana Console UI command:

curl -XPUT http://localhost:9200/catalog/_doc/1 -d '{ "sku": "SP000001", "title": "Elasticsearch for Hadoop", "description": "Elasticsearch for Hadoop", "author": "Vishal Shukla", "ISBN": "1785288997", "price": 26.99}'

We will use this example to understand the following concepts: indexes, types, and documents.

In the previous code block, the first line is PUT /catalog/_doc/1, which is followed by a JSON document.

PUT is the HTTP method that's used to index a new document. PUT is among the other HTTP methods we covered earlier. Here, catalog is the name of the index, _doc is the name of the type where the document will be indexed (more on this later; each index in Elasticsearch 7.0 should create just one type), and 1 is the ID to be assigned to the document after it is indexed.

The following sections explain each concept in depth.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.161.165