Current location - Loan Platform Complete Network - Big data management - Big data idmapping
Big data idmapping
This section focuses on some basic knowledge, including document routing principle, writing consistency, reading and adding, deleting and modifying requests.

(1) What does it mean that the document is routed to fragmentation?

The data of an index will be divided into multiple slices. So a document can only exist in one fragment. When a client creates a document, es needs to decide which fragment of the index to put the document on. This process is called document routing, which means data routing.

(2) routing algorithm: shard = hash (routing)% NUMBER _ of _ primary _ shards

For example, an index has three main fragments, P0, P 1, P2.

Every time a document is added, deleted or changed, a routing number is brought. The default is the id of the document (which can be specified manually or generated automatically). ES will pass this routing value into a hash function to generate a hash value of the routing value, hash(routing) = 2 1. Then the value generated by the hash function is the remainder of the number of main segments of this index, and 2 1% 3 = 0. ES just put this document on P0. (This shows why the number of primary_shards is fixed. )

(3) Manually specify the route: _ id or a custom route value.

The default route is _id, or you can specify the route manually when sending the request, for example

Please refer to the official documents for specific operations.

_ routing field | Elastic search Reference[7.6]| Elastic/article/ 1 10