我是靠谱客的博主 怡然白开水,这篇文章主要介绍[elasticsearch笔记] refresh/optimistic_concurrency_control重点refreshoptimistic concurrency control,现在分享给大家,希望可以做个参考。

重点

  • 数据写入后,并不是马上可以search到,需要refresh(index.refresh_interval 默认1s
  • refresh
    • empty string or true
    • wait_for
    • false (the default)
  • optimistic concurrency control
    • sequence number_seq_no) 通过该字段确保 旧数据 不会覆盖 新数据
    • _seq_no: index全局自增
    • _primary_term: 指定存储主分片
    • _version: 该索引的版本号,默认每次修改都会自增

refresh

  GET /twitter/_search
  {
    "query": {
      "match_all": {}
    }
  }
  
  PUT /twitter/_doc/1?refresh
  {
    "fullname": "zhengcj01",
    "text":"hello"
  }
  
  PUT /twitter/_doc/2?refresh=true
  {
    "fullname": "dongyc",
    "text":"how do you do"
  }
  
  PUT /twitter/_doc/3
  {
    "fullname": "liuhh",
    "text":"hello"
  }
  PUT /twitter/_doc/4?refresh=false
  {
    "fullname": "zhengzj",
    "text":"how do you do"
  }
  
  PUT /twitter/_doc/5?refresh=wait_for
  {
    "fullname": "zhengwj",
    "text":"how do you do"
  }

optimistic concurrency control

PUT products/_doc/1567?if_seq_no=362&if_primary_term=2
{
    "product" : "r2d2",
    "details" : "A resourceful astromech droid",
    "tags": ["droid"]
}

最后

以上就是怡然白开水最近收集整理的关于[elasticsearch笔记] refresh/optimistic_concurrency_control重点refreshoptimistic concurrency control的全部内容,更多相关[elasticsearch笔记]内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(107)

评论列表共有 0 条评论

立即
投稿
返回
顶部