#获取索引的mapping信息
GET /biz_article/_mapping
#获取索引的内容信息,如果记录过多会只展示一部分
GET /biz_article/_search
#根据某些条件查询索引的记录信息
GET /biz_article/_search
{
"query": {
"match": {
"content": "病毒"
}
},
"highlight": {
"fields" : {
"content" : {}
}
}
}
#发送一段文本并设定号分词器名称,让elasticsearch进行分词
POST _analyze
{
"analyzer": "ik_smart",
"text": "我是一个中国人,张姓在中国是大姓。"
}
#创建一个索引并指定他的部分mapping
PUT /biz_article
{
"mappings": {
"properties" : {
"id" : {
"type" : "integer"
},
"title" : {
"type" : "text",
"analyzer" : "ik_smart"
},
"user_id" : {
"type" : "keyword"
},
"author" : {
"type" : "text",
"analyzer" : "ik_smart"
},
"cover_image" : {
"type" : "text"
},
"qrcode_path" : {
"type" : "keyword"
},
"is_markdown" : {
"type" : "boolean"
},
"content" : {
"type" : "text",
"analyzer" : "ik_smart"
},
"content_md" : {
"type" : "text",
"analyzer" : "ik_smart"
},
"top" : {
"type" : "boolean"
},
"category_id" : {
"type" : "keyword"
},
"status" : {
"type" : "boolean"
},
"recommended" : {
"type" : "boolean"
},
"slider" : {
"type" : "boolean"
},
"slider_img" : {
"type" : "keyword"
},
"original" : {
"type" : "boolean"
},
"description" : {
"type" : "text",
"analyzer" : "ik_smart"
},
"keywords" : {
"type" : "keyword"
},
"comment" : {
"type" : "boolean"
},
"create_time" : {
"type" : "date"
},
"update_time" : {
"type" : "date"
},
"enclosure" : {
"type" : "keyword"
}
}
}
}
#删除一个索引
DELETE /biz_article/_doc/12