elasticsearch笔记

文章目录

索引

  • 创建索引

    index/type/id
    index = 关系型数据库database
    type = 关系型数据库table
    id = 关系型数据库主键id 必须唯一 不指定则自动生成
PUT /megacorp/employee/1
{
   "first_name" : "John",
   "last_name" :  "Smith",
   "age" :        25,
   "about" :      "I love to go rock climbing",
   "interests": [ "sports", "music" ]
}
  • 检索索引

GET /megacorp/employee/1
{
	  "_index" :   "megacorp", //索引
	  "_type" :    "employee", //索引type
	  "_id" :      "1", //索引id
	  "_version" : 1,   //修改次数
	  "found" :    true, //是否找到
	  "_source" :  {   //内容
		  "first_name" :  "John",
		  "last_name" :   "Smith",
		  "age" :         25,
		  "about" :       "I love to go rock climbing",
		  "interests":  [ "sports", "music" ]
	  }
}
上一篇:ai 写诗


下一篇:PHP图片加文字水印和图片水印方法(鉴于李老师博客因没加水印被盗,特搜集的办法。希望能有用!)