post操作elasticsearch增删改查(一)

一、创建索引

{
	"mappings":{
			"properties":{
				"id":{    
					"type":"text"  
				},
				"name":{
					"type":"text"
				},
				"birthday":{
					"type":"date",
					"format":"yyyy-MM-dd"
				}
			}
	}
}


二、删除索引

三、添加数据

{
"id":1,
"name":"qfx",
"birthday":"1992-01-07"
}

四、删除数据

五、查询(主键查询)

2、模糊匹配

3、高亮匹配查询结果


{
	"query":{
		"match":{
			"name":"fw"
		}
	},
	"highlight": {
	"pre_tags": "<b class='key' style='color:red'>",
	"post_tags": "</b>",
    "fields": {
      "name": {}
    }
  }
}
发布了68 篇原创文章 · 获赞 10 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/dw5235/article/details/104906856
今日推荐