https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html
一、Field datatypes:
二、Meta-Fields:
_index | The index to which the document belongs | |
_uid | A composite field consisting of the _type and the _id | |
_type | The document's mapping type | |
_id | The document's id | |
_source | The original JSON representing the body of the document | |
_size | The size of the _source field in bytes,provided by the mapper-size plugin | |
_all | A catch-all field that indexes the values of all other fields | |
_field_names | ||
_timestamp | ||
_ttl | ||
_parent | Used to create a parent-child relationship between two mapping types | |
_routing | A custom routing value which routes a document to a particular shard | |
_meta | Applicationg specific metadata |
三、Mapping parameters
fields:
It is often useful to Index the same filed in different ways for different purposes.This is the purpose of multi-fileds.For instance,a string field could be indexed as an analyzed field for full-text search, and as a not_analyzed field for sorting or aggregations
curl -XPUT 'http://localhost:9200/my_index/_mapping/my_type' -d '{
"properties": {
"city": {
"type": "string",
"fields": {
"raw": { =>city.raw field is a not_analyzed version of city field
"type": "string",
"index": "not_analyzed"
}
}
}
}
}'
curl -XPUT 'http://localhost:9200/my_index//my_type/1' -d '{
"city":"New York"
}'
curl -XPUT 'http://localhost:9200/my_index//my_type/2' -d '{
"city":"York"
}'
curl -XGET 'http://10.224.246.146:9200/my_index/my_type/_search'