This question already has an answer here:
I don't have reputations enough so for that, the most understandable answer is that they are not logia fruit users, i suspect that their are other types of devil fruit in which the body can produce as much amount of the matter(i unable to say the exact word) as they want. For example- admirals (more plasma, ice, or light), trebol( Donquixote Doflamingo family more sticky material), Blackbeard(more darkness), ace (more fire) etc. In such case the haki attack was only hits the matter covering their body and only able to scratch a little and therefore in this type of devil fruit power the body can be regained back to normal by just producing more matter. Please upvote if You find this helpful.