Elastic mapping flattened vs field wise

I would say that it is best to have each field mapped with the correct data type, the flattened data type should be used when you have an object with a lot of unkown keys.

It should not be used to map the entire document as mentioned in the documentation.

The flattened mapping type should not be used for indexing all document content, as it treats all values as keywords and does not provide full search functionality. The default approach, where each subfield has its own entry in the mappings, works well in the majority of cases.