Hello.
I’ve created a mapping like this (file is called “plantilla.json”)…
{
"index_patterns": ["packets-*"],
"mappings": {
"properties": {
"timestamp": {"type":"date", "format":"epoch_millis" }
}
}
}
…by running this command: curl -X PUT -k -u “admin:admin” https://127.0.0.1:9200/_template/plantilla1 -H “Content-Type:application/json” -d @plantilla.json
I want to index a content like this (file is called “captura.json”…it’s really obtained from tshark -T ek 's output but here I’m showing a simplified version)…
{"index":{"_index":"packets-2022-04-08","_type":"doc"}}
{"timestamp":"1649452291404","layers":"1234"}
{"index":{"_index":"packets-2022-04-08","_type":"doc"}}
{"timestamp":"1649452291404","layers":"5678"}
…by running this command: curl -XPOST -k -u “admin:admin” https://127.0.0.1:9200/_bulk -H “Content-Type:application/json” --data-binary @captura.json
But I get this error:
{“took”:545,“errors”:true,“items”:[{“index”:{“_index”:“packets-2022-04-08”,“_type”:“doc”,“_id”:“7TwCE4ABMXOQX3ZKhwV-”,“status”:400,“error”:{“type”:“illegal_argument_exception”,“reason”:“mapper [timestamp] cannot be changed from type [date] to [text]"}}},{“index”:{”_index":“packets-2022-04-08”,“_type”:“doc”,“_id”:“7jwCE4ABMXOQX3ZKhwV-”,“status”:400,“error”:{“type”:“illegal_argument_exception”,“reason”:"mapper [timestamp] cannot be changed from type [date] to [text]"}}}]}
The shocking issue is that if I try to use the Index API (via PUT or POST method, it’s the same) to index individuals documents, with the same format in “timestamp” field, mapping just works. So there must be something wrong with Bulk API…
Thanks a lot!!