好的想法是十分钱一打,真正无价的是能够实现这些想法的人。

6.x使用 reindex失敗

Elasticsearch | 作者 gentrice | 发布于2018年05月20日 | 阅读数:4397

使用reindex API
POST _reindex
{
    "source": {
    "remote": {
      "host": "http://192.168.138.85:9200"
    },
    "index": "flow_collector-2018.05.04"
  },
  "dest": {
    "index": "flow_collector-2018.05.04"
  }
}
 
回報錯誤
{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "[hit] failed to parse [_source]",
        "line": 1,
        "col": 356
      }
    ],
    "type": "exception",
    "reason": "Error parsing the response, remote is likely not an Elasticsearch instance",
    "caused_by": {
      "type": "parsing_exception",
      "reason": "[search_response] failed to parse field [hits]",
      "line": 1,
      "col": 356,
      "caused_by": {
        "type": "parsing_exception",
        "reason": "[hits] failed to parse field [hits]",
        "line": 1,
        "col": 356,
        "caused_by": {
          "type": "parsing_exception",
          "reason": "[hit] failed to parse field [_source]",
          "line": 1,
          "col": 356,
          "caused_by": {
            "type": "parsing_exception",
            "reason": "[hit] failed to parse [_source]",
            "line": 1,
            "col": 356,
            "caused_by": {
              "type": "json_parse_exception",
              "reason": "Duplicate field '8'\n at [Source: org.apache.http.nio.entity.ContentInputStream@97d2840; line: 1, column: 376]"
            }
          }
        }
      }
    }
  },
  "status": 500
}
 
想詢問一下該如何解決
謝謝
已邀请:

yayg2008

赞同来自: laoyang360

reindex的实现逻辑大致是查询原有index,然后使用其_source在新index进行重建。
按照现在的异常,“"[hit] failed to parse [_source]",”,意思就是_source格式化异常,你可以先检查一下_source的内容是否正常。再一个,检查下之前的index是否有存储source。

gentrice

赞同来自:

Hi yayg2008,
 
感謝回復,的確之前的index沒有設定_source,是否能在之前的index設定_source後再執行reindex?
 

要回复问题请先登录注册