1.创建索引
PUT exchange
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "test"
}
注意:索引名不能包含大些字母
2.指定参数创建索引
PUT blog
{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 1
}
}
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "blog"
}
3.查看索引
3.1 查看指定索引的配置信息
GET blog/_settings
{
"blog": {
"settings": {
"index": {
"creation_date": "1515458969949",
"number_of_shards": "3",
"number_of_replicas": "1",
"uuid": "A7pKNO7bTgucu1uNgmXlQg",
"version": {
"created": "5060399"
},
"provided_name": "blog"
}
}
}
}
4.删除索引
DELETE test
{
"acknowledged": true
}
5.添加索引并指定类型字段信息
PUT exchangehistory
{
"settings" : {
"number_of_shards" : 5
},
"mappings" : {
"record" : {
"properties" : {
"amount": {
"type": "float"
},
"contract": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"exchange_time": {
"type": "date"
},
"id": {
"type": "long"
},
"last": {
"type": "float"
},
"time": {
"type": "date"
},
"volume": {
"type": "float"
}
}
}
}
}