# 创建索引 并设置mapping&分片数&副本数
curl -XPUT 'http://user:password@url:9200/books' -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"book_id": {
"type": "keyword"
},
"book_name": {
"analyzer": "standard",
"type": "text"
},
"update_time": {
"type": "date"
},
"create_time": {
"type": "date"
}
}
}
}'
# 查询索引
curl -XGET 'http://user:password@url:9200/books?pretty'
# 删除索引
curl -XDELETE 'http://user:password@url:9200/books'
# 查询索引
curl -XGET 'http://user:password@url:9200/books?pretty'