目录
1.5.1 创建索引
PUT /hotel
{
"mappings": {
"properties": {
"title": {
"type": "text"
},
"city": {
"type": "keyword"
},
"price": {
"type": "double"
}
}
}
}
1.5.2 写入文档
POST /hotel/_doc/001
{
"title":"好再来酒店",
"city":"青岛",
"price":578.23
}
1.5.3 根据_id搜索文档
GET /hotel/_doc/001
1.5.4 根据一般字段搜索文档
GET /hotel/_search
{
"query": {
"term": {
"price": {
"value": 578.23
}
}
}
}
1.5.5 根据文本字段搜索文档
GET /hotel/_search
{
"query": {
"match": {
"title": "再来"
}
}
}