Elastyczne wyszukiwanie

Why were ES Mapping Types removed in ES v6.0?

Why were ES Mapping Types removed in ES v6.0?

What are Mapping Types?

In Elasticsearch, each document belongs to an Index and a Type. An Index can be considered as a Database whereas a Type can be seen as a Table when compared to a Relational Database. A mapping Type was a logical partition of an object with other objects which belonged to other Mapping Types in the same Index.

Each Mapping Type has its own fields. For example, a type of user can have following fields:


"id" : 123,
"name" : "Shubham",
"website" : 1

Another Mapping Type in the same index website can have following fields which are completely different from the user type:


"id" : 1,
"title" : "LinuxHint",
"link" : "https://linuxhint.com/"

While searching for a document in an index, the search could have been limited to a single document by specifying a single field as:

GET idx_name/user,website/_search

"query":
"match":
"id": 1


The _type field of the documents was combined with its _id to generate a _uid field so documents with same _id could exist in a single index.

Read Elasticsearch Tutorial for Beginners for a deeper understanding of Elasticsearch Architecture and get started with it with Install ElasticSearch on Ubuntu.

Why are Mapping Types being removed?

Just like what we said above while explaining how Index and Types were similar to a Database and a Table in a Relational Database, Elasticsearch team thought the same but this wasn't the case as Lucene Engine doesn't follow the same analogy. This is because of the following reasons:

Alternatives to Mapping Types

Although the decision has been made, we still need to separate different types of data. Now, the first alternative is to separate documents in their own index which has two advantages:

Another alternative to separating the data is maintaining a custom _type field in each document we insert, like:

PUT db_name/doc/123

"type": "user",
"id": 123,
"name": "Shubham",
"website": 1

PUT db_name/doc/website

"type": "website",
"id": 1,
"title": "LinuxHint",
"link": "https://linuxhint.com/"

This is an excellent usage if you're looking for a complete custom solution.

Schedual for removal of Mapping Types

As removing Mapping Types is a big change, ES team is doing the process slowly. Here is a schedule for the roll out extracted from elastic.co:

Conclusion

In this lesson, we looked at why were Elasticsearch Mapping types removed and will be completely unsupported in coming versions.

Gry Zremasterowane gry HD dla Linuksa, które nigdy wcześniej nie zostały wydane na Linuksa
Zremasterowane gry HD dla Linuksa, które nigdy wcześniej nie zostały wydane na Linuksa
Wielu twórców gier i wydawców wymyśla remaster HD starych gier, aby przedłużyć żywotność serii, prosimy fanów o kompatybilność z nowoczesnym sprzętem ...
Gry Jak używać AutoKey do automatyzacji gier Linux
Jak używać AutoKey do automatyzacji gier Linux
AutoKey to narzędzie do automatyzacji pulpitu dla systemów Linux i X11, zaprogramowane w Python 3, GTK i Qt. Korzystając ze skryptów i funkcji MAKRO, ...
Gry How to Show FPS Counter in Linux Games
How to Show FPS Counter in Linux Games
Linux gaming got a major push when Valve announced Linux support for Steam client and their games in 2012. Since then, many AAA and indie games have m...