Mappings: Fix Get field mapping api with pretty flag

Closes #6552
[ENGINE] Remove engine related command classes

Todaqy we pass structs to the engine to call optimize / refresh and flush.
This commit cleans up this logic to reduce complexity in the engine.