创建:
PUT estest
{
"settings" : {
"number_of_shards": 1,
"number_of_replicas" : 0
},
"mappings" : {
"properties": {
"id": {
"type": "keyword"
},
"time": {
"type": "date"
},
"name": {
"type": "text"
},
"content": {
"type": "text"
},
"city": {
"type": "text"
}
}
}
}
追加:
PUT estest/_mapping
{
"properties": {
"user": {
"properties": {
"first": {"type": "text"},
"last": {"type": "text"}
}
}
}
}
该文档展示了如何使用PUT请求创建一个Elasticsearch索引,设置分片和副本数量,并定义字段类型如id,time,name,content,city作为文本,以及time为日期。后续内容追加了user字段,包含first和last子字段,也定义为文本类型。
1781

被折叠的 条评论
为什么被折叠?



