经过一番评估,为了之后方便扩展,还是决定使用ElasticSearch进行开发。之前的地图服务都是基于Sprootboot框架构建的,因而这里需要将Elastic也糅合进去。
Elastic安装
对应关系2、下载好之后,解压缩,cmd命令进入bin文件夹下,执行命令elasticsearch.bat。
访问localhost:9200
bin
9200
可以看到当前es的相关信息,包括版本信息等,cluster_name可以在config/elasticsearch.yml中修改。
ES可视化界面
ElasticHDES增删改查
PostManES中新建索引
POST 127.0.0.1:9200/book/novel/1
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings":{
"novel":{
"properties":{
"word_count":{
"type":"integer"
},
"author":{
"type":"keyword"
},
"title":{
"type":"text"
},
"publish_date":{
"type":"date",
"format":"yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || epoch_millis"
}
}
}
}
}
索引中插入数据
{
"word_count":500,
"author":"zc",
"title":"空间分析",
"publish_date":"2015-09-23"
}
打开ElasticHD页面,可以看到:
book
下一篇讲如何集成到springboot中。