Can mapping for index be updated for all types in one command

I got another question on related subject - but this seems like a different question - could maps for multiple types in one index be updated with one command? if I put:

curl -X POST 'localhost:9200/testmaps/_mapping?ignore_conflicts=true' -d'
{
"mappings":
{
"properties": {
"favorite-car" : {
"type" : "string",
"fields" : {
"raw" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}
}
}
I get the error:
{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: mapping type is missing;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: mapping type is missing;"},

If I put:
curl -X POST 'localhost:9200/testmaps/my_type*/_mapping?ignore_conflicts=true' -d' etc ...

it looks like the new type gets created with name 'my_type*' and any new types created after this do not have the desired mapping.

Is there a way to do this wildcard type map update? There could be a sufficiently large number of types to make separate update impractical.

Thanks in advance.

Mixing types can be dangerous - https://www.elastic.co/blog/index-vs-type

Also look into templates instead of this, you can apply templates to multiple types/indices.

Thanks - yes I get that same field name should have same type (string, int) across different document types - that is in place already; But since originally my design had large/variable number of document types - one index pattern, with new index every day, then document types under it for different reasons - but as that number seemed to get very large I was hoping to manage all those document types (that are consistent between them self in terms of data types as you warned above) with one template mapping - but could not find a way to apply one mapping to many different document types with the wildcard as displayed above. So I am looking at the templates - and I tried to apply new template mapping:

curl -X POST 'localhost:9200/testmaps/_mapping?ignore_conflicts=true' -d'
{
"mappings": ... (above is the full command) and it errored out as not liking that I did not specify document type;
I tried wildcard for document type but it did not produce desired effect:

curl -X POST 'localhost:9200/testmaps/my_type*/_mapping?ignore_conflicts=true' -d' etc ...

that still did not have desired effect - so is it true that the document type as in "my_type*" cannot have wildcard - which then brings the original question - you have to do it type by type?

Thank you

Can you provide a replication with what you are doing and the response?

Sure - here is the first command that fails - example where I am trying to set that field as non analyzed:

curl -X POST 'localhost:9200/testmaps/_mapping?ignore_conflicts=true' -d'
{
"mappings":
{
"properties": {
"favorite-car" : {
"type" : "string",
"fields" : {
"raw" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}
}
}
I get the error:
{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: mapping type is missing;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: mapping type is missing;"},

So error indicates that 'mapping type is missing';

Then I add the type using the wildcard spec - my_type*:

curl -X POST 'localhost:9200/testmaps/my_type*/_mapping?ignore_conflicts=true' -d'
{
"properties": {
"favorite-car" : {
"type" : "string",
"fields" : {
"raw" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}
}
}

I get no errors - but it does not work - and it almose seems like it corrupted the es instance I was testing with ...

So if I have large number of types - say mytype1, my_type2, .. my_type100, ... how can I manage them all with one template update? The types are being added from time to time and I would much prefer no to have to specify one by one ...

Thank you,