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)