[elk]es增删改查最佳实战

PUT app01

GET app01/_settings

GET _all/_settings
PUT app01/_settings
{
  "number_of_replicas":0
}

GET _cat/health
GET _cat/nodes
GET _cat/indices?v


DELETE app01


POST app01/user/1
{
  "name":"bob",
  "gender":"male",
  "age":17
}


POST app01/user/2
{
  "name":"cristin",
  "gender":"femail",
  "age":19
}

POST app01/user/3
{
  "name":"emy",
  "gender":"female",
  "age":20
}


PUT app01/user/4
{
  "name":"aaron",
  "gender":"male",
  "age":23
}


GET app01/user/_search
GET app01/user/1
GET app01/user/1?_source
GET app01/user/1?_source=gender,age





PUT testdb/job1/1
{
  "title": "job1_1"
}


PUT testdb/job1/2
{
  "title": "job1_2"
}


PUT testdb/job2/1
{
  "title": "job2_1"
}

PUT testdb/job2/2
{
  "title": "job2_2"
}


GET _mget
{
  "docs": [
    {
      "_index":"testdb",
      "_type":"job1",
      "_id": 1
    },
    {
      "_index":"testdb",
      "_type":"job2",
      "_id": 2
    }
    ]
}



GET testdb/_mget
{
  "docs": [
    {
      "_type":"job1",
      "_id": 1
    },
    {
      "_type":"job2",
      "_id": 2
    }
    ]
}

GET testdb/job1/_mget
{
  "docs": [
    {
      "_id": 1
    },
    {
      "_id": 2
    }
    ]
}

GET testdb/job1/_mget
{
  "ids": [1,2]
}


PUT _bulk
{"index":{"_index":"lagou","_type":"job","_id":"1"}}
{"title":"python分布式爬虫开发","salary_min":15000,"city":"深圳","company":{"name":"腾讯","company_addr":"深圳市软件园"},"publish_date":"2017-11-11","comments":15}
{"index":{"_index":"lagou","_type":"job","_id":"2"}}
{"title":"django开发","salary_min":15000,"city":"上海","company":{"name":"阿里","company_addr":"广州市软件园"},"publish_date":"2017-11-12","comments":20}


{"index":{"_index":"testdb","_type":"job","_id":"1"}}
{"filed1":"value1"}

{"delete":{"_index":"testdb","_type":"job","_id":"1"}}

{"create":{"_index":"testdb","_type":"job","_id":"1"}}
{"filed1":"value1"}

{"update":{"_index":"testdb","_type":"job","_id":"1"}}
{"doc":{"filed2":"value2"}}





posted @ 2017-11-12 09:12  _毛台  阅读(355)  评论(0编辑  收藏  举报