I understand that when you attempt to index an document without specifying an id, Elasticsearch will autogenerate an unique id for your document.
I am wondering if it's possible to configure that id generation function for an existing index? I am hoping that so I can customize the id generation such as attaching a prefix, restricting character rules (like no numbers or hyphens), or use autoincrementing integers instead of strings.
I'd rather avoid using explicit id definition as the documentation explains that inserting a document with explicit id is slower than without explicit id because Elasticsearch would have to look through the index to find existing document with same id to replace.
I imagine that it could be done with
_mappings configuration to an index with generator function as a painless script.