Elasticsearch 6.0.0 and after removing an index allows mapping of multiple types of operations (removal of mapping types)

Source: Internet
Author: User

Used to 6.2, and thought that like 5.X allows the creation of a parent-child relationship document, that is, one index allows the mapping of multiple types, the operation will not find a viable

The following code:

put/company{  "mappings": {    "branch": {},    "employee": {      "_parent": {        "type": "Branch"       }    }  }}

Find the latest official documentation and give a description to the effect that:

6.0.0 Removing an index allows multiple types to be mapped, although the same indexed multi-type query is supported, but the version of Elasticsearch 7.0.0 is completely discarded.

But the authorities have given another solution.

Custom Type Fieldeditof course, there is a limit to how many primary shards can exist in a cluster so your may not want to Waste an entire shard for a collection of only a few thousand documents. In this case, you can implement your own custom type field which would work in a similar the-to-the-old _type. Let's take the user/tweet example above.  Originally, the workflow would has looked something like this:put twitter{"mappings": {"user": {"Properties":      {"Name": {"type": "Text"}, "user_name": {"type": "Keyword"}, "email": {"type": "Keyword"}  }}, "tweet": {"Properties": {"content": {"type": "Text"}, "user_name": {"type": "Keyword" }, "Tweeted_at": {"type": "Date"}}}}}put twitter/user/kimchy{"name": "Shay Banon", "user_name": " Kimchy "," email ":" [email protected] "}put twitter/tweet/1{" user_name ":" Kimchy "," Tweeted_at ":" 2017-10-24t09:0 0:00z "," Content ":" Types is going Away "}gettwitter/tweet/_search{"Query": {"match": {"user_name": "Kimchy"}}}you could achieve the same thing by ad  Ding a custom type field as Follows:put twitter{"mappings": {"_doc": {"Properties": {"type": {"type": "Keyword"}, "name": {"type": "Text"}, "user_name": {"type": "Keyword"}, "email": {"type": "Ke Yword "}," content ": {" type ":" Text "}," Tweeted_at ": {" type ":" Date "}}}}}put twitter/_doc/us er-kimchy{"type": "User", "name": "Shay Banon", "user_name": "Kimchy", "email": "[email protected]"}put Twitter /_doc/tweet-1{"type": "Tweet", "user_name": "Kimchy", "Tweeted_at": "2017-10-24t09:00:00z", "Content": "Types is Go"        ing away "}get twitter/_search{" "Query": {"bool": {"must": {"match": {"user_name": "Kimchy" }}, "filter": {"match": {"type": "Tweet"}}}} The explicit type F Ield takes the place ofThe implicit _type field. 

This is the 6.x of the official website. Description of this point: https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html

Elasticsearch 6.0.0 and after removing an index allows mapping of multiple types of operations (removal of mapping types)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.