标签:创建 index2 mapping number test elasticsearch fields date type
Mapping is the process of defining how a document, and the fields it contains, are stored and indexed. For instance, use mappings to define:
- which string fields should be treated as full text fields.
- which fields contain numbers, dates, or geolocations.
- the format of date values.
- custom rules to control the mapping for dynamically added fields.
简而言之,Mapping就是数据的映射关键,决定具体的数据类型及判断是否被分词
下面是具体的创建过程
PUT test_index2
{
"settings":{
"number_of_shards":1,
"number_of_replicas":0
},
"mappings": {
"dynamic": false,
"properties": {
"title": {
"type": "text"
},
"name": {
"type": "keyword"
},
"size": {
"type": "integer"
},
"price": {
"type": "integer"
},
"area": {
"type": "integer"
},
"createTime": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"lastUpdateTime": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"layoutDesc" : {
"type": "text"}
}
}
}
生产系统需要注意下面两个配置
"number_of_shards":1, ##数据大,就需要多些数据节点,可以把数据均衡分布到不同的节点,可以分布式的查询(并行)
"number_of_replicas":0 ###设置副本数量,提高数据安全行,同时提升查询性能
****分片的数量创建后不能改变,副本可以
查看分片信息:
http://127.0.0.1:9200/test_index2/_settings?pretty
kibanna查看:
GET test_index2/_settings?pretty
GET test_index2/_mapping?pretty
标签:创建,index2,mapping,number,test,elasticsearch,fields,date,type 来源: https://blog.csdn.net/h_sn9999/article/details/102769660
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。