How to disable formatting fields automatically

i have many fields in a index. but if i have a new field in an index and the data come in format 'yyyy/MM/dd' the elastic auto map this field as date format but in next value in this field could be text.

i want to disable the auto mapping and set new fields as text type.
how can i do that?


1 Like

You can disable dynamic mapping entirely if you want. See the docs here:

If you do that, you'll have to provide an explicit set of mappings before indexing any data. Alternatively, you could leave dynamic mappings enabled but set the mapping for the date field up-front.

Dynamic mappings are only applied to fields that are currently unmapped... so if you provide the correct mapping at the beginning that will be used instead of dynamic mapping

1 Like

Following up, one of my colleagues suggested a better way which I had forgotten. You can also disable date detection in text fields or specify how detected date should be indexed using dynamic templates.


Thank you
it's very helpful


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