Problem with JSON file import into ElasticSearch

Only if value can be coerced. For ex. for a keyword or text field type in the index you can pass numeric value. But not other way around.

If testid in a document looks "testid" : {...} or you have "testid.foo" field, you cannot pass "testid" : "abc" in subsequent documents. The former says testid is an object and later says it's a string. Object and Keyword/Text are incompatible with each other.

You need to determine correct type for each field and define mapping. For data that's not matching, you should use ingest processor or logstash to clean data or store it in other field of different type.