Elasticsearch 6映射创建抛出错误

时间:2018-12-12 19:06:16

标签: elasticsearch

我正在使用ES-6,默认情况下candidateCreationTime在Kibana中被索引为数字。如何将其映射到“日期”值?

{
    "_index": "candidatesources",
    "_type": "candidatesource",
    "_id": "5c08b8930bcfe318ca2a00f4",
    "_version": 3,
    "_score": 1,
    "_source": {
        "candidateNotes": "Some Notes",
        "candidateCreationTime": 1544066189124,
        "state": "verified"
    }
}

我尝试过

PUT candidatesources/_mapping/csdate
{
  "properties": {
  "candidateCreationTime": {
      "type": "date"
    }
  }
}

但是它给出了以下错误

Rejecting mapping update to [candidatesources] as the final mapping would have more than 1 type: [candidatesource, csdate]

我如何使其date而不是number

1 个答案:

答案 0 :(得分:1)

在ES 6.x中,您只能具有一种映射类型。参见this。另外,如前所述,here无法更新现有字段的映射。因此,根据您的情况,您需要使用正确的映射创建一个新索引,然后将数据重新索引到该新索引中,或者可以将multi-field添加到映射为{{1}的现有字段candidateCreationTime中}字段。