Changing Dynamic Mapping


I currently have 2 fields that need to be changed in my Elasticsearch.

They are the DOB (Date of Birth) and Phone number field.

Currently the phone field has the type "Long" and the DOB field has the type "Date"

When I index my data this doesn't work cause bot the DOB and Date data might have '-' or '+'.

So in the long run, I have to either change my dynamic mapping (which I think is possible but have no clue how to do) or reindex with the proper dynamic mapping?

What should be the type for these fields and should I reindex to a new index or change my dynamic mapping if possible.

Thank you in advanced

You need to reindex, you can't change something that has already been set,

1 Like

What should I use for the DOB and Phone number type? Also how would I reindex without any downtime

The first one seems like a date, the second will depend on what the format looks like.

The date had dashes in them and the phone numbers often have the plus symbol and dashes.

With our current types Long and Date, Elasticsearch rejects this.

How should we go about the types?

You should normalise the dates into a proper format so ES can store them as dates.
You should also normalise the phone numbers, strip out the + and -.

Is there a type that accepts both + and - ?

Also how would one reindex to a new index supposing my new index had the proper dynamic mapping

You can set it to keyword.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.