Use Flake IDs instead of random UUIDs when auto-generating id field

Flake IDs give better lookup performance in Lucene since they share
predictable prefixes (timestamp).

Closes #7531

Closes #6004

Closes #5941