Nithin
Nithin

Reputation: 1477

Elasticsearch 6 Mapping creation throwing error

I am using ES-6 and the candidateCreationTime by default is indexed as number in Kibana. How do i map it to a Date value?

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

I tried it with

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

But it is giving following error

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

How do i make it date and not number?

Upvotes: 0

Views: 24

Answers (1)

ben5556
ben5556

Reputation: 3018

In ES 6.x you can have only one mapping type. See this. Also, as mentioned here mapping for existing fields cannot be updated. So, in your case, you need to create a new index with correct mapping and reindex your data to the new index OR you can add a multi-field to the existing field candidateCreationTimemapped as a date field.

Upvotes: 1

Related Questions