015 es并发控制

2020-03-29  本文已影响0人  zhu733756

# 并发控制,es中没有行锁,所以用的是乐观锁机制,也就是通过version增加来控制,

# 可以尝试用if_seq_no=0&if_primary_term=1来检测版本冲突

DELETE blogs

PUT /blogs/_doc/1

{

    "title": "Quick brown rabbits",

    "body":  "Brown rabbits are commonly seen."

}

PUT /blogs/_doc/1?if_seq_no=2&if_primary_term=1

{

    "title": "Quick brown rabbits",

    "body":  "Brown rabbits are commonly seen."

}

PUT /blogs/_doc/1

{

    "title": "Keeping pets healthy",

    "body":  "My quick brown fox eats rabbits on a regular basis."

}

PUT /blogs/_doc/1?version=30000&version_type=external

{

    "title": "Keeping pets healthy",

    "body":  "My quick brown fox eats rabbits on a regular basis."

}

上一篇下一篇

猜你喜欢

热点阅读