To Detach the server, First login the ASP individually and then warm start the ASP (as mentioned in below attached snap), workstation application will be closed automatically.
Then again login the AS and Detach the server as mentioned below.
Login to AS-P individually > Right click > Advanced > Detach Server.
To add the automation server under the ES, login ES and Right click on Server > add server > add IP > protocol – TCP > port-4444 > create (as per below attached snap).
Now you will see the AS under ES.
Other possible Resolution: -