ElasticSearch 6.x 学习笔记:8.路由机制




PUT blog/csdn/3?routing=chengyuqiang 

{ 

  "id":3, 

  "title":"Java简介", 

  "author":"chengyuqiang", 

  "content":"Oracle Java" 

}
     
     
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

{
  "_index": "blog",
  "_type": "csdn",
  "_id": "3",
  "_version": 1,
  "result": "created",
  "_shards": {
    "total": 2,
    "successful": 2,
    "failed": 0
  },
  "created": true
}
  
  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

查询

GET blog/_search?routing=chengyuqiang
  
  
  • 1
{
  "took": 5,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 1,
    "hits": [
      {
        "_index": "blog",
        "_type": "csdn",
        "_id": "3",
        "_score": 1,
        "_routing": "chengyuqiang",
        "_source": { "id": 3, "title": "Java简介", "author": "chengyuqiang", "content": "Oracle Java" } }
    ]
  }
}
  
  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

删除

DELETE blog/csdn/3
  
  
  • 1
{
  "found": false,
  "_index": "blog",
  "_type": "csdn",
  "_id": "3",
  "_version": 1,
  "result": "not_found",
  "_shards": {
    "total": 2,
    "successful": 2,
    "failed": 0
  }
}
  
  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
DELETE blog/csdn/3?routing=hadron
  
  
  • 1
{
  "found": false,
  "_index": "blog",
  "_type": "csdn",
  "_id": "3",
  "_version": 2,
  "result": "not_found",
  "_shards": {
    "total": 2,
    "successful": 2,
    "failed": 0
  }
}
  
  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
DELETE blog/csdn/3?routing=chengyuqiang
  
  
  • 1

{ 

  "found": true, 

  "_index": "blog", 

  "_type": "csdn", 

  "_id": "3", 

  "_version": 2, 

  "result": "deleted", 

  "_shards": { 

    "total": 2, 

    "successful": 2, 

    "failed": 0 

  } 

}
  
  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13





PUT blog/csdn/3?routing=chengyuqiang 

{ 

  "id":3, 

  "title":"Java简介", 

  "author":"chengyuqiang", 

  "content":"Oracle Java" 

}
  
  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

猜你喜欢

转载自blog.csdn.net/u011428598/article/details/81081235
今日推荐