Attempting to update the layer definition of a hosted feature service through the REST Endpoint, such as adding a domain value, fails and returns the following error:
Error: Cannot drop index '<index name>' because it does not exist or you do not have permission.
This error may occur if the Optimized Layer Drawing setting is enabled. This is a setting in the Item Details page for the hosted feature service. For more information on Optimized Layer Drawing, refer to the following help document, ArcGIS Online: Manage hosted feature layers.
Disable the Optimized Layer Drawing setting before updating the layer definition. After updating the layer definition, enable the Optimized Layer Drawing setting again. Follow the steps below to disable the Optimized Layer Drawing setting: