1.第一步,下载压缩包,解压即可用
ES库解压版,下载后进入到bin目录下有一个 elasticsearch.bat 双击运行即可
链接:https://pan.baidu.com/s/1lo7Nhb0ytAIXCQFCYDmGMg
提取码:a123
ES库数据入库使用,使用方式:下载后解压,通过cmd进入到bin目录下,执行数据入库脚本的命令:elasticdump --output=http://127.0.0.1:9200/mgs_global_poi --input=D:\ES\global_addr.json --limit=1000
链接:https://pan.baidu.com/s/1akLK68C0pHT_K7hmeH6Oaw
提取码:b321
2.索引的创建脚本我放到最下面
解压后如下:
2.运行ES,进入bin目录下双击 elasticsearch.bat
3.运行成功测试,浏览器输入:http://localhost:9200 ,出现以下信息启动成功
创建索引,下载压缩包,然后解压
链接:https://pan.baidu.com/s/1KCt2ra0hpU2apVwQd6Cf7Q
提取码:a456
解压后打开index.html
点击进入
添加索引脚本,勾选易读,再点击验证JSON,然后点击提交请求
大家可能没有索引脚本,我这边提供一个,下载下来复制粘贴到第一步的框框里就行
链接:https://pan.baidu.com/s/1TA4vYmRBf5jlx9Kyk_Uf4w
提取码:b321
提交后创建成功
然后可以通过概览查看,图下为刚刚所新加索引
ES库本身自己就封装了一套对外查询的接口,可以通过postman测试
这里我多说一句关于数据怎么入库,我的数据是高德趴的数据,一个大JSON,可以通过 elasticsearch-head-master,通过cmd窗口进入bin目录下然后执行数据加载的脚本命令:elasticdump --output=http://127.0.0.1:9200/mgs_global_poi --input=D:\ES\global_addr.json --limit=1000
索引脚本(粘贴复制直接提交就行)
{
"settings": {
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"refresh_interval": "15s",
"number_of_shards": "5",
"max_result_window": "2147483647",
"analysis": {
"filter": {
"pinyin_simple_filter": {
"keep_joined_full_pinyin": "true",
"lowercase": "true",
"none_chinese_pinyin_tokenize": "false",
"padding_char": " ",
"keep_original": "true",
"keep_first_letter": "true",
"keep_separate_first_letter": "false",
"type": "pinyin",
"keep_full_pinyin": "false"
},
"pinyin_full_filter": {
"keep_joined_full_pinyin": "true",
"lowercase": "true",
"keep_original": "false",
"keep_first_letter": "false",
"keep_separate_first_letter": "false",
"type": "pinyin",
"keep_none_chinese": "false",
"limit_first_letter_length": "50",
"keep_full_pinyin": "true"
}
},
"analyzer": {
"pinyiSimpleIndexAnalyzer": {
"filter": [
"pinyin_simple_filter",
"lowercase"
],
"type": "custom",
"tokenizer": "ik_max_word"
},
"pinyinFullIndexAnalyzer": {
"filter": [
"asciifolding",
"lowercase",
"pinyin_full_filter"
],
"type": "custom",
"tokenizer": "ik_max_word"
},
"ik_pinyin_analyzer": {
"filter": [
"asciifolding",
"lowercase",
"pinyin_full_filter",
"word_delimiter"
],
"type": "custom",
"tokenizer": "ik_smart"
},
"ikIndexAnalyzer": {
"filter": [
"asciifolding",
"lowercase"
],
"type": "custom",
"tokenizer": "ik_max_word"
}
}
},
"number_of_replicas": "2"
}
},
"mappings": {
"dynamic_templates": [],
"properties": {
"center_location": {
"type": "geo_point"
},
"create_time": {
"type": "keyword"
},
"create_user": {
"type": "keyword"
},
"data_id": {
"type": "keyword"
},
"data_name": {
"type": "text",
"analyzer": "pinyinFullIndexAnalyzer"
},
"dataset_id": {
"type": "keyword"
},
"datasource_id": {
"type": "keyword"
},
"geo_type": {
"type": "keyword"
},
"is_share": {
"type": "integer"
},
"link_url": {
"type": "keyword"
},
"md5_id": {
"type": "keyword"
},
"place_adcode": {
"type": "keyword"
},
"place_address": {
"type": "text",
"analyzer": "pinyinFullIndexAnalyzer"
},
"place_city": {
"type": "keyword"
},
"place_country": {
"type": "keyword"
},
"place_countryside": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"place_district": {
"type": "keyword"
},
"place_doorplate": {
"type": "text"
},
"place_email": {
"type": "keyword"
},
"place_icon": {
"type": "keyword"
},
"place_labels": {
"type": "text"
},
"place_province": {
"type": "keyword"
},
"place_summary": {
"type": "text"
},
"place_telnum": {
"type": "keyword"
},
"place_town": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"place_website": {
"type": "keyword"
},
"smgeometry": {
"type": "geo_shape"
},
"type_code": {
"type": "long"
},
"type_name": {
"type": "keyword"
},
"update_time": {
"type": "keyword"
},
"update_user": {
"type": "keyword"
}
}
}
}