- Elasticsearch 7.0 Cookbook(Fourth Edition)
- Alberto Paro
- 229字
- 2021-06-24 14:52:00
There's more...
In Elasticsearch, the separation of documents in types is logical, not physical. The Elasticsearch core engine transparently manages this. Physically, all the document types go in the same Lucene index, so there is no full separation between them. The concept of types is purely logical and enforced by Elasticsearch. The user is not bothered about this internal management, but in some cases where you have huge amounts of records, this has an impact on the performance of reading and writing records because all the records are stored in the same index files.
Every document has a unique identifier, called UID for index, which is stored in the special _uid field of the document. This is automatically calculated by adding the type of the document to the _id. In our example, the _uid will be _doc#1.
The _id can be provided at index time or it can be assigned automatically by Elasticsearch if it is missing.
When a mapping type is created or changed, Elasticsearch automatically propagates mapping changes to all nodes in the cluster, so that all the shards are aligned to process that particular type.