# 索引初始化,number_of_shards:分片数,不可修改;number_of_replicas:副本数,可修改
PUT lagou
{"settings":{"index":{"number_of_shards":5,"number_of_replicas":1}}}# 获取索引settings
GET lagou/_settings
GET _all/_settings
GET _settingsGET .kibana,lagou/_settings# 更新索引
PUT lagou/_settings
{
“number_of_replicas”:2
}# 获取索引信息
GET _all
GET lagou
CRUD
# 新建# 新建数据,指定id
PUT lagou/job/1
{"title":"python分布式爬虫","salary_min":15000,"city":"北京","company":{"name":"百度","company_addr":"北京市软件园"},"publish_date":"2017-4-16","comments":15
}# 新建数据
POST lagou/job/
{"title":"python分布式爬虫","salary_min":15000,"city":"北京","company":{"name":"百度","company_addr":"北京市软件园"},"publish_date":"2017-4-16","comments":15
}# 查询
GET lagou/job/1
# 只获取title字段
GET lagou/job/1?_source=title
# 获取title,city字段
GET lagou/job/1?_source=title,city
# 获取所有字段
GET lagou/job/1?_source# 修改# 覆盖更新
PUT lagou/job/1
{"title":"python分布式爬虫","salary_min":15000,"company":{"name":"百度","company_addr":"北京市软件园"},"publish_date":"2017-4-16","comments":15
}# 更新指定字段
POST lagou/job/1/_update
{"doc":{"comments":20}}# 删除# 删除文档
DELETE lagou/job/1
# 删除索引
DELETE lagou