V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yxs19910622
V2EX  ›  Elasticsearch

es 插入新数据时可以选择不覆盖旧数据吗

  •  
  •   yxs19910622 · 2019-04-29 11:22:05 +08:00 · 5415 次点击
    这是一个创建于 1795 天前的主题,其中的信息可能已经有所发展或是发生改变。
    就是碰到相同 id 就跳过 试了几种插入都被覆盖了 也没有搜到相关的配置
    1 条回复    2019-04-29 12:01:47 +08:00
    AlloVince
        1
    AlloVince  
       2019-04-29 12:01:47 +08:00
    可以用 HTTP Head 检查 document 是否存在

    https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html#docs-get

    如果你是担心写入压力的问题,也可以在客户端发起请求前加去重的逻辑
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2559 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 15:56 · PVG 23:56 · LAX 08:56 · JFK 11:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.