1. A method of a device for filtering messages routed across a network, the messages including field name-value pairs, the method comprising: extracting, by a filter configured on a device, field name-value pairs from messages received via a network; determining, by a learning engine configured on the device, a most restrictive data type of values from a plurality of data types of values for a field name of the extracted field name-value pairs; determining, by the learning engine, a match factor for a data type, the match factor indicating a fraction of values for the same field name that match the data type; selecting, by the learning engine, a data type having a match factor exceeding a threshold and having no child data types with a match factor exceeding the threshold; and storing, by the device, the most restrictive data type in association with the field name.