在网上搜了一大圈,得出的结果要么版本太老,要么压根不能用,没办法,只能自力更生,去ElasticSearch官网寻找答案。
一、创建索引
如果使用curl,按照如下操作。ElasticSearch 7.x不再需要type,所以在后面的json的mappings中,直接设置properties即可。
$ curl -X PUT 'localhost:9200/you_index_name' -d '
{
"mappings": {
"properties": {
"user": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
},
"title": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
},
"desc": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
}
}
}
}'