Indexes

An index is a container that stores and manages documents of a single type in Elasticsearch. We will look at type in the next section. An index can contain documents of a single Type, as depicted in the following diagram:

Figure 2.3: Organization of Index, Type, and Document

An index is a logical container of a type. Some configuration parameters are defined at the index level, while other configuration parameters are defined at the type level, as we will see later in this chapter.

The concept of index in Elasticsearch is roughly analogous to the database schema in a relational database. Going by that analogy, a type in Elasticsearch is equivalent to a table, and a document is equivalent to a record in the table. But please keep in mind that this analogy is just for ease of understanding. Unlike relational database schemas, which almost always contain multiple tables, one index can just contain one type. 

Prior to Elasticsearch 6.0, one index could contain multiple types. This has been changed since 6.0 to allow only one type within an index. If you have an existing index with multiple types created prior to 6.0 and you are upgrading to Elasticsearch 6.0, you can still use your old index. You cannot create a new index with more than one type in Elasticsearch 6.0 and above.

With Elasticsearch 7.0, one index can strictly contain only one type by default. Attempting to create a second type would result in the following error: Rejecting mapping update to [index1] as the final mapping would have more than 1 type: [type1, type2]

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

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