ElasticSearch快速使用篇(基本命令篇)
实例:基于一个人员的管理系统项目详细介绍ElasticSearch接入使用的流程
1. 创建index(database)
curl -X PUT http://10.210.40.59:9200/manage?pretty
--服务器ip端口号就不说了
--manage 我们需要创建一个基于项目的数据库
--pretty 让Elasticsearch美化输出(pretty-print)JSON响应以便更加容易阅读
查看创建好的索引(database)信息
curl -X GET http://10.210.40.59:9200/manage?pretty
删除索引(database)
curl -X DELETE http://10.210.40.59:9200/manage?pretty
2. 创建type(table)
在数据库中创建user用户表,当然表字段属性设置除了type还有很多,这里只作简单快速使用的示例
curl -X PUT 10.210.40.59:9200/manage/_mapping/user?pretty -H 'Content-Type: application/json' -d '
{
"properties": {
"user_id": {
"type": "long"
},
"user_name": {
"type": "text"
},
"user_phone":