Mapping detailed 4 (mapping setting)

Source: Internet
Author: User

Mapping type

The mapping settings typically occur in:

1. When adding a new index, add the mapping type to set the fields mapping

PUT Twitter {"Mappings": {    "Tweet": {      "Properties": {        "message": {          "type":"string"        }      }    }  }}

2. Add a new mapping type for index, set the mapping of fields

PUT twitter/_mapping/User {  "properties": {    "  Name": {      "type""string "     }  }}

3. Add a new fields mapping setting for the existing mapping type

PUT twitter/_mapping/Tweet {  "properties": {    "  User_name": {      "type""string "    }  }}

Setup mode

1. Give the full mapping setting in the PUT request body

PUT Twitter {"Mappings": {//Mappings object, description for mapping settings    "Tweet": {//Specify mapping Type      "Properties": {//Specify the properties setting for the mapping type        "message": {//to set the mapping of a field message          "type":"string"              //mappingparameter Configuration        }      }    }  }}

When you add index, you can also set the index, in addition to setting the mapping type, such as configuring a custom analyzer, number of index shards, etc.

PUT/my_index{"Settings": {    " Analysis": {      "Analyzer": {        "AutoComplete": {           "type":"Custom",          "Tokenizer":" Standard",          "Filter": [            "lowercase",            "Autocomplete_filter"          ]        }      }    }  },  "Mappings": {    "My_type": {      "Properties": {        "text": {          "type":"string",          "Analyzer":"AutoComplete"        }      }    }  }}

2. Specify the type in the PUT request URI and give the type's settings in the request body

PUT twitter/_mapping/User {  "properties": {                   // Specify mapping The properties of type set    "name": {                       // Set the mapping of the field message       "type""string "               parameter Configuration     }  }}

3. A complete mapping type setting includes: Meta-fields and fields or properties settings

PUT my_index{"Mappings": {    "Type_1": {       "Properties": {...}//Properties Settings    },    "type_2": {       "_all": {//meta-fields Settings        "enabled":false      },      "Properties": {...} }  }}

Mapping detailed 4 (mapping setting)

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.