GET http://192.168.80.131:9200/_cat/plugins
GET http://192.168.80.131:9200/_cat/indices
PUT http://192.168.80.131:9200/tb_hero
PUT http://192.168.80.131:9200/tb_hero
{
"mappings": {
"properties":{
"id":{
"type":"long"
},
"name":{
"type":"keyword"
},
"tech":{
"type":"text",
"analyzer":"ik_max_word",
"search_analyzer":"ik_smart"
},
"age":{
"type":"integer"
},
"update_time":{
"type":"date"
}
}
}
}
PUT http://192.168.80.131:9200/tb_hero/_mapping
{
"properties":{
"id":{
"type":"long"
},
"name":{
"type":"keyword"
},
"tech":{
"type":"text",
"analyzer":"ik_max_word",
"search_analyzer":"ik_smart"
},
"age":{
"type":"integer"
},
"update_time":{
"type":"date"
}
}
}
GET http://192.168.80.131:9200/tb_hero
DELETE http://192.168.80.131:9200/tb_hero
# 方法1:
GET http://192.168.80.131:9200/_analyze
# 方法2:
POST http://192.168.80.131:9200/_analyze
{
"analyzer":"standard",
"text":"武松打虎"
}
1)、ik_smart
http://192.168.80.131:9200/_analyze?pretty=true
{
"analyzer":"ik_smart",
"text":"武松打虎"
}
2)、ik_max_word
GET http://192.168.80.131:9200/_analyze?pretty=true
{
"analyzer":"ik_max_word",
"text":"武松打虎"
}
POST http://192.168.80.131:9200/tb_hero/_doc/1
{
"id": 1,
"name": "武松",
"tech": "景阳冈打虎",
"age": 66,
"update_time": "2020-12-11"
}
GET http://192.168.80.131:9200/tb_hero/_doc/1
GET http://192.168.80.131:9200/tb_hero/_search
PUT http://192.168.80.131:9200/tb_hero/_doc/1
{
"id": 1,
"name": "武松",
"tech": "景阳冈打虎,醉打蒋门神",
"age": 38,
"update_time": "2023-09-03"
}
POST http://192.168.80.131:9200/tb_hero/_update/1
{
"doc": {
"age": 33
}
}
DELETE http://192.168.80.131:9200/tb_hero/_doc/1
根据英雄的技能查询
GET http://192.168.80.131:9200/tb_hero/_search
{
"query":{
"match":{
"tech": "草料"
}
}
}