获取错误 502,{“ok”:false,”message”:”backend closed connection”} 用于将字段丰富到另一个索引

Getting Error 502,{“ok”:false,”message”:”backend closed connection”} for enriching fields to another index

我有两个索引1.ther2.part。 “ther”索引有24个字段,“part”索引有19个字段。我必须用“part”索引字段丰富“ther”索引。

字段“user_id”在两个索引之间是通用的。使用丰富过程,我尝试创建第 3 个索引“part_ther”

get ther/_search
{
        "_index" : "ther",
        "_type" : "_doc",
        "_id" : "2",
        "_score" : 1.0,
        "_source" : {
          "Ahi" : 42.6,
          "Index" : 90,
          "ipapPressureAverage" : 49,
          "MinuteVentAverage" : 20,
          "DeviceSerialNumber" : "<>",
          "ClearAirwayApneaIndex" : 72.26135463,
          "PeriodicBreathingTime" : 9311,
          "cpapPressure90Pct" : 22,
          "epapPressureAverage" : 73,
          "ipapPressure90Pct" : 27,
          "Usage" : 93904,
          "epapPressure90Pct" : 10,
          "AverageBreathRate" : 65,
          "@timestamp" : "2021-08-29T00:00:00.000+05:30",
          "user_id" : "39,476",
          "TrigBreathsPct" : 93,
          "cpapPressureAverage" : 29,
          "AverageExhaledTidalVolume" : 20,
          "DayStorageDate" : "29-08-2021",
          "UnintendedLeakageAverage" : 67.58
        }

get part/_search

{
        "_index" : "part",
        "_type" : "_doc",
        "_id" : "2",
        "_score" : 1.0,
        "_source" : {
          "email" : "<>",
          "program_id" : 1849,
          "program_name" : "<> ",
          "scheduled_program_id" : 4765,
          "scheduled_program_name" : "<>",
          "scheduled_program_status" : 0,
          "experience_id" : 10129,
          "experience_name" : "<>",
          "response_id" : 364482,
          "user_id" : 39476,
          "firing_time" : "2021-09-19T09:28:51.000-04:00",
          "opened_at" : null,
          "participation_percentage" : 0,
          "status" : "<>",
          "created_at" : "2021-09-18T12:26:02.455-04:00",
          "updated_at" : "2021-09-19T09:30:04.228-04:00",
          "last_frame_completed_id" : null,
          "realm" : "affective-part-364482",
          "realms_organization_ids" : [
            "<>"
          ]
        }
      }

我尝试使用丰富过程创建第 3 个索引“ther-part”,以便“ther”索引中的所有字段都使用“part”索引进行丰富。

步数-

PUT /_enrich/policy/ther-policy
{
  "match": {
    "indices": "ther",
    "match_field": "user_id",
    "enrich_fields": ["Ahi","AverageBreatheRate","AverageExhaledTidalVolume","ClearAirwayApneaIndex","cpapPressureAverage","cpapPressure90Pct","DayStorageDate","epapPressureAverage","epapPressure90Pct","ipapPressureAverage","ipapPressure90Pct","MinuteVentAverage","PeriodicBreathingTime","TrigBreathsPct","UnintendedLeakageAverage","Usage","DeviceSerialNumber"]
  }
}
*****
Output-
{
  "acknowledged" : true
}

*************

POST /_enrich/policy/ther-policy/_execute
Output-
{
  "status" : {
    "phase" : "COMPLETE"
  }
}

*************************
PUT /_ingest/pipeline/ther_lookup
{
  "description" : "Enriching user details with tracks",
  "processors" : [
    {
      "enrich" : {
        "policy_name": "ther-policy",
        "field" : "user_id",
        "target_field": "tmp",
        "max_matches": "1"
      }
    },
    {
      "script": {
        "if": "ctx.tmp != null",
        "source": "ctx.putAll(ctx.tmp); ctx.remove('tmp');"
      }
    }
   ]
}
Output-
{
  "acknowledged" : true
}
**************************

POST _reindex
{
  "source": {
    "index": "part"
  },
  "dest": {
    "index": "part_ther",
    "pipeline": "ther_lookup"
    
  }
}

part_ther 索引中的字段越来越丰富。索引“part”和“ther”只有 2 个文档,因为我正在测试浓缩处理器。

get part_ther/_search
{
  "_index": "part_ther",
  "_type": "_doc",
  "_id": "1",
  "_score": 1,
  "_source": {
    "Ahi": 42.6,
    "response_id": 364482,
    "program_id": 1849,
    "program_name": "<> ",
    "created_at": "2021-09-18T12:26:02.455-04:00",
    "ipapPressureAverage": 49,
    "MinuteVentAverage": 20,
    "DeviceSerialNumber": "<>",
    "scheduled_program_id": 4765,
    "experience_id": 10129,
    "ClearAirwayApneaIndex": 72.26135463,
    "PeriodicBreathingTime": 9311,
    "updated_at": "2021-09-19T09:30:04.228-04:00",
    "scheduled_program_status": 0,
    "cpapPressure90Pct": 22,
    "email": "<>",
    "epapPressureAverage": 73,
    "ipapPressure90Pct": 27,
    "last_frame_completed_id": null,
    "Usage": 93904,
    "participation_percentage": 0,
    "epapPressure90Pct": 10,
    "firing_time": "2021-09-19T09:28:51.000-04:00",
    "opened_at": null,
    "realms_organization_ids": [
      "<>"
    ],
    "user_id": "39476",
    "scheduled_program_name": "<>",
    "TrigBreathsPct": 93,
    "cpapPressureAverage": 29,
    "experience_name": "<>",
    "AverageExhaledTidalVolume": 20,
    "DayStorageDate": "29-08-2021",
    "realm": "<>",
    "UnintendedLeakageAverage": 67.58,
    "status": "<>"
  }

在原始索引中,“治疗”索引有 9k 个文档,“参与索引”有 80k 个文档。

当我尝试在原始索引上创建第三个索引时,出现错误。 错误502,{"ok":false,"message":"后端关闭连接"} 如何避免此错误并成功丰富索引。

POST _reindex
{
  "source": {
    "index": "-participation"
  },
  "dest": {
    "index": "data-participation-therapy1",
    "pipeline": "therapy_lookup"
  }
}

output-
{"ok":false,"message":"backend closed connection"}

谢谢@Val 澄清这个错误。

backend closed connection 只是意味着客户端(即浏览器中的 Kibana Dev Tools)超时。 但是重建索引过程仍在后台进行。

如果您的源索引很大,很可能需要比超时时间更长的时间才能终止操作。因此,您应该使用

异步启动重新索引到 运行

POST _reindex?wait_for_completion=false

呼叫将立即 return 并为您提供一个任务 ID,您可以使用该 ID 在任务进行过程中检查任务状态

GET _tasks/<task_id>

引用 link-Enrich fields in new index using enrich processor