创建索引
PUT /hotel/
{
“mappings”:{
“properties”:{
“title”:{
“type”:“text”
},
“city”:{
“type”:“keyword”
},
“price”:{
“type”:“double”
}
}
}
}
给索引写入数据
POST /hotel/_doc/001
{
“title”:“好再来大酒店”,
“city”:“东京”,
“price”:986.98
}
查看索引数据
GET /hotel/_doc/001
搜索数据-term-精确匹配
GET /hotel/_search
{
“query”: {
“term”: {
“price”: {
“value”: 986.98
}
}
}
}
搜索数据-match-模糊匹配
GET /hotel/_search
{
“query”: {
“match”: {
“title”: “好再”
}
}
}