Jira numbers issues sequentially within a project, so this is correct behaviour.
Jira doesn't let you change the key of an issue, unless you move it into another project. (The whole point is that the keys are unique)
So, the short answer is that you can't. Deleting and moving issues leaves "holes" in your sequences. This really is not a problem in human or information terms, you're not losing anything. But it does mean that you can't misappropriate a Jira key for generating and reusing sequential ids. If you need to do that (or your user's OCD is really that string), then you should consider finding/writing a plugin that provides a field that can generate and maintain sequential numbers for the project.
This is not even something you can do in the database. If you'd got 1,2,3,4 and deleted 4, then you could set the counter back by 1. But as you've now got 5, that would only work if you deleted 5 and rolled back to 4 being the next one again. Renumbering existing issues is an absolute nightmare, and not recommended.
In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to have–in order to produce a reliable long-term roadmap. We're tur...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs