-
安装包快速下载地址
-
启动elasticsearch和kibana
- 解压 elasticsearch和kibana 压缩包
- windows
- 切换路径到elasticsearch-7.5.2的bin目录,双击elasticsearch.bat
- 切换路径到kibana-7.5.2的bin目录,双击kibana.bat
- mac,linux
- 切换到elasticsearch-7.5.2的bin目录,运行
./elasticsearch
命令 - 切换到kibana-7.5.2的bin目录,运行
./kibana
命令
- 切换到elasticsearch-7.5.2的bin目录,运行
- 打开
http://127.0.0.1:9200
查看elasticsearch是否启动成功 - 打开
http://127.0.0.1:5601
查看kibana是否启动成功
-
安装ik分词器插件
-
创建elasticsearch的车辆索引
- 在elasticsearch-7.5.2\config\analysis-ik的目录创建,synonyms.txt文件。
- 打开
http://127.0.0.1:5601/
- 点击左边的工具栏的 Dev Tools
- 在config目录中创建analysis-ik文件,并且在analysis-ik文件夹里创建synonyms.txt文件 !synonyms.txt文件
- 创建车辆索引:
PUT /car?include_type_name=false
{
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"analysis": {
"filter": {
"my_synonym_filter":{
"type":"synonym",
"synonyms_path":"analysis-ik/synonyms.txt"
}
},
"analyzer": {
"ik_syno":{
"type":"custom",
"tokenizer":"ik_smart",
"filter":["my_synonym_filter"]
},
"ik_syno_max":{
"type":"custom",
"tokenizer":"ik_max_word",
"filter":["my_synonym_filter"]
}
} }
},
"mappings": {
"properties": {
"id":{"type":"integer"},
"car_brand_name":{
"type": "text",
"analyzer": "ik_syno_max",
"search_analyzer": "ik_syno"
},
"car_series_name":{
"type": "text",
"analyzer": "ik_syno_max",
"search_analyzer": "ik_syno"
},
"car_model_name":{
"type": "text",
"analyzer": "ik_syno_max",
"search_analyzer": "ik_syno"
},
"mileage":{"type": "double"},
"new_car_price":{"type": "double"},
"create_time":{"type": "date"},
"price":{"type": "double"},
"purchase_price":{"type": "double"},
"predict_price":{"type": "double"},
"location":{"type": "geo_point"}
}
}
}