小编Ash*_*ari的帖子

version_conflict_engine_exception 与多个 _update_by_query

我有我得到的情况version_conflict_engine_exception。我有守护进程,它不断地将数据更新到elasticsearch。我正在使用_updat_by_query. 这是示例调用:

curl -XPOST 'localhost:9200/my_index/my_type/_update_by_query?pretty' -H 'Content-Type: application/json' -d '
{
   "query":{
      "term":{
         "userid":1234
      }
   },
   "script":{
      "lang":"painless",
      "inline":"if (ctx._source.containsKey(\"newfield\")) {ctx._source.newfiled.add(params.value)} else {ctx._source.newfield = [params.value]}",
      "params":{
         "value":{"new":"value"}
      }
   }
}'
Run Code Online (Sandbox Code Playgroud)

每当我有相同的用户 ID(在query.terms)时,就会有多个更新查询一个接一个地点击,它给我错误version_conflict_engine_exception。我知道这是因为版本冲突,但我们如何克服我经常更新查询的问题。我也没有找到任何bulk选项_update_by_query。我收到以下错误:

{
    "took": 1,
    "timed_out": false,
    "total": 1,
    "updated": 0,
    "deleted": 0,
    "batches": 1,
    "version_conflicts": 1,
    "noops": 0,
    "retries": {
        "bulk": 0,
        "search": 0
    },
    "throttled_millis": 0,
    "requests_per_second": -1.0,
    "throttled_until_millis": 0,
    "failures": [{
        "index": "my_index",
        "type": "my_type", …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

6
推荐指数
1
解决办法
1万
查看次数

无法以只读模式插入表

当我尝试在 clickhouse 数据库中插入记录时,出现以下异常:

例外:

Code: 164, e.displayText() = DB::Exception: Cannot insert into table in readonly mode, e.what() = DB::Exception
Run Code Online (Sandbox Code Playgroud)

节点包:

https://www.npmjs.com/package/clickhouse

连接代码:

const clickhouse = new ClickHouse({
url: 'http://localhost',
port: 8123,
debug: true,
database: 'mydb',
basicAuth: 'default',
username: '',
password: '',
isUseGzip: false,
config: {
    session_timeout                         : 60,
    output_format_json_quote_64bit_integers : 0,
    enable_http_compression                 : 0
},

});
Run Code Online (Sandbox Code Playgroud)

表架构:

CREATE TABLE logs_1 ( trid UInt64,  date UInt32,  email String) ENGINE = Log;
Run Code Online (Sandbox Code Playgroud)

node.js clickhouse

2
推荐指数
1
解决办法
3984
查看次数

标签 统计

clickhouse ×1

elasticsearch ×1

node.js ×1